[Xfce4-commits] <xfce4-indicator-plugin:master> brain dead port to xfconf

Mark Trompell noreply at xfce.org
Fri Mar 23 15:40:09 CET 2012


Updating branch refs/heads/master
         to 517416a99f407954c6e16e50086a7904b18b1941 (commit)
       from d46b02ec4913570112db453b133c627cbee3fa8c (commit)

commit 517416a99f407954c6e16e50086a7904b18b1941
Author: Mark Trompell <mark at foresightlinux.org>
Date:   Wed Mar 21 15:18:23 2012 +0100

    brain dead port to xfconf

 configure.in.in          |    1 +
 panel-plugin/Makefile.am |    2 ++
 panel-plugin/indicator.c |   45 +++++++++++++--------------------------------
 3 files changed, 16 insertions(+), 32 deletions(-)

diff --git a/configure.in.in b/configure.in.in
index a9c3405..8ec40e7 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -67,6 +67,7 @@ dnl ***********************************
 XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.14.0])
 XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.3.99.2])
 XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.3.99.2])
+XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.6.0])
 XDT_CHECK_PACKAGE([INDICATOR], [indicator], [0.3.0], [indicator_pkgname=indicator], [XDT_CHECK_PACKAGE([INDICATOR], [indicator-0.4], [0.3.90], [indicator_pkgname=indicator-0.4], [])])
 
 dnl ***********************************
diff --git a/panel-plugin/Makefile.am b/panel-plugin/Makefile.am
index 5327a91..0c1ba0e 100644
--- a/panel-plugin/Makefile.am
+++ b/panel-plugin/Makefile.am
@@ -24,6 +24,7 @@ xfce4_indicator_plugin_SOURCES =				\
 xfce4_indicator_plugin_CFLAGS =					\
 	$(LIBXFCE4UTIL_CFLAGS)						\
 	$(LIBXFCE4PANEL_CFLAGS)						\
+	$(XFCONF_CFLAGS)					\
 	$(INDICATOR_CFLAGS)						\
 	$(PLATFORM_CFLAGS)					\
 	-DDATADIR=\""$(datadir)"\" 				\
@@ -34,6 +35,7 @@ xfce4_indicator_plugin_CFLAGS =					\
 xfce4_indicator_plugin_LDADD =					\
 	$(LIBXFCE4UTIL_LIBS)						\
 	$(LIBXFCE4PANEL_LIBS)						\
+	$(XFCONF_LIBS)						\
 	$(INDICATOR_LIBS)
 
 #
diff --git a/panel-plugin/indicator.c b/panel-plugin/indicator.c
index 1172ef0..fff5319 100644
--- a/panel-plugin/indicator.c
+++ b/panel-plugin/indicator.c
@@ -26,6 +26,7 @@
 #include <libxfce4util/libxfce4util.h>
 #include <libxfce4panel/xfce-panel-plugin.h>
 #include <libindicator/indicator-object.h>
+#include <xfconf/xfconf.h>
 
 #include "indicator.h"
 #include "indicator-box.h"
@@ -94,36 +95,15 @@ indicator_save (XfcePanelPlugin *plugin,
 static void
 indicator_read (IndicatorPlugin *indicator)
 {
-  XfceRc      *rc;
-  gchar       *file;
-
-  /* get the plugin config file location */
-  file = xfce_panel_plugin_lookup_rc_file (indicator->plugin);
-
-  if (G_LIKELY (file != NULL))
-    {
-      /* open the config file, readonly */
-      rc = xfce_rc_simple_open (file, TRUE);
-
-      /* cleanup */
-      g_free (file);
-
-      if (G_LIKELY (rc != NULL))
-        {
-          /* read the settings */
-          indicator->excluded_modules = xfce_rc_read_list_entry (rc, "Exclude", NULL);
-
-          /* cleanup */
-          xfce_rc_close (rc);
-
-          /* leave the function, everything went well */
-          return;
-        }
-    }
-
+  XfconfChannel * channel = xfconf_channel_get ("xfce4-panel");
+  gchar * property = g_strconcat (xfce_panel_plugin_get_property_base(indicator->plugin),"/blacklist",NULL);
+  indicator->excluded_modules = xfconf_channel_get_string_list(channel, property);
+  g_free (property);
   /* something went wrong, apply default values */
+  /*
   DBG ("Applying default settings");
   indicator->excluded_modules = DEFAULT_EXCLUDED_MODULES;
+  */
 }
 
 static IndicatorPlugin *
@@ -148,10 +128,11 @@ indicator_new (XfcePanelPlugin *plugin)
   /*gtk_widget_set_name(GTK_WIDGET (indicator->plugin), "indicator-plugin");*/
   
   indicator->buttonbox = xfce_indicator_box_new ();;
-  
-  /* get the list of excluded modules */
-  indicator_read (indicator);
-  
+  /* initialize xfconf */
+  if (xfconf_init(NULL)){
+    /* get the list of excluded modules */
+    indicator_read (indicator);
+  }
   /* load 'em */
   if (g_file_test(INDICATOR_DIR, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) {
     GDir * dir = g_dir_open(INDICATOR_DIR, 0, NULL);
@@ -212,7 +193,7 @@ indicator_free (XfcePanelPlugin *plugin,
   dialog = g_object_get_data (G_OBJECT (plugin), "dialog");
   if (G_UNLIKELY (dialog != NULL))
     gtk_widget_destroy (dialog);
-
+  xfconf_shutdown();
   /* free the plugin structure */
   panel_slice_free (IndicatorPlugin, indicator);
 }


More information about the Xfce4-commits mailing list