Patch for bug #621907

This patch add the option --no-markup in the info, warning, error and question dialogs
So if the user wants to use & \ ' and other symbols, now he can, and no error will be
showed.
This commit is contained in:
Arx Cruz 2011-07-06 14:55:30 -03:00
parent 0443b025b5
commit d8954d9222
4 changed files with 57 additions and 3 deletions

View File

@ -122,6 +122,9 @@ Set the dialog text
.TP .TP
.B \-\-no\-wrap .B \-\-no\-wrap
Do not enable text wrapping Do not enable text wrapping
.TP
.B \-\-no\-markup
Do not enable pango markup
.PP .PP
File selection options File selection options
@ -156,6 +159,9 @@ Set the dialog text
.TP .TP
.B \-\-no\-wrap .B \-\-no\-wrap
Do not enable text wrapping Do not enable text wrapping
.TP
.B \-\-no\-markup
Do not enable pango markup
.PP .PP
List options List options
@ -234,6 +240,9 @@ Set the dialog text
.B \-\-no\-wrap .B \-\-no\-wrap
Do not enable text wrapping Do not enable text wrapping
.TP .TP
.B \-\-no\-markup
Do not enable pango markup
.TP
.B \-\-ok\-label .B \-\-ok\-label
Set the text of the OK button Set the text of the OK button
.TP .TP
@ -268,6 +277,9 @@ Set the dialog text
.TP .TP
.B \-\-no\-wrap .B \-\-no\-wrap
Do not enable text wrapping Do not enable text wrapping
.TP
.B \-\-no\-markup
Do not enable pango markup
.PP .PP
Scale options Scale options

View File

@ -131,7 +131,10 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
if (msg_data->dialog_text) if (msg_data->dialog_text)
gtk_label_set_markup (GTK_LABEL (text), g_strcompress (msg_data->dialog_text)); gtk_label_set_markup (GTK_LABEL (text), g_strcompress (msg_data->dialog_text));
if (msg_data->no_markup)
gtk_label_set_use_markup (GTK_LABEL (text), FALSE);
if (msg_data->no_wrap) if (msg_data->no_wrap)
gtk_label_set_line_wrap (GTK_LABEL (text), FALSE); gtk_label_set_line_wrap (GTK_LABEL (text), FALSE);

View File

