[Xfce4-commits] <xfce4-panel:devel> Use custom bindings in windowmenu plugin.

Nick Schermer nick at xfce.org
Tue Aug 11 20:34:24 CEST 2009


Updating branch refs/heads/devel
         to dfa80d2ce52861da0532cffa9dedd84a26480b47 (commit)
       from 35fbf9d3aefdceb03b4b5b3dc0ef79e7a280d8e3 (commit)

commit dfa80d2ce52861da0532cffa9dedd84a26480b47
Author: Nick Schermer <nick at xfce.org>
Date:   Mon Jun 1 00:57:01 2009 +0200

    Use custom bindings in windowmenu plugin.

 plugins/windowmenu/Makefile.am  |    4 +++-
 plugins/windowmenu/windowmenu.c |   29 ++++++++++++++++-------------
 2 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/plugins/windowmenu/Makefile.am b/plugins/windowmenu/Makefile.am
index 257195e..b2de203 100644
--- a/plugins/windowmenu/Makefile.am
+++ b/plugins/windowmenu/Makefile.am
@@ -37,6 +37,7 @@ libwindowmenu_la_LDFLAGS = \
 
 libwindowmenu_la_LIBADD = \
 	$(top_builddir)/libxfce4panel/libxfce4panel.la \
+	$(top_builddir)/common/libpanel-xfconf.la \
 	$(EXO_LIBS) \
 	$(GTK_LIBS) \
 	$(XFCONF_LIBS) \
@@ -45,7 +46,8 @@ libwindowmenu_la_LIBADD = \
 	$(LIBWNCK_LIBS)
 
 libwindowmenu_la_DEPENDENCIES = \
-	$(top_builddir)/libxfce4panel/libxfce4panel.la
+	$(top_builddir)/libxfce4panel/libxfce4panel.la \
+	$(top_builddir)/common/libpanel-xfconf.la
 
 #
 # .desktop file
diff --git a/plugins/windowmenu/windowmenu.c b/plugins/windowmenu/windowmenu.c
index 93404b6..8d97cd0 100644
--- a/plugins/windowmenu/windowmenu.c
+++ b/plugins/windowmenu/windowmenu.c
@@ -26,6 +26,7 @@
 #include <libxfce4ui/libxfce4ui.h>
 #include <libxfce4panel/libxfce4panel.h>
 #include <libwnck/libwnck.h>
+#include <common/panel-xfconf.h>
 #include <gdk/gdkkeysyms.h>
 #include <common/panel-private.h>
 
@@ -382,25 +383,27 @@ window_menu_plugin_screen_changed (GtkWidget *widget,
 static void
 window_menu_plugin_construct (XfcePanelPlugin *panel_plugin)
 {
-  WindowMenuPlugin *plugin = XFCE_WINDOW_MENU_PLUGIN (panel_plugin);
+  WindowMenuPlugin    *plugin = XFCE_WINDOW_MENU_PLUGIN (panel_plugin);
+  const PanelProperty  properties[] =
+  {
+    { "style", G_TYPE_UINT },
+    { "workspace-actions", G_TYPE_BOOLEAN },
+    { "workspace-names", G_TYPE_BOOLEAN },
+    { "urgentcy-notification", G_TYPE_BOOLEAN },
+    { "all-workspaces", G_TYPE_BOOLEAN },
+    { NULL, G_TYPE_NONE }
+  };
 
   /* open the xfconf channel */
-  plugin->channel = xfce_panel_plugin_xfconf_channel_new (panel_plugin);
+  plugin->channel = xfconf_channel_new (XFCE_PANEL_PLUGIN_CHANNEL_NAME);
 
   /* show the icon */
   gtk_widget_show (plugin->icon);
 
-  /* bind the properties */
-  xfconf_g_property_bind (plugin->channel, "/style",
-                          G_TYPE_UINT, plugin, "style");
-  xfconf_g_property_bind (plugin->channel, "/workspace-actions",
-                          G_TYPE_BOOLEAN, plugin, "workspace-actions");
-  xfconf_g_property_bind (plugin->channel, "/workspace-names",
-                          G_TYPE_BOOLEAN, plugin, "workspace-names");
-  xfconf_g_property_bind (plugin->channel, "/urgentcy-notification",
-                          G_TYPE_BOOLEAN, plugin, "urgentcy-notification");
-  xfconf_g_property_bind (plugin->channel, "/all-workspaces",
-                          G_TYPE_BOOLEAN, plugin, "all-workspaces");
+  /* bind all properties */
+  panel_properties_bind (plugin->channel, G_OBJECT (plugin),
+                         xfce_panel_plugin_get_property_base (panel_plugin),
+                         properties, NULL);
 
   /* monitor screen changes */
   g_signal_connect (G_OBJECT (plugin), "screen-changed",



More information about the Xfce4-commits mailing list