summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2015-12-03 17:49:44 +0300
committermonsta <[email protected]>2015-12-03 17:49:44 +0300
commitde92b6a96f46f5ef57976d28e592c499472d24b1 (patch)
treea06a1e3190753cef249256b47506418dd9ae5ec8
parent7fccfc47d28706e51fd8282bc30a3899d3e7cdcd (diff)
downloadmate-panel-de92b6a96f46f5ef57976d28e592c499472d24b1.tar.bz2
mate-panel-de92b6a96f46f5ef57976d28e592c499472d24b1.tar.xz
Add separate "Delete" button in reload applet dialog
and the "Don't reload" button will no longer delete the applet adapted from https://git.gnome.org/browse/gnome-panel/commit/?id=2a1faa93b8cdb12a8c0ff9d4fc870216a55fb5e0
-rw-r--r--mate-panel/mate-panel-applet-frame.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/mate-panel/mate-panel-applet-frame.c b/mate-panel/mate-panel-applet-frame.c
index dda1290e..ab301838 100644
--- a/mate-panel/mate-panel-applet-frame.c
+++ b/mate-panel/mate-panel-applet-frame.c
@@ -46,6 +46,10 @@
#include "mate-panel-applet-frame.h"
+#define PANEL_RESPONSE_DELETE 0
+#define PANEL_RESPONSE_DONT_RELOAD 1
+#define PANEL_RESPONSE_RELOAD 2
+
static void mate_panel_applet_frame_activating_free (MatePanelAppletFrameActivating *frame_act);
static void mate_panel_applet_frame_loading_failed (const char *iid,
@@ -816,7 +820,7 @@ mate_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;
@@ -839,11 +843,11 @@ mate_panel_applet_frame_reload_response (GtkWidget *dialog,
g_free (iid);
g_free (id);
- } else if (info) {
+ } else if (response == PANEL_RESPONSE_DELETE) {
/* 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_profile_id_lists_are_writable ())
+ if (panel_profile_id_lists_are_writable () && info)
panel_profile_delete_object (info);
}
@@ -886,13 +890,21 @@ _mate_panel_applet_frame_applet_broken (MatePanelAppletFrame *frame)
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_profile_id_lists_are_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);