[gnome-panel/wip/status-notifier: 12/14] snh: sn_item_client_get_menu now returns GtkMenu



commit 59645d68c4437b652b7ebc4d7d8dd43bfd425cc1
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Jul 20 18:22:41 2015 +0300

    snh: sn_item_client_get_menu now returns GtkMenu

 applets/snh/snh-item.c |   59 ++++++++++++++++++------------------------------
 configure.ac           |    2 +-
 2 files changed, 23 insertions(+), 38 deletions(-)
---
diff --git a/applets/snh/snh-item.c b/applets/snh/snh-item.c
index 3a9206c..be5cd48 100644
--- a/applets/snh/snh-item.c
+++ b/applets/snh/snh-item.c
@@ -17,8 +17,6 @@
 
 #include "config.h"
 
-#include <libdbusmenu-gtk/menu.h>
-
 #include "snh-item.h"
 
 #define UPDATE_TIMEOUT 10
@@ -26,33 +24,31 @@
 
 struct _SnhItem
 {
-  GtkEventBox      parent;
-
-  SnItemClient    *item;
+  GtkEventBox     parent;
 
-  GtkOrientation   orientation;
-  gint             size;
+  SnItemClient   *item;
 
-  guint            update_id;
-  guint            update_icons_id;
+  GtkOrientation  orientation;
+  gint            size;
 
-  gchar           *title;
-  gchar           *tooltip_title;
-  gchar           *tooltip_text;
-  gchar           *icon_theme_path;
+  guint           update_id;
+  guint           update_icons_id;
 
-  GdkPixbuf       *icon;
-  GdkPixbuf       *overlay_icon;
-  GdkPixbuf       *attention_icon;
-  GdkPixbuf       *tooltip_icon;
+  gchar          *title;
+  gchar          *tooltip_title;
+  gchar          *tooltip_text;
+  gchar          *icon_theme_path;
 
-  SnItemStatus     status;
+  GdkPixbuf      *icon;
+  GdkPixbuf      *overlay_icon;
+  GdkPixbuf      *attention_icon;
+  GdkPixbuf      *tooltip_icon;
 
-  GtkWidget       *box;
-  GtkWidget       *image;
-  GtkWidget       *label;
+  SnItemStatus    status;
 
-  DbusmenuGtkMenu *gtk_menu;
+  GtkWidget      *box;
+  GtkWidget      *image;
+  GtkWidget      *label;
 };
 
 enum
@@ -436,28 +432,17 @@ snh_item_button_press_event (GtkWidget      *widget,
                              GdkEventButton *event)
 {
   SnhItem *item;
+  GtkMenu *menu;
 
   item = SNH_ITEM (widget);
 
-  if (item->gtk_menu == NULL)
-    {
-      gchar *name;
-      const gchar *menu;
-
-      g_object_get (item->item, "dbus-name", &name, NULL);
-      menu = sn_item_client_get_menu (item->item);
-
-      if (menu != NULL)
-        item->gtk_menu = dbusmenu_gtkmenu_new (name, (gchar *) menu);
-
-      g_free (name);
-    }
+  menu = sn_item_client_get_menu (item->item);
 
-  if (item->gtk_menu)
+  if (menu)
     {
       GtkWidget *widget;
 
-      widget = GTK_WIDGET (item->gtk_menu);
+      widget = GTK_WIDGET (menu);
 
       if (gtk_widget_is_visible (widget) == FALSE)
         gtk_menu_popup (GTK_MENU (widget), NULL, NULL, NULL, NULL,
diff --git a/configure.ac b/configure.ac
index f61d566..64bc78d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,7 +119,7 @@ PKG_CHECK_MODULES(NOTIFICATION_AREA, gtk+-3.0 >= $GTK_REQUIRED)
 AC_SUBST(NOTIFICATION_AREA_CFLAGS)
 AC_SUBST(NOTIFICATION_AREA_LIBS)
 
-PKG_CHECK_MODULES(SNH, gtk+-3.0 >= $GTK_REQUIRED libstatus-notifier-3.0 >= $LIBSTATUS_NOTIFIER_REQUIRED 
dbusmenu-gtk3-0.4)
+PKG_CHECK_MODULES(SNH, gtk+-3.0 >= $GTK_REQUIRED libstatus-notifier-3.0 >= $LIBSTATUS_NOTIFIER_REQUIRED)
 AC_SUBST(SNH_CFLAGS)
 AC_SUBST(SNH_LIBS)
 


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