[gnome-panel/wip/muktupavels/shutdown-applet: 2/2] action-button: turn shutdown object into applet



commit bccbc435d80120096758834f9c30b4dc18040d00
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Apr 16 23:47:26 2020 +0300

    action-button: turn shutdown object into applet

 gnome-panel/libpanel-util/Makefile.am              |   2 -
 gnome-panel/libpanel-util/panel-session-manager.c  | 153 ------------
 gnome-panel/libpanel-util/panel-session-manager.h  |  62 -----
 gnome-panel/panel-action-button.c                  |  33 ---
 gnome-panel/panel-enums.h                          |   1 -
 gnome-panel/panel-icon-names.h                     |   1 -
 gnome-panel/panel-object-loader.c                  |   1 +
 modules/action-button/Makefile.am                  |   2 +
 modules/action-button/gp-action-button-module.c    |  13 +
 modules/action-button/gp-shutdown-applet.c         | 272 +++++++++++++++++++++
 modules/action-button/gp-shutdown-applet.h         |  34 +++
 modules/action-button/org.gnome.SessionManager.xml |   6 +
 modules/menu/gp-lock-logout.c                      |  74 ++----
 po/POTFILES.in                                     |   1 +
 14 files changed, 353 insertions(+), 302 deletions(-)
---
diff --git a/gnome-panel/libpanel-util/Makefile.am b/gnome-panel/libpanel-util/Makefile.am
index 3faeea3f1..032b0cd29 100644
--- a/gnome-panel/libpanel-util/Makefile.am
+++ b/gnome-panel/libpanel-util/Makefile.am
@@ -23,8 +23,6 @@ libpanel_util_la_SOURCES =            \
        panel-gsettings.h               \
        panel-keyfile.c                 \
        panel-keyfile.h                 \
-       panel-session-manager.c         \
-       panel-session-manager.h         \
        panel-show.c                    \
        panel-show.h                    \
        panel-xdg.c                     \
diff --git a/gnome-panel/panel-action-button.c b/gnome-panel/panel-action-button.c
index cfdc3f9bf..eb128820c 100644
--- a/gnome-panel/panel-action-button.c
+++ b/gnome-panel/panel-action-button.c
@@ -32,7 +32,6 @@
 
 #include <libpanel-util/panel-error.h>
 #include <libpanel-util/panel-glib.h>
-#include <libpanel-util/panel-session-manager.h>
 #include <libpanel-util/panel-show.h>
 
 #include "applet.h"
@@ -66,7 +65,6 @@ static PanelEnumStringPair panel_action_type_map [] = {
        { PANEL_ACTION_NONE,           "none"           },
        { PANEL_ACTION_RUN,            "run"            },
        { PANEL_ACTION_FORCE_QUIT,     "force-quit"     },
-       { PANEL_ACTION_SHUTDOWN,       "shutdown"       },
        { 0,                           NULL             },
 };
 
@@ -99,28 +97,6 @@ panel_enum_to_string (gint enum_value)
        return NULL;
 }
 
-static void
-panel_action_shutdown (GtkWidget *widget)
-{
-       PanelSessionManager *manager;
-
-       manager = panel_session_manager_get ();
-       panel_session_manager_request_shutdown (manager);
-}
-
-static gboolean
-panel_action_shutdown_reboot_is_disabled (void)
-{
-       PanelSessionManager *manager;
-
-       if (panel_lockdown_get_disable_log_out_s ())
-               return TRUE;
-
-       manager = panel_session_manager_get ();
-
-       return (!panel_session_manager_is_shutdown_available (manager));
-}
-
 /* Run Application
  */
 static void
@@ -174,15 +150,6 @@ static PanelAction actions [] = {
                "ACTION:force-quit:NEW",
                panel_action_force_quit,
                panel_lockdown_get_disable_force_quit_s
-       },
-       {
-               PANEL_ACTION_SHUTDOWN,
-               PANEL_ICON_SHUTDOWN,
-               N_("Power Off"),
-               N_("Power off the computer"),
-               "ACTION:shutdown:NEW",
-               panel_action_shutdown,
-               panel_action_shutdown_reboot_is_disabled
        }
 };
 
