[Xfce4-commits] <xfce4-panel:devel> Handle xfconf_init and xfconf_shutdown in another way.

Nick Schermer nick at xfce.org
Tue Aug 11 20:35:00 CEST 2009


Updating branch refs/heads/devel
         to 9183ec915f81de8b8f006c19f74968696a1808a7 (commit)
       from a5a1a3ff7e5c51de116d644d1006e54ca9320d02 (commit)

commit 9183ec915f81de8b8f006c19f74968696a1808a7
Author: Nick Schermer <nick at xfce.org>
Date:   Fri Jun 19 11:30:17 2009 +0200

    Handle xfconf_init and xfconf_shutdown in another way.
    
    This requires a patch for xfconf that disconnects from
    DBus using dispose.

 common/panel-xfconf.c           |   19 +++++++++----------
 common/panel-xfconf.h           |   16 ----------------
 panel/main.c                    |   13 -------------
 plugins/actions/actions.c       |    3 ---
 plugins/clock/clock.c           |    3 ---
 plugins/launcher/launcher.c     |    3 ---
 plugins/pager/pager.c           |    3 ---
 plugins/separator/separator.c   |    3 ---
 plugins/systray/systray.c       |    3 ---
 plugins/tasklist/tasklist.c     |    3 ---
 plugins/windowmenu/windowmenu.c |    3 ---
 11 files changed, 9 insertions(+), 63 deletions(-)

diff --git a/common/panel-xfconf.c b/common/panel-xfconf.c
index 1929eb6..4ecd05f 100644
--- a/common/panel-xfconf.c
+++ b/common/panel-xfconf.c
@@ -173,11 +173,20 @@ XfconfChannel *
 panel_properties_get_channel (void)
 {
   static XfconfChannel *channel = NULL;
+  GError *error = NULL;
 
   if (G_UNLIKELY (channel == NULL))
     {
+      if (!xfconf_init (&error))
+        {
+          g_critical ("Failed to initialize Xfconf: %s", error->message);
+          g_error_free (error);
+        }
+
       channel = xfconf_channel_new (XFCE_PANEL_PLUGIN_CHANNEL_NAME);
       g_object_add_weak_pointer (G_OBJECT (channel), (gpointer) &channel);
+
+      g_object_weak_ref (G_OBJECT (channel), (GWeakNotify) xfconf_shutdown, NULL);
     }
   else
     {
@@ -302,13 +311,3 @@ panel_properties_shared_hash_table (GHashTable *hash_table)
   else
     shared_hash_table = NULL;
 }
-
-
-
-void
-panel_properties_shutdown (gpointer  user_data,
-                           GObject  *where_the_object_was)
-{
-  /* delay this a bit to avoid warnings */
-  g_idle_add ((GSourceFunc) xfconf_shutdown, NULL);
-}
diff --git a/common/panel-xfconf.h b/common/panel-xfconf.h
index 083450a..5c5f32b 100644
--- a/common/panel-xfconf.h
+++ b/common/panel-xfconf.h
@@ -22,19 +22,6 @@
 
 #include <xfconf/xfconf.h>
 
-#define PANEL_PROPERTIES_INIT(panel_plugin) do { \
-  GError *__err = NULL; \
-  if (G_LIKELY (xfconf_init (&__err))) \
-    { \
-      g_object_weak_ref (G_OBJECT (panel_plugin), \
-          panel_properties_shutdown, NULL); \
-    } \
-  else \
-    { \
-      g_critical ("Failed to initialize Xfconf: %s", __err->message); \
-      g_error_free (__err); \
-    } } while (0)
-
 
 
 typedef struct _PanelProperty PanelProperty;
@@ -58,7 +45,4 @@ void           panel_properties_unbind            (GObject             *object);
 
 void           panel_properties_shared_hash_table (GHashTable          *hash_table);
 
-void           panel_properties_shutdown          (gpointer             user_data,
-                                                   GObject             *where_the_object_was);
-
 #endif /* !__PANEL_XFCONF_H__ */
diff --git a/panel/main.c b/panel/main.c
index d535544..0b9d8e2 100644
--- a/panel/main.c
+++ b/panel/main.c
@@ -223,16 +223,6 @@ main (gint argc, gchar **argv)
       goto dbus_return;
     }
 
-  /* initialize xfconf */
-  if (!xfconf_init (&error))
-    {
-      /* print error and exit */
-      g_error ("Failed to connect to xfconf daemon: %s.", error->message);
-      g_error_free (error);
-
-      return EXIT_FAILURE;
-    }
-
   /* create dbus service */
   dbus_service = panel_dbus_service_get ();
 
@@ -258,9 +248,6 @@ main (gint argc, gchar **argv)
   /* release application reference */
   g_object_unref (G_OBJECT (application));
 
