[Xfce4-commits] <xfce4-panel:devel> Remove plugin from xfconf channel when it was not found during startup.

Nick Schermer nick at xfce.org
Tue Aug 11 20:32:37 CEST 2009


Updating branch refs/heads/devel
         to 0e07205e4e7cf17995cf0eae04c854b5c9eca694 (commit)
       from 09ff76973bdf331d0e661c805e414e70773d7eb3 (commit)

commit 0e07205e4e7cf17995cf0eae04c854b5c9eca694
Author: Nick Schermer <nick at xfce.org>
Date:   Mon May 25 20:30:52 2009 +0200

    Remove plugin from xfconf channel when it was not found during startup.

 panel/panel-application.c    |   16 ++++++++++++++--
 panel/panel-module-factory.c |    2 +-
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/panel/panel-application.c b/panel/panel-application.c
index edb3b95..a8ed897 100644
--- a/panel/panel-application.c
+++ b/panel/panel-application.c
@@ -326,8 +326,20 @@ panel_application_load (PanelApplication *application)
               unique_id = xfconf_channel_get_int (channel, buf, -1);
 
               screen = gtk_window_get_screen (GTK_WINDOW (window));
-              panel_application_plugin_insert (application, window, screen,
-                                               name, unique_id, NULL, -1);
+              if (!panel_application_plugin_insert (application, window, screen,
+                                                    name, unique_id, NULL, -1))
+                {
+                  /* plugin could not be loaded, remove it from the channel */
+                  g_snprintf (buf, sizeof (buf), "/panels/panel-%u/plugins/plugin-%u", i, j);
+                  xfconf_channel_reset_property (channel, buf, TRUE);
+
+                  g_snprintf (buf, sizeof (buf), "/panels/plugin-%d", unique_id);
+                  xfconf_channel_reset_property (channel, buf, TRUE);
+
+                  /* show warnings */
+                  g_critical (_("Plugin \"%s-%d\" was not found and has been "
+                              "removed from the configuration"), name, unique_id);
+                }
 
               /* cleanup */
               g_free (name);
diff --git a/panel/panel-module-factory.c b/panel/panel-module-factory.c
index 82e0a4e..e5ad679 100644
--- a/panel/panel-module-factory.c
+++ b/panel/panel-module-factory.c
@@ -424,7 +424,7 @@ panel_module_factory_new_plugin (PanelModuleFactory  *factory,
   if (G_UNLIKELY (module == NULL))
     {
       /* show warning */
-      g_warning ("Module \"%s\" not found in the factory", name);
+      g_debug ("Module \"%s\" not found in the factory", name);
 
       return NULL;
     }



More information about the Xfce4-commits mailing list