[Xfce4-commits] <xfce4-panel:devel> Allow custom names for the Xfconf channel.

Nick Schermer noreply at xfce.org
Mon Feb 15 21:38:01 CET 2010


Updating branch refs/heads/devel
         to b34e7a509235dd66031095dcdd20613fefe33b7c (commit)
       from 326dc35ea2f9b20f3322467a7de303a23ec880c1 (commit)

commit b34e7a509235dd66031095dcdd20613fefe33b7c
Author: Nick Schermer <nick at xfce.org>
Date:   Mon Feb 15 21:30:53 2010 +0100

    Allow custom names for the Xfconf channel.
    
    You can override the default Xfconf channel name with
    the XFCE_PANEL_CHANNEL_NAME environment variable. Also
    rename the macro to a more suitable name.

 common/panel-xfconf.c                      |    2 +-
 docs/references/libxfce4panel-sections.txt |    2 +-
 libxfce4panel/xfce-panel-macros.h          |   12 ++++++++----
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/common/panel-xfconf.c b/common/panel-xfconf.c
index fe85ccc..ccae3ae 100644
--- a/common/panel-xfconf.c
+++ b/common/panel-xfconf.c
@@ -74,7 +74,7 @@ panel_properties_get_channel (GObject *object_for_weak_ref)
       return NULL;
     }
 
-  channel = xfconf_channel_get (XFCE_PANEL_PLUGIN_CHANNEL_NAME);
+  channel = xfconf_channel_get (XFCE_PANEL_CHANNEL_NAME);
   g_object_weak_ref (object_for_weak_ref, (GWeakNotify) xfconf_shutdown, NULL);
 
   return channel;
diff --git a/docs/references/libxfce4panel-sections.txt b/docs/references/libxfce4panel-sections.txt
index 5f38d35..fe8c687 100644
--- a/docs/references/libxfce4panel-sections.txt
+++ b/docs/references/libxfce4panel-sections.txt
@@ -85,7 +85,7 @@ xfce_panel_image_get_type
 <SECTION>
 <FILE>xfce-panel-macros</FILE>
 <TITLE>Panel Plugin Macros</TITLE>
-XFCE_PANEL_PLUGIN_CHANNEL_NAME
+XFCE_PANEL_CHANNEL_NAME
 xfce_panel_plugin_xfconf_channel_new
 XFCE_PANEL_DEFINE_PLUGIN
 XFCE_PANEL_DEFINE_PLUGIN_RESIDENT
diff --git a/libxfce4panel/xfce-panel-macros.h b/libxfce4panel/xfce-panel-macros.h
index f02b1e1..f556569 100644
--- a/libxfce4panel/xfce-panel-macros.h
+++ b/libxfce4panel/xfce-panel-macros.h
@@ -56,16 +56,20 @@ typedef GTypeModule XfcePanelTypeModule;
 
 
 /**
- * XFCE_PANEL_PLUGIN_CHANNEL_NAME:
+ * XFCE_PANEL_CHANNEL_NAME:
  *
- * Macro for the name of the Xfconf channel used by the panel.
+ * Macro for the name of the Xfconf channel used by the panel. By default
+ * this returns "xfce4-panel", but you can override this value with the
+ * environment variable XFCE_PANEL_CHANNEL_NAME.
  *
  * See also: xfce_panel_plugin_xfconf_channel_new,
  *           xfce_panel_plugin_get_property_base
  *
  * Since: 4.8.0
  **/
-#define XFCE_PANEL_PLUGIN_CHANNEL_NAME ("xfce4-panel")
+#define XFCE_PANEL_CHANNEL_NAME \
+  (G_LIKELY (g_getenv ("XFCE_PANEL_CHANNEL_NAME") == NULL) ? \
+      "xfce4-panel" : g_getenv ("XFCE_PANEL_CHANNEL_NAME"))
 
 
 
@@ -83,7 +87,7 @@ typedef GTypeModule XfcePanelTypeModule;
  * Since: 4.8.0
  **/
 #define xfce_panel_plugin_xfconf_channel_new(plugin) \
-  xfconf_channel_new_with_property_base (XFCE_PANEL_PLUGIN_CHANNEL_NAME, \
+  xfconf_channel_new_with_property_base (XFCE_PANEL_CHANNEL_NAME, \
     xfce_panel_plugin_get_property_base (XFCE_PANEL_PLUGIN (plugin)))
 
 



More information about the Xfce4-commits mailing list