-  /* shutdown xfconf */
-  xfconf_shutdown ();
-
   /* whether we need to restart */
   if (dbus_quit_with_restart)
     {
diff --git a/plugins/actions/actions.c b/plugins/actions/actions.c
index 9690dc9..56740bb 100644
--- a/plugins/actions/actions.c
+++ b/plugins/actions/actions.c
@@ -179,9 +179,6 @@ actions_plugin_init (ActionsPlugin *plugin)
   plugin->first_action = ACTION_LOG_OUT_DIALOG;
   plugin->second_action = ACTION_DISABLED;
 
-  /* initialize properties */
-  PANEL_PROPERTIES_INIT (plugin);
-
   /* show the properties dialog */
   xfce_panel_plugin_menu_show_configure (XFCE_PANEL_PLUGIN (plugin));
 
diff --git a/plugins/clock/clock.c b/plugins/clock/clock.c
index af7f432..ef8bbbb 100644
--- a/plugins/clock/clock.c
+++ b/plugins/clock/clock.c
@@ -162,9 +162,6 @@ clock_plugin_init (ClockPlugin *plugin)
   plugin->tooltip_interval = 0;
   plugin->clock_timeout_id = 0;
 
-  /* initialize properties */
-  PANEL_PROPERTIES_INIT (plugin);
-
   /* show configure */
   xfce_panel_plugin_menu_show_configure (XFCE_PANEL_PLUGIN (plugin));
 
diff --git a/plugins/launcher/launcher.c b/plugins/launcher/launcher.c
index bb74ff9..b100a5f 100644
--- a/plugins/launcher/launcher.c
+++ b/plugins/launcher/launcher.c
@@ -246,9 +246,6 @@ launcher_plugin_init (LauncherPlugin *plugin)
   plugin->menu_timeout_id = 0;
   plugin->menu_icon_size = DEFAULT_MENU_ICON_SIZE;
 
-  /* initialize properties */
-  PANEL_PROPERTIES_INIT (plugin);
-
   /* show the configure menu item */
   xfce_panel_plugin_menu_show_configure (XFCE_PANEL_PLUGIN (plugin));
 
diff --git a/plugins/pager/pager.c b/plugins/pager/pager.c
index 74a7d24..6c3cdae 100644
--- a/plugins/pager/pager.c
+++ b/plugins/pager/pager.c
@@ -149,9 +149,6 @@ pager_plugin_init (PagerPlugin *plugin)
   plugin->rows = 1;
   plugin->wnck_pager = NULL;
 
-  /* initialize properties */
-  PANEL_PROPERTIES_INIT (plugin);
-
   /* show the properties dialog */
   xfce_panel_plugin_menu_show_configure (XFCE_PANEL_PLUGIN (plugin));
 }
diff --git a/plugins/separator/separator.c b/plugins/separator/separator.c
index c943e5a..b445dfb 100644
--- a/plugins/separator/separator.c
+++ b/plugins/separator/separator.c
@@ -138,9 +138,6 @@ separator_plugin_init (SeparatorPlugin *plugin)
   /* initialize */
   plugin->style = SEPARATOR_PLUGIN_STYLE_SEPARATOR;
 
-  /* initialize properties */
-  PANEL_PROPERTIES_INIT (plugin);
-
   /* show the properties dialog */
   xfce_panel_plugin_menu_show_configure (XFCE_PANEL_PLUGIN (plugin));
 }
diff --git a/plugins/systray/systray.c b/plugins/systray/systray.c
index c83ff52..fbf89a6 100644
--- a/plugins/systray/systray.c
+++ b/plugins/systray/systray.c
@@ -155,9 +155,6 @@ systray_plugin_init (SystrayPlugin *plugin)
   plugin->manager = NULL;
   plugin->show_frame = FALSE;
 
-  /* initialize properties */
-  PANEL_PROPERTIES_INIT (plugin);
-
   /* show configure */
   xfce_panel_plugin_menu_show_configure (XFCE_PANEL_PLUGIN (plugin));
 
diff --git a/plugins/tasklist/tasklist.c b/plugins/tasklist/tasklist.c
index 7aa99e7..96b459c 100644
--- a/plugins/tasklist/tasklist.c
+++ b/plugins/tasklist/tasklist.c
@@ -90,9 +90,6 @@ tasklist_plugin_init (TasklistPlugin *plugin)
 {
   GtkWidget *box;
 
-  /* initialize properties */
-  PANEL_PROPERTIES_INIT (plugin);
-
   /* show configure */
   xfce_panel_plugin_menu_show_configure (XFCE_PANEL_PLUGIN (plugin));
 
diff --git a/plugins/windowmenu/windowmenu.c b/plugins/windowmenu/windowmenu.c
index 4726fd8..650680e 100644
--- a/plugins/windowmenu/windowmenu.c
+++ b/plugins/windowmenu/windowmenu.c
@@ -201,9 +201,6 @@ window_menu_plugin_init (WindowMenuPlugin *plugin)
   plugin->all_workspaces = TRUE;
   plugin->urgent_windows = 0;
 
-  /* initialize properties */
-  PANEL_PROPERTIES_INIT (plugin);
-
   /* show configure */
   xfce_panel_plugin_menu_show_configure (XFCE_PANEL_PLUGIN (plugin));
 



More information about the Xfce4-commits mailing list