[Xfce4-commits] <xfce4-panel:devel> Cleanup some panel code.

Nick Schermer nick at xfce.org
Tue Aug 11 20:30:28 CEST 2009


Updating branch refs/heads/devel
         to acae8be1444aea859eb2cd99ac992d1cfa4edfa7 (commit)
       from 2d37dbb817ba3a00227d7d041cc1fe99bcf63c6c (commit)

commit acae8be1444aea859eb2cd99ac992d1cfa4edfa7
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Mar 15 16:15:26 2009 +0100

    Cleanup some panel code.

 libxfce4panel/xfce-panel-plugin-provider.h |   14 ++--
 panel/panel-application.c                  |   15 ++---
 panel/panel-dbus-service.c                 |    4 +-
 panel/panel-item-dialog.c                  |   14 ++--
 panel/panel-module-factory.c               |   26 ++++----
 panel/panel-module-factory.h               |   28 +++++-----
 panel/panel-module.c                       |   85 +++++++++++-----------------
 panel/panel-module.h                       |   31 +++++-----
 panel/panel-plugin-external.c              |   18 +++---
 panel/panel-plugin-external.h              |   13 ++--
 panel/panel-preferences-dialog.c           |    4 +-
 wrapper/wrapper-module.c                   |   10 ++--
 12 files changed, 119 insertions(+), 143 deletions(-)

diff --git a/libxfce4panel/xfce-panel-plugin-provider.h b/libxfce4panel/xfce-panel-plugin-provider.h
index b0cf04a..b3ed0fc 100644
--- a/libxfce4panel/xfce-panel-plugin-provider.h
+++ b/libxfce4panel/xfce-panel-plugin-provider.h
@@ -35,13 +35,13 @@ typedef enum   _XfcePanelPluginProviderSignal XfcePanelPluginProviderSignal;
 #define XFCE_PANEL_PLUGIN_PROVIDER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), XFCE_TYPE_PANEL_PLUGIN_PROVIDER, XfcePanelPluginProviderIface))
 
 /* plugin module functions */
