Fix for bug #611297 Now Zenity have --ok-label and --cancel-label in all dialogs. This patch doesn't break old zenity scripts.
This commit is contained in:
parent
7a34df3041
commit
6768a40e99
@ -39,6 +39,7 @@ zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data)
|
|||||||
{
|
{
|
||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
GtkWidget *button;
|
||||||
GObject *text;
|
GObject *text;
|
||||||
|
|
||||||
zen_cal_data = cal_data;
|
zen_cal_data = cal_data;
|
||||||
@ -88,6 +89,20 @@ zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data)
|
|||||||
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->ok_label) {
|
||||||
|
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_image (GTK_BUTTON (button),
|
||||||
|
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data->cancel_label) {
|
||||||
|
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_calendar_cancel_button"));
|
||||||
|
gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
|
||||||
|
gtk_button_set_image (GTK_BUTTON (button),
|
||||||
|
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
|
||||||
|
}
|
||||||
|
|
||||||
g_object_unref (builder);
|
g_object_unref (builder);
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
|
17
src/color.c
17
src/color.c
@ -35,6 +35,7 @@ void zenity_colorselection (ZenityData *data, ZenityColorData *color_data)
|
|||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkWidget *colorsel;
|
GtkWidget *colorsel;
|
||||||
|
GtkWidget *button;
|
||||||
GdkColor color;
|
GdkColor color;
|
||||||
|
|
||||||
zen_data = data;
|
zen_data = data;
|
||||||
@ -56,6 +57,22 @@ void zenity_colorselection (ZenityData *data, ZenityColorData *color_data)
|
|||||||
&color);
|
&color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data->ok_label) {
|
||||||
|
g_object_get (G_OBJECT (dialog), "ok-button", &button);
|
||||||
|
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
|
||||||
|
gtk_button_set_image (GTK_BUTTON (button),
|
||||||
|
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
|
||||||
|
g_object_unref (G_OBJECT (button));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data->cancel_label) {
|
||||||
|
g_object_get (G_OBJECT (dialog), "cancel-button", &button);
|
||||||
|
gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
|
||||||
|
gtk_button_set_image (GTK_BUTTON (button),
|
||||||
|
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
|
||||||
|
g_object_unref (G_OBJECT (button));
|
||||||
|
}
|
||||||
|
|
||||||
gtk_color_selection_set_has_palette (GTK_COLOR_SELECTION (colorsel),
|
gtk_color_selection_set_has_palette (GTK_COLOR_SELECTION (colorsel),
|
||||||
color_data->show_palette);
|
color_data->show_palette);
|
||||||
|
|
||||||
|
15
src/entry.c
15
src/entry.c
@ -53,6 +53,7 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_data)
|
|||||||
{
|
{
|
||||||
GtkBuilder *builder = NULL;
|
GtkBuilder *builder = NULL;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
GtkWidget *button;
|
||||||
GObject *text;
|
GObject *text;
|
||||||
GSList *entries = NULL;
|
GSList *entries = NULL;
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
@ -80,6 +81,20 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_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->ok_label) {
|
||||||
|
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_image (GTK_BUTTON (button),
|
||||||
|
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data->cancel_label) {
|
||||||
|
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_entry_cancel_button"));
|
||||||
|
gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
|
||||||
|
gtk_button_set_image (GTK_BUTTON (button),
|
||||||
|
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
|
||||||
|
}
|
||||||
|
|
||||||
text = gtk_builder_get_object (builder, "zenity_entry_text");
|
text = gtk_builder_get_object (builder, "zenity_entry_text");
|
||||||
|
|
||||||
if (entry_data->dialog_text)
|
if (entry_data->dialog_text)
|
||||||
|
15
src/forms.c
15
src/forms.c
@ -36,6 +36,7 @@ void zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data)
|
|||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkWidget *table;
|
GtkWidget *table;
|
||||||
GtkWidget *text;
|
GtkWidget *text;
|
||||||
|
GtkWidget *button;
|
||||||
|
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
|
|
||||||
@ -63,6 +64,20 @@ 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->ok_label) {
|
||||||
|
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_image (GTK_BUTTON (button),
|
||||||
|
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data->cancel_label) {
|
||||||
|
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_cancel_button"));
|
||||||
|
gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
|
||||||
|
gtk_button_set_image (GTK_BUTTON (button),
|
||||||
|
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
|
||||||
|
}
|
||||||
|
|
||||||
text = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_text"));
|
text = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_text"));
|
||||||
|
|
||||||
if (forms_data->dialog_text)
|
if (forms_data->dialog_text)
|
||||||
|
26
src/msg.c
26
src/msg.c
@ -29,7 +29,7 @@
|
|||||||
static void zenity_msg_dialog_response (GtkWidget *widget, int response, gpointer data);
|
static void zenity_msg_dialog_response (GtkWidget *widget, int response, gpointer data);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
zenity_msg_construct_question_dialog (GtkWidget *dialog, ZenityMsgData *msg_data)
|
zenity_msg_construct_question_dialog (GtkWidget *dialog, ZenityMsgData *msg_data, ZenityData *data)
|
||||||
{
|
{
|
||||||
GtkWidget *cancel_button, *ok_button;
|
GtkWidget *cancel_button, *ok_button;
|
||||||
|
|
||||||
@ -38,14 +38,14 @@ zenity_msg_construct_question_dialog (GtkWidget *dialog, ZenityMsgData *msg_data
|
|||||||
|
|
||||||
gtk_widget_grab_focus (ok_button);
|
gtk_widget_grab_focus (ok_button);
|
||||||
|
|
||||||
if (msg_data->cancel_label) {
|
if (data->cancel_label) {
|
||||||
gtk_button_set_label (GTK_BUTTON (cancel_button), msg_data->cancel_label);
|
gtk_button_set_label (GTK_BUTTON (cancel_button), data->cancel_label);
|
||||||
gtk_button_set_image (GTK_BUTTON (cancel_button),
|
gtk_button_set_image (GTK_BUTTON (cancel_button),
|
||||||
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
|
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg_data->ok_label) {
|
if (data->ok_label) {
|
||||||
gtk_button_set_label (GTK_BUTTON (ok_button), msg_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),
|
||||||
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
|
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
|
||||||
}
|
}
|
||||||
@ -56,6 +56,7 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
|
|||||||
{
|
{
|
||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
GtkWidget *ok_button;
|
||||||
GObject *text;
|
GObject *text;
|
||||||
|
|
||||||
switch (msg_data->mode) {
|
switch (msg_data->mode) {
|
||||||
@ -63,30 +64,35 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
|
|||||||
builder = zenity_util_load_ui_file ("zenity_warning_dialog", NULL);
|
builder = zenity_util_load_ui_file ("zenity_warning_dialog", NULL);
|
||||||
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_warning_dialog"));
|
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_warning_dialog"));
|
||||||
text = gtk_builder_get_object (builder, "zenity_warning_text");
|
text = gtk_builder_get_object (builder, "zenity_warning_text");
|
||||||
|
ok_button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_warning_ok_button"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ZENITY_MSG_QUESTION:
|
case ZENITY_MSG_QUESTION:
|
||||||
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");
|
||||||
|
ok_button = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ZENITY_MSG_ERROR:
|
case ZENITY_MSG_ERROR:
|
||||||
builder = zenity_util_load_ui_file ("zenity_error_dialog", NULL);
|
builder = zenity_util_load_ui_file ("zenity_error_dialog", NULL);
|
||||||
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_error_dialog"));
|
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_error_dialog"));
|
||||||
text = gtk_builder_get_object (builder, "zenity_error_text");
|
text = gtk_builder_get_object (builder, "zenity_error_text");
|
||||||
|
ok_button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_error_ok_button"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ZENITY_MSG_INFO:
|
case ZENITY_MSG_INFO:
|
||||||
builder = zenity_util_load_ui_file ("zenity_info_dialog", NULL);
|
builder = zenity_util_load_ui_file ("zenity_info_dialog", NULL);
|
||||||
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_info_dialog"));
|
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_info_dialog"));
|
||||||
text = gtk_builder_get_object (builder, "zenity_info_text");
|
text = gtk_builder_get_object (builder, "zenity_info_text");
|
||||||
|
ok_button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_info_ok_button"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
builder = NULL;
|
builder = NULL;
|
||||||
dialog = NULL;
|
dialog = NULL;
|
||||||
text = NULL;
|
text = NULL;
|
||||||
|
ok_button = NULL;
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -104,6 +110,14 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
|
|||||||
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);
|
||||||
|
|
||||||
|
if (ok_button) {
|
||||||
|
if (data->ok_label) {
|
||||||
|
gtk_button_set_label (GTK_BUTTON (ok_button), data->ok_label);
|
||||||
|
gtk_button_set_image (GTK_BUTTON (ok_button),
|
||||||
|
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (msg_data->mode) {
|
switch (msg_data->mode) {
|
||||||
case ZENITY_MSG_WARNING:
|
case ZENITY_MSG_WARNING:
|
||||||
zenity_util_set_window_icon_from_stock (dialog, data->window_icon, GTK_STOCK_DIALOG_WARNING);
|
zenity_util_set_window_icon_from_stock (dialog, data->window_icon, GTK_STOCK_DIALOG_WARNING);
|
||||||
@ -111,7 +125,7 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
|
|||||||
|
|
||||||
case ZENITY_MSG_QUESTION:
|
case ZENITY_MSG_QUESTION:
|
||||||
zenity_util_set_window_icon_from_stock (dialog, data->window_icon, GTK_STOCK_DIALOG_QUESTION);
|
zenity_util_set_window_icon_from_stock (dialog, data->window_icon, GTK_STOCK_DIALOG_QUESTION);
|
||||||
zenity_msg_construct_question_dialog (dialog, msg_data);
|
zenity_msg_construct_question_dialog (dialog, msg_data, data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ZENITY_MSG_ERROR:
|
case ZENITY_MSG_ERROR:
|
||||||
|
70
src/option.c
70
src/option.c
@ -187,6 +187,24 @@ static GOptionEntry general_options[] = {
|
|||||||
/* Timeout for closing the dialog */
|
/* Timeout for closing the dialog */
|
||||||
N_("TIMEOUT")
|
N_("TIMEOUT")
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"ok-label",
|
||||||
|
'\0',
|
||||||
|
G_OPTION_FLAG_NOALIAS,
|
||||||
|
G_OPTION_ARG_STRING,
|
||||||
|
&zenity_general_ok_button,
|
||||||
|
N_("Sets the label of the Ok button"),
|
||||||
|
N_("TEXT")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cancel-label",
|
||||||
|
'\0',
|
||||||
|
G_OPTION_FLAG_NOALIAS,
|
||||||
|
G_OPTION_ARG_STRING,
|
||||||
|
&zenity_general_cancel_button,
|
||||||
|
N_("Sets the label of the Cancel button"),
|
||||||
|
N_("TEXT")
|
||||||
|
},
|
||||||
{
|
{
|
||||||
NULL
|
NULL
|
||||||
}
|
}
|
||||||
@ -689,24 +707,6 @@ static GOptionEntry question_options[] = {
|
|||||||
N_("Set the dialog text"),
|
N_("Set the dialog text"),
|
||||||
N_("TEXT")
|
N_("TEXT")
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"ok-label",
|
|
||||||
'\0',
|
|
||||||
G_OPTION_FLAG_NOALIAS,
|
|
||||||
G_OPTION_ARG_STRING,
|
|
||||||
&zenity_general_ok_button,
|
|
||||||
N_("Sets the label of the Ok button"),
|
|
||||||
N_("TEXT")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cancel-label",
|
|
||||||
'\0',
|
|
||||||
G_OPTION_FLAG_NOALIAS,
|
|
||||||
G_OPTION_ARG_STRING,
|
|
||||||
&zenity_general_cancel_button,
|
|
||||||
N_("Sets the label of the Cancel button"),
|
|
||||||
N_("TEXT")
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"no-wrap",
|
"no-wrap",
|
||||||
'\0',
|
'\0',
|
||||||
@ -766,24 +766,6 @@ static GOptionEntry text_options[] = {
|
|||||||
N_("Set the text font"),
|
N_("Set the text font"),
|
||||||
N_("TEXT")
|
N_("TEXT")
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"ok-label",
|
|
||||||
'\0',
|
|
||||||
G_OPTION_FLAG_NOALIAS,
|
|
||||||
G_OPTION_ARG_STRING,
|
|
||||||
&zenity_general_ok_button,
|
|
||||||
N_("Sets the label of the Ok button"),
|
|
||||||
N_("TEXT")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cancel-label",
|
|
||||||
'\0',
|
|
||||||
G_OPTION_FLAG_NOALIAS,
|
|
||||||
G_OPTION_ARG_STRING,
|
|
||||||
&zenity_general_cancel_button,
|
|
||||||
N_("Sets the label of the Cancel button"),
|
|
||||||
N_("TEXT")
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"checkbox",
|
"checkbox",
|
||||||
'\0',
|
'\0',
|
||||||
@ -1468,6 +1450,8 @@ zenity_general_post_callback (GOptionContext *context,
|
|||||||
results->data->width = zenity_general_width;
|
results->data->width = zenity_general_width;
|
||||||
results->data->height = zenity_general_height;
|
results->data->height = zenity_general_height;
|
||||||
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->cancel_label = zenity_general_cancel_button;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1497,6 +1481,7 @@ zenity_calendar_post_callback (GOptionContext *context,
|
|||||||
results->calendar_data->day = zenity_calendar_day;
|
results->calendar_data->day = zenity_calendar_day;
|
||||||
results->calendar_data->month = zenity_calendar_month;
|
results->calendar_data->month = zenity_calendar_month;
|
||||||
results->calendar_data->year = zenity_calendar_year;
|
results->calendar_data->year = zenity_calendar_year;
|
||||||
|
|
||||||
if (zenity_calendar_date_format)
|
if (zenity_calendar_date_format)
|
||||||
results->calendar_data->date_format = zenity_calendar_date_format;
|
results->calendar_data->date_format = zenity_calendar_date_format;
|
||||||
else
|
else
|
||||||
@ -1748,8 +1733,6 @@ zenity_question_post_callback (GOptionContext *context,
|
|||||||
results->msg_data->mode = ZENITY_MSG_QUESTION;
|
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->ok_label = zenity_general_ok_button;
|
|
||||||
results->msg_data->cancel_label = zenity_general_cancel_button;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1768,8 +1751,6 @@ zenity_text_post_callback (GOptionContext *context,
|
|||||||
results->text_data->editable = zenity_general_editable;
|
results->text_data->editable = zenity_general_editable;
|
||||||
results->text_data->no_wrap = zenity_general_dialog_no_wrap;
|
results->text_data->no_wrap = zenity_general_dialog_no_wrap;
|
||||||
results->text_data->font = zenity_text_font;
|
results->text_data->font = zenity_text_font;
|
||||||
results->text_data->ok_label = zenity_general_ok_button;
|
|
||||||
results->text_data->cancel_label = zenity_general_cancel_button;
|
|
||||||
results->text_data->checkbox = zenity_text_checkbox;
|
results->text_data->checkbox = zenity_text_checkbox;
|
||||||
#ifdef HAVE_WEBKITGTK
|
#ifdef HAVE_WEBKITGTK
|
||||||
results->text_data->html = zenity_text_enable_html;
|
results->text_data->html = zenity_text_enable_html;
|
||||||
@ -2165,12 +2146,13 @@ zenity_option_parse (gint argc, gchar **argv)
|
|||||||
zenity_option_error (zenity_option_get_name (text_options, &zenity_general_uri), ERROR_SUPPORT);
|
zenity_option_error (zenity_option_get_name (text_options, &zenity_general_uri), ERROR_SUPPORT);
|
||||||
|
|
||||||
if (zenity_general_ok_button)
|
if (zenity_general_ok_button)
|
||||||
if(results->mode != MODE_QUESTION && results->mode != MODE_TEXTINFO)
|
if(results->mode == MODE_FILE)
|
||||||
zenity_option_error (zenity_option_get_name (text_options, &zenity_general_ok_button), ERROR_SUPPORT);
|
zenity_option_error (zenity_option_get_name (general_options, &zenity_general_ok_button), ERROR_SUPPORT);
|
||||||
|
|
||||||
if (zenity_general_cancel_button)
|
if (zenity_general_cancel_button)
|
||||||
if(results->mode != MODE_QUESTION && results->mode != MODE_TEXTINFO)
|
if(results->mode == MODE_FILE || results->mode == MODE_ERROR || results->mode == MODE_WARNING || results->mode == MODE_INFO)
|
||||||
zenity_option_error (zenity_option_get_name (text_options, &zenity_general_cancel_button), ERROR_SUPPORT);
|
zenity_option_error (zenity_option_get_name (general_options, &zenity_general_cancel_button), ERROR_SUPPORT);
|
||||||
|
|
||||||
|
|
||||||
if (zenity_general_dialog_no_wrap)
|
if (zenity_general_dialog_no_wrap)
|
||||||
if (results->mode != MODE_INFO && results->mode != MODE_ERROR && results->mode != MODE_QUESTION && results->mode != MODE_WARNING && results->mode != MODE_TEXTINFO)
|
if (results->mode != MODE_INFO && results->mode != MODE_ERROR && results->mode != MODE_QUESTION && results->mode != MODE_WARNING && results->mode != MODE_TEXTINFO)
|
||||||
|
@ -45,10 +45,10 @@ void zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data
|
|||||||
dialog = gtk_dialog_new ();
|
dialog = gtk_dialog_new ();
|
||||||
|
|
||||||
gtk_dialog_add_button(GTK_DIALOG(dialog),
|
gtk_dialog_add_button(GTK_DIALOG(dialog),
|
||||||
GTK_STOCK_CANCEL,
|
data->cancel_label != NULL ? data->cancel_label : GTK_STOCK_CANCEL,
|
||||||
GTK_RESPONSE_CANCEL);
|
GTK_RESPONSE_CANCEL);
|
||||||
gtk_dialog_add_button(GTK_DIALOG(dialog),
|
gtk_dialog_add_button(GTK_DIALOG(dialog),
|
||||||
GTK_STOCK_OK,
|
data->ok_label != NULL ? data->ok_label : GTK_STOCK_OK,
|
||||||
GTK_RESPONSE_OK);
|
GTK_RESPONSE_OK);
|
||||||
|
|
||||||
image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION,
|
image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION,
|
||||||
|
@ -227,6 +227,7 @@ void
|
|||||||
zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
|
zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
GtkWidget *button;
|
||||||
GObject *text;
|
GObject *text;
|
||||||
GObject *progress_bar;
|
GObject *progress_bar;
|
||||||
GObject *cancel_button,*ok_button;
|
GObject *cancel_button,*ok_button;
|
||||||
@ -255,6 +256,20 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_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->ok_label) {
|
||||||
|
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_image (GTK_BUTTON (button),
|
||||||
|
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data->cancel_label) {
|
||||||
|
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_progress_cancel_button"));
|
||||||
|
gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
|
||||||
|
gtk_button_set_image (GTK_BUTTON (button),
|
||||||
|
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
|
||||||
|
}
|
||||||
|
|
||||||
text = gtk_builder_get_object (builder, "zenity_progress_text");
|
text = gtk_builder_get_object (builder, "zenity_progress_text");
|
||||||
|
|
||||||
if (progress_data->dialog_text)
|
if (progress_data->dialog_text)
|
||||||
|
15
src/scale.c
15
src/scale.c
@ -36,6 +36,7 @@ zenity_scale (ZenityData *data, ZenityScaleData *scale_data)
|
|||||||
{
|
{
|
||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
GtkWidget *button;
|
||||||
GObject *text;
|
GObject *text;
|
||||||
|
|
||||||
builder = zenity_util_load_ui_file ("zenity_scale_dialog", "adjustment1", NULL);
|
builder = zenity_util_load_ui_file ("zenity_scale_dialog", "adjustment1", NULL);
|
||||||
@ -75,6 +76,20 @@ zenity_scale (ZenityData *data, ZenityScaleData *scale_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->ok_label) {
|
||||||
|
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_image (GTK_BUTTON (button),
|
||||||
|
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data->cancel_label) {
|
||||||
|
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_scale_cancel_button"));
|
||||||
|
gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
|
||||||
|
gtk_button_set_image (GTK_BUTTON (button),
|
||||||
|
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
|
||||||
|
}
|
||||||
|
|
||||||
if (scale_data->dialog_text)
|
if (scale_data->dialog_text)
|
||||||
gtk_label_set_markup (GTK_LABEL (text), g_strcompress (scale_data->dialog_text));
|
gtk_label_set_markup (GTK_LABEL (text), g_strcompress (scale_data->dialog_text));
|
||||||
|
|
||||||
|
14
src/text.c
14
src/text.c
@ -262,11 +262,17 @@ 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 (text_data->ok_label)
|
if (data->ok_label) {
|
||||||
gtk_button_set_label (GTK_BUTTON(ok_button), text_data->ok_label);
|
gtk_button_set_label (GTK_BUTTON (ok_button), data->ok_label);
|
||||||
|
gtk_button_set_image (GTK_BUTTON (ok_button),
|
||||||
|
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
|
||||||
|
}
|
||||||
|
|
||||||
if (text_data->cancel_label)
|
if (data->cancel_label) {
|
||||||
gtk_button_set_label (GTK_BUTTON(cancel_button), text_data->cancel_label);
|
gtk_button_set_label (GTK_BUTTON (cancel_button), data->cancel_label);
|
||||||
|
gtk_button_set_image (GTK_BUTTON (cancel_button),
|
||||||
|
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
|
||||||
|
}
|
||||||
|
|
||||||
if (text_data->checkbox) {
|
if (text_data->checkbox) {
|
||||||
gtk_widget_set_visible (GTK_WIDGET (checkbox), TRUE);
|
gtk_widget_set_visible (GTK_WIDGET (checkbox), TRUE);
|
||||||
|
15
src/tree.c
15
src/tree.c
@ -287,6 +287,7 @@ void
|
|||||||
zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
|
zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
GtkWidget *button;
|
||||||
GObject *tree_view;
|
GObject *tree_view;
|
||||||
GObject *text;
|
GObject *text;
|
||||||
GtkTreeViewColumn *column;
|
GtkTreeViewColumn *column;
|
||||||
@ -344,6 +345,20 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
|
|||||||
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);
|
||||||
|
|
||||||
|
if (data->ok_label) {
|
||||||
|
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_image (GTK_BUTTON (button),
|
||||||
|
gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data->cancel_label) {
|
||||||
|
button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_tree_cancel_button"));
|
||||||
|
gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
|
||||||
|
gtk_button_set_image (GTK_BUTTON (button),
|
||||||
|
gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
|
||||||
|
}
|
||||||
|
|
||||||
text = gtk_builder_get_object (builder, "zenity_tree_text");
|
text = gtk_builder_get_object (builder, "zenity_tree_text");
|
||||||
|
|
||||||
if (tree_data->dialog_text)
|
if (tree_data->dialog_text)
|
||||||
|
@ -26,6 +26,8 @@ G_BEGIN_DECLS
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
gchar *dialog_title;
|
gchar *dialog_title;
|
||||||
gchar *window_icon;
|
gchar *window_icon;
|
||||||
|
gchar *ok_label;
|
||||||
|
gchar *cancel_label;
|
||||||
gint width;
|
gint width;
|
||||||
gint height;
|
gint height;
|
||||||
gint exit_code;
|
gint exit_code;
|
||||||
@ -61,8 +63,6 @@ typedef struct {
|
|||||||
MsgMode mode;
|
MsgMode mode;
|
||||||
gboolean no_wrap;
|
gboolean no_wrap;
|
||||||
gboolean no_markup;
|
gboolean no_markup;
|
||||||
gchar *ok_label;
|
|
||||||
gchar *cancel_label;
|
|
||||||
} ZenityMsgData;
|
} ZenityMsgData;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -108,8 +108,6 @@ typedef struct {
|
|||||||
gboolean no_wrap;
|
gboolean no_wrap;
|
||||||
gchar *font;
|
gchar *font;
|
||||||
GtkTextBuffer *buffer;
|
GtkTextBuffer *buffer;
|
||||||
gchar *ok_label;
|
|
||||||
gchar *cancel_label;
|
|
||||||
gchar *checkbox;
|
gchar *checkbox;
|
||||||
#ifdef HAVE_WEBKITGTK
|
#ifdef HAVE_WEBKITGTK
|
||||||
gboolean html;
|
gboolean html;
|
||||||
|
@ -365,7 +365,7 @@
|
|||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="layout_style">end</property>
|
<property name="layout_style">end</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="cancelbutton12">
|
<object class="GtkButton" id="zenity_forms_cancel_button">
|
||||||
<property name="label">gtk-cancel</property>
|
<property name="label">gtk-cancel</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
@ -380,7 +380,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="okbutton12">
|
<object class="GtkButton" id="zenity_forms_ok_button">
|
||||||
<property name="label">gtk-ok</property>
|
<property name="label">gtk-ok</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
@ -449,8 +449,8 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<action-widgets>
|
<action-widgets>
|
||||||
<action-widget response="-6">cancelbutton12</action-widget>
|
<action-widget response="-6">zenity_forms_cancel_button</action-widget>
|
||||||
<action-widget response="-5">okbutton12</action-widget>
|
<action-widget response="-5">zenity_forms_ok_button</action-widget>
|
||||||
</action-widgets>
|
</action-widgets>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkDialog" id="zenity_info_dialog">
|
<object class="GtkDialog" id="zenity_info_dialog">
|
||||||
@ -739,7 +739,7 @@
|
|||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="layout_style">end</property>
|
<property name="layout_style">end</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="cancelbutton1">
|
<object class="GtkButton" id="zenity_scale_cancel_button">
|
||||||
<property name="label">gtk-cancel</property>
|
<property name="label">gtk-cancel</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
@ -755,7 +755,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="okbutton1">
|
<object class="GtkButton" id="zenity_scale_ok_button">
|
||||||
<property name="label">gtk-ok</property>
|
<property name="label">gtk-ok</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
@ -823,8 +823,8 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<action-widgets>
|
<action-widgets>
|
||||||
<action-widget response="-6">cancelbutton1</action-widget>
|
<action-widget response="-6">zenity_scale_cancel_button</action-widget>
|
||||||
<action-widget response="-5">okbutton1</action-widget>
|
<action-widget response="-5">zenity_scale_ok_button</action-widget>
|
||||||
</action-widgets>
|
</action-widgets>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkDialog" id="zenity_text_dialog">
|
<object class="GtkDialog" id="zenity_text_dialog">
|
||||||
|
Reference in New Issue
Block a user