Bug #534935 Need hability to specify default answer in --question dialog
This commit is contained in:
parent
63d6a2032d
commit
b0fc720fe4
@ -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);
|
||||
|
12
src/option.c
12
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;
|
||||
|
@ -66,6 +66,7 @@ typedef struct {
|
||||
MsgMode mode;
|
||||
gboolean no_wrap;
|
||||
gboolean no_markup;
|
||||
gboolean default_cancel;
|
||||
} ZenityMsgData;
|
||||
|
||||
typedef struct {
|
||||
|
Reference in New Issue
Block a user