@ -40,6 +40,7 @@ static gboolean zenity_general_multiple;
static gboolean zenity_general_editable; static gboolean zenity_general_editable;
static gchar *zenity_general_uri; static gchar *zenity_general_uri;
static gboolean zenity_general_dialog_no_wrap; static gboolean zenity_general_dialog_no_wrap;
static gboolean zenity_general_dialog_no_markup;
static gint zenity_general_timeout_delay; static gint zenity_general_timeout_delay;
static gchar *zenity_general_ok_button; static gchar *zenity_general_ok_button;
static gchar *zenity_general_cancel_button; static gchar *zenity_general_cancel_button;
@ -318,6 +319,14 @@ static GOptionEntry error_options[] = {
N_("Do not enable text wrapping"), N_("Do not enable text wrapping"),
NULL NULL
}, },
{
"no-markup",
'\0',
G_OPTION_FLAG_NOALIAS,
G_OPTION_ARG_NONE,
&zenity_general_dialog_no_markup,
N_("Do not enable pango markup")
},
{ {
NULL NULL
} }
@ -351,6 +360,14 @@ static GOptionEntry info_options[] = {
N_("Do not enable text wrapping"), N_("Do not enable text wrapping"),
NULL NULL
}, },
{
"no-markup",
'\0',
G_OPTION_FLAG_NOALIAS,
G_OPTION_ARG_NONE,
&zenity_general_dialog_no_markup,
N_("Do not enable pango markup")
},
{ {
NULL NULL
} }
@ -695,6 +712,14 @@ static GOptionEntry question_options[] = {
N_("Do not enable text wrapping"), N_("Do not enable text wrapping"),
NULL NULL
}, },
{
"no-markup",
'\0',
G_OPTION_FLAG_NOALIAS,
G_OPTION_ARG_NONE,
&zenity_general_dialog_no_markup,
N_("Do not enable pango markup")
},
{ {
NULL NULL
} }
@ -797,6 +822,14 @@ static GOptionEntry warning_options[] = {
N_("Do not enable text wrapping"), N_("Do not enable text wrapping"),
NULL NULL
}, },
{
"no-markup",
'\0',
G_OPTION_FLAG_NOALIAS,
G_OPTION_ARG_NONE,
&zenity_general_dialog_no_markup,
N_("Do not enable pango markup")
},
{ {
NULL NULL
} }
@ -1177,6 +1210,7 @@ zenity_general_pre_callback (GOptionContext *context,
zenity_general_ok_button = NULL; zenity_general_ok_button = NULL;
zenity_general_cancel_button = NULL; zenity_general_cancel_button = NULL;
zenity_general_dialog_no_wrap = FALSE; zenity_general_dialog_no_wrap = FALSE;
zenity_general_dialog_no_markup = FALSE;
zenity_general_timeout_delay = -1; zenity_general_timeout_delay = -1;
return TRUE; return TRUE;
@ -1498,6 +1532,7 @@ zenity_error_post_callback (GOptionContext *context,
results->msg_data->dialog_text = zenity_general_dialog_text; results->msg_data->dialog_text = zenity_general_dialog_text;
results->msg_data->mode = ZENITY_MSG_ERROR; results->msg_data->mode = ZENITY_MSG_ERROR;
results->msg_data->no_wrap = zenity_general_dialog_no_wrap; results->msg_data->no_wrap = zenity_general_dialog_no_wrap;
results->msg_data->no_markup = zenity_general_dialog_no_markup;
} }
return TRUE; return TRUE;
@ -1514,7 +1549,8 @@ zenity_info_post_callback (GOptionContext *context,
if (results->mode == MODE_INFO) { if (results->mode == MODE_INFO) {
results->msg_data->dialog_text = zenity_general_dialog_text; results->msg_data->dialog_text = zenity_general_dialog_text;
results->msg_data->mode = ZENITY_MSG_INFO; results->msg_data->mode = ZENITY_MSG_INFO;
results->msg_data->no_wrap = zenity_general_dialog_no_wrap; results->msg_data->no_wrap = zenity_general_dialog_no_wrap;
results->msg_data->no_markup = zenity_general_dialog_no_markup;
} }
return TRUE; return TRUE;
@ -1683,6 +1719,7 @@ zenity_question_post_callback (GOptionContext *context,
results->msg_data->dialog_text = zenity_general_dialog_text; results->msg_data->dialog_text = zenity_general_dialog_text;
results->msg_data->mode = ZENITY_MSG_QUESTION; results->msg_data->mode = ZENITY_MSG_QUESTION;
results->msg_data->no_wrap = zenity_general_dialog_no_wrap; results->msg_data->no_wrap = zenity_general_dialog_no_wrap;
results->msg_data->no_markup = zenity_general_dialog_no_markup;
results->msg_data->ok_label = zenity_general_ok_button; results->msg_data->ok_label = zenity_general_ok_button;
results->msg_data->cancel_label = zenity_general_cancel_button; results->msg_data->cancel_label = zenity_general_cancel_button;
} }
@ -1725,7 +1762,8 @@ zenity_warning_post_callback (GOptionContext *context,
if (results->mode == MODE_WARNING) { if (results->mode == MODE_WARNING) {
results->msg_data->dialog_text = zenity_general_dialog_text; results->msg_data->dialog_text = zenity_general_dialog_text;
results->msg_data->mode = ZENITY_MSG_WARNING; results->msg_data->mode = ZENITY_MSG_WARNING;
results->msg_data->no_wrap = zenity_general_dialog_no_wrap; results->msg_data->no_wrap = zenity_general_dialog_no_wrap;
results->msg_data->no_markup = zenity_general_dialog_no_markup;
} }
return TRUE; return TRUE;

View File

@ -60,6 +60,7 @@ typedef struct {
gchar *dialog_text; gchar *dialog_text;
MsgMode mode; MsgMode mode;
gboolean no_wrap; gboolean no_wrap;
gboolean no_markup;
gchar *ok_label; gchar *ok_label;
gchar *cancel_label; gchar *cancel_label;
} ZenityMsgData; } ZenityMsgData;