[Xfce4-commits] <xfce4-panel:devel> * "Remove panel item depended external code. It gives too much problems with items running in the wrapper and it is also a too advanced setting for normal users.

Nick Schermer nick at xfce.org
Tue Aug 11 20:22:14 CEST 2009


Updating branch refs/heads/devel
         to becbb87004cb3689e9039b75b4f49a334ecc9e88 (commit)
       from 30832eca84e77cea04419957e3bcf6ccb73f55c2 (commit)

commit becbb87004cb3689e9039b75b4f49a334ecc9e88
Author: Nick Schermer <nick at xfce.org>
Date:   Thu Jun 19 19:04:25 2008 +0200

    * "Remove panel item depended external code. It gives too
      much problems with items running in the wrapper and it
      is also a too advanced setting for normal users.

 libxfce4panel/xfce-panel-plugin-provider.c |   22 ++++++----------------
 libxfce4panel/xfce-panel-plugin-provider.h |    3 ---
 libxfce4panel/xfce-panel-plugin.c          |   10 ----------
 panel/panel-application.c                  |   17 ++++++-----------
 panel/panel-module-factory.c               |    5 ++---
 panel/panel-module-factory.h               |    3 +--
 panel/panel-module.c                       |   16 +++++-----------
 panel/panel-module.h                       |   11 ++---------
 8 files changed, 22 insertions(+), 65 deletions(-)

diff --git a/libxfce4panel/xfce-panel-plugin-provider.c b/libxfce4panel/xfce-panel-plugin-provider.c
index f088481..7819be8 100644
--- a/libxfce4panel/xfce-panel-plugin-provider.c
+++ b/libxfce4panel/xfce-panel-plugin-provider.c
@@ -90,7 +90,7 @@ xfce_panel_plugin_provider_base_init (gpointer klass)
                       0, NULL, NULL,
                       g_cclosure_marshal_VOID__BOOLEAN,
                       G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
-                      
+
       provider_signals[MOVE] =
         g_signal_new (I_("move-item"),
                       G_TYPE_FROM_CLASS (klass),
@@ -98,7 +98,7 @@ xfce_panel_plugin_provider_base_init (gpointer klass)
                       0, NULL, NULL,
                       g_cclosure_marshal_VOID__VOID,
                       G_TYPE_NONE, 0);
-                      
+
       provider_signals[ADD_NEW_ITEMS] =
         g_signal_new (I_("add-new-items"),
                       G_TYPE_FROM_CLASS (klass),
@@ -106,7 +106,7 @@ xfce_panel_plugin_provider_base_init (gpointer klass)
                       0, NULL, NULL,
                       g_cclosure_marshal_VOID__VOID,
                       G_TYPE_NONE, 0);
-                      
+
       provider_signals[CUSTOMIZE_PANEL] =
         g_signal_new (I_("customize-panel"),
                       G_TYPE_FROM_CLASS (klass),
@@ -122,21 +122,11 @@ xfce_panel_plugin_provider_base_init (gpointer klass)
 
 
 
-gboolean
-xfce_panel_plugin_provider_is_external (XfcePanelPluginProvider *provider)
-{
-  g_return_val_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider), TRUE);
-  
-  return (XFCE_PANEL_PLUGIN_PROVIDER_GET_IFACE (provider)->is_external) ();
-}
-
-
-
 const gchar *
 xfce_panel_plugin_provider_get_name (XfcePanelPluginProvider *provider)
 {
   g_return_val_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider), NULL);
-  
+
   return (*XFCE_PANEL_PLUGIN_PROVIDER_GET_IFACE (provider)->get_name) (provider);
 }
 
@@ -146,7 +136,7 @@ const gchar *
 xfce_panel_plugin_provider_get_id (XfcePanelPluginProvider *provider)
 {
   g_return_val_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider), NULL);
-  
+
   return (*XFCE_PANEL_PLUGIN_PROVIDER_GET_IFACE (provider)->get_id) (provider);
 }
 
