[Xfce4-commits] <xfce4-panel:devel> Use custom bindings in actions plugin.
Nick Schermer
nick at xfce.org
Tue Aug 11 20:34:17 CEST 2009
Updating branch refs/heads/devel
to fbb8cbb77097ea2e71d2f8d913226b59fbe6498b (commit)
from a26bc971712de9e770355a313960bcbc29065d13 (commit)
commit fbb8cbb77097ea2e71d2f8d913226b59fbe6498b
Author: Nick Schermer <nick at xfce.org>
Date: Mon Jun 1 00:54:40 2009 +0200
Use custom bindings in actions plugin.
plugins/actions/Makefile.am | 4 +++-
plugins/actions/actions.c | 29 ++++++++++++++++++-----------
2 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/plugins/actions/Makefile.am b/plugins/actions/Makefile.am
index c6926bb..734f123 100644
--- a/plugins/actions/Makefile.am
+++ b/plugins/actions/Makefile.am
@@ -35,6 +35,7 @@ libactions_la_LDFLAGS = \
libactions_la_LIBADD = \
$(top_builddir)/libxfce4panel/libxfce4panel.la \
+ $(top_builddir)/common/libpanel-xfconf.la \
$(GTK_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCE4UI_LIBS) \
@@ -42,7 +43,8 @@ libactions_la_LIBADD = \
$(XFCONF_LIBS)
libactions_la_DEPENDENCIES = \
- $(top_builddir)/libxfce4panel/libxfce4panel.la
+ $(top_builddir)/libxfce4panel/libxfce4panel.la \
+ $(top_builddir)/common/libpanel-xfconf.la
#
# .desktop file
diff --git a/plugins/actions/actions.c b/plugins/actions/actions.c
index 8fbdb34..13f32e0 100644
--- a/plugins/actions/actions.c
+++ b/plugins/actions/actions.c
@@ -25,6 +25,7 @@
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfce4ui/libxfce4ui.h>
+#include <common/panel-xfconf.h>
#include <xfconf/xfconf.h>
#include <exo/exo.h>
@@ -301,16 +302,21 @@ actions_plugin_set_property (GObject *object,
static void
actions_plugin_construct (XfcePanelPlugin *panel_plugin)
{
- ActionsPlugin *plugin = XFCE_ACTIONS_PLUGIN (panel_plugin);
-
- /* set the xfconf channel */
- plugin->channel = xfce_panel_plugin_xfconf_channel_new (panel_plugin);
-
- /* bind properties */
- xfconf_g_property_bind (plugin->channel, "/first-action",
- G_TYPE_UINT, plugin, "first-action");
- xfconf_g_property_bind (plugin->channel, "/second-action",
- G_TYPE_UINT, plugin, "second-action");
+ ActionsPlugin *plugin = XFCE_ACTIONS_PLUGIN (panel_plugin);
+ const PanelProperty properties[] =
+ {
+ { "first-action", G_TYPE_UINT },
+ { "second-action", G_TYPE_UINT },
+ { NULL, G_TYPE_NONE }
+ };
+
+ /* open the xfconf channel */
+ plugin->channel = xfconf_channel_new (XFCE_PANEL_PLUGIN_CHANNEL_NAME);
+
+ /* bind all properties */
+ panel_properties_bind (plugin->channel, G_OBJECT (plugin),
+ xfce_panel_plugin_get_property_base (panel_plugin),
+ properties, NULL);
/* set orientation and size */
actions_plugin_orientation_changed (panel_plugin,
@@ -330,7 +336,8 @@ actions_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