-typedef XfcePanelPluginProvider *(*PluginConstructFunc)   (const gchar  *name,
-                                                           gint          unique_id,
-                                                           const gchar  *display_name,
-                                                           gchar       **arguments,
-                                                           GdkScreen    *screen);
-typedef GType                     (*PluginInitializeFunc) (GTypeModule  *module,
-                                                           gboolean     *make_resident);
+typedef GtkWidget *(*PluginConstructFunc)   (const gchar  *name,
+                                             gint          unique_id,
+                                             const gchar  *display_name,
+                                             gchar       **arguments,
+                                             GdkScreen    *screen);
+typedef GType      (*PluginInitializeFunc)  (GTypeModule  *module,
+                                             gboolean     *make_resident);
 
 struct _XfcePanelPluginProviderIface
 {
diff --git a/panel/panel-application.c b/panel/panel-application.c
index a36593a..ddb0fe7 100644
--- a/panel/panel-application.c
+++ b/panel/panel-application.c
@@ -539,8 +539,7 @@ panel_application_plugin_insert (PanelApplication  *application,
                                  gchar            **arguments,
                                  gint               position)
 {
-  GtkWidget               *itembar;
-  XfcePanelPluginProvider *provider;
+  GtkWidget *itembar, *provider;
 
   panel_return_val_if_fail (PANEL_IS_APPLICATION (application), FALSE);
   panel_return_val_if_fail (PANEL_IS_WINDOW (window), FALSE);
@@ -548,9 +547,9 @@ panel_application_plugin_insert (PanelApplication  *application,
   panel_return_val_if_fail (name != NULL, FALSE);
 
   /* create a new panel plugin */
-  provider = panel_module_factory_create_plugin (application->factory,
-                                                 screen, name, unique_id,
-                                                 arguments);
+  provider = panel_module_factory_new_plugin (application->factory,
+                                              name, screen, unique_id,
+                                              arguments);
   if (G_UNLIKELY (provider == NULL))
     return FALSE;
 
@@ -558,7 +557,7 @@ panel_application_plugin_insert (PanelApplication  *application,
    * new plugin is created */
   if (G_UNLIKELY (unique_id == -1))
     {
-      unique_id = xfce_panel_plugin_provider_get_unique_id (provider);
+      unique_id = xfce_panel_plugin_provider_get_unique_id (XFCE_PANEL_PLUGIN_PROVIDER (provider));
       panel_application_plugin_delete_config (application, name, unique_id);
     }
 
@@ -574,10 +573,10 @@ panel_application_plugin_insert (PanelApplication  *application,
                         GTK_WIDGET (provider), position);
 
   /* send all the needed info about the panel to the plugin */
-  panel_glue_set_provider_info (provider, window);
+  panel_glue_set_provider_info (XFCE_PANEL_PLUGIN_PROVIDER (provider), window);
 
   /* show the plugin */
-  gtk_widget_show (GTK_WIDGET (provider));
+  gtk_widget_show (provider);
 
   return TRUE;
 }
diff --git a/panel/panel-dbus-service.c b/panel/panel-dbus-service.c
index 779c6ef..62e7d92 100644
--- a/panel/panel-dbus-service.c
+++ b/panel/panel-dbus-service.c
@@ -314,8 +314,8 @@ panel_dbus_service_plugin_provider_signal (PanelDBusService *service,
                                            gint              provider_signal,
                                            GError           *error)
 {
-  PanelModuleFactory      *factory;
-  XfcePanelPluginProvider *provider;
+  PanelModuleFactory *factory;
+  GtkWidget          *provider;
 
   panel_return_val_if_fail (PANEL_IS_DBUS_SERVICE (service), FALSE);
   panel_return_val_if_fail (plugin_id != -1, FALSE);
diff --git a/panel/panel-item-dialog.c b/panel/panel-item-dialog.c
index 9c03e75..247bd5e 100644
--- a/panel/panel-item-dialog.c
+++ b/panel/panel-item-dialog.c
@@ -470,7 +470,7 @@ panel_item_dialog_drag_data_get (GtkWidget        *treeview,
   if (G_LIKELY (module))
     {
       /* get the internal module name */
-      internal_name = panel_module_get_internal_name (module);
+      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));
@@ -541,12 +541,12 @@ panel_item_dialog_compare_func (GtkTreeModel *model,
       /* don't move the separator */
       result = 0;
     }
-  else if (exo_str_is_equal (LAUNCHER_PLUGIN_NAME, panel_module_get_internal_name (module_a)))
+  else if (exo_str_is_equal (LAUNCHER_PLUGIN_NAME, panel_module_get_name (module_a)))
     {
       /* move the launcher to the first position */
       result = -1;
     }
-  else if (exo_str_is_equal (LAUNCHER_PLUGIN_NAME, panel_module_get_internal_name (module_b)))
+  else if (exo_str_is_equal (LAUNCHER_PLUGIN_NAME, panel_module_get_name (module_b)))
     {
       /* move the launcher to the first position */
       result = 1;
@@ -554,8 +554,8 @@ panel_item_dialog_compare_func (GtkTreeModel *model,
   else
     {
       /* get the visible module names */
-      name_a = panel_module_get_name (module_a);
-      name_b = panel_module_get_name (module_b);
+      name_a = panel_module_get_display_name (module_a);
+      name_b = panel_module_get_display_name (module_b);
 
       /* get sort order */
       if (G_LIKELY (name_a && name_b))
@@ -610,7 +610,7 @@ panel_item_dialog_visible_func (GtkTreeModel *model,
   text_casefolded = g_utf8_casefold (normalized, -1);
   g_free (normalized);
 
-  name = panel_module_get_name (module);
+  name = panel_module_get_display_name (module);
   if (G_LIKELY (name != NULL))
     {
       /* casefold the name */
@@ -671,7 +671,7 @@ panel_item_dialog_text_renderer (GtkTreeViewColumn *column,
     return;
 
   /* get module info */
-  name = panel_module_get_name (module);
+  name = panel_module_get_display_name (module);
   comment = panel_module_get_comment (module);
 
   /* create the markup string */
diff --git a/panel/panel-module-factory.c b/panel/panel-module-factory.c
index 81b456f..747280c 100644
--- a/panel/panel-module-factory.c
+++ b/panel/panel-module-factory.c
@@ -257,7 +257,7 @@ 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_internal_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;
@@ -376,7 +376,7 @@ panel_module_factory_has_module (PanelModuleFactory *factory,
 
 
 
-XfcePanelPluginProvider *
+GtkWidget *
 panel_module_factory_get_plugin (PanelModuleFactory *factory,
                                  gint                unique_id)
 {
@@ -388,23 +388,23 @@ 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)
-      return XFCE_PANEL_PLUGIN_PROVIDER (li->data);
+      return GTK_WIDGET (li->data);
 
   return NULL;
 }
 
 
 
-XfcePanelPluginProvider *
-panel_module_factory_create_plugin (PanelModuleFactory  *factory,
-                                    GdkScreen           *screen,
-                                    const gchar         *name,
-                                    gint                 unique_id,
-                                    gchar              **arguments)
+GtkWidget *
+panel_module_factory_new_plugin (PanelModuleFactory  *factory,
+                                 const gchar         *name,
+                                 GdkScreen           *screen,
+                                 gint                 unique_id,
+                                 gchar              **arguments)
 {
-  PanelModule             *module;
-  XfcePanelPluginProvider *provider;
-  static gint              unique_id_counter = 0;
+  PanelModule *module;
+  GtkWidget   *provider;
+  static gint  unique_id_counter = 0;
 
   panel_return_val_if_fail (PANEL_IS_MODULE_FACTORY (factory), NULL);
   panel_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
@@ -426,7 +426,7 @@ panel_module_factory_create_plugin (PanelModuleFactory  *factory,
     unique_id = ++unique_id_counter;
 
   /* create the new module */
-  provider = panel_module_create_plugin (module, screen, name, unique_id, arguments);
+  provider = panel_module_new_plugin (module, screen, unique_id, arguments);
 
   /* insert plugin in the list */
   if (G_LIKELY (provider))
diff --git a/panel/panel-module-factory.h b/panel/panel-module-factory.h
index e21c083..21cc7dc 100644
--- a/panel/panel-module-factory.h
+++ b/panel/panel-module-factory.h
@@ -39,27 +39,27 @@ typedef struct _PanelModuleFactory      PanelModuleFactory;
 
 #define LAUNCHER_PLUGIN_NAME "launcher"
 
-GType                    panel_module_factory_get_type            (void) G_GNUC_CONST;
+GType               panel_module_factory_get_type            (void) G_GNUC_CONST;
 
-PanelModuleFactory      *panel_module_factory_get                 (void);
+PanelModuleFactory *panel_module_factory_get                 (void);
 
-gboolean                 panel_module_factory_has_launcher        (PanelModuleFactory  *factory);
+gboolean            panel_module_factory_has_launcher        (PanelModuleFactory  *factory);
 
-void                     panel_module_factory_emit_unique_changed (PanelModule         *module);
+void                panel_module_factory_emit_unique_changed (PanelModule         *module);
 
-GList                   *panel_module_factory_get_modules         (PanelModuleFactory  *factory);
+GList              *panel_module_factory_get_modules         (PanelModuleFactory  *factory);
 
-gboolean                 panel_module_factory_has_module          (PanelModuleFactory  *factory,
-                                                                   const gchar         *name);
+gboolean            panel_module_factory_has_module          (PanelModuleFactory  *factory,
+                                                              const gchar         *name);
 
-XfcePanelPluginProvider *panel_module_factory_get_plugin          (PanelModuleFactory  *factory,
-                                                                   gint                 unique_id);
+GtkWidget          *panel_module_factory_get_plugin          (PanelModuleFactory  *factory,
+                                                              gint                 unique_id);
 
-XfcePanelPluginProvider *panel_module_factory_create_plugin       (PanelModuleFactory  *factory,
-                                                                   GdkScreen           *screen,
-                                                                   const gchar         *name,
-                                                                   gint                 unique_id,
-                                                                   gchar              **arguments);
+GtkWidget          *panel_module_factory_new_plugin          (PanelModuleFactory  *factory,
+                                                              const gchar         *name,
+                                                              GdkScreen           *screen,
+                                                              gint                 unique_id,
+                                                              gchar              **arguments);
 
 G_END_DECLS
 
diff --git a/panel/panel-module.c b/panel/panel-module.c
index 9ebfe65..1c1a890 100644
--- a/panel/panel-module.c
+++ b/panel/panel-module.c
@@ -71,7 +71,7 @@ struct _PanelModule
   gchar               *filename;
 
   /* plugin information from the desktop file */
-  gchar               *name;
+  gchar               *display_name;
   gchar               *comment;
   gchar               *icon_name;
 
@@ -120,7 +120,7 @@ panel_module_init (PanelModule *module)
   module->type = G_TYPE_NONE;
   module->filename = NULL;
   module->run_in_wrapper = TRUE;
-  module->name = NULL;
+  module->display_name = NULL;
   module->comment = NULL;
   module->icon_name = NULL;
   module->is_unique = FALSE;
@@ -149,7 +149,7 @@ panel_module_finalize (GObject *object)
 
   /* cleanup */
   g_free (module->filename);
-  g_free (module->name);
+  g_free (module->display_name);
   g_free (module->comment);
   g_free (module->icon_name);
 
@@ -226,15 +226,14 @@ panel_module_unload (GTypeModule *type_module)
 
 
 static void
-panel_module_item_finalized (gpointer  user_data,
-                             GObject  *item)
+panel_module_plugin_destroyed (gpointer  user_data,
+                               GObject  *where_the_plugin_was)
 {
   PanelModule *module = PANEL_MODULE (user_data);
 
   panel_return_if_fail (PANEL_IS_MODULE (module));
   panel_return_if_fail (G_IS_TYPE_MODULE (module));
   panel_return_if_fail (module->use_count > 0);
-  panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (item));
 
   /* decrease counter */
   module->use_count--;
@@ -302,8 +301,8 @@ panel_module_new_from_desktop_file (const gchar *filename,
           g_type_module_set_name (G_TYPE_MODULE (module), name);
 
           /* read the plugin name */
-          value = xfce_rc_read_entry (rc, "Name", NULL);
-          module->name = g_strdup (value);
+          value = xfce_rc_read_entry (rc, "Name", name);
+          module->display_name = g_strdup (value);
 
           /* read the plugin comment */
           value = xfce_rc_read_entry (rc, "Comment", NULL);
@@ -340,31 +339,31 @@ panel_module_new_from_desktop_file (const gchar *filename,
 
 
 
-XfcePanelPluginProvider *
-panel_module_create_plugin (PanelModule  *module,
-                            GdkScreen    *screen,
-                            const gchar  *name,
-                            gint          unique_id,
-                            gchar       **arguments)
+GtkWidget *
+panel_module_new_plugin (PanelModule  *module,
+                         GdkScreen    *screen,
+                         gint          unique_id,
+                         gchar       **arguments)
 {
-  XfcePanelPluginProvider *plugin = NULL;
+  GtkWidget   *plugin = NULL;
+  const gchar *name;
 
   panel_return_val_if_fail (PANEL_IS_MODULE (module), NULL);
   panel_return_val_if_fail (G_IS_TYPE_MODULE (module), NULL);
   panel_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-  panel_return_val_if_fail (IS_STRING (name), NULL);
   panel_return_val_if_fail (unique_id != -1, NULL);
-  panel_return_val_if_fail (exo_str_is_equal (name,
-                            G_TYPE_MODULE (module)->name), NULL);
 
   /* return null if the module is not usable (unique and already used) */
   if (G_UNLIKELY (panel_module_is_usable (module) == FALSE))
     return NULL;
+  
+  /* get the internal plugin name */
+  name = panel_module_get_name (module);
 
   if (module->run_in_wrapper)
     {
       /* create external plugin */
-      plugin = panel_plugin_external_new (module, name, unique_id, arguments);
+      plugin = panel_plugin_external_new (module, unique_id, arguments);
     }
   else
     {
@@ -372,35 +371,30 @@ panel_module_create_plugin (PanelModule  *module,
       if (g_type_module_use (G_TYPE_MODULE (module)))
         {
           if (module->type != G_TYPE_NONE)
-            {g_message ("New plugin from object");
+            {
               plugin = g_object_new (module->type,
                                      "name", name,
                                      "unique-id", unique_id,
-                                     "display-name", module->name,
+                                     "display-name", module->display_name,
                                      "arguments", arguments, NULL);
             }
-          else
-            {g_message ("New plugin from construct function");
+          else if (module->construct_func != NULL)
+            {
               /* create a new panel plugin */
-              panel_return_val_if_fail (module->construct_func != NULL, NULL);
-              plugin = (*module->construct_func) (name, unique_id, module->name,
+              plugin = (*module->construct_func) (name, unique_id, 
+                                                  module->display_name,
                                                   arguments, screen);
             }
         }
-      else
-        {
-          /* this should never happen */
-          panel_assert_not_reached ();
-        }
     }
 
-  if (G_LIKELY (plugin))
+  if (G_LIKELY (plugin != NULL))
     {
       /* increase count */
       module->use_count++;
 
       /* handle module use count and unloading */
-      g_object_weak_ref (G_OBJECT (plugin), panel_module_item_finalized, 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)
@@ -421,7 +415,7 @@ panel_module_create_plugin (PanelModule  *module,
 
 
 const gchar *
-panel_module_get_internal_name (PanelModule *module)
+panel_module_get_name (PanelModule *module)
 {
   panel_return_val_if_fail (PANEL_IS_MODULE (module), NULL);
   panel_return_val_if_fail (G_IS_TYPE_MODULE (module), NULL);
@@ -432,7 +426,7 @@ panel_module_get_internal_name (PanelModule *module)
 
 
 const gchar *
-panel_module_get_library_filename (PanelModule *module)
+panel_module_get_filename (PanelModule *module)
 {
   panel_return_val_if_fail (PANEL_IS_MODULE (module), NULL);
   panel_return_val_if_fail (G_IS_TYPE_MODULE (module), NULL);
@@ -443,22 +437,13 @@ panel_module_get_library_filename (PanelModule *module)
 
 
 const gchar *
-panel_module_get_name (PanelModule *module)
+panel_module_get_display_name (PanelModule *module)
 {
-  const gchar *name;
-
   panel_return_val_if_fail (PANEL_IS_MODULE (module), NULL);
   panel_return_val_if_fail (G_IS_TYPE_MODULE (module), NULL);
+  panel_return_val_if_fail (g_utf8_validate (module->display_name, -1, NULL), NULL);
 
-  if (module->name != NULL)
-    name = module->name;
-  else
-    name = G_TYPE_MODULE (module)->name;
-
-  panel_return_val_if_fail (name != NULL
-                            && g_utf8_validate (name, -1, NULL), NULL);
-
-  return name;
+  return module->display_name;
 }
 
 
@@ -467,9 +452,7 @@ const gchar *
 panel_module_get_comment (PanelModule *module)
 {
   panel_return_val_if_fail (PANEL_IS_MODULE (module), NULL);
-  panel_return_val_if_fail (module->comment == NULL
-                            || g_utf8_validate (module->comment, -1,
-                                                NULL), NULL);
+  panel_return_val_if_fail (g_utf8_validate (module->comment, -1, NULL), NULL);
 
   return module->comment;
 }
@@ -480,9 +463,7 @@ const gchar *
 panel_module_get_icon_name (PanelModule *module)
 {
   panel_return_val_if_fail (PANEL_IS_MODULE (module), NULL);
-  panel_return_val_if_fail (module->icon_name == NULL
-                            || g_utf8_validate (module->icon_name, -1,
-                                                NULL), NULL);
+  panel_return_val_if_fail (g_utf8_validate (module->icon_name, -1, NULL), NULL);
 
   return module->icon_name;
 }
diff --git a/panel/panel-module.h b/panel/panel-module.h
index 671dd6c..16b54f8 100644
--- a/panel/panel-module.h
+++ b/panel/panel-module.h
@@ -38,32 +38,31 @@ typedef struct _PanelModule      PanelModule;
 
 
 
-GType                    panel_module_get_type                  (void) G_GNUC_CONST;
+GType        panel_module_get_type                 (void) G_GNUC_CONST;
 
-PanelModule             *panel_module_new_from_desktop_file     (const gchar             *filename,
-                                                                 const gchar             *name);
+PanelModule *panel_module_new_from_desktop_file    (const gchar             *filename,
+                                                    const gchar             *name);
 
-XfcePanelPluginProvider *panel_module_create_plugin             (PanelModule             *module,
-                                                                 GdkScreen               *screen,
-                                                                 const gchar             *name,
-                                                                 gint                     unique_id,
-                                                                 gchar                  **arguments);
+GtkWidget   *panel_module_new_plugin               (PanelModule             *module,
+                                                    GdkScreen               *screen,
+                                                    gint                     unique_id,
+                                                    gchar                  **arguments);
 
-const gchar             *panel_module_get_internal_name         (PanelModule             *module);
+const gchar *panel_module_get_name                 (PanelModule             *module);
 
-const gchar             *panel_module_get_library_filename      (PanelModule             *module);
+const gchar *panel_module_get_filename             (PanelModule             *module);
 
-const gchar             *panel_module_get_name                  (PanelModule             *module);
+const gchar *panel_module_get_display_name         (PanelModule             *module);
 
-const gchar             *panel_module_get_comment               (PanelModule             *module);
+const gchar *panel_module_get_comment              (PanelModule             *module);
 
-const gchar             *panel_module_get_icon_name             (PanelModule             *module);
+const gchar *panel_module_get_icon_name            (PanelModule             *module);
 
-PanelModule             *panel_module_get_from_plugin_provider  (XfcePanelPluginProvider *provider);
+PanelModule *panel_module_get_from_plugin_provider (XfcePanelPluginProvider *provider);
 
-gboolean                 panel_module_is_valid                  (PanelModule             *module);
+gboolean     panel_module_is_valid                 (PanelModule             *module);
 
-gboolean                 panel_module_is_usable                 (PanelModule             *module);
+gboolean     panel_module_is_usable                (PanelModule             *module);
 
 G_END_DECLS
 
diff --git a/panel/panel-plugin-external.c b/panel/panel-plugin-external.c
index 93c37c3..a8d4a89 100644
--- a/panel/panel-plugin-external.c
+++ b/panel/panel-plugin-external.c
@@ -234,13 +234,13 @@ panel_plugin_external_realize (GtkWidget *widget)
   /* setup the basic argv */
   argv[0]  = (gchar *) LIBEXECDIR "/xfce4-panel-wrapper";
   argv[1]  = (gchar *) "-n";
-  argv[2]  = (gchar *) panel_module_get_internal_name (external->module);
+  argv[2]  = (gchar *) panel_module_get_name (external->module);
   argv[3]  = (gchar *) "-i";
   argv[4]  = (gchar *) unique_id;
   argv[5]  = (gchar *) "-d";
-  argv[6]  = (gchar *) panel_module_get_name (external->module);
+  argv[6]  = (gchar *) panel_module_get_display_name (external->module);
   argv[7]  = (gchar *) "-f";
-  argv[8]  = (gchar *) panel_module_get_library_filename (external->module);
+  argv[8]  = (gchar *) panel_module_get_filename (external->module);
   argv[9]  = (gchar *) "-s";
   argv[10] = (gchar *) socket_id;
 
@@ -329,7 +329,7 @@ panel_plugin_external_plug_removed (GtkSocket *socket)
                                        GTK_DIALOG_DESTROY_WITH_PARENT,
                                        GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
                                        _("Plugin '%s' unexpectedly left the building, do you want to restart it?"),
-                                       panel_module_get_name (external->module));
+                                       panel_module_get_display_name (external->module));
       gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), _("If you press Execute "
                                                 "the panel will try to restart the plugin otherwise it "
                                                 "will be permanently removed from the panel."));
@@ -352,7 +352,7 @@ panel_plugin_external_plug_removed (GtkSocket *socket)
 
       /* print a message we did an autorestart */
       g_message ("Automatically restarting plugin %s-%d, try %d",
-                 panel_module_get_internal_name (external->module),
+                 panel_module_get_name (external->module),
                  external->unique_id, external->n_restarts);
   }
 
@@ -463,7 +463,7 @@ panel_plugin_external_get_name (XfcePanelPluginProvider *provider)
   panel_return_val_if_fail (PANEL_IS_PLUGIN_EXTERNAL (provider), NULL);
   panel_return_val_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider), NULL);
 
-  return panel_module_get_internal_name (PANEL_PLUGIN_EXTERNAL (provider)->module);
+  return panel_module_get_name (PANEL_PLUGIN_EXTERNAL (provider)->module);
 }
 
 
@@ -686,16 +686,14 @@ panel_plugin_external_set_sensitive (PanelPluginExternal *external)
 
 
 
-XfcePanelPluginProvider *
+GtkWidget *
 panel_plugin_external_new (PanelModule  *module,
-                           const gchar  *name,
                            gint          unique_id,
                            gchar       **arguments)
 {
   PanelPluginExternal *external;
 
   panel_return_val_if_fail (PANEL_IS_MODULE (module), NULL);
-  panel_return_val_if_fail (name != NULL, NULL);
   panel_return_val_if_fail (unique_id != -1, NULL);
 
   /* create new object */
@@ -706,7 +704,7 @@ panel_plugin_external_new (PanelModule  *module,
   external->module = g_object_ref (G_OBJECT (module));
   external->arguments = g_strdupv (arguments);
 
-  return XFCE_PANEL_PLUGIN_PROVIDER (external);
+  return GTK_WIDGET (external);
 }
 
 
diff --git a/panel/panel-plugin-external.h b/panel/panel-plugin-external.h
index 2943f03..d0230a6 100644
--- a/panel/panel-plugin-external.h
+++ b/panel/panel-plugin-external.h
@@ -37,15 +37,14 @@ typedef struct _PanelPluginExternal      PanelPluginExternal;
 #define PANEL_IS_PLUGIN_EXTERNAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANEL_TYPE_PLUGIN_EXTERNAL))
 #define PANEL_PLUGIN_EXTERNAL_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), PANEL_TYPE_PLUGIN_EXTERNAL, PanelPluginExternalClass))
 
-GType                    panel_plugin_external_get_type             (void) G_GNUC_CONST;
+GType      panel_plugin_external_get_type             (void) G_GNUC_CONST;
 
-XfcePanelPluginProvider *panel_plugin_external_new                  (PanelModule          *module,
-                                                                     const gchar          *name,
-                                                                     gint                  unique_id,
-                                                                     gchar               **arguments);
+GtkWidget *panel_plugin_external_new                  (PanelModule          *module,
+                                                       gint                  unique_id,
+                                                       gchar               **arguments);
 
-void                     panel_plugin_external_set_background_alpha (PanelPluginExternal  *external,
-                                                                     gint                  percentage);
+void       panel_plugin_external_set_background_alpha (PanelPluginExternal  *external,
+                                                       gint                  percentage);
 
 G_END_DECLS
 
diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c
index b8a5f43..7e1a7f2 100644
--- a/panel/panel-preferences-dialog.c
+++ b/panel/panel-preferences-dialog.c
@@ -534,7 +534,7 @@ panel_preferences_dialog_item_store_rebuild (PanelPreferencesDialog *dialog)
                                          COLUMN_ICON_NAME,
                                          panel_module_get_icon_name (module),
                                          COLUMN_DISPLAY_NAME,
-                                         panel_module_get_name (module),
+                                         panel_module_get_display_name (module),
                                          COLUMN_PROVIDER, li->data, -1);
     }
 
@@ -648,7 +648,7 @@ panel_preferences_dialog_item_remove (GtkWidget              *button,
       /* create question dialog (same code is also in xfce-panel-plugin.c) */
       toplevel = gtk_widget_get_toplevel (button);
       widget = gtk_message_dialog_new (GTK_WINDOW (toplevel), GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
-                                       _("Are you sure that you want to remove \"%s\"?"), panel_module_get_name (module));
+                                       _("Are you sure that you want to remove \"%s\"?"), panel_module_get_display_name (module));
       gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (widget), _("If you remove the item from the panel, it is permanently lost."));
       gtk_dialog_add_buttons (GTK_DIALOG (widget), GTK_STOCK_CANCEL, GTK_RESPONSE_NO, GTK_STOCK_REMOVE, GTK_RESPONSE_YES, NULL);
       gtk_dialog_set_default_response (GTK_DIALOG (widget), GTK_RESPONSE_NO);
diff --git a/wrapper/wrapper-module.c b/wrapper/wrapper-module.c
index e625841..b7f3c62 100644
--- a/wrapper/wrapper-module.c
+++ b/wrapper/wrapper-module.c
@@ -210,7 +210,7 @@ wrapper_module_new_provider (WrapperModule  *module,
   if (g_type_module_use (G_TYPE_MODULE (module)))
     {
       if (module->type != G_TYPE_NONE)
-        {g_message ("New plugin from object");
+        {
           /* create the object */
           plugin = g_object_new (module->type,
                                  "name", name,
@@ -219,11 +219,11 @@ wrapper_module_new_provider (WrapperModule  *module,
                                  "arguments", arguments, NULL);
         }
       else if (module->construct_func != NULL)
-        {g_message ("New plugin from construct function");
+        {
           /* create a new panel plugin */
-          plugin = GTK_WIDGET ((*module->construct_func) (name, unique_id,
-                                                          display_name,
-                                                          arguments, screen));
+          plugin = (*module->construct_func) (name, unique_id,
+                                              display_name,
+                                              arguments, screen);
         }
 
       if (G_LIKELY (plugin != NULL))



More information about the Xfce4-commits mailing list