ADD gchar **extra_label TO struct ZenityData
this is done to keep the name of the extra buttons ADD general option "extra-button" with string array as argument This will upon consecutive calls save the name of buttons in an array of strings To all MODES, except notification.c and about.c ADD if (data->extra_label) { gint i=0; while(data->extra_label[i]!=NULL){ gtk_dialog_add_button (GTK_DIALOG (dialog), data->extra_label[i], i); i++; } } This add the extra buttons to the dialog. The response is the number of the button To all MODES response, except notification.c and about.c ADD default: if (response < g_strv_length(zen_data->extra_label)) printf("%s\n",zen_data->extra_label[response]); This will print the button name to stdout when they are pressed ADD question option "switch" This will suppress the standard "ok" and "cancel" button in question. This just wort in combination with --extra-button, otherwise error is raised. https://bugzilla.gnome.org/show_bug.cgi?id=118016
This commit is contained in:
parent
5c9095731e
commit
ba5ea0386d
@ -91,7 +91,15 @@ zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data)
|
|||||||
if (data->timeout_delay > 0) {
|
if (data->timeout_delay > 0) {
|
||||||
g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, dialog);
|
g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data->extra_label) {
|
||||||
|
gint i=0;
|
||||||
|
while(data->extra_label[i]!=NULL){
|
||||||
|
gtk_dialog_add_button (GTK_DIALOG (dialog), data->extra_label[i], i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (data->ok_label) {
|
if (data->ok_label) {
|
||||||
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_calendar_ok_button"));
|
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_calendar_ok_button"));
|
||||||
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
|
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
|
||||||
@ -149,7 +157,8 @@ zenity_calendar_dialog_response (GtkWidget *widget, int response, gpointer data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* Esc dialog */
|
if (response < g_strv_length(zen_data->extra_label))
|
||||||
|
printf("%s\n",zen_data->extra_label[response]);
|
||||||
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
10
src/color.c
10
src/color.c
@ -57,6 +57,14 @@ void zenity_colorselection (ZenityData *data, ZenityColorData *color_data)
|
|||||||
&color);
|
&color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data->extra_label) {
|
||||||
|
gint i=0;
|
||||||
|
while(data->extra_label[i]!=NULL){
|
||||||
|
gtk_dialog_add_button (GTK_DIALOG (dialog), data->extra_label[i], i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (data->ok_label) {
|
if (data->ok_label) {
|
||||||
g_object_get (G_OBJECT (dialog), "ok-button", &button, NULL);
|
g_object_get (G_OBJECT (dialog), "ok-button", &button, NULL);
|
||||||
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
|
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
|
||||||
@ -109,6 +117,8 @@ zenity_colorselection_dialog_response (GtkWidget *widget, int response, gpointer
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if (response < g_strv_length(zen_data->extra_label))
|
||||||
|
printf("%s\n",zen_data->extra_label[response]);
|
||||||
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
13
src/entry.c
13
src/entry.c
@ -83,7 +83,15 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_data)
|
|||||||
|
|
||||||
if (data->modal)
|
if (data->modal)
|
||||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||||
|
|
||||||
|
if (data->extra_label) {
|
||||||
|
gint i=0;
|
||||||
|
while(data->extra_label[i]!=NULL){
|
||||||
|
gtk_dialog_add_button (GTK_DIALOG (dialog), data->extra_label[i], i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (data->ok_label) {
|
if (data->ok_label) {
|
||||||
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_entry_ok_button"));
|
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_entry_ok_button"));
|
||||||
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
|
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
|
||||||
@ -188,7 +196,8 @@ zenity_entry_dialog_response (GtkWidget *widget, int response, gpointer data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* Esc dialog */
|
if (response < g_strv_length(zen_data->extra_label))
|
||||||
|
printf("%s\n",zen_data->extra_label[response]);
|
||||||
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,14 @@ void zenity_fileselection (ZenityData *data, ZenityFileData *file_data)
|
|||||||
g_signal_connect (G_OBJECT (dialog), "response",
|
g_signal_connect (G_OBJECT (dialog), "response",
|
||||||
G_CALLBACK (zenity_fileselection_dialog_response), file_data);
|
G_CALLBACK (zenity_fileselection_dialog_response), file_data);
|
||||||
|
|
||||||
|
if (data->extra_label) {
|
||||||
|
gint i=0;
|
||||||
|
while(data->extra_label[i]!=NULL){
|
||||||
|
gtk_dialog_add_button (GTK_DIALOG (dialog), data->extra_label[i], i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (data->dialog_title)
|
if (data->dialog_title)
|
||||||
gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
|
gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
|
||||||
|
|
||||||
@ -181,7 +189,8 @@ zenity_fileselection_dialog_response (GtkWidget *widget, int response, gpointer
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* Esc dialog */
|
if (response < g_strv_length(zen_data->extra_label))
|
||||||
|
printf("%s\n",zen_data->extra_label[response]);
|
||||||
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
10
src/forms.c
10
src/forms.c
@ -206,6 +206,14 @@ void zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data)
|
|||||||
if (data->width > -1 || data->height > -1)
|
if (data->width > -1 || data->height > -1)
|
||||||
gtk_window_set_default_size (GTK_WINDOW (dialog), data->width, data->height);
|
gtk_window_set_default_size (GTK_WINDOW (dialog), data->width, data->height);
|
||||||
|
|
||||||
|
if (data->extra_label) {
|
||||||
|
gint i=0;
|
||||||
|
while(data->extra_label[i]!=NULL){
|
||||||
|
gtk_dialog_add_button (GTK_DIALOG (dialog), data->extra_label[i], i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (data->ok_label) {
|
if (data->ok_label) {
|
||||||
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_ok_button"));
|
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_ok_button"));
|
||||||
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
|
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
|
||||||
@ -439,6 +447,8 @@ zenity_forms_dialog_response (GtkWidget *widget, int response, gpointer data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if (response < g_strv_length(zen_data->extra_label))
|
||||||
|
printf("%s\n",zen_data->extra_label[response]);
|
||||||
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
21
src/msg.c
21
src/msg.c
@ -31,8 +31,10 @@ static void zenity_text_size_allocate (GtkWidget *widget, GtkAllocation *allocat
|
|||||||
static void
|
static void
|
||||||
zenity_msg_construct_question_dialog (GtkWidget *dialog, ZenityMsgData *msg_data, ZenityData *data)
|
zenity_msg_construct_question_dialog (GtkWidget *dialog, ZenityMsgData *msg_data, ZenityData *data)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
GtkWidget *cancel_button, *ok_button;
|
GtkWidget *cancel_button, *ok_button;
|
||||||
|
|
||||||
cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_NO, GTK_RESPONSE_CANCEL);
|
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);
|
ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_YES, GTK_RESPONSE_OK);
|
||||||
|
|
||||||
@ -49,6 +51,8 @@ zenity_msg_construct_question_dialog (GtkWidget *dialog, ZenityMsgData *msg_data
|
|||||||
gtk_button_set_image (GTK_BUTTON (ok_button),
|
gtk_button_set_image (GTK_BUTTON (ok_button),
|
||||||
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
|
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -95,6 +99,7 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ZENITY_MSG_QUESTION:
|
case ZENITY_MSG_QUESTION:
|
||||||
|
case ZENITY_MSG_SWITCH:
|
||||||
builder = zenity_util_load_ui_file ("zenity_question_dialog", NULL);
|
builder = zenity_util_load_ui_file ("zenity_question_dialog", NULL);
|
||||||
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_question_dialog"));
|
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_question_dialog"));
|
||||||
text = gtk_builder_get_object (builder, "zenity_question_text");
|
text = gtk_builder_get_object (builder, "zenity_question_text");
|
||||||
@ -128,6 +133,14 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data->extra_label) {
|
||||||
|
gint i=0;
|
||||||
|
while(data->extra_label[i]!=NULL){
|
||||||
|
gtk_dialog_add_button (GTK_DIALOG (dialog), data->extra_label[i], i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (builder == NULL) {
|
if (builder == NULL) {
|
||||||
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
|
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
|
||||||
return;
|
return;
|
||||||
@ -159,6 +172,10 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
|
|||||||
zenity_msg_construct_question_dialog (dialog, msg_data, data);
|
zenity_msg_construct_question_dialog (dialog, msg_data, data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ZENITY_MSG_SWITCH:
|
||||||
|
zenity_util_set_window_icon_from_stock (dialog, data->window_icon, GTK_STOCK_DIALOG_QUESTION);
|
||||||
|
break;
|
||||||
|
|
||||||
case ZENITY_MSG_ERROR:
|
case ZENITY_MSG_ERROR:
|
||||||
zenity_util_set_window_icon_from_stock (dialog, data->window_icon, GTK_STOCK_DIALOG_ERROR);
|
zenity_util_set_window_icon_from_stock (dialog, data->window_icon, GTK_STOCK_DIALOG_ERROR);
|
||||||
break;
|
break;
|
||||||
@ -233,6 +250,8 @@ zenity_msg_dialog_response (GtkWidget *widget, int response, gpointer data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if (response < g_strv_length(zen_data->extra_label))
|
||||||
|
printf("%s\n",zen_data->extra_label[response]);
|
||||||
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
40
src/option.c
40
src/option.c
@ -45,6 +45,7 @@ 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;
|
||||||
|
static gchar **zenity_general_extra_buttons;
|
||||||
static gboolean zenity_general_modal;
|
static gboolean zenity_general_modal;
|
||||||
static gint zenity_general_attach;
|
static gint zenity_general_attach;
|
||||||
static gboolean zenity_general_dialog_ellipsize;
|
static gboolean zenity_general_dialog_ellipsize;
|
||||||
@ -104,6 +105,7 @@ static gboolean zenity_progress_time_remaining;
|
|||||||
/* Question Dialog Options */
|
/* Question Dialog Options */
|
||||||
static gboolean zenity_question_active;
|
static gboolean zenity_question_active;
|
||||||
static gboolean zenity_question_default_cancel;
|
static gboolean zenity_question_default_cancel;
|
||||||
|
static gboolean zenity_question_switch;
|
||||||
|
|
||||||
/* Text Dialog Options */
|
/* Text Dialog Options */
|
||||||
static gboolean zenity_text_active;
|
static gboolean zenity_text_active;
|
||||||
@ -222,6 +224,15 @@ static GOptionEntry general_options[] = {
|
|||||||
N_("Sets the label of the Cancel button"),
|
N_("Sets the label of the Cancel button"),
|
||||||
N_("TEXT")
|
N_("TEXT")
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"extra-button",
|
||||||
|
'\0',
|
||||||
|
0,
|
||||||
|
G_OPTION_ARG_STRING_ARRAY,
|
||||||
|
&zenity_general_extra_buttons,
|
||||||
|
N_("Add extra-button"),
|
||||||
|
N_("TEXT")
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"modal",
|
"modal",
|
||||||
'\0',
|
'\0',
|
||||||
@ -855,6 +866,15 @@ static GOptionEntry question_options[] = {
|
|||||||
&zenity_general_dialog_ellipsize,
|
&zenity_general_dialog_ellipsize,
|
||||||
N_("Enable ellipsizing in the dialog text. This fixes the high window size with long texts")
|
N_("Enable ellipsizing in the dialog text. This fixes the high window size with long texts")
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"switch",
|
||||||
|
'\0',
|
||||||
|
G_OPTION_FLAG_NOALIAS,
|
||||||
|
G_OPTION_ARG_NONE,
|
||||||
|
&zenity_question_switch,
|
||||||
|
N_("Supress ok and cancel buttons"),
|
||||||
|
NULL
|
||||||
|
},
|
||||||
{
|
{
|
||||||
NULL
|
NULL
|
||||||
}
|
}
|
||||||
@ -1341,7 +1361,9 @@ zenity_option_free (void) {
|
|||||||
g_free (zenity_general_ok_button);
|
g_free (zenity_general_ok_button);
|
||||||
if (zenity_general_cancel_button)
|
if (zenity_general_cancel_button)
|
||||||
g_free (zenity_general_cancel_button);
|
g_free (zenity_general_cancel_button);
|
||||||
|
if (zenity_general_extra_buttons)
|
||||||
|
g_strfreev (zenity_general_extra_buttons);
|
||||||
|
|
||||||
if (zenity_calendar_date_format)
|
if (zenity_calendar_date_format)
|
||||||
g_free (zenity_calendar_date_format);
|
g_free (zenity_calendar_date_format);
|
||||||
|
|
||||||
@ -1463,6 +1485,7 @@ zenity_general_pre_callback (GOptionContext *context,
|
|||||||
zenity_general_uri = NULL;
|
zenity_general_uri = NULL;
|
||||||
zenity_general_ok_button = NULL;
|
zenity_general_ok_button = NULL;
|
||||||
zenity_general_cancel_button = NULL;
|
zenity_general_cancel_button = NULL;
|
||||||
|
zenity_general_extra_buttons = NULL;
|
||||||
zenity_general_dialog_no_wrap = FALSE;
|
zenity_general_dialog_no_wrap = FALSE;
|
||||||
zenity_general_dialog_no_markup = FALSE;
|
zenity_general_dialog_no_markup = FALSE;
|
||||||
zenity_general_timeout_delay = -1;
|
zenity_general_timeout_delay = -1;
|
||||||
@ -1594,7 +1617,7 @@ zenity_question_pre_callback (GOptionContext *context,
|
|||||||
{
|
{
|
||||||
zenity_question_active = FALSE;
|
zenity_question_active = FALSE;
|
||||||
zenity_question_default_cancel = FALSE;
|
zenity_question_default_cancel = FALSE;
|
||||||
|
zenity_question_switch = FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1710,6 +1733,7 @@ zenity_general_post_callback (GOptionContext *context,
|
|||||||
results->data->timeout_delay = zenity_general_timeout_delay;
|
results->data->timeout_delay = zenity_general_timeout_delay;
|
||||||
results->data->ok_label = zenity_general_ok_button;
|
results->data->ok_label = zenity_general_ok_button;
|
||||||
results->data->cancel_label = zenity_general_cancel_button;
|
results->data->cancel_label = zenity_general_cancel_button;
|
||||||
|
results->data->extra_label = zenity_general_extra_buttons;
|
||||||
results->data->modal = zenity_general_modal;
|
results->data->modal = zenity_general_modal;
|
||||||
results->data->attach = zenity_general_attach;
|
results->data->attach = zenity_general_attach;
|
||||||
|
|
||||||
@ -2012,13 +2036,18 @@ zenity_question_post_callback (GOptionContext *context,
|
|||||||
if (results->mode == MODE_QUESTION) {
|
if (results->mode == MODE_QUESTION) {
|
||||||
results->msg_data->dialog_text = zenity_general_dialog_text;
|
results->msg_data->dialog_text = zenity_general_dialog_text;
|
||||||
results->msg_data->dialog_icon = zenity_general_dialog_icon;
|
results->msg_data->dialog_icon = zenity_general_dialog_icon;
|
||||||
results->msg_data->mode = ZENITY_MSG_QUESTION;
|
if(zenity_question_switch)
|
||||||
|
results->msg_data->mode = ZENITY_MSG_SWITCH;
|
||||||
|
else
|
||||||
|
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->no_markup = zenity_general_dialog_no_markup;
|
||||||
results->msg_data->ellipsize = zenity_general_dialog_ellipsize;
|
results->msg_data->ellipsize = zenity_general_dialog_ellipsize;
|
||||||
results->msg_data->default_cancel = zenity_question_default_cancel;
|
results->msg_data->default_cancel = zenity_question_default_cancel;
|
||||||
}
|
}
|
||||||
|
if(zenity_question_switch && zenity_general_extra_buttons==NULL)
|
||||||
|
zenity_option_error (zenity_option_get_name (question_options, &zenity_question_switch), ERROR_SYNTAX);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2495,5 +2524,6 @@ zenity_option_parse (gint argc, gchar **argv)
|
|||||||
if (results->mode != MODE_INFO && results->mode != MODE_ERROR && results->mode != MODE_QUESTION && results->mode != MODE_WARNING)
|
if (results->mode != MODE_INFO && results->mode != MODE_ERROR && results->mode != MODE_QUESTION && results->mode != MODE_WARNING)
|
||||||
zenity_option_error (zenity_option_get_name (text_options, &zenity_general_dialog_ellipsize), ERROR_SUPPORT);
|
zenity_option_error (zenity_option_get_name (text_options, &zenity_general_dialog_ellipsize), ERROR_SUPPORT);
|
||||||
|
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,14 @@ void zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data
|
|||||||
|
|
||||||
dialog = gtk_dialog_new ();
|
dialog = gtk_dialog_new ();
|
||||||
|
|
||||||
|
if (data->extra_label) {
|
||||||
|
gint i=0;
|
||||||
|
while(data->extra_label[i]!=NULL){
|
||||||
|
gtk_dialog_add_button (GTK_DIALOG (dialog), data->extra_label[i], i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gtk_dialog_add_button(GTK_DIALOG(dialog),
|
gtk_dialog_add_button(GTK_DIALOG(dialog),
|
||||||
data->cancel_label != NULL ? data->cancel_label : GTK_STOCK_CANCEL,
|
data->cancel_label != NULL ? data->cancel_label : GTK_STOCK_CANCEL,
|
||||||
GTK_RESPONSE_CANCEL);
|
GTK_RESPONSE_CANCEL);
|
||||||
@ -177,6 +185,8 @@ zenity_password_dialog_response (GtkWidget *widget, int response, gpointer data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if (response < g_strv_length(zen_data->extra_label))
|
||||||
|
printf("%s\n",zen_data->extra_label[response]);
|
||||||
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -316,6 +316,14 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
|
|||||||
if (data->modal)
|
if (data->modal)
|
||||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||||
|
|
||||||
|
if (data->extra_label) {
|
||||||
|
gint i=0;
|
||||||
|
while(data->extra_label[i]!=NULL){
|
||||||
|
gtk_dialog_add_button (GTK_DIALOG (dialog), data->extra_label[i], i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (data->ok_label) {
|
if (data->ok_label) {
|
||||||
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_progress_ok_button"));
|
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_progress_ok_button"));
|
||||||
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
|
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
|
||||||
@ -389,7 +397,8 @@ zenity_progress_dialog_response (GtkWidget *widget, int response, gpointer data)
|
|||||||
zenity_util_exit_code_with_data (ZENITY_TIMEOUT, zen_data);
|
zenity_util_exit_code_with_data (ZENITY_TIMEOUT, zen_data);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Esc dialog */
|
if (response < g_strv_length(zen_data->extra_label))
|
||||||
|
printf("%s\n",zen_data->extra_label[response]);
|
||||||
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
12
src/scale.c
12
src/scale.c
@ -78,7 +78,15 @@ zenity_scale (ZenityData *data, ZenityScaleData *scale_data)
|
|||||||
|
|
||||||
if (data->modal)
|
if (data->modal)
|
||||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||||
|
|
||||||
|
if (data->extra_label) {
|
||||||
|
gint i=0;
|
||||||
|
while(data->extra_label[i]!=NULL){
|
||||||
|
gtk_dialog_add_button (GTK_DIALOG (dialog), data->extra_label[i], i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (data->ok_label) {
|
if (data->ok_label) {
|
||||||
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_scale_ok_button"));
|
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_scale_ok_button"));
|
||||||
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
|
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
|
||||||
@ -145,6 +153,8 @@ zenity_scale_dialog_response (GtkWidget *widget, int response, gpointer data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if (response < g_strv_length(zen_data->extra_label))
|
||||||
|
printf("%s\n",zen_data->extra_label[response]);
|
||||||
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
11
src/text.c
11
src/text.c
@ -276,6 +276,14 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
|
|||||||
if (text_data->editable)
|
if (text_data->editable)
|
||||||
zen_text_data->buffer = text_buffer;
|
zen_text_data->buffer = text_buffer;
|
||||||
|
|
||||||
|
if (data->extra_label) {
|
||||||
|
gint i=0;
|
||||||
|
while(data->extra_label[i]!=NULL){
|
||||||
|
gtk_dialog_add_button (GTK_DIALOG (dialog), data->extra_label[i], i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (data->ok_label) {
|
if (data->ok_label) {
|
||||||
gtk_button_set_label (GTK_BUTTON (ok_button), data->ok_label);
|
gtk_button_set_label (GTK_BUTTON (ok_button), data->ok_label);
|
||||||
gtk_button_set_image (GTK_BUTTON (ok_button),
|
gtk_button_set_image (GTK_BUTTON (ok_button),
|
||||||
@ -398,7 +406,8 @@ zenity_text_dialog_response (GtkWidget *widget, int response, gpointer data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* Esc dialog */
|
if (response < g_strv_length(zen_data->extra_label))
|
||||||
|
printf("%s\n",zen_data->extra_label[response]);
|
||||||
zenity_util_exit_code_with_data(ZENITY_ESC, zen_data);
|
zenity_util_exit_code_with_data(ZENITY_ESC, zen_data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
11
src/tree.c
11
src/tree.c
@ -396,6 +396,14 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
|
|||||||
if (data->modal)
|
if (data->modal)
|
||||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||||
|
|
||||||
|
if (data->extra_label) {
|
||||||
|
gint i=0;
|
||||||
|
while(data->extra_label[i]!=NULL){
|
||||||
|
gtk_dialog_add_button (GTK_DIALOG (dialog), data->extra_label[i], i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (data->ok_label) {
|
if (data->ok_label) {
|
||||||
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_tree_ok_button"));
|
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_tree_ok_button"));
|
||||||
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
|
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
|
||||||
@ -708,7 +716,8 @@ zenity_tree_dialog_response (GtkWidget *widget, int response, gpointer data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* Esc dialog */
|
if (response < g_strv_length(zen_data->extra_label))
|
||||||
|
printf("%s\n",zen_data->extra_label[response]);
|
||||||
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ zenity_util_load_ui_file (const gchar *root_widget, ...)
|
|||||||
/* Enforce terminating NULL */
|
/* Enforce terminating NULL */
|
||||||
g_ptr_array_add (ptrarray, NULL);
|
g_ptr_array_add (ptrarray, NULL);
|
||||||
objects = (gchar**) g_ptr_array_free (ptrarray, FALSE);
|
objects = (gchar**) g_ptr_array_free (ptrarray, FALSE);
|
||||||
|
|
||||||
if (g_file_test (ZENITY_UI_FILE_RELATIVEPATH, G_FILE_TEST_EXISTS)) {
|
if (g_file_test (ZENITY_UI_FILE_RELATIVEPATH, G_FILE_TEST_EXISTS)) {
|
||||||
/* Try current dir, for debugging */
|
/* Try current dir, for debugging */
|
||||||
result = gtk_builder_add_objects_from_file (builder,
|
result = gtk_builder_add_objects_from_file (builder,
|
||||||
|
@ -28,6 +28,7 @@ typedef struct {
|
|||||||
gchar *window_icon;
|
gchar *window_icon;
|
||||||
gchar *ok_label;
|
gchar *ok_label;
|
||||||
gchar *cancel_label;
|
gchar *cancel_label;
|
||||||
|
gchar **extra_label;
|
||||||
gint width;
|
gint width;
|
||||||
gint height;
|
gint height;
|
||||||
gint exit_code;
|
gint exit_code;
|
||||||
@ -56,6 +57,7 @@ typedef struct {
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
ZENITY_MSG_WARNING,
|
ZENITY_MSG_WARNING,
|
||||||
ZENITY_MSG_QUESTION,
|
ZENITY_MSG_QUESTION,
|
||||||
|
ZENITY_MSG_SWITCH,
|
||||||
ZENITY_MSG_ERROR,
|
ZENITY_MSG_ERROR,
|
||||||
ZENITY_MSG_INFO
|
ZENITY_MSG_INFO
|
||||||
} MsgMode;
|
} MsgMode;
|
||||||
|
Reference in New Issue
Block a user