[Xfce4-commits] <xfce4-panel:devel> Check for new modules when openening the items dialog.

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


Updating branch refs/heads/devel
         to e970036da46493376cff15ae1528e6add62388bb (commit)
       from 5c4d414dc0e356bfec2c14da012c5b486e77c313 (commit)

commit e970036da46493376cff15ae1528e6add62388bb
Author: Nick Schermer <nick at xfce.org>
Date:   Sun May 24 19:01:54 2009 +0200

    Check for new modules when openening the items dialog.

 panel/panel-item-dialog.c    |   27 +++++++++++++++++----------
 panel/panel-module-factory.c |   19 ++++++++++++++-----
 panel/panel-module.c         |    3 ++-
 3 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/panel/panel-item-dialog.c b/panel/panel-item-dialog.c
index 247bd5e..534f20b 100644
--- a/panel/panel-item-dialog.c
+++ b/panel/panel-item-dialog.c
@@ -141,11 +141,13 @@ panel_item_dialog_init (PanelItemDialog *dialog)
   dialog->factory = panel_module_factory_get ();
 
   /* signal for unique changes */
-  g_signal_connect (G_OBJECT (dialog->factory), "unique-changed", G_CALLBACK (panel_item_dialog_unique_changed), dialog);
+  g_signal_connect (G_OBJECT (dialog->factory), "unique-changed", 
+      G_CALLBACK (panel_item_dialog_unique_changed), dialog);
 
   /* setup dialog */
   gtk_window_set_title (GTK_WINDOW (dialog), _("Xfce Panel Item Browser"));
-  xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (dialog), _("Add new plugins to your Xfce panels"));
+  xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (dialog), 
+      _("Add new plugins to your Xfce panels"));
   gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_ADD);
   gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
   gtk_window_set_default_size (GTK_WINDOW (dialog), 350, 450);
@@ -242,7 +244,8 @@ panel_item_dialog_finalize (GObject *object)
   PanelItemDialog *dialog = PANEL_ITEM_DIALOG (object);
 
   /* disconnect unique-changed signal */
-  g_signal_handlers_disconnect_by_func (G_OBJECT (dialog->factory), panel_item_dialog_unique_changed, dialog);
+  g_signal_handlers_disconnect_by_func (G_OBJECT (dialog->factory), 
+      panel_item_dialog_unique_changed, dialog);
 
   /* make the windows sensitive again */
   panel_application_windows_sensitive (dialog->application, TRUE);
@@ -306,7 +309,8 @@ panel_item_dialog_unique_changed (PanelModuleFactory *factory,
   panel_return_if_fail (GTK_IS_LIST_STORE (dialog->store));
 
   /* search the module and update its sensitivity */
-  gtk_tree_model_foreach (GTK_TREE_MODEL (dialog->store), panel_item_dialog_unique_changed_foreach, module);
+  gtk_tree_model_foreach (GTK_TREE_MODEL (dialog->store), 
+      panel_item_dialog_unique_changed_foreach, module);
 }
 
 
@@ -473,7 +477,8 @@ panel_item_dialog_drag_data_get (GtkWidget        *treeview,
       internal_name = panel_module_get_name (module);
 
       /* set the selection data */
-      gtk_selection_data_set (selection_data, selection_data->target, 8, (guchar *) internal_name, strlen (internal_name));
+      gtk_selection_data_set (selection_data, selection_data->target, 8, 
+          (guchar *) internal_name, strlen (internal_name));
 
       /* release module */
       g_object_unref (G_OBJECT (module));
@@ -505,9 +510,9 @@ panel_item_dialog_populate_store (PanelItemDialog *dialog)
 
       /* insert in the store */
       gtk_list_store_insert_with_values (dialog->store, &iter, n,
-                                         COLUMN_MODULE, module,
-                                         COLUMN_ICON_NAME, panel_module_get_icon_name (module),
-                                         COLUMN_SENSITIVE, panel_module_is_usable (module), -1);
+          COLUMN_MODULE, module,
+          COLUMN_ICON_NAME, panel_module_get_icon_name (module),
+          COLUMN_SENSITIVE, panel_module_is_usable (module), -1);
     }
 
   /* cleanup */
@@ -515,7 +520,8 @@ panel_item_dialog_populate_store (PanelItemDialog *dialog)
 
   /* add an empty item for separator in 2nd position */
   if (panel_module_factory_has_launcher (dialog->factory))
