[Xfce4-commits] <xfce4-panel:master> Add function to return the Xfconf panel name.
Nick Schermer
noreply at xfce.org
Sat Nov 20 12:36:01 CET 2010
Updating branch refs/heads/master
to ae208594589c0ad80f05f6cf5e5ddbf36f2c903d (commit)
from 5253474958a85198e2f7d85faef65f41cfeae7f2 (commit)
commit ae208594589c0ad80f05f6cf5e5ddbf36f2c903d
Author: Nick Schermer <nick at xfce.org>
Date: Fri Nov 19 21:05:11 2010 +0100
Add function to return the Xfconf panel name.
This will be easier to maintain then the macro if we want to
extend it in the feature. Also cache the value, since it
will not change during runtime of the panel.
docs/references/libxfce4panel-sections.txt | 1 +
libxfce4panel/libxfce4panel.symbols | 1 +
libxfce4panel/xfce-panel-convenience.c | 32 ++++++++++++++++++++++++++++
libxfce4panel/xfce-panel-convenience.h | 6 +++-
libxfce4panel/xfce-panel-macros.h | 11 +++------
libxfce4panel/xfce-panel-plugin.c | 5 ++-
migrate/Makefile.am | 4 +++
7 files changed, 49 insertions(+), 11 deletions(-)
diff --git a/docs/references/libxfce4panel-sections.txt b/docs/references/libxfce4panel-sections.txt
index 1305e62..843e2b4 100644
--- a/docs/references/libxfce4panel-sections.txt
+++ b/docs/references/libxfce4panel-sections.txt
@@ -55,6 +55,7 @@ xfce_hvbox_get_type
<FILE>convenience</FILE>
xfce_panel_create_button
xfce_panel_create_toggle_button
+xfce_panel_get_channel_name
xfce_allow_panel_customization
xfce_create_panel_button
xfce_create_panel_toggle_button
diff --git a/libxfce4panel/libxfce4panel.symbols b/libxfce4panel/libxfce4panel.symbols
index 715bda5..fcbe2dc 100644
--- a/libxfce4panel/libxfce4panel.symbols
+++ b/libxfce4panel/libxfce4panel.symbols
@@ -75,6 +75,7 @@ xfce_hvbox_get_orientation
#if IN_SOURCE(__XFCE_PANEL_CONVENIENCE_C__)
xfce_panel_create_button G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT
xfce_panel_create_toggle_button G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT
+xfce_panel_get_channel_name
#endif
#endif
diff --git a/libxfce4panel/xfce-panel-convenience.c b/libxfce4panel/xfce-panel-convenience.c
index 638e6bd..03ef5f2 100644
--- a/libxfce4panel/xfce-panel-convenience.c
+++ b/libxfce4panel/xfce-panel-convenience.c
@@ -86,5 +86,37 @@ xfce_panel_create_toggle_button (void)
+/**
+ * xfce_panel_get_channel_name:
+ *
+ * Function 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.
+ *
+ * Returns: name of the Xfconf channel
+ *
+ * See also: XFCE_PANEL_CHANNEL_NAME,
+ * xfce_panel_plugin_xfconf_channel_new and
+ * xfce_panel_plugin_get_property_base
+ *
+ * Since: 4.8
+ **/
+const gchar *
+xfce_panel_get_channel_name (void)
+{
+ static const gchar *name = NULL;
+
+ if (G_UNLIKELY (name == NULL))
+ {
+ name = g_getenv ("XFCE_PANEL_CHANNEL_NAME");
+ if (G_LIKELY (name == NULL))
+ name = "xfce4-panel";
+ }
+
+ return name;
+}
+
+
+
#define __XFCE_PANEL_CONVENIENCE_C__
#include <libxfce4panel/libxfce4panel-aliasdef.c>
diff --git a/libxfce4panel/xfce-panel-convenience.h b/libxfce4panel/xfce-panel-convenience.h
index d09b60e..eec96aa 100644
--- a/libxfce4panel/xfce-panel-convenience.h
+++ b/libxfce4panel/xfce-panel-convenience.h
@@ -29,9 +29,11 @@
G_BEGIN_DECLS
-GtkWidget *xfce_panel_create_button (void) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
+GtkWidget *xfce_panel_create_button (void) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
-GtkWidget *xfce_panel_create_toggle_button (void) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
+GtkWidget *xfce_panel_create_toggle_button (void) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
+
+const gchar *xfce_panel_get_channel_name (void);
G_END_DECLS
diff --git a/libxfce4panel/xfce-panel-macros.h b/libxfce4panel/xfce-panel-macros.h
index 75ac35e..0ec8e05 100644
--- a/libxfce4panel/xfce-panel-macros.h
+++ b/libxfce4panel/xfce-panel-macros.h
@@ -75,18 +75,14 @@ typedef GTypeModule XfcePanelTypeModule;
/**
* XFCE_PANEL_CHANNEL_NAME:
*
- * 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.
+ * Macro to return the value of xfce_panel_get_channel_name().
*
* See also: xfce_panel_plugin_xfconf_channel_new,
* xfce_panel_plugin_get_property_base
*
* Since: 4.8
**/
-#define XFCE_PANEL_CHANNEL_NAME \
- (G_LIKELY (g_getenv ("XFCE_PANEL_CHANNEL_NAME") == NULL) ? \
- "xfce4-panel" : g_getenv ("XFCE_PANEL_CHANNEL_NAME"))
+#define XFCE_PANEL_CHANNEL_NAME (xfce_panel_get_channel_name ())
@@ -99,7 +95,8 @@ typedef GTypeModule XfcePanelTypeModule;
* xfce_panel_plugin_get_property_base().
*
* See also: xfce_panel_plugin_get_property_base,
- * XFCE_PANEL_PLUGIN_CHANNEL_NAME
+ * XFCE_PANEL_PLUGIN_CHANNEL_NAME and
+ * xfce_panel_get_channel_name
*
* Since: 4.8
**/
diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index 9cc4e9a..4c9323c 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -1505,8 +1505,9 @@ xfce_panel_plugin_get_unique_id (XfcePanelPlugin *plugin)
*
* Returns: the property base for the xfconf channel userd by a plugin.
*
- * See also: xfconf_channel_new_with_property_base() and
- * XFCE_PANEL_PLUGIN_CHANNEL_NAME.
+ * See also: xfconf_channel_new_with_property_base.
+ * XFCE_PANEL_PLUGIN_CHANNEL_NAME and
+ * xfce_panel_get_channel_name
**/
G_CONST_RETURN gchar *
xfce_panel_plugin_get_property_base (XfcePanelPlugin *plugin)
diff --git a/migrate/Makefile.am b/migrate/Makefile.am
index 168c221..4e53e05 100644
--- a/migrate/Makefile.am
+++ b/migrate/Makefile.am
@@ -34,11 +34,15 @@ migrate_LDFLAGS = \
$(PLATFORM_LDFLAGS)
migrate_LDADD = \
+ $(top_builddir)/libxfce4panel/libxfce4panel-$(LIBXFCE4PANEL_VERSION_API).la \
$(GTK_LIBS) \
$(XFCONF_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCE4UI_LIBS)
+migrate_DEPENDENCIES = \
+ $(top_builddir)/libxfce4panel/libxfce4panel-$(LIBXFCE4PANEL_VERSION_API).la
+
EXTRA_DIST = \
default.xml
More information about the Xfce4-commits
mailing list