[gnome-panel] menu: move append_separator_if_needed to utils file



commit a006f1ff09429e77ac7b9f7edf9001061765c56b
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Wed Sep 12 00:22:31 2018 +0300

    menu: move append_separator_if_needed to utils file

 modules/menu/gp-lock-logout.c | 29 +----------------------------
 modules/menu/gp-menu-utils.c  | 28 ++++++++++++++++++++++++++++
 modules/menu/gp-menu-utils.h  |  2 ++
 3 files changed, 31 insertions(+), 28 deletions(-)
---
diff --git a/modules/menu/gp-lock-logout.c b/modules/menu/gp-lock-logout.c
index 2e448098b..bf0465bcd 100644
--- a/modules/menu/gp-lock-logout.c
+++ b/modules/menu/gp-lock-logout.c
@@ -20,6 +20,7 @@
 
 #include "gp-dm-seat-gen.h"
 #include "gp-login1-manager-gen.h"
+#include "gp-menu-utils.h"
 #include "gp-screensaver-gen.h"
 #include "gp-session-manager-gen.h"
 
@@ -727,34 +728,6 @@ create_menu_item (GpApplet    *applet,
   return item;
 }
 
-static void
-append_separator_if_needed (GtkMenu *menu)
-{
-  GList *children;
-  GList *last;
-  GtkWidget *item;
-
-  children = gtk_container_get_children (GTK_CONTAINER (menu));
-  last = g_list_last (children);
-
-  if (last == NULL)
-    return;
-
-  if (GTK_IS_SEPARATOR_MENU_ITEM (last->data))
-    {
-      g_list_free (children);
-      return;
-    }
-
-  g_list_free (children);
-
-  item = gtk_separator_menu_item_new ();
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-  gtk_widget_show (item);
-
-  gtk_widget_set_sensitive (item, FALSE);
-}
-
 static void
 gp_lock_logout_constructed (GObject *object)
 {
diff --git a/modules/menu/gp-menu-utils.c b/modules/menu/gp-menu-utils.c
index d7747f4ca..ef21778e8 100644
--- a/modules/menu/gp-menu-utils.c
+++ b/modules/menu/gp-menu-utils.c
@@ -476,3 +476,31 @@ gp_menu_utils_get_user_name (void)
 
   return user_name;
 }
+
+void
+append_separator_if_needed (GtkMenu *menu)
+{
+  GList *children;
+  GList *last;
+  GtkWidget *item;
+
+  children = gtk_container_get_children (GTK_CONTAINER (menu));
+  last = g_list_last (children);
+
+  if (last == NULL)
+    return;
+
+  if (GTK_IS_SEPARATOR_MENU_ITEM (last->data))
+    {
+      g_list_free (children);
+      return;
+    }
+
+  g_list_free (children);
+
+  item = gtk_separator_menu_item_new ();
+  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+  gtk_widget_show (item);
+
+  gtk_widget_set_sensitive (item, FALSE);
+}
diff --git a/modules/menu/gp-menu-utils.h b/modules/menu/gp-menu-utils.h
index 65fdb6298..2fd03cd3c 100644
--- a/modules/menu/gp-menu-utils.h
+++ b/modules/menu/gp-menu-utils.h
@@ -39,6 +39,8 @@ void   gp_menu_utils_show_error_dialog  (const gchar     *message,
 
 gchar *gp_menu_utils_get_user_name      (void);
 
+void   append_separator_if_needed       (GtkMenu         *menu);
+
 G_END_DECLS
 
 #endif


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