[gnome-panel/wip/segeiger/reload] panel-applet-frame.c: Add delete button in reload applet dialog



commit 27ca9682c557e21f43b698f3975c63de656ada28
Author: Sebastian Geiger <sbastig gmx net>
Date:   Sun Aug 23 01:33:01 2015 +0200

    panel-applet-frame.c: Add delete button in reload applet dialog
    
    The "Don't reload" button will no longer delete the applet.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=569216

 gnome-panel/panel-applet-frame.c |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)
---
diff --git a/gnome-panel/panel-applet-frame.c b/gnome-panel/panel-applet-frame.c
index 948d77c..7de3ce9 100644
--- a/gnome-panel/panel-applet-frame.c
+++ b/gnome-panel/panel-applet-frame.c
@@ -46,6 +46,10 @@
 
 #include "panel-applet-frame.h"
 
+#define PANEL_RESPONSE_DELETE      0
+#define PANEL_RESPONSE_DONT_RELOAD 1
+#define PANEL_RESPONSE_RELOAD      2
+
 static void panel_applet_frame_activating_free (PanelAppletFrameActivating *frame_act);
 
 static void panel_applet_frame_loading_failed  (const char  *iid,
@@ -659,7 +663,7 @@ panel_applet_frame_reload_response (GtkWidget        *dialog,
 
        info = frame->priv->applet_info;
 
-       if (response == GTK_RESPONSE_YES) {
+       if (response == PANEL_RESPONSE_RELOAD) {
                PanelWidget *panel;
                char        *iid;
                char        *id = NULL;
@@ -686,7 +690,7 @@ panel_applet_frame_reload_response (GtkWidget        *dialog,
                /* if we can't write to applets list we can't really delete
                   it, so we'll just ignore this.  FIXME: handle this
                   more correctly I suppose. */
-               if (panel_layout_is_writable ())
+               if (panel_layout_is_writable () && response == PANEL_RESPONSE_DELETE)
                        panel_layout_delete_object (panel_applet_get_id (info));
        }
 
@@ -724,18 +728,26 @@ _panel_applet_frame_applet_broken (PanelAppletFrame *frame)
                                         dialog_txt, applet_name ? applet_name : NULL);
 
        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                                                 _("If you reload a panel object, it will automatically "
-                                                   "be added back to the panel."));
+                                                                                         _("If you reload a 
panel object, it will automatically "
+                                                                                                             
  "be added back to the panel."));
 
        gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
 
-       gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-                               _("_Don't Reload"), GTK_RESPONSE_NO,
-                               _("_Reload"), GTK_RESPONSE_YES,
-                               NULL);
+       if (panel_layout_is_writable ()) {
+               gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+                                       _("D_elete"), PANEL_RESPONSE_DELETE,
+                                       _("_Don't Reload"), PANEL_RESPONSE_DONT_RELOAD,
+                                       _("_Reload"), PANEL_RESPONSE_RELOAD,
+                                       NULL);
+       } else {
+               gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+                                       _("_Don't Reload"), PANEL_RESPONSE_DONT_RELOAD,
+                                       _("_Reload"), PANEL_RESPONSE_RELOAD,
+                                       NULL);
+       }
 
        gtk_dialog_set_default_response (GTK_DIALOG (dialog),
-                                        GTK_RESPONSE_YES);
+                                        PANEL_RESPONSE_RELOAD);
 
        gtk_window_set_screen (GTK_WINDOW (dialog), screen);
 


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