From d8954d9222654f645ebdcc1752c70be97faaae45 Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Wed, 6 Jul 2011 14:55:30 -0300 Subject: 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. --- data/zenity.1 | 12 ++++++++++++ src/msg.c | 5 ++++- src/option.c | 42 ++++++++++++++++++++++++++++++++++++++++-- src/zenity.h | 1 + 4 files changed, 57 insertions(+), 3 deletions(-) diff --git a/data/zenity.1 b/data/zenity.1 index dba0aa2..5cde33b 100644 --- a/data/zenity.1 +++ b/data/zenity.1 @@ -122,6 +122,9 @@ Set the dialog text .TP .B \-\-no\-wrap Do not enable text wrapping +.TP +.B \-\-no\-markup +Do not enable pango markup .PP File selection options @@ -156,6 +159,9 @@ Set the dialog text .TP .B \-\-no\-wrap Do not enable text wrapping +.TP +.B \-\-no\-markup +Do not enable pango markup .PP List options @@ -234,6 +240,9 @@ Set the dialog text .B \-\-no\-wrap Do not enable text wrapping .TP +.B \-\-no\-markup +Do not enable pango markup +.TP .B \-\-ok\-label Set the text of the OK button .TP @@ -268,6 +277,9 @@ Set the dialog text .TP .B \-\-no\-wrap Do not enable text wrapping +.TP +.B \-\-no\-markup +Do not enable pango markup .PP Scale options diff --git a/src/msg.c b/src/msg.c index 1f060c5..b5a1aa0 100644 --- a/src/msg.c +++ b/src/msg.c @@ -131,7 +131,10 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data) if (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) gtk_label_set_line_wrap (GTK_LABEL (text), FALSE); diff --git a/src/option.c b/src/option.c index 954ba64..079bd02 100644 --- a/src/option.c +++ b/src/option.c @@ -40,6 +40,7 @@ static gboolean zenity_general_multiple; static gboolean zenity_general_editable; static gchar *zenity_general_uri; static gboolean zenity_general_dialog_no_wrap; +static gboolean zenity_general_dialog_no_markup; static gint zenity_general_timeout_delay; static gchar *zenity_general_ok_button; static gchar *zenity_general_cancel_button; @@ -318,6 +319,14 @@ static GOptionEntry error_options[] = { N_("Do not enable text wrapping"), NULL }, + { + "no-markup", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_markup, + N_("Do not enable pango markup") + }, { NULL } @@ -351,6 +360,14 @@ static GOptionEntry info_options[] = { N_("Do not enable text wrapping"), NULL }, + { + "no-markup", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_markup, + N_("Do not enable pango markup") + }, { NULL } @@ -695,6 +712,14 @@ static GOptionEntry question_options[] = { N_("Do not enable text wrapping"), NULL }, + { + "no-markup", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_markup, + N_("Do not enable pango markup") + }, { NULL } @@ -797,6 +822,14 @@ static GOptionEntry warning_options[] = { N_("Do not enable text wrapping"), NULL }, + { + "no-markup", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_markup, + N_("Do not enable pango markup") + }, { NULL } @@ -1177,6 +1210,7 @@ zenity_general_pre_callback (GOptionContext *context, zenity_general_ok_button = NULL; zenity_general_cancel_button = NULL; zenity_general_dialog_no_wrap = FALSE; + zenity_general_dialog_no_markup = FALSE; zenity_general_timeout_delay = -1; return TRUE; @@ -1498,6 +1532,7 @@ zenity_error_post_callback (GOptionContext *context, results->msg_data->dialog_text = zenity_general_dialog_text; results->msg_data->mode = ZENITY_MSG_ERROR; results->msg_data->no_wrap = zenity_general_dialog_no_wrap; + results->msg_data->no_markup = zenity_general_dialog_no_markup; } return TRUE; @@ -1514,7 +1549,8 @@ zenity_info_post_callback (GOptionContext *context, if (results->mode == MODE_INFO) { results->msg_data->dialog_text = zenity_general_dialog_text; 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; @@ -1683,6 +1719,7 @@ zenity_question_post_callback (GOptionContext *context, results->msg_data->dialog_text = zenity_general_dialog_text; results->msg_data->mode = ZENITY_MSG_QUESTION; 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->cancel_label = zenity_general_cancel_button; } @@ -1725,7 +1762,8 @@ zenity_warning_post_callback (GOptionContext *context, if (results->mode == MODE_WARNING) { results->msg_data->dialog_text = zenity_general_dialog_text; 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; diff --git a/src/zenity.h b/src/zenity.h index fd744b6..22ffca7 100644 --- a/src/zenity.h +++ b/src/zenity.h @@ -60,6 +60,7 @@ typedef struct { gchar *dialog_text; MsgMode mode; gboolean no_wrap; + gboolean no_markup; gchar *ok_label; gchar *cancel_label; } ZenityMsgData; -- cgit v1.2.3-2-g168b