@@ -174,7 +164,7 @@ xfce_panel_plugin_provider_set_orientation (XfcePanelPluginProvider *provider,
 
 
 
-void            
+void
 xfce_panel_plugin_provider_set_screen_position (XfcePanelPluginProvider *provider,
                                                 XfceScreenPosition       screen_position)
 {
diff --git a/libxfce4panel/xfce-panel-plugin-provider.h b/libxfce4panel/xfce-panel-plugin-provider.h
index 9d430db..8d68eed 100644
--- a/libxfce4panel/xfce-panel-plugin-provider.h
+++ b/libxfce4panel/xfce-panel-plugin-provider.h
@@ -61,7 +61,6 @@ struct _XfcePanelPluginProviderIface
   GTypeInterface __parent__;
 
   /*< public >*/
-  gboolean     (*is_external)         (void);
   const gchar *(*get_name)            (XfcePanelPluginProvider *provider);
   const gchar *(*get_id)              (XfcePanelPluginProvider *provider);
   void         (*set_size)            (XfcePanelPluginProvider *provider,
@@ -76,8 +75,6 @@ struct _XfcePanelPluginProviderIface
 
 GType        xfce_panel_plugin_provider_get_type            (void) G_GNUC_CONST;
 
-gboolean     xfce_panel_plugin_provider_is_external         (XfcePanelPluginProvider *provider);
-
 const gchar *xfce_panel_plugin_provider_get_name            (XfcePanelPluginProvider *provider);
 
 const gchar *xfce_panel_plugin_provider_get_id              (XfcePanelPluginProvider *provider);
diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index 0ef83a9..19b974c 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -56,7 +56,6 @@ static void         xfce_panel_plugin_menu_remove          (XfcePanelPlugin
 static void         xfce_panel_plugin_menu_add_items       (XfcePanelPlugin              *plugin);
 static void         xfce_panel_plugin_menu_customize_panel (XfcePanelPlugin              *plugin);
 static GtkWidget   *xfce_panel_plugin_menu_new             (XfcePanelPlugin              *plugin);
-static gboolean     xfce_panel_plugin_is_external          (void);
 static gchar       *xfce_panel_plugin_relative_filename    (XfcePanelPlugin              *plugin);
 static void         xfce_panel_plugin_set_size             (XfcePanelPluginProvider      *provider,
                                                             gint                          size);
@@ -366,7 +365,6 @@ xfce_panel_plugin_init (XfcePanelPlugin *plugin)
 static void
 xfce_panel_plugin_provider_init (XfcePanelPluginProviderIface *iface)
 {
-  iface->is_external = xfce_panel_plugin_is_external;
   iface->get_name = (ProviderToPlugin) xfce_panel_plugin_get_name;
   iface->get_id = (ProviderToPlugin) xfce_panel_plugin_get_id;
   iface->set_size = xfce_panel_plugin_set_size;
@@ -740,14 +738,6 @@ xfce_panel_plugin_relative_filename (XfcePanelPlugin *plugin)
 
 
 
-static gboolean
-xfce_panel_plugin_is_external (void)
-{
-  return FALSE;
-}
-
-
-
 const gchar *
 xfce_panel_plugin_get_name (XfcePanelPlugin *plugin)
 {
diff --git a/panel/panel-application.c b/panel/panel-application.c
index 5ea5914..a099bc8 100644
--- a/panel/panel-application.c
+++ b/panel/panel-application.c
@@ -393,7 +393,6 @@ panel_application_insert_plugin (PanelApplication  *application,
                                  const gchar       *name,
                                  const gchar       *id,
                                  gchar            **arguments,
-                                 UseWrapper         use_wrapper,
                                  gint               position)
 {
   GtkWidget               *itembar;
@@ -410,7 +409,7 @@ panel_application_insert_plugin (PanelApplication  *application,
     id = panel_application_get_unique_id ();
 
   /* create a new panel plugin */
-  provider = panel_module_factory_create_plugin (application->factory, screen, name, id, arguments, use_wrapper);
+  provider = panel_module_factory_create_plugin (application->factory, screen, name, id, arguments);
 
   if (G_LIKELY (provider != NULL))
     {
@@ -454,7 +453,6 @@ panel_application_load_start_element (GMarkupParseContext  *context,
   const gchar *name = NULL;
   const gchar *value = NULL;
   const gchar *id = NULL;
-  UseWrapper   use_wrapper = FROM_DESKTOP_FILE;
 
   switch (parser->state)
     {
@@ -514,15 +512,13 @@ panel_application_load_start_element (GMarkupParseContext  *context,
                   name = attribute_values[n];
                 else if (exo_str_is_equal (attribute_names[n], "id"))
                   id = attribute_values[n];
-                else if (exo_str_is_equal (attribute_names[n], "external"))
-                  use_wrapper = exo_str_is_equal (attribute_values[n], "1") ? FORCE_EXTERNAL : FORCE_INTERNAL;
               }
 
             /* append the new plugin */
             if (G_LIKELY (name != NULL))
               panel_application_insert_plugin (parser->application, parser->window,
                                                gtk_window_get_screen (GTK_WINDOW (parser->window)),
-                                               name, id, NULL, use_wrapper, -1);
+                                               name, id, NULL, -1);
           }
         break;
 
@@ -664,10 +660,9 @@ panel_application_save_xml_contents (PanelApplication *application)
           provider = XFCE_PANEL_PLUGIN_PROVIDER (lp->data);
 
           /* store plugin name and id */
-          g_string_append_printf (contents, "\t\t\t<item name=\"%s\" id=\"%s\" external=\"%d\" />\n",
+          g_string_append_printf (contents, "\t\t\t<item name=\"%s\" id=\"%s\" />\n",
                                   xfce_panel_plugin_provider_get_name (provider),
-                                  xfce_panel_plugin_provider_get_id (provider),
-                                  xfce_panel_plugin_provider_is_external (provider));
+                                  xfce_panel_plugin_provider_get_id (provider));
         }
 
       /* cleanup */
@@ -842,7 +837,7 @@ panel_application_add_new_item (PanelApplication  *application,
 
       /* add the panel to the end of the choosen window */
       panel_application_insert_plugin (application, window, gtk_widget_get_screen (GTK_WIDGET (window)),
-                                       plugin_name, NULL, arguments, /* FROM_DESKTOP_FILE */ FORCE_EXTERNAL, -1);
+                                       plugin_name, NULL, arguments, -1);
     }
   else
     {
@@ -899,7 +894,7 @@ panel_application_drag_data_received (GtkWidget        *itembar,
 
             /* create a new item with a unique id */
             succeed = panel_application_insert_plugin (application, window, screen, name,
-                                                       NULL, NULL, FROM_DESKTOP_FILE, position);
+                                                       NULL, NULL, position);
           }
         break;
 
diff --git a/panel/panel-module-factory.c b/panel/panel-module-factory.c
index 5c25697..f8fb1c0 100644
--- a/panel/panel-module-factory.c
+++ b/panel/panel-module-factory.c
@@ -359,8 +359,7 @@ panel_module_factory_create_plugin (PanelModuleFactory  *factory,
                                     GdkScreen           *screen,
                                     const gchar         *name,
                                     const gchar         *id,
-                                    gchar              **arguments,
-                                    UseWrapper           use_wrapper)
+                                    gchar              **arguments)
 {
   PanelModule *module;
 
@@ -380,5 +379,5 @@ panel_module_factory_create_plugin (PanelModuleFactory  *factory,
     }
 
   /* create the new module */
-  return panel_module_create_plugin (module, screen, name, id, arguments, use_wrapper);
+  return panel_module_create_plugin (module, screen, name, id, arguments);
 }
diff --git a/panel/panel-module-factory.h b/panel/panel-module-factory.h
index 14f537a..835c828 100644
--- a/panel/panel-module-factory.h
+++ b/panel/panel-module-factory.h
@@ -54,8 +54,7 @@ XfcePanelPluginProvider *panel_module_factory_create_plugin       (PanelModuleFa
                                                                    GdkScreen           *screen,
                                                                    const gchar         *name,
                                                                    const gchar         *id,
-                                                                   gchar              **arguments,
-                                                                   UseWrapper           use_wrapper);
+                                                                   gchar              **arguments);
 
 G_END_DECLS
 
diff --git a/panel/panel-module.c b/panel/panel-module.c
index 892280c..0bdfd79 100644
--- a/panel/panel-module.c
+++ b/panel/panel-module.c
@@ -219,9 +219,8 @@ panel_module_item_finalized (gpointer  user_data,
   module->use_count--;
 
   /* unuse the library if the plugin runs internal */
-  /* TODO this needs to be fixed */
-  //if (!xfce_panel_plugin_provider_is_external (XFCE_PANEL_PLUGIN_PROVIDER (item)))
-  //  g_type_module_unuse (G_TYPE_MODULE (module));
+  if (module->run_in_wrapper == FALSE)
+    g_type_module_unuse (G_TYPE_MODULE (module));
 
   /* emit signal unique signal in the factory */
   if (module->is_unique)
@@ -324,11 +323,9 @@ panel_module_create_plugin (PanelModule  *module,
                             GdkScreen    *screen,
                             const gchar  *name,
                             const gchar  *id,
-                            gchar       **arguments,
-                            UseWrapper    use_wrapper)
+                            gchar       **arguments)
 {
   XfcePanelPluginProvider *plugin = NULL;
-  gboolean                 external;
 
   panel_return_val_if_fail (PANEL_IS_MODULE (module), NULL);
   panel_return_val_if_fail (G_IS_TYPE_MODULE (module), NULL);
@@ -341,10 +338,7 @@ panel_module_create_plugin (PanelModule  *module,
   if (G_UNLIKELY (panel_module_is_usable (module) == FALSE))
     return NULL;
 
-  /* whether we're going to start the module external */
-  external = !!(use_wrapper == FORCE_EXTERNAL || (use_wrapper == FROM_DESKTOP_FILE && module->run_in_wrapper));
-
-  if (external)
+  if (module->run_in_wrapper)
     {
       /* create external plugin */
       plugin = panel_plugin_external_new (module, name, id, arguments);
@@ -381,7 +375,7 @@ panel_module_create_plugin (PanelModule  *module,
       if (module->is_unique)
         panel_module_factory_emit_unique_changed (module);
     }
-  else if (external == FALSE)
+  else if (module->run_in_wrapper == FALSE)
     {
       /* decrease the use count since loading failed somehow */
       g_type_module_unuse (G_TYPE_MODULE (module));
diff --git a/panel/panel-module.h b/panel/panel-module.h
index 3d79db8..6ee283d 100644
--- a/panel/panel-module.h
+++ b/panel/panel-module.h
@@ -26,7 +26,6 @@ G_BEGIN_DECLS
 
 typedef struct _PanelModuleClass PanelModuleClass;
 typedef struct _PanelModule      PanelModule;
-typedef enum   _UseWrapper       UseWrapper;
 
 #define PANEL_TYPE_MODULE            (panel_module_get_type ())
 #define PANEL_MODULE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PANEL_TYPE_MODULE, PanelModule))
@@ -35,12 +34,7 @@ typedef enum   _UseWrapper       UseWrapper;
 #define PANEL_IS_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANEL_TYPE_MODULE))
 #define PANEL_MODULE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), PANEL_TYPE_MODULE, PanelModuleClass))
 
-enum _UseWrapper
-{
-  FROM_DESKTOP_FILE,
-  FORCE_INTERNAL,
-  FORCE_EXTERNAL
-};
+
 
 GType                    panel_module_get_type              (void) G_GNUC_CONST;
 
@@ -51,8 +45,7 @@ XfcePanelPluginProvider *panel_module_create_plugin         (PanelModule  *modul
                                                              GdkScreen    *screen,
                                                              const gchar  *name,
                                                              const gchar  *id,
-                                                             gchar       **arguments,
-                                                             UseWrapper    use_wrapper);
+                                                             gchar       **arguments);
 
 const gchar             *panel_module_get_internal_name     (PanelModule  *module);
 



More information about the Xfce4-commits mailing list