[Xfce4-commits] <xfce4-panel:devel> Make the value array type shared.

Nick Schermer noreply at xfce.org
Mon Jan 25 15:22:01 CET 2010


Updating branch refs/heads/devel
         to 8a91fe62a85593342fb5d0aa5a1011d2e0e99b22 (commit)
       from 1cbb5eaa1e124d370192ede47744c6f1e359321d (commit)

commit 8a91fe62a85593342fb5d0aa5a1011d2e0e99b22
Author: Nick Schermer <nick at xfce.org>
Date:   Mon Jan 25 12:39:14 2010 +0100

    Make the value array type shared.

 common/panel-xfconf.c       |   19 +++++++++++++++++++
 common/panel-xfconf.h       |   18 +++++++++++-------
 plugins/launcher/launcher.c |    6 ++----
 3 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/common/panel-xfconf.c b/common/panel-xfconf.c
index 2c52a5d..fe85ccc 100644
--- a/common/panel-xfconf.c
+++ b/common/panel-xfconf.c
@@ -20,6 +20,8 @@
 #include <config.h>
 #endif
 
+#include <dbus/dbus-glib.h>
+
 #include <common/panel-private.h>
 #include <common/panel-xfconf.h>
 #include <libxfce4panel/xfce-panel-macros.h>
@@ -120,3 +122,20 @@ panel_properties_unbind (GObject *object)
 {
   xfconf_g_property_unbind_all (object);
 }
+
+
+
+GType
+panel_properties_value_array_get_type (void)
+{
+  static volatile gsize type__volatile = 0;
+  GType                 type;
+
+  if (g_once_init_enter (&type__volatile))
+    {
+      type = dbus_g_type_get_collection ("GPtrArray", G_TYPE_VALUE);
+      g_once_init_leave (&type__volatile, type);
+    }
+
+  return type__volatile;
+}
diff --git a/common/panel-xfconf.h b/common/panel-xfconf.h
index 2689609..8102ea3 100644
--- a/common/panel-xfconf.h
+++ b/common/panel-xfconf.h
@@ -21,6 +21,8 @@
 
 #include <xfconf/xfconf.h>
 
+#define PANEL_PROPERTIES_TYPE_VALUE_ARRAY (panel_properties_value_array_get_type ())
+
 
 
 typedef struct _PanelProperty PanelProperty;
@@ -32,14 +34,16 @@ struct _PanelProperty
 
 
 
-XfconfChannel *panel_properties_get_channel       (GObject             *object_for_weak_ref);
+XfconfChannel *panel_properties_get_channel          (GObject             *object_for_weak_ref);
+
+void           panel_properties_bind                 (XfconfChannel       *channel,
+                                                      GObject             *object,
+                                                      const gchar         *property_base,
+                                                      const PanelProperty *properties,
+                                                      gboolean             save_properties);
 
-void           panel_properties_bind              (XfconfChannel       *channel,
-                                                   GObject             *object,
-                                                   const gchar         *property_base,
-                                                   const PanelProperty *properties,
-                                                   gboolean             save_properties);
+void           panel_properties_unbind               (GObject             *object);
 
-void           panel_properties_unbind            (GObject             *object);
+GType          panel_properties_value_array_get_type (void) G_GNUC_CONST;
 
 #endif /* !__PANEL_XFCONF_H__ */
diff --git a/plugins/launcher/launcher.c b/plugins/launcher/launcher.c
index add44df..56b386d 100644
--- a/plugins/launcher/launcher.c
+++ b/plugins/launcher/launcher.c
@@ -25,7 +25,6 @@
 #endif
 
 #include <exo/exo.h>
-#include <dbus/dbus-glib.h>
 #include <libxfce4util/libxfce4util.h>
 #include <libxfce4ui/libxfce4ui.h>
 #include <garcon/garcon.h>
@@ -44,7 +43,6 @@
 #define NO_ARROW_INSIDE_BUTTON(plugin) ((plugin)->arrow_position != LAUNCHER_ARROW_INTERNAL \
                                         || LIST_HAS_ONE_OR_NO_ENTRIES ((plugin)->items))
 #define ARROW_INSIDE_BUTTON(plugin)    (!NO_ARROW_INSIDE_BUTTON (plugin))
-#define LAUNCHER_TYPE_PTR_ARRAY        (dbus_g_type_get_collection("GPtrArray", G_TYPE_VALUE))
 #define RELATIVE_CONFIG_PATH           PANEL_PLUGIN_RELATIVE_PATH G_DIR_SEPARATOR_S "%s-%d"
 
 
@@ -273,7 +271,7 @@ launcher_plugin_class_init (LauncherPluginClass *klass)
                                    PROP_ITEMS,
                                    g_param_spec_boxed ("items",
                                                        NULL, NULL,
-                                                       LAUNCHER_TYPE_PTR_ARRAY,
+                                                       PANEL_PROPERTIES_TYPE_VALUE_ARRAY,
                                                        EXO_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class,
@@ -941,7 +939,7 @@ launcher_plugin_construct (XfcePanelPlugin *panel_plugin)
   const PanelProperty  properties[] =
   {
     { "show-label", G_TYPE_BOOLEAN },
-    { "items", LAUNCHER_TYPE_PTR_ARRAY },
+    { "items", PANEL_PROPERTIES_TYPE_VALUE_ARRAY },
     { "disable-tooltips", G_TYPE_BOOLEAN },
     { "move-first", G_TYPE_BOOLEAN },
     { "arrow-position", G_TYPE_UINT },



More information about the Xfce4-commits mailing list