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

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


Updating branch refs/heads/devel
         to 8b88b46cae1729ee9a30463f532388cea453be8c (commit)
       from 71809611397ed9522ecf83de0ff55761649c4f34 (commit)

commit 8b88b46cae1729ee9a30463f532388cea453be8c
Author: Nick Schermer <nick at xfce.org>
Date:   Mon Jun 1 00:55:48 2009 +0200

    Use custom bindings in separator plugin.

 plugins/separator/Makefile.am |    4 +++-
 plugins/separator/separator.c |   25 ++++++++++++++++---------
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/plugins/separator/Makefile.am b/plugins/separator/Makefile.am
index c3a8566..855606a 100644
--- a/plugins/separator/Makefile.am
+++ b/plugins/separator/Makefile.am
@@ -36,6 +36,7 @@ libseparator_la_LDFLAGS = \
 
 libseparator_la_LIBADD = \
 	$(top_builddir)/libxfce4panel/libxfce4panel.la \
+	$(top_builddir)/common/libpanel-xfconf.la \
 	$(GTK_LIBS) \
 	$(CAIRO_LIBS) \
 	$(LIBXFCE4UTIL_LIBS) \
@@ -44,7 +45,8 @@ libseparator_la_LIBADD = \
 	$(XFCONF_LIBS)
 
 libseparator_la_DEPENDENCIES = \
-	$(top_builddir)/libxfce4panel/libxfce4panel.la
+	$(top_builddir)/libxfce4panel/libxfce4panel.la \
+	$(top_builddir)/common/libpanel-xfconf.la
 
 #
 # .desktop file
diff --git a/plugins/separator/separator.c b/plugins/separator/separator.c
index 1d2461c..12353c6 100644
--- a/plugins/separator/separator.c
+++ b/plugins/separator/separator.c
@@ -25,6 +25,7 @@
 #include <gtk/gtk.h>
 #include <libxfce4panel/libxfce4panel.h>
 #include <libxfce4util/libxfce4util.h>
+#include <common/panel-xfconf.h>
 #include <xfconf/xfconf.h>
 #include <exo/exo.h>
 
@@ -274,18 +275,23 @@ separator_plugin_expose_event (GtkWidget      *widget,
 static void
 separator_plugin_construct (XfcePanelPlugin *panel_plugin)
 {
-  SeparatorPlugin *plugin = XFCE_SEPARATOR_PLUGIN (panel_plugin);
+  SeparatorPlugin     *plugin = XFCE_SEPARATOR_PLUGIN (panel_plugin);
+  const PanelProperty  properties[] =
+  {
+    { "style", G_TYPE_UINT },
+    { "expand", G_TYPE_BOOLEAN },
+    { NULL, G_TYPE_NONE }
+  };
 
   /* set the xfconf channel */
-  plugin->channel = xfce_panel_plugin_xfconf_channel_new (panel_plugin);
+  plugin->channel = xfconf_channel_new (XFCE_PANEL_PLUGIN_CHANNEL_NAME);
 
-  /* bind properties */
-  xfconf_g_property_bind (plugin->channel, "/style",
-                          G_TYPE_UINT, plugin, "style");
-  xfconf_g_property_bind (plugin->channel, "/expand",
-                          G_TYPE_BOOLEAN, plugin, "expand");
+  /* connect all properties */
+  panel_properties_bind (plugin->channel, G_OBJECT (plugin),
+                         xfce_panel_plugin_get_property_base (panel_plugin),
+                         properties, NULL);
 
-  /* now we draw the plugin */
+  /* make sure the plugin is drawn */
   gtk_widget_queue_draw (GTK_WIDGET (panel_plugin));
 }
 
@@ -299,7 +305,8 @@ separator_plugin_free_data (XfcePanelPlugin *panel_plugin)
   panel_return_if_fail (XFCONF_IS_CHANNEL (plugin->channel));
 
   /* release the xfonf channel */
-  g_object_unref (G_OBJECT (plugin->channel));
+  if (G_LIKELY (plugin->channel != NULL))
+    g_object_unref (G_OBJECT (plugin->channel));
 
   /* shutdown xfconf */
   xfconf_shutdown ();



More information about the Xfce4-commits mailing list