From bace8e2bd2cf05e568127da834b62f7dc4a1403c Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Fri, 17 Feb 2012 20:16:09 +0200 Subject: [PATCH] zenity: add 2.32.1 ..with some backports of button-name functionality that we need --- recipes/gnome/zenity/01_textfont.patch | 108 +++++ recipes/gnome/zenity/02_okcancel.patch | 360 ++++++++++++++++ recipes/gnome/zenity/03_okcancel.patch | 548 +++++++++++++++++++++++++ recipes/gnome/zenity_2.32.1.bb | 20 + 4 files changed, 1036 insertions(+) create mode 100644 recipes/gnome/zenity/01_textfont.patch create mode 100644 recipes/gnome/zenity/02_okcancel.patch create mode 100644 recipes/gnome/zenity/03_okcancel.patch create mode 100644 recipes/gnome/zenity_2.32.1.bb diff --git a/recipes/gnome/zenity/01_textfont.patch b/recipes/gnome/zenity/01_textfont.patch new file mode 100644 index 0000000000..a27387bf2f --- /dev/null +++ b/recipes/gnome/zenity/01_textfont.patch @@ -0,0 +1,108 @@ +commit e5467650a641694c82d85cc5d34a5ece28fd51f0 +Author: muzuiget +Date: Thu Aug 19 05:40:57 2010 +0800 + + Add font and no wrap mode support in text dialog + +diff --git a/src/option.c zenity-2.32.1/src/option.c +index f481345..2d6d8a4 100644 +--- a/src/option.c ++++ zenity-2.32.1/src/option.c +@@ -97,6 +97,7 @@ static gchar *zenity_question_cancel_button; + + /* Text Dialog Options */ + static gboolean zenity_text_active; ++static gchar *zenity_text_font; + + /* Warning Dialog Options */ + static gboolean zenity_warning_active; +@@ -716,6 +717,15 @@ static GOptionEntry text_options[] = { + N_("Allow changes to text"), + NULL + }, ++ { ++ "font", ++ '\0', ++ 0, ++ G_OPTION_ARG_STRING, ++ &zenity_text_font, ++ N_("Set the text font"), ++ N_("TEXT") ++ }, + { + NULL + } +@@ -972,6 +982,9 @@ zenity_option_free (void) { + if (zenity_question_cancel_button) + g_free (zenity_question_cancel_button); + ++ if (zenity_text_font) ++ g_free (zenity_text_font); ++ + if (zenity_colorsel_color) + g_free (zenity_colorsel_color); + +@@ -1163,6 +1176,7 @@ zenity_text_pre_callback (GOptionContext *context, + GError **error) + { + zenity_text_active = FALSE; ++ zenity_text_font = NULL; + + return TRUE; + } +@@ -1544,7 +1558,13 @@ zenity_text_post_callback (GOptionContext *context, + if (results->mode == MODE_TEXTINFO) { + results->text_data->uri = zenity_general_uri; + results->text_data->editable = zenity_general_editable; +- } ++ results->text_data->no_wrap = zenity_general_dialog_no_wrap; ++ results->text_data->font = zenity_text_font; ++ } else { ++ if (zenity_text_font) ++ zenity_option_error (zenity_option_get_name (text_options, &zenity_text_font), ++ ERROR_SUPPORT); ++ } + + return TRUE; + } +@@ -1895,7 +1915,7 @@ zenity_option_parse (gint argc, gchar **argv) + zenity_option_error (zenity_option_get_name (text_options, &zenity_general_uri), ERROR_SUPPORT); + + if (zenity_general_dialog_no_wrap) +- 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 && results->mode != MODE_TEXTINFO) + zenity_option_error (zenity_option_get_name (text_options, &zenity_general_dialog_no_wrap), ERROR_SUPPORT); + + return results; +diff --git a/src/text.c zenity-2.32.1/src/text.c +index eb5f989..cd31c5f 100644 +--- a/src/text.c ++++ zenity-2.32.1/src/text.c +@@ -134,6 +134,14 @@ zenity_text (ZenityData *data, ZenityTextData *text_data) + gtk_text_view_set_buffer (GTK_TEXT_VIEW (text_view), text_buffer); + gtk_text_view_set_editable (GTK_TEXT_VIEW(text_view), text_data->editable); + ++ if (text_data->no_wrap) ++ gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW(text_view), GTK_WRAP_NONE); ++ ++ if (text_data->font) { ++ PangoFontDescription *fontDesc = pango_font_description_from_string (text_data->font); ++ gtk_widget_modify_font(GTK_TEXT_VIEW(text_view), fontDesc); ++ } ++ + if (text_data->uri) + zenity_util_fill_file_buffer (text_buffer, text_data->uri); + else +diff --git a/src/zenity.h zenity-2.32.1/src/zenity.h +index 537f5f0..6414140 100644 +--- a/src/zenity.h ++++ zenity-2.32.1/src/zenity.h +@@ -104,6 +104,8 @@ typedef struct { + typedef struct { + gchar *uri; + gboolean editable; ++ gboolean no_wrap; ++ gchar *font; + GtkTextBuffer *buffer; + } ZenityTextData; + diff --git a/recipes/gnome/zenity/02_okcancel.patch b/recipes/gnome/zenity/02_okcancel.patch new file mode 100644 index 0000000000..b8f7de0177 --- /dev/null +++ b/recipes/gnome/zenity/02_okcancel.patch @@ -0,0 +1,360 @@ +commit 5872558feef3727e3ff1bb2bf395dfc6bd896f74 +Author: Arx Cruz +Date: Tue Jun 28 17:09:04 2011 -0300 + + This change add a new functionality to text-info: + + * Added a cancel button returning 1 if clicked + * Renamed the Close button to Ok, still returning 0 if clicked + * Added --ok-label=TEXT option to change the Ok button label + * Added --cancel-label=TEXT option to change the Cancel button label + * Added --checkbox=TEXT option to show an "I Agree and accept the terms" checkbox + If --checkbox is enabled, the Ok button will be disabled if the checkbox isn't checked. + +diff --git a/src/option.c zenity-2.32.1/src/option.c +index cd81209..954ba64 100644 +--- a/src/option.c ++++ zenity-2.32.1/src/option.c +@@ -41,6 +41,8 @@ static gboolean zenity_general_editable; + static gchar *zenity_general_uri; + static gboolean zenity_general_dialog_no_wrap; + static gint zenity_general_timeout_delay; ++static gchar *zenity_general_ok_button; ++static gchar *zenity_general_cancel_button; + + /* Calendar Dialog Options */ + static gboolean zenity_calendar_active; +@@ -92,12 +94,11 @@ static gboolean zenity_progress_no_cancel; + + /* 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; + static gchar *zenity_text_font; ++static gchar *zenity_text_checkbox; + + /* Warning Dialog Options */ + static gboolean zenity_warning_active; +@@ -672,7 +673,7 @@ static GOptionEntry question_options[] = { + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, +- &zenity_question_ok_button, ++ &zenity_general_ok_button, + N_("Sets the label of the Ok button"), + N_("TEXT") + }, +@@ -681,7 +682,7 @@ static GOptionEntry question_options[] = { + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, +- &zenity_question_cancel_button, ++ &zenity_general_cancel_button, + N_("Sets the label of the Cancel button"), + N_("TEXT") + }, +@@ -736,6 +737,33 @@ static GOptionEntry text_options[] = { + N_("Set the text font"), + 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", ++ '\0', ++ G_OPTION_FLAG_NOALIAS, ++ G_OPTION_ARG_STRING, ++ &zenity_text_checkbox, ++ N_("Enable a I read and agree checkbox"), ++ N_("TEXT") ++ }, + { + NULL + } +@@ -1040,6 +1068,10 @@ zenity_option_free (void) { + if (zenity_general_uri) + g_free (zenity_general_uri); + g_free (zenity_general_separator); ++ if (zenity_general_ok_button) ++ g_free (zenity_general_ok_button); ++ if (zenity_general_cancel_button) ++ g_free (zenity_general_cancel_button); + + if (zenity_calendar_date_format) + g_free (zenity_calendar_date_format); +@@ -1060,13 +1092,10 @@ 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); +- + if (zenity_text_font) + g_free (zenity_text_font); ++ if (zenity_text_checkbox) ++ g_free (zenity_text_checkbox); + + if (zenity_colorsel_color) + g_free (zenity_colorsel_color); +@@ -1145,6 +1174,8 @@ zenity_general_pre_callback (GOptionContext *context, + zenity_general_multiple = FALSE; + zenity_general_editable = FALSE; + zenity_general_uri = NULL; ++ zenity_general_ok_button = NULL; ++ zenity_general_cancel_button = NULL; + zenity_general_dialog_no_wrap = FALSE; + zenity_general_timeout_delay = -1; + +@@ -1281,7 +1312,7 @@ zenity_text_pre_callback (GOptionContext *context, + { + zenity_text_active = FALSE; + zenity_text_font = NULL; +- ++ zenity_text_checkbox = NULL; + return TRUE; + } + +@@ -1610,7 +1641,6 @@ zenity_progress_post_callback (GOptionContext *context, + GError **error) + { + zenity_option_set_dialog_mode (zenity_progress_active, MODE_PROGRESS); +- + if (results->mode == MODE_PROGRESS) { + results->progress_data->dialog_text = zenity_general_dialog_text; + results->progress_data->pulsate = zenity_progress_pulsate; +@@ -1649,14 +1679,12 @@ zenity_question_post_callback (GOptionContext *context, + GError **error) + { + zenity_option_set_dialog_mode (zenity_question_active, MODE_QUESTION); +- +- + 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->ok_label = zenity_question_ok_button; +- results->msg_data->cancel_label = zenity_question_cancel_button; ++ results->msg_data->ok_label = zenity_general_ok_button; ++ results->msg_data->cancel_label = zenity_general_cancel_button; + } + + return TRUE; +@@ -1675,12 +1703,14 @@ zenity_text_post_callback (GOptionContext *context, + results->text_data->editable = zenity_general_editable; + results->text_data->no_wrap = zenity_general_dialog_no_wrap; + 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; + } else { +- if (zenity_text_font) ++ if (zenity_text_font) + zenity_option_error (zenity_option_get_name (text_options, &zenity_text_font), + ERROR_SUPPORT); + } +- + return TRUE; + } + +@@ -2063,7 +2093,15 @@ zenity_option_parse (gint argc, gchar **argv) + if (zenity_general_uri) + if (results->mode != MODE_FILE && results->mode != MODE_TEXTINFO) + zenity_option_error (zenity_option_get_name (text_options, &zenity_general_uri), ERROR_SUPPORT); ++ ++ if (zenity_general_ok_button) ++ if(results->mode != MODE_QUESTION && results->mode != MODE_TEXTINFO) ++ zenity_option_error (zenity_option_get_name (text_options, &zenity_general_ok_button), ERROR_SUPPORT); + ++ if (zenity_general_cancel_button) ++ if(results->mode != MODE_QUESTION && results->mode != MODE_TEXTINFO) ++ zenity_option_error (zenity_option_get_name (text_options, &zenity_general_cancel_button), ERROR_SUPPORT); ++ + 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) + zenity_option_error (zenity_option_get_name (text_options, &zenity_general_dialog_no_wrap), ERROR_SUPPORT); +diff --git a/src/text.c zenity-2.32.1/src/text.c +index 9868675..fabc860 100644 +--- a/src/text.c ++++ zenity-2.32.1/src/text.c +@@ -29,6 +29,7 @@ + static ZenityTextData *zen_text_data; + + static void zenity_text_dialog_response (GtkWidget *widget, int response, gpointer data); ++static void zenity_text_toggle_button (GtkToggleButton *button, gpointer data); + + static gboolean + zenity_text_handle_stdin (GIOChannel *channel, +@@ -103,6 +104,10 @@ zenity_text (ZenityData *data, ZenityTextData *text_data) + { + GtkBuilder *builder; + GtkWidget *dialog; ++ GtkWidget *ok_button; ++ GtkWidget *checkbox; ++ GtkWidget *cancel_button; ++ + GObject *text_view; + GtkTextBuffer *text_buffer; + +@@ -118,7 +123,11 @@ zenity_text (ZenityData *data, ZenityTextData *text_data) + gtk_builder_connect_signals (builder, NULL); + + dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_text_dialog")); +- ++ ++ ok_button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_text_close_button")); ++ cancel_button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_text_cancel_button")); ++ checkbox = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_text_checkbox")); ++ + g_signal_connect (G_OBJECT (dialog), "response", + G_CALLBACK (zenity_text_dialog_response), data); + +@@ -150,6 +159,21 @@ zenity_text (ZenityData *data, ZenityTextData *text_data) + if (text_data->editable) + zen_text_data->buffer = text_buffer; + ++ if (text_data->ok_label) ++ gtk_button_set_label (GTK_BUTTON(ok_button), text_data->ok_label); ++ ++ if (text_data->cancel_label) ++ gtk_button_set_label (GTK_BUTTON(cancel_button), text_data->cancel_label); ++ ++ if (text_data->checkbox) { ++ gtk_widget_set_visible (GTK_WIDGET(checkbox), TRUE); ++ gtk_widget_set_sensitive (GTK_WIDGET(ok_button), FALSE); ++ gtk_button_set_label (GTK_BUTTON(checkbox), text_data->checkbox); ++ ++ g_signal_connect (G_OBJECT (checkbox), "toggled", ++ G_CALLBACK (zenity_text_toggle_button), ok_button); ++ } ++ + if (data->width > -1 || data->height > -1) + gtk_window_set_default_size (GTK_WINDOW (dialog), data->width, data->height); + else +@@ -167,6 +191,13 @@ zenity_text (ZenityData *data, ZenityTextData *text_data) + } + + static void ++zenity_text_toggle_button (GtkToggleButton *button, gpointer data) ++{ ++ GtkWidget *ok_button = (GtkWidget *)data; ++ gtk_widget_set_sensitive (GTK_WIDGET(ok_button), gtk_toggle_button_get_active(button)); ++} ++ ++static void + zenity_text_dialog_response (GtkWidget *widget, int response, gpointer data) + { + ZenityData *zen_data = data; +@@ -176,7 +207,6 @@ zenity_text_dialog_response (GtkWidget *widget, int response, gpointer data) + if (zen_text_data->editable) { + GtkTextIter start, end; + gchar *text; +- + gtk_text_buffer_get_bounds (zen_text_data->buffer, &start, &end); + text = gtk_text_buffer_get_text (zen_text_data->buffer, &start, &end, 0); + g_print ("%s", text); +diff --git a/src/zenity.h zenity-2.32.1/src/zenity.h +index e5c6f4c..fd744b6 100644 +--- a/src/zenity.h ++++ zenity-2.32.1/src/zenity.h +@@ -107,6 +107,9 @@ typedef struct { + gboolean no_wrap; + gchar *font; + GtkTextBuffer *buffer; ++ gchar *ok_label; ++ gchar *cancel_label; ++ gchar *checkbox; + } ZenityTextData; + + typedef struct { +diff --git a/src/zenity.ui zenity-2.32.1/src/zenity.ui +index 3187d0b..07aa51a 100644 +--- a/src/zenity.ui ++++ zenity-2.32.1/src/zenity.ui +@@ -423,11 +423,10 @@ + True + end + +- +- gtk-close ++ ++ gtk-cancel + True + True +- True + False + True + +@@ -447,6 +446,7 @@ + + + ++ zenity_text_cancel_button + zenity_text_close_button + + +@@ -807,6 +807,23 @@ + 0 + + ++ ++ ++ gtk-ok ++ True ++ True ++ True ++ True ++ False ++ True ++ right ++ ++ ++ False ++ False ++ 1 ++ ++ + + + False +@@ -865,6 +882,20 @@ + 1 + + ++ ++ ++ True ++ False ++ False ++ 0 ++ True ++ ++ ++ False ++ False ++ 1 ++ ++ + + + 1 diff --git a/recipes/gnome/zenity/03_okcancel.patch b/recipes/gnome/zenity/03_okcancel.patch new file mode 100644 index 0000000000..598d9efb3d --- /dev/null +++ b/recipes/gnome/zenity/03_okcancel.patch @@ -0,0 +1,548 @@ +commit 6768a40e997697d05008aecdb41815e1dbae61c6 +Author: Arx Cruz +Date: Tue Jul 26 14:00:28 2011 -0300 + + Fix for bug #611297 Now Zenity have --ok-label and --cancel-label in all dialogs. This patch doesn't break old zenity scripts. + +diff -urp zenity-2.32.1_2/src/calendar.c zenity-2.32.1/src/calendar.c +--- zenity-2.32.1_2/src/calendar.c 2012-02-17 18:03:32.841172001 +0200 ++++ zenity-2.32.1/src/calendar.c 2012-02-17 18:08:18.521172001 +0200 +@@ -39,6 +39,7 @@ zenity_calendar (ZenityData *data, Zenit + { + GtkBuilder *builder; + GtkWidget *dialog; ++ GtkWidget *button; + GObject *text; + + zen_cal_data = cal_data; +@@ -88,6 +89,20 @@ zenity_calendar (ZenityData *data, Zenit + g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, NULL); + } + ++ 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); + + gtk_main (); +diff -urp zenity-2.32.1_2/src/color.c zenity-2.32.1/src/color.c +--- zenity-2.32.1_2/src/color.c 2012-02-17 18:03:32.831172000 +0200 ++++ zenity-2.32.1/src/color.c 2012-02-17 18:03:51.161171999 +0200 +@@ -35,6 +35,7 @@ void zenity_colorselection (ZenityData * + { + GtkWidget *dialog; + GtkWidget *colorsel; ++ GtkWidget *button; + GdkColor color; + + zen_data = data; +@@ -56,6 +57,22 @@ void zenity_colorselection (ZenityData * + &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), + color_data->show_palette); + +diff -urp zenity-2.32.1_2/src/entry.c zenity-2.32.1/src/entry.c +--- zenity-2.32.1_2/src/entry.c 2012-02-17 18:03:32.831172000 +0200 ++++ zenity-2.32.1/src/entry.c 2012-02-17 18:03:51.161171999 +0200 +@@ -53,6 +53,7 @@ zenity_entry (ZenityData *data, ZenityEn + { + GtkBuilder *builder = NULL; + GtkWidget *dialog; ++ GtkWidget *button; + GObject *text; + GSList *entries = NULL; + GSList *tmp; +@@ -79,6 +80,20 @@ zenity_entry (ZenityData *data, ZenityEn + + if (data->width > -1 || data->height > -1) + 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"); + +diff -urp zenity-2.32.1_2/src/msg.c zenity-2.32.1/src/msg.c +--- zenity-2.32.1_2/src/msg.c 2012-02-17 18:03:32.831172000 +0200 ++++ zenity-2.32.1/src/msg.c 2012-02-17 18:03:51.161171999 +0200 +@@ -29,7 +29,7 @@ + static void zenity_msg_dialog_response (GtkWidget *widget, int response, gpointer data); + + 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; + +@@ -38,14 +38,14 @@ zenity_msg_construct_question_dialog (Gt + + gtk_widget_grab_focus (ok_button); + +- if (msg_data->cancel_label) { +- gtk_button_set_label (GTK_BUTTON (cancel_button), msg_data->cancel_label); ++ if (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 (msg_data->ok_label) { +- gtk_button_set_label (GTK_BUTTON (ok_button), msg_data->ok_label); ++ 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)); + } +@@ -56,6 +56,7 @@ zenity_msg (ZenityData *data, ZenityMsgD + { + GtkBuilder *builder; + GtkWidget *dialog; ++ GtkWidget *ok_button; + GObject *text; + + switch (msg_data->mode) { +@@ -63,30 +64,35 @@ zenity_msg (ZenityData *data, ZenityMsgD + builder = zenity_util_load_ui_file ("zenity_warning_dialog", NULL); + dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_warning_dialog")); + text = gtk_builder_get_object (builder, "zenity_warning_text"); ++ ok_button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_warning_ok_button")); + break; + + case ZENITY_MSG_QUESTION: + builder = zenity_util_load_ui_file ("zenity_question_dialog", NULL); + dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_question_dialog")); + text = gtk_builder_get_object (builder, "zenity_question_text"); ++ ok_button = NULL; + break; + + case ZENITY_MSG_ERROR: + builder = zenity_util_load_ui_file ("zenity_error_dialog", NULL); + dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_error_dialog")); + text = gtk_builder_get_object (builder, "zenity_error_text"); ++ ok_button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_error_ok_button")); + break; + + case ZENITY_MSG_INFO: + builder = zenity_util_load_ui_file ("zenity_info_dialog", NULL); + dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_info_dialog")); + text = gtk_builder_get_object (builder, "zenity_info_text"); ++ ok_button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_info_ok_button")); + break; + + default: + builder = NULL; + dialog = NULL; + text = NULL; ++ ok_button = NULL; + g_assert_not_reached (); + break; + } +@@ -104,6 +110,14 @@ zenity_msg (ZenityData *data, ZenityMsgD + if (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) { + case ZENITY_MSG_WARNING: + zenity_util_set_window_icon_from_stock (dialog, data->window_icon, GTK_STOCK_DIALOG_WARNING); +@@ -111,7 +125,7 @@ zenity_msg (ZenityData *data, ZenityMsgD + + case ZENITY_MSG_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; + + case ZENITY_MSG_ERROR: +diff -urp zenity-2.32.1_2/src/option.c zenity-2.32.1/src/option.c +--- zenity-2.32.1_2/src/option.c 2012-02-17 18:03:32.831172000 +0200 ++++ zenity-2.32.1/src/option.c 2012-02-17 18:09:05.151172001 +0200 +@@ -171,6 +171,24 @@ static GOptionEntry general_options[] = + 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 + } + }; +@@ -654,24 +672,6 @@ static GOptionEntry question_options[] = + 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", + '\0', + G_OPTION_FLAG_NOALIAS, +@@ -723,24 +723,6 @@ static GOptionEntry text_options[] = { + 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", + '\0', + G_OPTION_FLAG_NOALIAS, +@@ -1281,7 +1263,9 @@ zenity_general_post_callback (GOptionCon + results->data->window_icon = zenity_general_window_icon; + results->data->width = zenity_general_width; + 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; + } + +@@ -1311,6 +1295,7 @@ zenity_calendar_post_callback (GOptionCo + results->calendar_data->day = zenity_calendar_day; + results->calendar_data->month = zenity_calendar_month; + results->calendar_data->year = zenity_calendar_year; ++ + if (zenity_calendar_date_format) + results->calendar_data->date_format = zenity_calendar_date_format; + else +@@ -1557,8 +1542,6 @@ zenity_question_post_callback (GOptionCo + 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->ok_label = zenity_general_ok_button; +- results->msg_data->cancel_label = zenity_general_cancel_button; + } + + return TRUE; +@@ -1577,8 +1560,6 @@ zenity_text_post_callback (GOptionContex + results->text_data->editable = zenity_general_editable; + results->text_data->no_wrap = zenity_general_dialog_no_wrap; + 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; + } else { + if (zenity_text_font) +@@ -1930,15 +1911,16 @@ zenity_option_parse (gint argc, gchar ** + if (zenity_general_uri) + if (results->mode != MODE_FILE && results->mode != MODE_TEXTINFO) + zenity_option_error (zenity_option_get_name (text_options, &zenity_general_uri), ERROR_SUPPORT); +- ++ + if (zenity_general_ok_button) +- if(results->mode != MODE_QUESTION && results->mode != MODE_TEXTINFO) +- zenity_option_error (zenity_option_get_name (text_options, &zenity_general_ok_button), ERROR_SUPPORT); ++ if(results->mode == MODE_FILE) ++ zenity_option_error (zenity_option_get_name (general_options, &zenity_general_ok_button), ERROR_SUPPORT); + + if (zenity_general_cancel_button) +- if(results->mode != MODE_QUESTION && results->mode != MODE_TEXTINFO) +- zenity_option_error (zenity_option_get_name (text_options, &zenity_general_cancel_button), ERROR_SUPPORT); +- ++ if(results->mode == MODE_FILE || results->mode == MODE_ERROR || results->mode == MODE_WARNING || results->mode == MODE_INFO) ++ zenity_option_error (zenity_option_get_name (general_options, &zenity_general_cancel_button), ERROR_SUPPORT); ++ ++ + 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) + zenity_option_error (zenity_option_get_name (text_options, &zenity_general_dialog_no_wrap), ERROR_SUPPORT); +diff -urp zenity-2.32.1_2/src/password.c zenity-2.32.1/src/password.c +--- zenity-2.32.1_2/src/password.c 2012-02-17 18:03:32.851172001 +0200 ++++ zenity-2.32.1/src/password.c 2012-02-17 18:03:51.161171999 +0200 +@@ -45,10 +45,10 @@ void zenity_password_dialog (ZenityData + dialog = gtk_dialog_new (); + + gtk_dialog_add_button(GTK_DIALOG(dialog), +- GTK_STOCK_CANCEL, ++ data->cancel_label != NULL ? data->cancel_label : GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL); + gtk_dialog_add_button(GTK_DIALOG(dialog), +- GTK_STOCK_OK, ++ data->ok_label != NULL ? data->ok_label : GTK_STOCK_OK, + GTK_RESPONSE_OK); + + image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION, +diff -urp zenity-2.32.1_2/src/progress.c zenity-2.32.1/src/progress.c +--- zenity-2.32.1_2/src/progress.c 2012-02-17 18:03:32.831172000 +0200 ++++ zenity-2.32.1/src/progress.c 2012-02-17 18:03:51.161171999 +0200 +@@ -227,6 +227,7 @@ void + zenity_progress (ZenityData *data, ZenityProgressData *progress_data) + { + GtkWidget *dialog; ++ GtkWidget *button; + GObject *text; + GObject *progress_bar; + GObject *cancel_button,*ok_button; +@@ -255,6 +256,20 @@ zenity_progress (ZenityData *data, Zenit + if (data->width > -1 || data->height > -1) + 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"); + + if (progress_data->dialog_text) +diff -urp zenity-2.32.1_2/src/scale.c zenity-2.32.1/src/scale.c +--- zenity-2.32.1_2/src/scale.c 2012-02-17 18:03:32.851172001 +0200 ++++ zenity-2.32.1/src/scale.c 2012-02-17 18:03:51.161171999 +0200 +@@ -36,6 +36,7 @@ zenity_scale (ZenityData *data, ZenitySc + { + GtkBuilder *builder; + GtkWidget *dialog; ++ GtkWidget *button; + GObject *text; + + builder = zenity_util_load_ui_file ("zenity_scale_dialog", "adjustment1", NULL); +@@ -75,6 +76,20 @@ zenity_scale (ZenityData *data, ZenitySc + if (data->width > -1 || data->height > -1) + 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) + gtk_label_set_markup (GTK_LABEL (text), g_strcompress (scale_data->dialog_text)); + +diff -urp zenity-2.32.1_2/src/text.c zenity-2.32.1/src/text.c +--- zenity-2.32.1_2/src/text.c 2012-02-17 18:03:32.831172000 +0200 ++++ zenity-2.32.1/src/text.c 2012-02-17 18:03:51.161171999 +0200 +@@ -159,16 +159,22 @@ zenity_text (ZenityData *data, ZenityTex + if (text_data->editable) + zen_text_data->buffer = text_buffer; + +- if (text_data->ok_label) +- gtk_button_set_label (GTK_BUTTON(ok_button), text_data->ok_label); ++ 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)); ++ } + +- if (text_data->cancel_label) +- gtk_button_set_label (GTK_BUTTON(cancel_button), text_data->cancel_label); ++ if (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) { +- gtk_widget_set_visible (GTK_WIDGET(checkbox), TRUE); +- gtk_widget_set_sensitive (GTK_WIDGET(ok_button), FALSE); +- gtk_button_set_label (GTK_BUTTON(checkbox), text_data->checkbox); ++ gtk_widget_set_visible (GTK_WIDGET (checkbox), TRUE); ++ gtk_widget_set_sensitive (GTK_WIDGET (ok_button), FALSE); ++ gtk_button_set_label (GTK_BUTTON (checkbox), text_data->checkbox); + + g_signal_connect (G_OBJECT (checkbox), "toggled", + G_CALLBACK (zenity_text_toggle_button), ok_button); +diff -urp zenity-2.32.1_2/src/tree.c zenity-2.32.1/src/tree.c +--- zenity-2.32.1_2/src/tree.c 2012-02-17 18:03:32.841172001 +0200 ++++ zenity-2.32.1/src/tree.c 2012-02-17 18:03:51.161171999 +0200 +@@ -282,6 +282,7 @@ void + zenity_tree (ZenityData *data, ZenityTreeData *tree_data) + { + GtkWidget *dialog; ++ GtkWidget *button; + GObject *tree_view; + GObject *text; + GtkTreeViewColumn *column; +@@ -339,6 +340,20 @@ zenity_tree (ZenityData *data, ZenityTre + if (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"); + + if (tree_data->dialog_text) +diff -urp zenity-2.32.1_2/src/zenity.h zenity-2.32.1/src/zenity.h +--- zenity-2.32.1_2/src/zenity.h 2012-02-17 18:03:32.841172001 +0200 ++++ zenity-2.32.1/src/zenity.h 2012-02-17 18:09:27.781172001 +0200 +@@ -26,6 +26,8 @@ G_BEGIN_DECLS + typedef struct { + gchar *dialog_title; + gchar *window_icon; ++ gchar *ok_label; ++ gchar *cancel_label; + gint width; + gint height; + gint exit_code; +@@ -60,8 +62,6 @@ typedef struct { + gchar *dialog_text; + MsgMode mode; + gboolean no_wrap; +- gchar *ok_label; +- gchar *cancel_label; + } ZenityMsgData; + + typedef struct { +@@ -107,8 +107,6 @@ typedef struct { + gboolean no_wrap; + gchar *font; + GtkTextBuffer *buffer; +- gchar *ok_label; +- gchar *cancel_label; + gchar *checkbox; + } ZenityTextData; + +diff -urp zenity-2.32.1_2/src/zenity.ui zenity-2.32.1/src/zenity.ui +--- zenity-2.32.1_2/src/zenity.ui 2012-02-17 18:03:32.831172000 +0200 ++++ zenity-2.32.1/src/zenity.ui 2012-02-17 18:03:51.161171999 +0200 +@@ -906,7 +906,7 @@ + True + end + +- ++ + gtk-cancel + True + True +@@ -921,7 +921,7 @@ + + + +- ++ + gtk-ok + True + True +@@ -945,8 +945,8 @@ + + + +- cancelbutton1 +- okbutton1 ++ zenity_scale_cancel_button ++ zenity_scale_ok_button + + + diff --git a/recipes/gnome/zenity_2.32.1.bb b/recipes/gnome/zenity_2.32.1.bb new file mode 100644 index 0000000000..27827641ee --- /dev/null +++ b/recipes/gnome/zenity_2.32.1.bb @@ -0,0 +1,20 @@ +DESCRIPTION = "A tool to display dialogs from the command line and shell scripts." +LICENSE = "GPL" + +DEPENDS = "gtk+ libglade glib-2.0 libnotify" + +inherit gnome + +SRC_URI += "file://01_textfont.patch;patch=1 \ + file://02_okcancel.patch;patch=1 \ + file://03_okcancel.patch;patch=1 \ + " + +do_configure_prepend() { + sed -i -e '/help\/Makefile/d' configure.in + sed -i -e 's/data.*/data/' -e '/help/d' Makefile.am + sed -i -e '/-I$(includedir)/d' src/Makefile.am +} + +SRC_URI[archive.md5sum] = "aa66ec35451b16e424519b4973082170" +SRC_URI[archive.sha256sum] = "8838be041a07364b62a4281c971392e4a09bb01bb3237a836ec0457ec0ea18ac" -- 2.39.5