From 03a791abee3f604a0c0d918643157585fb55589b Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Sun, 22 Mar 2015 04:17:38 +0000 Subject: src/zenity.ui: Changes when open with Glade 3.18.3 --- src/zenity.ui | 65 ++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/zenity.ui b/src/zenity.ui index 32cff725..272c3bb2 100644 --- a/src/zenity.ui +++ b/src/zenity.ui @@ -1,7 +1,7 @@ + - - + 100 1 @@ -17,11 +17,11 @@ dialog - + True False - + True False end @@ -122,12 +122,12 @@ dialog - + True False 2 - + True False end @@ -234,12 +234,12 @@ dialog - + True False 2 - + True False end @@ -365,12 +365,12 @@ dialog - + True False 2 - + True False end @@ -469,12 +469,12 @@ dialog - + True False 14 - + True False end @@ -518,7 +518,7 @@ False 0 gtk-dialog-error - 6 + 6 True @@ -566,12 +566,12 @@ 5 normal - + True False 2 - + True False end @@ -672,6 +672,12 @@ + + + + + + @@ -708,12 +714,12 @@ dialog - + True False 14 - + True False end @@ -752,7 +758,7 @@ False 0 gtk-dialog-info - 6 + 6 True @@ -796,12 +802,12 @@ dialog - + True False 2 - + True False end @@ -911,12 +917,12 @@ dialog - + True False 14 - + True False end @@ -941,7 +947,7 @@ 0 0 gtk-dialog-question - 6 + 6 False @@ -984,11 +990,11 @@ dialog - + True False - + True False end @@ -1059,6 +1065,9 @@ True True True + + + @@ -1090,12 +1099,12 @@ dialog - + True False 14 - + True False end @@ -1136,7 +1145,7 @@ 0 0 gtk-dialog-warning - 6 + 6 False -- cgit From a1fe6eb88e1701319d007a7b1a469d1154bba5ab Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Sun, 22 Mar 2015 04:30:20 +0000 Subject: src/zenity.ui: Do not use deprecated stock buttons --- src/zenity.ui | 57 +++++++++++++++++++++++---------------------------------- 1 file changed, 23 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/zenity.ui b/src/zenity.ui index 272c3bb2..f1edfa19 100644 --- a/src/zenity.ui +++ b/src/zenity.ui @@ -27,12 +27,11 @@ end - gtk-cancel + Cancel True True True False - True False @@ -42,12 +41,11 @@ - gtk-ok + OK True True True False - True False @@ -133,11 +131,10 @@ end - gtk-cancel + Cancel True True False - True False @@ -147,12 +144,11 @@ - gtk-ok + OK True True True True - True right @@ -245,12 +241,11 @@ end - gtk-cancel + Cancel True True True False - True False @@ -260,13 +255,12 @@ - gtk-ok + OK True True True True False - True False @@ -376,12 +370,11 @@ end - gtk-cancel + Cancel True True True False - True False @@ -391,13 +384,12 @@ - gtk-ok + OK True True True True False - True False @@ -480,12 +472,11 @@ end - gtk-ok + OK True True True False - True False @@ -577,11 +568,10 @@ end - gtk-cancel + Cancel True True True - True False @@ -591,11 +581,10 @@ - gtk-ok + OK True True True - True False @@ -678,6 +667,12 @@ + + + + + + @@ -725,12 +720,11 @@ end - gtk-ok + OK True True True False - True False @@ -813,12 +807,11 @@ end - gtk-cancel + Cancel True True True False - True False @@ -828,14 +821,13 @@ - gtk-ok + OK True False True True True False - True False @@ -1000,12 +992,11 @@ end - gtk-cancel + Cancel True True True False - True False @@ -1015,12 +1006,11 @@ - gtk-ok + OK True True True False - True False @@ -1110,13 +1100,12 @@ end - gtk-ok + OK True True True True False - True False -- cgit From d26aa23e1dbc38be7709782d36df487ac59d0541 Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Sun, 22 Mar 2015 04:43:49 +0000 Subject: src/zenity.ui: Do not use deprecated stock images --- src/zenity.ui | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/zenity.ui b/src/zenity.ui index f1edfa19..fed8c23b 100644 --- a/src/zenity.ui +++ b/src/zenity.ui @@ -508,7 +508,7 @@ True False 0 - gtk-dialog-error + dialog-error 6 @@ -751,7 +751,7 @@ True False 0 - gtk-dialog-info + dialog-information 6 @@ -938,7 +938,7 @@ False 0 0 - gtk-dialog-question + dialog-question 6 @@ -1133,7 +1133,7 @@ False 0 0 - gtk-dialog-warning + dialog-warning 6 -- cgit From 6fcbb80fd1b5268fbedcdb985ffa873a2e475840 Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Sun, 22 Mar 2015 04:57:05 +0000 Subject: Do not use an icon for Cancel/OK buttons GTK+ documentation recommends to not use an icons, but use "_OK"/"_Cancel" labels instead --- src/calendar.c | 4 ---- src/color.c | 4 ---- src/entry.c | 4 ---- src/fileselection.c | 4 ++-- src/forms.c | 4 ---- src/msg.c | 6 ------ src/password.c | 4 ++-- src/progress.c | 4 ---- src/scale.c | 4 ---- src/text.c | 4 ---- src/tree.c | 4 ---- 11 files changed, 4 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/calendar.c b/src/calendar.c index e8967974..0166c500 100644 --- a/src/calendar.c +++ b/src/calendar.c @@ -95,15 +95,11 @@ zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data) 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); diff --git a/src/color.c b/src/color.c index e3b8a428..6820bbbe 100644 --- a/src/color.c +++ b/src/color.c @@ -60,16 +60,12 @@ void zenity_colorselection (ZenityData *data, ZenityColorData *color_data) if (data->ok_label) { g_object_get (G_OBJECT (dialog), "ok-button", &button, NULL); 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, NULL); 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)); } diff --git a/src/entry.c b/src/entry.c index ca5e3752..efb2234d 100644 --- a/src/entry.c +++ b/src/entry.c @@ -87,15 +87,11 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_data) 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 --git a/src/fileselection.c b/src/fileselection.c index 9edbb6ae..30495558 100644 --- a/src/fileselection.c +++ b/src/fileselection.c @@ -52,8 +52,8 @@ void zenity_fileselection (ZenityData *data, ZenityFileData *file_data) dialog = gtk_file_chooser_dialog_new (NULL, NULL, action, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, + _("_Cancel"), GTK_RESPONSE_CANCEL, + _("_OK"), GTK_RESPONSE_OK, NULL); gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), diff --git a/src/forms.c b/src/forms.c index 59c6461f..072908e6 100644 --- a/src/forms.c +++ b/src/forms.c @@ -209,15 +209,11 @@ void zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data) 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")); diff --git a/src/msg.c b/src/msg.c index 4132ae98..ce25ab3a 100644 --- a/src/msg.c +++ b/src/msg.c @@ -40,14 +40,10 @@ zenity_msg_construct_question_dialog (GtkWidget *dialog, ZenityMsgData *msg_data 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 (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)); } } @@ -119,8 +115,6 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data) 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)); } } diff --git a/src/password.c b/src/password.c index ff254fde..6d85390b 100644 --- a/src/password.c +++ b/src/password.c @@ -45,10 +45,10 @@ void zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data dialog = gtk_dialog_new (); gtk_dialog_add_button(GTK_DIALOG(dialog), - data->cancel_label != NULL ? data->cancel_label : GTK_STOCK_CANCEL, + data->cancel_label != NULL ? data->cancel_label : _("_Cancel"), GTK_RESPONSE_CANCEL); gtk_dialog_add_button(GTK_DIALOG(dialog), - data->ok_label != NULL ? data->ok_label : GTK_STOCK_OK, + data->ok_label != NULL ? data->ok_label : _("_OK"), GTK_RESPONSE_OK); image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION, diff --git a/src/progress.c b/src/progress.c index 3fd2c2ef..dfbdd8a9 100644 --- a/src/progress.c +++ b/src/progress.c @@ -319,15 +319,11 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data) 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)); } if (progress_data->dialog_text) diff --git a/src/scale.c b/src/scale.c index adcf67be..ea56dd22 100644 --- a/src/scale.c +++ b/src/scale.c @@ -82,15 +82,11 @@ zenity_scale (ZenityData *data, ZenityScaleData *scale_data) 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) diff --git a/src/text.c b/src/text.c index 8f383b9c..83aff9b5 100644 --- a/src/text.c +++ b/src/text.c @@ -278,14 +278,10 @@ zenity_text (ZenityData *data, ZenityTextData *text_data) 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 (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) { diff --git a/src/tree.c b/src/tree.c index 819f9a8e..ac61cd87 100644 --- a/src/tree.c +++ b/src/tree.c @@ -399,15 +399,11 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data) 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"); -- cgit From c1cf0abc21133e4fa79f412f2e7b0d1a4b6954bd Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Sun, 22 Mar 2015 05:00:48 +0000 Subject: Do not use stock dialog --- src/password.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/password.c b/src/password.c index 6d85390b..be3bcf43 100644 --- a/src/password.c +++ b/src/password.c @@ -51,8 +51,8 @@ void zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data data->ok_label != NULL ? data->ok_label : _("_OK"), GTK_RESPONSE_OK); - image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION, - GTK_ICON_SIZE_DIALOG); + image = gtk_image_new_from_icon_name("dialog-password", + GTK_ICON_SIZE_DIALOG); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); hbox = gtk_hbox_new(FALSE, 5); -- cgit From 1a43253ac568bc8ff293746477361a33a4469f88 Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Sun, 22 Mar 2015 05:17:25 +0000 Subject: Do not use a stock answer for yes/no buttons --- src/msg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/msg.c b/src/msg.c index ce25ab3a..73c48981 100644 --- a/src/msg.c +++ b/src/msg.c @@ -33,8 +33,8 @@ zenity_msg_construct_question_dialog (GtkWidget *dialog, ZenityMsgData *msg_data { GtkWidget *cancel_button, *ok_button; - 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); + cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("_No"), GTK_RESPONSE_CANCEL); + ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Yes"), GTK_RESPONSE_OK); gtk_widget_grab_focus (msg_data->default_cancel ? cancel_button : ok_button); -- cgit From fba4f05582d6c84030354ba3e1adc228543a3919 Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Sun, 22 Mar 2015 06:02:41 +0000 Subject: Rework zenity_util_set_window_icon* to not use stock images --- src/msg.c | 8 ++++---- src/util.c | 65 +++++++++++++++++++++++++++++--------------------------------- src/util.h | 8 ++++---- 3 files changed, 38 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/msg.c b/src/msg.c index 73c48981..6892e733 100644 --- a/src/msg.c +++ b/src/msg.c @@ -120,20 +120,20 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data) switch (msg_data->mode) { 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_icon_name (dialog, data->window_icon, "dialog-warning"); break; 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_icon_name (dialog, data->window_icon, "dialog-question"); zenity_msg_construct_question_dialog (dialog, msg_data, data); break; 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_icon_name (dialog, data->window_icon, "dialog-error"); break; case ZENITY_MSG_INFO: - zenity_util_set_window_icon_from_stock (dialog, data->window_icon, GTK_STOCK_DIALOG_INFO); + zenity_util_set_window_icon_from_icon_name (dialog, data->window_icon, "dialog-information"); break; default: diff --git a/src/util.c b/src/util.c index d63aecaf..29ef6daf 100644 --- a/src/util.c +++ b/src/util.c @@ -178,66 +178,61 @@ zenity_util_fill_file_buffer (GtkTextBuffer *buffer, const gchar *filename) } const gchar * -zenity_util_stock_from_filename (const gchar *filename) +zenity_util_icon_name_from_filename (const gchar *filename) { if (!filename || !filename[0]) - return GTK_STOCK_DIALOG_WARNING; /* default */ + return "dialog-warning"; /* default */ if (!g_ascii_strcasecmp (filename, "warning")) - return GTK_STOCK_DIALOG_WARNING; + return "dialog-warning"; if (!g_ascii_strcasecmp (filename, "info")) - return GTK_STOCK_DIALOG_INFO; + return "dialog-information"; if (!g_ascii_strcasecmp (filename, "question")) - return GTK_STOCK_DIALOG_QUESTION; + return "dialog-question"; if (!g_ascii_strcasecmp (filename, "error")) - return GTK_STOCK_DIALOG_ERROR; + return "dialog-error"; return NULL; } -GdkPixbuf * -zenity_util_pixbuf_new_from_file (GtkWidget *widget, const gchar *filename) -{ - const gchar *stock; - - stock = zenity_util_stock_from_filename (filename); - if (stock) - return gtk_widget_render_icon (widget, stock, GTK_ICON_SIZE_BUTTON, NULL); - - return gdk_pixbuf_new_from_file (filename, NULL); -} - void -zenity_util_set_window_icon (GtkWidget *widget, const gchar *filename, const gchar *default_file) +zenity_util_set_window_icon_from_file (GtkWidget *widget, const gchar *filename) { GdkPixbuf *pixbuf; + const gchar *icon_name; - if (filename != NULL) - pixbuf = zenity_util_pixbuf_new_from_file (widget, (gchar *) filename); - else - pixbuf = gdk_pixbuf_new_from_file (default_file, NULL); - - if (pixbuf != NULL) { + icon_name = zenity_util_icon_name_from_filename (filename); + if (icon_name) { + gtk_window_set_icon_name (GTK_WINDOW (widget), icon_name); + } else { + pixbuf = gdk_pixbuf_new_from_file (filename, NULL); gtk_window_set_icon (GTK_WINDOW (widget), pixbuf); g_object_unref (pixbuf); } } -void -zenity_util_set_window_icon_from_stock (GtkWidget *widget, const gchar *filename, const gchar *default_stock_id) +void +zenity_util_set_window_icon (GtkWidget *widget, const gchar *filename, const gchar *default_file) { GdkPixbuf *pixbuf; if (filename != NULL) { - pixbuf = zenity_util_pixbuf_new_from_file (widget, (gchar *) filename); - } - else { - pixbuf = gtk_widget_render_icon (widget, default_stock_id, GTK_ICON_SIZE_BUTTON, NULL); + zenity_util_set_window_icon_from_file (widget, filename); + } else { + pixbuf = gdk_pixbuf_new_from_file (default_file, NULL); + if (pixbuf != NULL) { + gtk_window_set_icon (GTK_WINDOW (widget), pixbuf); + g_object_unref (pixbuf); + } } +} - if (pixbuf != NULL) { - gtk_window_set_icon (GTK_WINDOW (widget), pixbuf); - g_object_unref (pixbuf); - } +void +zenity_util_set_window_icon_from_icon_name (GtkWidget *widget, const gchar *filename, const gchar *default_icon_name) +{ + if (filename != NULL) + zenity_util_set_window_icon_from_file (widget, filename); + else + gtk_window_set_icon_name (GTK_WINDOW (widget), default_icon_name); } void diff --git a/src/util.h b/src/util.h index f9db4bea..0fd2fff9 100644 --- a/src/util.h +++ b/src/util.h @@ -19,14 +19,14 @@ GtkBuilder* zenity_util_load_ui_file (const gchar *widge gchar * zenity_util_strip_newline (gchar *string); gboolean zenity_util_fill_file_buffer (GtkTextBuffer *buffer, const gchar *filename); -const gchar * zenity_util_stock_from_filename (const gchar *filename); +const gchar * zenity_util_icon_name_from_filename (const gchar *filename); void zenity_util_set_window_icon (GtkWidget *widget, const gchar *filename, const gchar *default_file); -void zenity_util_set_window_icon_from_stock (GtkWidget *widget, +void zenity_util_set_window_icon_from_icon_name(GtkWidget *widget, const gchar *filename, - const gchar *default_stock_id); -GdkPixbuf * zenity_util_pixbuf_new_from_file (GtkWidget *widget, + const gchar *default_icon_name); +void zenity_util_set_window_icon_from_file (GtkWidget *widget, const gchar *filename); void zenity_util_show_help (GError **error); gint zenity_util_return_exit_code (ZenityExitCode value); -- cgit From e54c5db6aa0374db35abe8ae6e128648e95a35b1 Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Sun, 22 Mar 2015 06:30:57 +0000 Subject: src/color.c: Port to GtkColorChooserDialog --- src/color.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/color.c b/src/color.c index 6820bbbe..2a7e0396 100644 --- a/src/color.c +++ b/src/color.c @@ -34,27 +34,21 @@ static void zenity_colorselection_dialog_response (GtkWidget *widget, int respon void zenity_colorselection (ZenityData *data, ZenityColorData *color_data) { GtkWidget *dialog; - GtkWidget *colorsel; GtkWidget *button; - GdkColor color; + GdkRGBA color; zen_data = data; - dialog = gtk_color_selection_dialog_new (NULL); + dialog = gtk_color_chooser_dialog_new (data->dialog_title, NULL); g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (zenity_colorselection_dialog_response), color_data); - if (data->dialog_title) - gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title); - - colorsel = gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (dialog)); - if (color_data->color) { - if (gdk_color_parse (color_data->color, &color)) - gtk_color_selection_set_current_color (GTK_COLOR_SELECTION (colorsel), - &color); + if (gdk_rgba_parse (&color, color_data->color)) { + gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (dialog), &color); + } } if (data->ok_label) { @@ -72,8 +66,7 @@ void zenity_colorselection (ZenityData *data, ZenityColorData *color_data) if (data->modal) gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); - gtk_color_selection_set_has_palette (GTK_COLOR_SELECTION (colorsel), - color_data->show_palette); + g_object_set (dialog, "show-editor", !color_data->show_palette, NULL); zenity_util_show_dialog (dialog, data->attach); @@ -89,15 +82,13 @@ void zenity_colorselection (ZenityData *data, ZenityColorData *color_data) static void zenity_colorselection_dialog_response (GtkWidget *widget, int response, gpointer data) { - GtkWidget *colorsel; - GdkColor color; + GdkRGBA color; switch (response) { case GTK_RESPONSE_OK: - zenity_util_exit_code_with_data(ZENITY_OK, zen_data); - colorsel = gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (widget)); - gtk_color_selection_get_current_color (GTK_COLOR_SELECTION (colorsel), &color); - g_print ("%s\n", gdk_color_to_string (&color)); + zenity_util_exit_code_with_data(ZENITY_OK, zen_data); + gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (widget), &color); + g_print ("%s\n", gdk_rgba_to_string (&color)); break; case GTK_RESPONSE_CANCEL: -- cgit From 1cf533964e61202c2e0921e10dc4ee149423bd6c Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Sun, 22 Mar 2015 07:15:51 +0000 Subject: src/text.c: gtk_widget_override_font instead gtk_widget_modify_font --- src/text.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/text.c b/src/text.c index 83aff9b5..634be3da 100644 --- a/src/text.c +++ b/src/text.c @@ -265,7 +265,7 @@ zenity_text (ZenityData *data, ZenityTextData *text_data) if (text_data->font) { PangoFontDescription *fontDesc = pango_font_description_from_string (text_data->font); - gtk_widget_modify_font (GTK_WIDGET(text_view), fontDesc); + gtk_widget_override_font (GTK_WIDGET(text_view), fontDesc); } if (text_data->uri) -- cgit From 1f130a37fac4976687473b951908581612168bdc Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Sun, 22 Mar 2015 07:19:56 +0000 Subject: password: Use gtk_box instead gtk_[v|h]box --- src/password.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/password.c b/src/password.c index be3bcf43..32be61ea 100644 --- a/src/password.c +++ b/src/password.c @@ -55,7 +55,7 @@ void zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data GTK_ICON_SIZE_DIALOG); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); - hbox = gtk_hbox_new(FALSE, 5); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5); gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, @@ -81,10 +81,10 @@ void zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data TRUE, 5); - vbox_labels = gtk_vbox_new(FALSE, 5); - vbox_entries = gtk_vbox_new(FALSE, 5); + vbox_labels = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); + vbox_entries = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); - hbox = gtk_hbox_new(FALSE, 5); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), hbox, FALSE, -- cgit From 7c4cd1fc426e4e30a25a390987b139fc1d32a0b3 Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Sun, 22 Mar 2015 07:25:59 +0000 Subject: src/password.c: Do not use deprecated GtkAlignment widget --- src/password.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/password.c b/src/password.c index 32be61ea..c5161002 100644 --- a/src/password.c +++ b/src/password.c @@ -38,7 +38,6 @@ void zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data GtkWidget *vbox_labels; GtkWidget *vbox_entries; GtkWidget *label; - GtkWidget *align; zen_data = data; @@ -103,11 +102,9 @@ void zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data 12); if(password_data->username) { - align = gtk_alignment_new(0.0, 0.12, 0.0, 0.0); label = gtk_label_new(_("Username:")); - gtk_container_add(GTK_CONTAINER(align), label); gtk_box_pack_start(GTK_BOX(vbox_labels), - align, + label, TRUE, FALSE, 12); @@ -119,12 +116,9 @@ void zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data 12); } - align = gtk_alignment_new(0.0, 0.5, 0.0, 0.0); label = gtk_label_new(_("Password:")); - gtk_container_add(GTK_CONTAINER(align), label); - gtk_box_pack_start(GTK_BOX(vbox_labels), - align, + label, TRUE, FALSE, 12); -- cgit From fcb28a3a141d272a5ca8ec5ef64233b66a746395 Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Sun, 22 Mar 2015 08:05:26 +0000 Subject: forms: Use GtkGrid instead deprecated GtkTable/GtkAlignment --- src/forms.c | 98 ++++++++--------------------------------------------------- src/zenity.ui | 74 +++++--------------------------------------- 2 files changed, 20 insertions(+), 152 deletions(-) (limited to 'src') diff --git a/src/forms.c b/src/forms.c index 072908e6..3e19f4c5 100644 --- a/src/forms.c +++ b/src/forms.c @@ -173,13 +173,12 @@ void zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data) { GtkBuilder *builder = NULL; GtkWidget *dialog; - GtkWidget *table; + GtkWidget *grid; GtkWidget *text; GtkWidget *button; GSList *tmp; - gint number_of_widgets = g_slist_length (forms_data->list); int list_count = 0; int combo_count = 0; int i = 0; @@ -221,122 +220,51 @@ void zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data) if (forms_data->dialog_text) gtk_label_set_markup (GTK_LABEL (text), g_strcompress (forms_data->dialog_text)); - table = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_table")); - - gtk_table_resize (GTK_TABLE (table), number_of_widgets, 2); + grid = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_grid")); for (tmp = forms_data->list; tmp; tmp = tmp->next) { ZenityFormsValue *zenity_value = (ZenityFormsValue *) tmp->data; GtkWidget *label; - GtkWidget *align; label = gtk_label_new(zenity_value->option_value); - - align = gtk_alignment_new (0.0, 0.5, 0.0, 0.0); - gtk_container_add (GTK_CONTAINER (align), label); - - gtk_table_attach (GTK_TABLE (table), - GTK_WIDGET (align), - 0, - 1, - i, - i+1, - GTK_FILL, - GTK_FILL, - 0, - 0); + gtk_widget_set_halign (label, GTK_ALIGN_START); + gtk_grid_attach (GTK_GRID (grid), + label, + 0, i, + 1, 1); switch(zenity_value->type) { case ZENITY_FORMS_ENTRY: zenity_value->forms_widget = gtk_entry_new(); - gtk_table_attach (GTK_TABLE (table), - GTK_WIDGET (zenity_value->forms_widget), - 1, - 2, - i, - i+1, - GTK_EXPAND | GTK_FILL, - GTK_EXPAND | GTK_FILL, - 0, - 0); break; case ZENITY_FORMS_PASSWORD: zenity_value->forms_widget = gtk_entry_new(); gtk_entry_set_visibility(GTK_ENTRY(zenity_value->forms_widget), FALSE); - gtk_table_attach (GTK_TABLE (table), - GTK_WIDGET (zenity_value->forms_widget), - 1, - 2, - i, - i+1, - GTK_EXPAND | GTK_FILL, - GTK_EXPAND | GTK_FILL, - 0, - 0); break; case ZENITY_FORMS_CALENDAR: zenity_value->forms_widget = gtk_calendar_new(); - gtk_alignment_set (GTK_ALIGNMENT (align), 0.0, 0.02, 0.0, 0.0); - align = gtk_alignment_new (0.0, 0.5, 0.0, 0.0); - gtk_container_add (GTK_CONTAINER (align), zenity_value->forms_widget); - gtk_table_attach (GTK_TABLE (table), - GTK_WIDGET (align), - 1, - 2, - i, - i+1, - GTK_FILL, - GTK_FILL, - 0, - 0); break; case ZENITY_FORMS_LIST: zenity_value->forms_widget = zenity_forms_create_and_fill_list (forms_data, list_count, zenity_value->option_value); - gtk_alignment_set (GTK_ALIGNMENT (align), 0.0, 0.02, 0.0, 0.0); - gtk_table_attach (GTK_TABLE (table), - GTK_WIDGET (zenity_value->forms_widget), - 1, - 2, - i, - i+1, - GTK_EXPAND | GTK_FILL, - GTK_EXPAND | GTK_FILL, - 0, - 0); list_count++; break; case ZENITY_FORMS_COMBO: zenity_value->forms_widget = zenity_forms_create_and_fill_combo (forms_data, combo_count); - gtk_alignment_set (GTK_ALIGNMENT (align), 0.0, 0.02, 0.0, 0.0); - gtk_table_attach (GTK_TABLE (table), - GTK_WIDGET (zenity_value->forms_widget), - 1, - 2, - i, - i+1, - GTK_EXPAND | GTK_FILL, - GTK_EXPAND | GTK_FILL, - 0, - 0); combo_count++; break; default: zenity_value->forms_widget = gtk_entry_new(); - gtk_table_attach (GTK_TABLE (table), - GTK_WIDGET (zenity_value->forms_widget), - 1, - 2, - i, - i+1, - GTK_EXPAND | GTK_FILL, - GTK_EXPAND | GTK_FILL, - 0, - 0); break; } + + gtk_grid_attach_next_to (GTK_GRID (grid), + GTK_WIDGET (zenity_value->forms_widget), + label, + GTK_POS_RIGHT, + 1, 1); i++; } diff --git a/src/zenity.ui b/src/zenity.ui index fed8c23b..edd30585 100644 --- a/src/zenity.ui +++ b/src/zenity.ui @@ -606,75 +606,15 @@ False 0 - + True False - 12 - 12 - 6 - - - True - False - 2 - 10 - 6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 12 + 6 + 12 + 6 + 6 + 10 -- cgit From 81d9a261e25f5fe612affa1372e7abd95fbcf1e4 Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Sun, 22 Mar 2015 08:52:44 +0000 Subject: src/zenity.ui: Use GtkBox instead deprecated Gtk[H|V]Box --- src/zenity.ui | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/zenity.ui b/src/zenity.ui index edd30585..79827a90 100644 --- a/src/zenity.ui +++ b/src/zenity.ui @@ -62,10 +62,11 @@ - + True False 5 + vertical 6 @@ -166,7 +167,7 @@ - + True False 5 @@ -277,13 +278,14 @@ - + True False 5 + vertical 6 - + True False 6 @@ -406,12 +408,13 @@ - + True False 6 + vertical - + True False 6 @@ -493,12 +496,12 @@ - + True False 6 - + True False 5 @@ -681,7 +684,7 @@ - + True False 5 @@ -784,10 +787,11 @@ - + True False 5 + vertical 6 @@ -867,7 +871,7 @@ - + True False 5 @@ -967,10 +971,11 @@ - + True False 5 + vertical 6 @@ -1062,7 +1067,7 @@ - + True False 5 -- cgit From d97b99cfc32abe024564622b0904ff773ff81107 Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Sun, 22 Mar 2015 09:00:16 +0000 Subject: Use GtkScale instead deprecated GtkHScale --- src/zenity.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/zenity.ui b/src/zenity.ui index 79827a90..f6bc0c7a 100644 --- a/src/zenity.ui +++ b/src/zenity.ui @@ -83,7 +83,7 @@ - + True True adjustment1 -- cgit From a3568bc51baa1ceccb430c31b0f95c2672eccbcb Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Sun, 22 Mar 2015 09:05:23 +0000 Subject: src/notification.c: Remove non-used variable --- src/notification.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/notification.c b/src/notification.c index 06ac1dde..2bdd05b6 100644 --- a/src/notification.c +++ b/src/notification.c @@ -175,10 +175,6 @@ zenity_notification_handle_stdin (GIOChannel *channel, GIOCondition condition, gpointer user_data) { - ZenityData *zen_data; - - zen_data = (ZenityData *)user_data; - if ((condition & G_IO_IN) != 0) { GString *string; GError *error = NULL; -- cgit From f01d7220db8d62846a01ab044a5976dd1304f446 Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Sun, 22 Mar 2015 09:07:34 +0000 Subject: src/tree.c: Do not use deprecated gtk_tree_view_set_rules_hint() --- src/tree.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/tree.c b/src/tree.c index ac61cd87..a979d8a1 100644 --- a/src/tree.c +++ b/src/tree.c @@ -551,8 +551,6 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data) column_index++; } - gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (tree_view), TRUE); - if (tree_data->hide_header) gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), FALSE); -- cgit From c45daa96bfdc5a958cc0f2cdaf4db71ac61b8fde Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Sun, 22 Mar 2015 09:24:26 +0000 Subject: src/tree.c: avoid a compilation warning --- src/tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/tree.c b/src/tree.c index a979d8a1..c87958f0 100644 --- a/src/tree.c +++ b/src/tree.c @@ -305,8 +305,9 @@ zenity_mid_search_func (GtkTreeModel *model, gint column, { gchar *iter_string = NULL; gtk_tree_model_get (model, iter, column, &iter_string, -1); - return ! g_strrstr (g_utf8_strdown(iter_string, -1), - g_utf8_strdown(key, -1)) != NULL; + return ! (g_strrstr (g_utf8_strdown(iter_string, -1), + g_utf8_strdown(key, -1)) != NULL); + } static void -- cgit