-    gtk_list_store_insert_with_values (dialog->store, &iter, 1, COLUMN_MODULE, NULL, -1);
+    gtk_list_store_insert_with_values (dialog->store, &iter, 1, 
+                                       COLUMN_MODULE, NULL, -1);
 }
 
 
@@ -705,7 +711,8 @@ panel_item_dialog_show (PanelWindow *active)
     active = panel_application_get_window (dialog->application, 0);
 
   /* show the dialog on the same screen as the panel */
-  gtk_window_set_screen (GTK_WINDOW (dialog), gtk_widget_get_screen (GTK_WIDGET (active)));
+  gtk_window_set_screen (GTK_WINDOW (dialog), 
+      gtk_widget_get_screen (GTK_WIDGET (active)));
 
   /* show the dialog */
   gtk_widget_show (GTK_WIDGET (dialog));
diff --git a/panel/panel-module-factory.c b/panel/panel-module-factory.c
index 747280c..82e0a4e 100644
--- a/panel/panel-module-factory.c
+++ b/panel/panel-module-factory.c
@@ -112,7 +112,8 @@ panel_module_factory_init (PanelModuleFactory *factory)
   factory->has_launcher = FALSE;
 
   /* create hash tables */
-  factory->modules = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
+  factory->modules = g_hash_table_new_full (g_str_hash, g_str_equal, 
+                                            g_free, g_object_unref);
 
   /* load all the modules */
   panel_module_factory_load_modules (factory);
@@ -257,7 +258,9 @@ panel_module_factory_modules_cleanup (gpointer key,
   remove_from_table = !panel_module_is_valid (module);
 
   /* if we're going to remove this item, check if it's the launcher */
-  if (remove_from_table && exo_str_is_equal (LAUNCHER_PLUGIN_NAME, panel_module_get_name (module)))
+  if (remove_from_table 
+      && exo_str_is_equal (LAUNCHER_PLUGIN_NAME, 
+                           panel_module_get_name (module)))
     factory->has_launcher = FALSE;
 
   return remove_from_table;
@@ -347,14 +350,19 @@ GList *
 panel_module_factory_get_modules (PanelModuleFactory *factory)
 {
   panel_return_val_if_fail (PANEL_IS_MODULE_FACTORY (factory), NULL);
+  
+  /* scan the resource directories again */
+  panel_module_factory_load_modules (factory);
 
   /* make sure the hash table is clean */
-  g_hash_table_foreach_remove (factory->modules, panel_module_factory_modules_cleanup, factory);
+  g_hash_table_foreach_remove (factory->modules, 
+      panel_module_factory_modules_cleanup, factory);
 
 #if !GLIB_CHECK_VERSION (2,14,0)
   GList *value = NULL;
 
-  g_hash_table_foreach (factory->modules, panel_module_factory_get_modules_foreach, &value);
+  g_hash_table_foreach (factory->modules, 
+      panel_module_factory_get_modules_foreach, &value);
 
   return value;
 #else
@@ -387,7 +395,8 @@ panel_module_factory_get_plugin (PanelModuleFactory *factory,
 
   /* traverse the list to find the plugin with this unique id */
   for (li = factory->plugins; li != NULL; li = li->next)
-    if (xfce_panel_plugin_provider_get_unique_id (XFCE_PANEL_PLUGIN_PROVIDER (li->data)) == unique_id)
+    if (xfce_panel_plugin_provider_get_unique_id (
+        XFCE_PANEL_PLUGIN_PROVIDER (li->data)) == unique_id)
       return GTK_WIDGET (li->data);
 
   return NULL;
diff --git a/panel/panel-module.c b/panel/panel-module.c
index c35d2e0..be4d50f 100644
--- a/panel/panel-module.c
+++ b/panel/panel-module.c
@@ -399,7 +399,8 @@ panel_module_new_plugin (PanelModule  *module,
       module->use_count++;
 
       /* handle module use count and unloading */
-      g_object_weak_ref (G_OBJECT (plugin), panel_module_plugin_destroyed, module);
+      g_object_weak_ref (G_OBJECT (plugin), 
+          panel_module_plugin_destroyed, module);
 
       /* emit unique-changed if the plugin is unique */
       if (module->is_unique)



More information about the Xfce4-commits mailing list