diff --git a/gnome-panel/panel-enums.h b/gnome-panel/panel-enums.h
index 8ebc1dea7..412ec221f 100644
--- a/gnome-panel/panel-enums.h
+++ b/gnome-panel/panel-enums.h
@@ -40,7 +40,6 @@ typedef enum {
         PANEL_ACTION_NONE = 0,
         PANEL_ACTION_RUN,
        PANEL_ACTION_FORCE_QUIT,
-       PANEL_ACTION_SHUTDOWN,
         PANEL_ACTION_LAST
 } PanelActionButtonType;
 
diff --git a/gnome-panel/panel-icon-names.h b/gnome-panel/panel-icon-names.h
index 5bdb8827e..7481598b9 100644
--- a/gnome-panel/panel-icon-names.h
+++ b/gnome-panel/panel-icon-names.h
@@ -20,7 +20,6 @@
 #define PANEL_ICON_PANEL               "gnome-panel"
 #define PANEL_ICON_REMOTE              "applications-internet"
 #define PANEL_ICON_RUN                 "system-run"
-#define PANEL_ICON_SHUTDOWN            "system-shutdown"
 #define PANEL_ICON_UNKNOWN             "image-missing"
 
 #endif /* PANEL_ICON_NAMES_H */
diff --git a/gnome-panel/panel-object-loader.c b/gnome-panel/panel-object-loader.c
index 067705bad..cfb82bd1b 100644
--- a/gnome-panel/panel-object-loader.c
+++ b/gnome-panel/panel-object-loader.c
@@ -425,6 +425,7 @@ panel_object_iid_to_type (const char       *iid,
                                 return FALSE;
 
                         if (g_strcmp0 (d, "lock") == 0 ||
+                            g_strcmp0 (d, "shutdown") == 0 ||
                             g_strcmp0 (d, "logout") == 0) {
                                 *type = PANEL_OBJECT_APPLET;
                                 return TRUE;
diff --git a/modules/action-button/Makefile.am b/modules/action-button/Makefile.am
index c510b20b3..308481706 100644
--- a/modules/action-button/Makefile.am
+++ b/modules/action-button/Makefile.am
@@ -28,6 +28,8 @@ org_gnome_gnome_panel_action_button_la_SOURCES = \
        gp-lock-screen-applet.h \
        gp-logout-applet.c \
        gp-logout-applet.h \
+       gp-shutdown-applet.c \
+       gp-shutdown-applet.h \
        $(BUILT_SOURCES) \
        $(NULL)
 
diff --git a/modules/action-button/gp-action-button-module.c b/modules/action-button/gp-action-button-module.c
index f8cda4019..6fd47277c 100644
--- a/modules/action-button/gp-action-button-module.c
+++ b/modules/action-button/gp-action-button-module.c
@@ -22,6 +22,7 @@
 
 #include "gp-lock-screen-applet.h"
 #include "gp-logout-applet.h"
+#include "gp-shutdown-applet.h"
 
 static GpAppletInfo *
 action_button_get_applet_info (const char *id)
@@ -53,6 +54,15 @@ action_button_get_applet_info (const char *id)
 
       is_disabled_func = gp_logout_applet_is_disabled;
     }
+  else if (g_strcmp0 (id, "shutdown") == 0)
+    {
+      type_func = gp_shutdown_applet_get_type;
+      name = _("Power Off");
+      description = _("Power off the computer");
+      icon = "system-shutdown";
+
+      is_disabled_func = gp_shutdown_applet_is_disabled;
+    }
   else
     {
       g_assert_not_reached ();
@@ -74,6 +84,8 @@ action_button_get_applet_id_from_iid (const char *iid)
     return "lock-screen";
   else if (g_strcmp0 (iid, "PanelInternalFactory::ActionButton:logout") == 0)
     return "logout";
+  else if (g_strcmp0 (iid, "PanelInternalFactory::ActionButton:shutdown") == 0)
+    return "shutdown";
 
   return NULL;
 }
@@ -93,6 +105,7 @@ gp_module_load (GpModule *module)
   gp_module_set_applet_ids (module,
                             "lock-screen",
                             "logout",
+                            "shutdown",
                             NULL);
 
   gp_module_set_get_applet_info (module, action_button_get_applet_info);
diff --git a/modules/action-button/gp-shutdown-applet.c b/modules/action-button/gp-shutdown-applet.c
new file mode 100644
index 000000000..6ee0c2b14
--- /dev/null
+++ b/modules/action-button/gp-shutdown-applet.c
@@ -0,0 +1,272 @@
+/*
+ * Copyright (C) 2020 Alberts Muktupāvels
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+#include "gp-shutdown-applet.h"
+
+#include <glib/gi18n-lib.h>
+
+#include "gpab-session-manager-gen.h"
+
+struct _GpShutdownApplet
+{
+  GpActionButtonApplet   parent;
+
+  GpabSessionManagerGen *session_manager;
+
+  gboolean               can_shutdown;
+};
+
+G_DEFINE_TYPE (GpShutdownApplet, gp_shutdown_applet, GP_TYPE_ACTION_BUTTON_APPLET)
+
+static void
+lockdown_changed (GpShutdownApplet *self)
+{
+  GpLockdownFlags lockdowns;
+  gboolean applet_sensitive;
+
+  lockdowns = gp_applet_get_lockdowns (GP_APPLET (self));
+
+  applet_sensitive = TRUE;
+
+  if ((lockdowns & GP_LOCKDOWN_FLAGS_APPLET) == GP_LOCKDOWN_FLAGS_APPLET ||
+      (lockdowns & GP_LOCKDOWN_FLAGS_LOG_OUT) == GP_LOCKDOWN_FLAGS_LOG_OUT ||
+      !self->can_shutdown)
+    applet_sensitive = FALSE;
+
+  gtk_widget_set_sensitive (GTK_WIDGET (self), applet_sensitive);
+}
+
+static void
+lockdowns_cb (GpApplet         *applet,
+              GParamSpec       *pspec,
+              GpShutdownApplet *self)
+{
+  lockdown_changed (self);
+}
+
+static void
+setup_applet (GpShutdownApplet *self)
+{
+  const char *text;
+  AtkObject *atk;
+
+  gp_action_button_applet_set_icon_name (GP_ACTION_BUTTON_APPLET (self),
+                                         "system-shutdown");
+
+  text = _("Power off the computer");
+
+  atk = gtk_widget_get_accessible (GTK_WIDGET (self));
+  atk_object_set_name (atk, text);
+  atk_object_set_description (atk, text);
+
+  gtk_widget_set_tooltip_text (GTK_WIDGET (self), text);
+
+  g_object_bind_property (self,
+                          "enable-tooltips",
+                          self,
+                          "has-tooltip",
+                          G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
+
+  lockdown_changed (self);
+}
+
+static void
+can_shutdown_cb (GObject      *source,
+                 GAsyncResult *res,
+                 gpointer      user_data)
+{
+  gboolean can_shutdown;
+  GError *error;
+  GpShutdownApplet *self;
+
+  can_shutdown = FALSE;
+  error = NULL;
+
+  gpab_session_manager_gen_call_can_shutdown_finish (GPAB_SESSION_MANAGER_GEN (source),
+                                                     &can_shutdown,
+                                                     res,
+                                                     &error);
+
+  if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+    {
+      g_error_free (error);
+      return;
+    }
+
+  self = GP_SHUTDOWN_APPLET (user_data);
+  self->can_shutdown = can_shutdown;
+
+  if (error)
+    {
+      g_warning ("%s", error->message);
+      g_error_free (error);
+
+      return;
+    }
+
+  lockdown_changed (self);
+}
+
+static void
+session_manager_ready_cb (GObject      *source,
+                          GAsyncResult *res,
+                          gpointer      user_data)
+{
+  GError *error;
+  GpabSessionManagerGen *session_manager;
+  GpShutdownApplet *self;
+
+  error = NULL;
+  session_manager = gpab_session_manager_gen_proxy_new_for_bus_finish (res,
+                                                                       &error);
+
+  if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+    {
+      g_error_free (error);
+      return;
+    }
+
+  self = GP_SHUTDOWN_APPLET (user_data);
+  self->session_manager = session_manager;
+
+  if (error)
+    {
+      g_warning ("%s", error->message);
+      g_error_free (error);
+
+      return;
+    }
+
+  gpab_session_manager_gen_call_can_shutdown (self->session_manager,
+                                              NULL,
+                                              can_shutdown_cb,
+                                              self);
+}
+
+static void
+gp_shutdown_applet_constructed (GObject *object)
+{
+  G_OBJECT_CLASS (gp_shutdown_applet_parent_class)->constructed (object);
+  setup_applet (GP_SHUTDOWN_APPLET (object));
+}
+
+static void
+gp_shutdown_applet_dispose (GObject *object)
+{
+  GpShutdownApplet *self;
+
+  self = GP_SHUTDOWN_APPLET (object);
+
+  g_clear_object (&self->session_manager);
+
+  G_OBJECT_CLASS (gp_shutdown_applet_parent_class)->dispose (object);
+}
+
+static void
+shutdown_cb (GObject      *source,
+             GAsyncResult *res,
+             gpointer      user_data)
+{
+  GError *error;
+
+  error = NULL;
+  gpab_session_manager_gen_call_shutdown_finish (GPAB_SESSION_MANAGER_GEN (source),
+                                                 res,
+                                                 &error);
+
+  if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+    {
+      g_error_free (error);
+      return;
+    }
+
+  if (error)
+    {
+      g_warning ("Could not ask session manager to shut down: %s",
+                 error->message);
+
+      g_error_free (error);
+      return;
+    }
+}
+
+static void
+gp_shutdown_applet_clicked (GpActionButtonApplet *applet)
+{
+  GpShutdownApplet *self;
+
+  self = GP_SHUTDOWN_APPLET (applet);
+
+  if (!self->session_manager)
+    {
+      g_warning ("Session manager service not available.");
+      return;
+    }
+
+  gpab_session_manager_gen_call_shutdown (self->session_manager,
+                                          NULL,
+                                          shutdown_cb,
+                                          self);
+}
+
+static void
+gp_shutdown_applet_class_init (GpShutdownAppletClass *self_class)
+{
+  GObjectClass *object_class;
+  GpActionButtonAppletClass *action_button_applet_class;
+
+  object_class = G_OBJECT_CLASS (self_class);
+  action_button_applet_class = GP_ACTION_BUTTON_APPLET_CLASS (self_class);
+
+  object_class->constructed = gp_shutdown_applet_constructed;
+  object_class->dispose = gp_shutdown_applet_dispose;
+
+  action_button_applet_class->clicked = gp_shutdown_applet_clicked;
+}
+
+static void
+gp_shutdown_applet_init (GpShutdownApplet *self)
+{
+  gpab_session_manager_gen_proxy_new_for_bus (G_BUS_TYPE_SESSION,
+                                              G_DBUS_PROXY_FLAGS_NONE,
+                                              "org.gnome.SessionManager",
+                                              "/org/gnome/SessionManager",
+                                              NULL,
+                                              session_manager_ready_cb,
+                                              self);
+
+  g_signal_connect (self,
+                    "notify::lockdowns",
+                    G_CALLBACK (lockdowns_cb),
+                    self);
+}
+
+gboolean
+gp_shutdown_applet_is_disabled (GpLockdownFlags   flags,
+                                char            **reason)
+{
+  if ((flags & GP_LOCKDOWN_FLAGS_LOG_OUT) != GP_LOCKDOWN_FLAGS_LOG_OUT)
+    return FALSE;
+
+  if (reason != NULL)
+    *reason = g_strdup (_("Disabled because “disable-log-out” setting in "
+                          "“org.gnome.desktop.lockdown” GSettings schema is "
+                          "set to true."));
+
+  return TRUE;
+}
diff --git a/modules/action-button/gp-shutdown-applet.h b/modules/action-button/gp-shutdown-applet.h
new file mode 100644
index 000000000..e4b96b612
--- /dev/null
+++ b/modules/action-button/gp-shutdown-applet.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2020 Alberts Muktupāvels
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GP_SHUTDOWN_APPLET_H
+#define GP_SHUTDOWN_APPLET_H
+
+#include "gp-action-button-applet.h"
+
+G_BEGIN_DECLS
+
+#define GP_TYPE_SHUTDOWN_APPLET (gp_shutdown_applet_get_type ())
+G_DECLARE_FINAL_TYPE (GpShutdownApplet, gp_shutdown_applet,
+                      GP, SHUTDOWN_APPLET, GpActionButtonApplet)
+
+gboolean gp_shutdown_applet_is_disabled (GpLockdownFlags   flags,
+                                         char            **reason);
+
+G_END_DECLS
+
+#endif
diff --git a/modules/action-button/org.gnome.SessionManager.xml 
b/modules/action-button/org.gnome.SessionManager.xml
index e4c8ba0a1..c147a42d9 100644
--- a/modules/action-button/org.gnome.SessionManager.xml
+++ b/modules/action-button/org.gnome.SessionManager.xml
@@ -5,6 +5,12 @@
   <interface name="org.gnome.SessionManager">
     <annotation name="org.gtk.GDBus.C.Name" value="SessionManagerGen" />
 
+    <method name="Shutdown" />
+
+    <method name="CanShutdown">
+      <arg name="is_available" direction="out" type="b" />
+    </method>
+
     <method name="Logout">
       <arg name="mode" type="u" direction="in" />
     </method>
diff --git a/modules/menu/gp-lock-logout.c b/modules/menu/gp-lock-logout.c
index 8b07db464..4b8bb9d3a 100644
--- a/modules/menu/gp-lock-logout.c
+++ b/modules/menu/gp-lock-logout.c
@@ -683,8 +683,7 @@ static GtkWidget *
 create_menu_item (GpLockLogout *lock_logout,
                   const gchar  *icon_name,
                   const gchar  *label,
-                  const gchar  *tooltip,
-                  const gchar  *drag_id)
+                  const gchar  *tooltip)
 {
   GtkWidget *image;
   GtkWidget *item;
@@ -706,27 +705,6 @@ create_menu_item (GpLockLogout *lock_logout,
                               G_BINDING_SYNC_CREATE);
     }
 
-  if (drag_id != NULL && !lock_logout->locked_down)
-    {
-      static const GtkTargetEntry drag_targets[] =
-        {
-          { (gchar *) "application/x-panel-applet-internal", 0, 0 }
-        };
-
-      gtk_drag_source_set (item, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
-                           drag_targets, G_N_ELEMENTS (drag_targets),
-                           GDK_ACTION_COPY);
-
-      if (icon_name != NULL)
-        gtk_drag_source_set_icon_name (item, icon_name);
-
-      g_signal_connect_data (item, "drag-data-get",
-                             G_CALLBACK (drag_data_get_cb),
-                             g_strdup (drag_id),
-                             (GClosureNotify) free_drag_id,
-                             0);
-    }
-
   return item;
 }
 
@@ -968,7 +946,6 @@ gp_lock_logout_append_to_menu (GpLockLogout *lock_logout,
   gboolean disable_log_out;
   const gchar *label;
   const gchar *tooltip;
-  const gchar *drag_id;
   GtkWidget *switch_user;
   GtkWidget *logout;
   GtkWidget *lock_screen;
@@ -994,12 +971,11 @@ gp_lock_logout_append_to_menu (GpLockLogout *lock_logout,
     {
       label = _("Switch User");
       tooltip = NULL;
-      drag_id = NULL;
 
       switch_user = create_menu_item (lock_logout,
                                       "system-users",
-                                      label, tooltip,
-                                      drag_id);
+                                      label,
+                                      tooltip);
 
       g_signal_connect (switch_user, "activate",
                         G_CALLBACK (switch_user_activate_cb),
@@ -1011,17 +987,16 @@ gp_lock_logout_append_to_menu (GpLockLogout *lock_logout,
     {
       label = _("Log Out");
       tooltip = _("Log out of this session to log in as a different user");
-      drag_id = "org.gnome.gnome-panel.action-button::logout";
 
       logout = create_menu_item (lock_logout,
                                  "system-log-out",
-                                 label, tooltip,
-                                 NULL);
+                                 label,
+                                 tooltip);
 
       setup_drag_source (lock_logout,
                          logout,
                          "system-log-out",
-                         drag_id);
+                         "org.gnome.gnome-panel.action-button::logout");
 
       g_signal_connect (logout, "activate",
                         G_CALLBACK (logout_activate_cb),
@@ -1033,17 +1008,16 @@ gp_lock_logout_append_to_menu (GpLockLogout *lock_logout,
     {
       label = _("Lock Screen");
       tooltip = _("Protect your computer from unauthorized use");
-      drag_id = "org.gnome.gnome-panel.action-button::lock-screen";
 
       lock_screen = create_menu_item (lock_logout,
                                       "system-lock-screen",
-                                      label, tooltip,
-                                      NULL);
+                                      label,
+                                      tooltip);
 
       setup_drag_source (lock_logout,
                          lock_screen,
                          "system-lock-screen",
-                         drag_id);
+                         "org.gnome.gnome-panel.action-button::lock-screen");
 
       g_signal_connect (lock_screen, "activate",
                         G_CALLBACK (lock_screen_activate_cb),
@@ -1080,12 +1054,11 @@ gp_lock_logout_append_to_menu (GpLockLogout *lock_logout,
     {
       label = _("Hibernate");
       tooltip = NULL;
-      drag_id = NULL;
 
       hibernate = create_menu_item (lock_logout,
                                     "gnome-panel-hibernate",
-                                    label, tooltip,
-                                    drag_id);
+                                    label,
+                                    tooltip);
 
       g_signal_connect (hibernate, "activate",
                         G_CALLBACK (hibernate_activate_cb),
@@ -1097,12 +1070,11 @@ gp_lock_logout_append_to_menu (GpLockLogout *lock_logout,
     {
       label = _("Suspend");
       tooltip = NULL;
-      drag_id = NULL;
 
       suspend = create_menu_item (lock_logout,
                                   "gnome-panel-suspend",
-                                  label, tooltip,
-                                  drag_id);
+                                  label,
+                                  tooltip);
 
       g_signal_connect (suspend, "activate",
                         G_CALLBACK (suspend_activate_cb),
@@ -1114,12 +1086,11 @@ gp_lock_logout_append_to_menu (GpLockLogout *lock_logout,
     {
       label = _("Hybrid Sleep");
       tooltip = NULL;
-      drag_id = NULL;
 
       hybrid_sleep = create_menu_item (lock_logout,
                                        "gnome-panel-suspend",
-                                       label, tooltip,
-                                       drag_id);
+                                       label,
+                                       tooltip);
 
       g_signal_connect (hybrid_sleep, "activate",
                         G_CALLBACK (hybrid_sleep_activate_cb),
@@ -1133,12 +1104,11 @@ gp_lock_logout_append_to_menu (GpLockLogout *lock_logout,
     {
       label = _("Restart");
       tooltip = _("Restart the computer");
-      drag_id = NULL;
 
       reboot = create_menu_item (lock_logout,
                                  "view-refresh",
-                                 label, tooltip,
-                                 drag_id);
+                                 label,
+                                 tooltip);
 
       g_signal_connect (reboot, "activate",
                         G_CALLBACK (reboot_activate_cb),
@@ -1150,12 +1120,16 @@ gp_lock_logout_append_to_menu (GpLockLogout *lock_logout,
     {
       label = _("Power Off");
       tooltip = _("Power off the computer");
-      drag_id = "ACTION:shutdown:NEW";
 
       shutdown = create_menu_item (lock_logout,
                                    "system-shutdown",
-                                   label, tooltip,
-                                   drag_id);
+                                   label,
+                                   tooltip);
+
+      setup_drag_source (lock_logout,
+                         shutdown,
+                         "system-shutdown",
+                         "org.gnome.gnome-panel.action-button::shutdown");
 
       g_signal_connect (shutdown, "activate",
                         G_CALLBACK (shutdown_activate_cb),
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1445f865b..36e3b0525 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -35,6 +35,7 @@ modules/action-button/gp-action-button-module.c
 modules/action-button/gp-lock-screen-applet.c
 modules/action-button/gp-lock-screen-menu.ui
 modules/action-button/gp-logout-applet.c
+modules/action-button/gp-shutdown-applet.c
 modules/clock/calendar-client.c
 modules/clock/calendar-window.c
 modules/clock/clock-applet.c


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