summaryrefslogtreecommitdiff
path: root/src/option.c
diff options
context:
space:
mode:
authorLucas Rocha <lucasr@gnome.org>2008-03-29 22:13:50 +0000
committerLucas Almeida Rocha <lucasr@src.gnome.org>2008-03-29 22:13:50 +0000
commit2141cb9184c20be91e469b2bd4e4bb22e57faba3 (patch)
tree365dfc58346aa5c3ed10b92b029d62fbd7e96b8d /src/option.c
parent23eb83f5bc97bb777b9612122a9ebd3cfd6f49c0 (diff)
Allow question dialogs to use custom button label text (Fixes bug
2008-03-30 Lucas Rocha <lucasr@gnome.org> Allow question dialogs to use custom button label text (Fixes bug #335763). Patch from Cosimo Cecchi <anarki@lilik.it> and Thomas Thurman <tthurman@gnome.org>. * src/msg.c (zenity_msg_construct_question_dialog), (zenity_msg): dynamically add dialog buttons with provided labels. * src/option.c (zenity_option_free): free input labels. (zenity_question_post_callback): set button labels provided by the respective command line options. * src/zenity.glade: remove pre-defined dialog button from question dialog. * src/zenity.h: added ok_label and cancel_label to ZenityMsgData. svn path=/trunk/; revision=1346
Diffstat (limited to 'src/option.c')
-rw-r--r--src/option.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/option.c b/src/option.c
index babe4e9..b56d5f0 100644
--- a/src/option.c
+++ b/src/option.c
@@ -87,6 +87,8 @@ static gboolean zenity_progress_auto_kill;
/* Question Dialog Options */
static gboolean zenity_question_active;
+static gchar *zenity_question_ok_button;
+static gchar *zenity_question_cancel_button;
/* Text Dialog Options */
static gboolean zenity_text_active;
@@ -609,6 +611,24 @@ static GOptionEntry question_options[] = {
N_("TEXT")
},
{
+ "ok-label",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_question_ok_button,
+ N_("Sets the label of the Ok button"),
+ N_("TEXT")
+ },
+ {
+ "cancel-label",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_question_cancel_button,
+ N_("Sets the label of the Cancel button"),
+ N_("TEXT")
+ },
+ {
"no-wrap",
'\0',
G_OPTION_FLAG_NOALIAS,
@@ -837,6 +857,11 @@ zenity_option_free (void) {
if (zenity_list_hide_column)
g_free (zenity_list_hide_column);
+ if (zenity_question_ok_button)
+ g_free (zenity_question_ok_button);
+ if (zenity_question_cancel_button)
+ g_free (zenity_question_cancel_button);
+
g_option_context_free (ctx);
}
@@ -1342,7 +1367,9 @@ zenity_question_post_callback (GOptionContext *context,
if (results->mode == MODE_QUESTION) {
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_wrap = zenity_general_dialog_no_wrap;
+ results->msg_data->ok_label = zenity_question_ok_button;
+ results->msg_data->cancel_label = zenity_question_cancel_button;
}
return TRUE;