diff options
author | Berislav Kovacki <pantokrator@pantokrator.net> | 2013-11-23 16:44:26 -0200 |
---|---|---|
committer | Arx Cruz <arxcruz@gnome.org> | 2013-11-23 16:44:26 -0200 |
commit | b0fc720fe4584530d1090cd3e9175905e6381c85 (patch) | |
tree | d428a6d8f890ea8e340fd853d0d5150befe4be89 /src | |
parent | [l10n] Updated Catalan (Valencian) translation (diff) | |
download | zenity-b0fc720fe4584530d1090cd3e9175905e6381c85.tar.gz zenity-b0fc720fe4584530d1090cd3e9175905e6381c85.tar.bz2 zenity-b0fc720fe4584530d1090cd3e9175905e6381c85.zip |
Bug #534935 Need hability to specify default answer in --question dialog
Diffstat (limited to 'src')
-rw-r--r-- | src/msg.c | 2 | ||||
-rw-r--r-- | src/option.c | 12 | ||||
-rw-r--r-- | src/zenity.h | 1 |
3 files changed, 14 insertions, 1 deletions
@@ -36,7 +36,7 @@ zenity_msg_construct_question_dialog (GtkWidget *dialog, ZenityMsgData *msg_data cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_NO, GTK_RESPONSE_CANCEL); ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_YES, GTK_RESPONSE_OK); - gtk_widget_grab_focus (ok_button); + gtk_widget_grab_focus (msg_data->default_cancel ? cancel_button : ok_button); if (data->cancel_label) { gtk_button_set_label (GTK_BUTTON (cancel_button), data->cancel_label); diff --git a/src/option.c b/src/option.c index d3004fe2..46112d04 100644 --- a/src/option.c +++ b/src/option.c @@ -100,6 +100,7 @@ static gboolean zenity_progress_no_cancel; /* Question Dialog Options */ static gboolean zenity_question_active; +static gboolean zenity_question_default_cancel; /* Text Dialog Options */ static gboolean zenity_text_active; @@ -797,6 +798,15 @@ static GOptionEntry question_options[] = { &zenity_general_dialog_no_markup, N_("Do not enable pango markup") }, + { + "default-cancel", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_question_default_cancel, + N_("Give cancel button focus by default"), + NULL + }, { NULL } @@ -1507,6 +1517,7 @@ zenity_question_pre_callback (GOptionContext *context, GError **error) { zenity_question_active = FALSE; + zenity_question_default_cancel = FALSE; return TRUE; } @@ -1913,6 +1924,7 @@ zenity_question_post_callback (GOptionContext *context, 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->default_cancel = zenity_question_default_cancel; } return TRUE; diff --git a/src/zenity.h b/src/zenity.h index acde39bf..52c29df5 100644 --- a/src/zenity.h +++ b/src/zenity.h @@ -66,6 +66,7 @@ typedef struct { MsgMode mode; gboolean no_wrap; gboolean no_markup; + gboolean default_cancel; } ZenityMsgData; typedef struct { |