[gedit] Do not use stock items in the filebrowser confirmation dialogs



commit 9f45222396ae981aa98680f6b94e4f870b0f7dcc
Author: Paolo Borelli <pborelli gnome org>
Date:   Wed Feb 5 18:25:35 2014 +0100

    Do not use stock items in the filebrowser confirmation dialogs

 plugins/filebrowser/gedit-file-browser-plugin.c |    6 +---
 plugins/filebrowser/gedit-file-browser-utils.c  |   34 ++++-------------------
 plugins/filebrowser/gedit-file-browser-utils.h  |    1 -
 3 files changed, 8 insertions(+), 33 deletions(-)
---
diff --git a/plugins/filebrowser/gedit-file-browser-plugin.c b/plugins/filebrowser/gedit-file-browser-plugin.c
index d4265cd..d8763e0 100644
--- a/plugins/filebrowser/gedit-file-browser-plugin.c
+++ b/plugins/filebrowser/gedit-file-browser-plugin.c
@@ -919,8 +919,7 @@ on_confirm_no_trash_cb (GeditFileBrowserWidget *widget,
                                                               GTK_MESSAGE_QUESTION,
                                                               message,
                                                               secondary,
-                                                              GTK_STOCK_DELETE,
-                                                              NULL);
+                                                              _("_Delete"));
        g_free (secondary);
 
        return result;
@@ -958,8 +957,7 @@ on_confirm_delete_cb (GeditFileBrowserWidget *widget,
                                                               GTK_MESSAGE_QUESTION,
                                                               message,
                                                               secondary,
-                                                              GTK_STOCK_DELETE,
-                                                              NULL);
+                                                              _("_Delete"));
 
        g_free (message);
 
diff --git a/plugins/filebrowser/gedit-file-browser-utils.c b/plugins/filebrowser/gedit-file-browser-utils.c
index 80b3764..015febb 100644
--- a/plugins/filebrowser/gedit-file-browser-utils.c
+++ b/plugins/filebrowser/gedit-file-browser-utils.c
@@ -149,12 +149,10 @@ gedit_file_browser_utils_confirmation_dialog (GeditWindow    *window,
                                               GtkMessageType  type,
                                               gchar const    *message,
                                              gchar const    *secondary,
-                                             gchar const    *button_stock,
                                              gchar const    *button_label)
 {
        GtkWidget *dlg;
        gint ret;
-       GtkWidget *button;
 
        dlg = gtk_message_dialog_new (GTK_WINDOW (window),
                                      GTK_DIALOG_MODAL |
@@ -168,37 +166,17 @@ gedit_file_browser_utils_confirmation_dialog (GeditWindow    *window,
                    (GTK_MESSAGE_DIALOG (dlg), "%s", secondary);
        }
 
-       /* Add a cancel button */
-       button = gtk_button_new_with_mnemonic (_("_Cancel"));
-       gtk_widget_show (button);
+       gtk_dialog_add_buttons (GTK_DIALOG (dlg),
+                               _("_Cancel"), GTK_RESPONSE_CANCEL,
+                               button_label, GTK_RESPONSE_OK,
+                               NULL);
 
-       gtk_widget_set_can_default (button, TRUE);
-       gtk_dialog_add_action_widget (GTK_DIALOG (dlg),
-                                     button,
-                                     GTK_RESPONSE_CANCEL);
-
-       /* Add custom button */
-       G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-       button = gtk_button_new_from_stock (button_stock);
-       G_GNUC_END_IGNORE_DEPRECATIONS;
-
-       if (button_label)
-       {
-               G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-               gtk_button_set_use_stock (GTK_BUTTON (button), FALSE);
-               G_GNUC_END_IGNORE_DEPRECATIONS;
-               gtk_button_set_label (GTK_BUTTON (button), button_label);
-       }
-
-       gtk_widget_show (button);
-       gtk_widget_set_can_default (button, TRUE);
-       gtk_dialog_add_action_widget (GTK_DIALOG (dlg),
-                                      button,
-                                      GTK_RESPONSE_OK);
+       gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_CANCEL);
 
        ret = gtk_dialog_run (GTK_DIALOG (dlg));
        gtk_widget_destroy (dlg);
 
        return (ret == GTK_RESPONSE_OK);
 }
+
 /* ex:ts=8:noet: */
diff --git a/plugins/filebrowser/gedit-file-browser-utils.h b/plugins/filebrowser/gedit-file-browser-utils.h
index ab6750e..b2da8f6 100644
--- a/plugins/filebrowser/gedit-file-browser-utils.h
+++ b/plugins/filebrowser/gedit-file-browser-utils.h
@@ -39,7 +39,6 @@ gboolean       gedit_file_browser_utils_confirmation_dialog   (GeditWindow    *window,
                                                                 GtkMessageType  type,
                                                                 gchar const    *message,
                                                                 gchar const    *secondary,
-                                                                gchar const    *button_stock,
                                                                 gchar const    *button_label);
 
 #endif /* __GEDIT_FILE_BROWSER_UTILS_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]