[Xfce4-commits] <xfce4-panel:devel> * Put provider signal in class_init. * Fix xfce_panel_plugin_unregister_menu and make if work with panel_window_{freeze, thaw}_autohide. * Set module name when dragging a plugin. * Make dbus defined in xfce-panel-plugin-provider.h * Show properties and items dialog on the correct screen. * Cleanup and refactor some code.

Nick Schermer nick at xfce.org
Tue Aug 11 20:24:06 CEST 2009


Updating branch refs/heads/devel
         to 237bf29fe98c24d133eb93bce09c16d02559fe47 (commit)
       from 4c097965d03178d992d3b122812d0241adfa7553 (commit)

commit 237bf29fe98c24d133eb93bce09c16d02559fe47
Author: Nick Schermer <nick at xfce.org>
Date:   Fri Aug 22 11:53:53 2008 +0200

    * Put provider signal in class_init.
    * Fix xfce_panel_plugin_unregister_menu and make if work with
      panel_window_{freeze,thaw}_autohide.
    * Set module name when dragging a plugin.
    * Make dbus defined in xfce-panel-plugin-provider.h
    * Show properties and items dialog on the correct screen.
    * Cleanup and refactor some code.

 libxfce4panel/xfce-panel-plugin-provider.c |   53 +++++++++-------------------
 libxfce4panel/xfce-panel-plugin-provider.h |   52 +++++++++++++++------------
 libxfce4panel/xfce-panel-plugin.c          |    9 ++---
 panel/panel-application.c                  |   39 ++++++++++++--------
 panel/panel-dbus-client.c                  |    4 +-
 panel/panel-dbus-service.c                 |   34 +++++++-----------
 panel/panel-dbus-service.h                 |    3 --
 panel/panel-glue.c                         |    2 +-
 panel/panel-item-dialog.c                  |   22 +++++++----
 panel/panel-item-dialog.h                  |    3 +-
 panel/panel-module.c                       |   25 +++++++++++++
 panel/panel-module.h                       |   32 +++++++++--------
 panel/panel-plugin-external.c              |   50 +++++++++++++-------------
 panel/panel-preferences-dialog.c           |   21 ++++++-----
 panel/panel-window.c                       |    4 +-
 wrapper/main.c                             |    9 +++--
 16 files changed, 191 insertions(+), 171 deletions(-)

diff --git a/libxfce4panel/xfce-panel-plugin-provider.c b/libxfce4panel/xfce-panel-plugin-provider.c
index f95ab45..58746e8 100644
--- a/libxfce4panel/xfce-panel-plugin-provider.c
+++ b/libxfce4panel/xfce-panel-plugin-provider.c
@@ -38,7 +38,7 @@ enum
 
 
 
-static void xfce_panel_plugin_provider_base_init (gpointer klass);
+static void xfce_panel_plugin_provider_class_init (gpointer klass);
 
 
 
@@ -49,25 +49,14 @@ static guint provider_signals[LAST_SIGNAL];
 GType
 xfce_panel_plugin_provider_get_type (void)
 {
-  static GType type = G_TYPE_INVALID;
-
-  if (G_UNLIKELY (type == G_TYPE_INVALID))
-    {
-      static const GTypeInfo info =
-      {
-        sizeof (XfcePanelPluginProviderIface),
-        (GBaseInitFunc) xfce_panel_plugin_provider_base_init,
-        NULL,
-        NULL,
-        NULL,
-        NULL,
-        0,
-        0,
-        NULL,
-        NULL
-      };
-
-      type = g_type_register_static (G_TYPE_INTERFACE, I_("XfcePanelPluginProvider"), &info, 0);
+  static GType type = 0;
+
+  if (G_UNLIKELY (type == 0))
+    {      
+      type = g_type_register_static_simple (G_TYPE_INTERFACE, I_("XfcePanelPluginProvider"),
+						                                sizeof (XfcePanelPluginProviderIface),
+						                                (GClassInitFunc) xfce_panel_plugin_provider_class_init,
+						                                0, NULL, 0);
     }
 
   return type;
@@ -76,23 +65,15 @@ xfce_panel_plugin_provider_get_type (void)
 
 
 static void
-xfce_panel_plugin_provider_base_init (gpointer klass)
+xfce_panel_plugin_provider_class_init (gpointer klass)
 {
-  static gboolean initialized = FALSE;
-
-  if (G_UNLIKELY (!initialized))
-    {
-      provider_signals[PROVIDER_SIGNAL] =
-        g_signal_new (I_("provider-signal"),
-                      G_TYPE_FROM_CLASS (klass),
-                      G_SIGNAL_RUN_LAST,
-                      0, NULL, NULL,
-                      g_cclosure_marshal_VOID__UINT,
-                      G_TYPE_NONE, 1, G_TYPE_UINT);
-
-      /* initialization finished */
-      initialized = TRUE;
-    }
+  provider_signals[PROVIDER_SIGNAL] =
+    g_signal_new (I_("provider-signal"),
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  0, NULL, NULL,
+                  g_cclosure_marshal_VOID__UINT,
+                  G_TYPE_NONE, 1, G_TYPE_UINT);
 }
 
 
diff --git a/libxfce4panel/xfce-panel-plugin-provider.h b/libxfce4panel/xfce-panel-plugin-provider.h
index 239c0fe..2321124 100644
--- a/libxfce4panel/xfce-panel-plugin-provider.h
+++ b/libxfce4panel/xfce-panel-plugin-provider.h
@@ -25,37 +25,27 @@
 
 G_BEGIN_DECLS
 
-typedef struct _XfcePanelPluginProviderIface XfcePanelPluginProviderIface;
-typedef struct _XfcePanelPluginProvider      XfcePanelPluginProvider;
-typedef enum   _ProviderSignal               ProviderSignal;
+typedef struct _XfcePanelPluginProviderIface  XfcePanelPluginProviderIface;
+typedef struct _XfcePanelPluginProvider       XfcePanelPluginProvider;
+typedef enum   _XfcePanelPluginProviderSignal XfcePanelPluginProviderSignal;
 
+#define XFCE_TYPE_PANEL_PLUGIN_PROVIDER           (xfce_panel_plugin_provider_get_type ())
+#define XFCE_PANEL_PLUGIN_PROVIDER(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_PANEL_PLUGIN_PROVIDER, XfcePanelPluginProvider))
+#define XFCE_IS_PANEL_PLUGIN_PROVIDER(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_PANEL_PLUGIN_PROVIDER))
+#define XFCE_PANEL_PLUGIN_PROVIDER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), XFCE_TYPE_PANEL_PLUGIN_PROVIDER, XfcePanelPluginProviderIface))
+
+/* panel dbus names */
+#define PANEL_DBUS_SERVICE_INTERFACE "org.xfce.Panel"
+#define PANEL_DBUS_SERVICE_PATH      "/org/xfce/Panel"
+#define PANEL_DBUS_SERVICE_NAME      PANEL_DBUS_SERVICE_INTERFACE
+
+/* provider contruct function */
 typedef XfcePanelPluginProvider *(*PluginConstructFunc) (const gchar  *name,
                                                          const gchar  *id,
                                                          const gchar  *display_name,
                                                          gchar       **arguments,
                                                          GdkScreen    *screen);
 
-
-
-enum _ProviderSignal
-{
-  MOVE_PLUGIN,
-  EXPAND_PLUGIN,
-  COLLAPSE_PLUGIN,
-  LOCK_PANEL,
-  UNLOCK_PANEL,
-  REMOVE_PLUGIN,
-  ADD_NEW_ITEMS,
-  PANEL_PREFERENCES,
-};
-
-
-
-#define XFCE_TYPE_PANEL_PLUGIN_PROVIDER           (xfce_panel_plugin_provider_get_type ())
-#define XFCE_PANEL_PLUGIN_PROVIDER(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_PANEL_PLUGIN_PROVIDER, XfcePanelPluginProvider))
-#define XFCE_IS_PANEL_PLUGIN_PROVIDER(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_PANEL_PLUGIN_PROVIDER))
-#define XFCE_PANEL_PLUGIN_PROVIDER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), XFCE_TYPE_PANEL_PLUGIN_PROVIDER, XfcePanelPluginProviderIface))
-
 struct _XfcePanelPluginProviderIface
 {
   /*< private >*/
@@ -73,6 +63,20 @@ struct _XfcePanelPluginProviderIface
   void         (*save)                (XfcePanelPluginProvider *provider);
 };
 
+enum _XfcePanelPluginProviderSignal
+{
+  MOVE_PLUGIN,
+  EXPAND_PLUGIN,
+  COLLAPSE_PLUGIN,
+  LOCK_PANEL,
+  UNLOCK_PANEL,
+  REMOVE_PLUGIN,
+  ADD_NEW_ITEMS,
+  PANEL_PREFERENCES,
+};
+
+
+
 GType        xfce_panel_plugin_provider_get_type            (void) G_GNUC_CONST;
 
 const gchar *xfce_panel_plugin_provider_get_name            (XfcePanelPluginProvider *provider);
diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index 3c79012..5d0cf53 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -750,10 +750,14 @@ xfce_panel_plugin_unregister_menu (GtkMenu         *menu,
                                    XfcePanelPlugin *plugin)
 {
     panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin));
+    panel_return_if_fail (plugin->priv->registered_menus > 0);
     panel_return_if_fail (GTK_IS_MENU (menu));
 
     if (G_LIKELY (plugin->priv->registered_menus > 0))
       {
+        /* disconnect this signal */
+        g_signal_handlers_disconnect_by_func (G_OBJECT (menu), G_CALLBACK (xfce_panel_plugin_unregister_menu), plugin);
+        
         /* decrease the counter */
         plugin->priv->registered_menus--;
 
@@ -761,11 +765,6 @@ xfce_panel_plugin_unregister_menu (GtkMenu         *menu,
         if (G_LIKELY (plugin->priv->registered_menus == 0))
           g_signal_emit_by_name (G_OBJECT (plugin), "provider-signal", UNLOCK_PANEL);
       }
-    else
-      {
-        /* show a warning */
-        g_message ("Plugin %s-%s unregistered a menu without registering it.", plugin->priv->name, plugin->priv->id);
-      }
 }
 
 
diff --git a/panel/panel-application.c b/panel/panel-application.c
index 786c22d..5253381 100644
--- a/panel/panel-application.c
+++ b/panel/panel-application.c
@@ -538,7 +538,9 @@ static void
 panel_application_plugin_move (GtkWidget        *item,
                                PanelApplication *application)
 {
-  GtkTargetList *target_list;
+  GtkTargetList  *target_list;
+  const gchar    *icon_name;
+  GdkDragContext *context;
 
   panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (item));
   panel_return_if_fail (PANEL_IS_APPLICATION (application));
@@ -550,9 +552,11 @@ panel_application_plugin_move (GtkWidget        *item,
   target_list = gtk_target_list_new (drag_targets, G_N_ELEMENTS (drag_targets));
 
   /* begin a drag */
-  gtk_drag_begin (item, target_list, GDK_ACTION_MOVE, 1, NULL);
+  context = gtk_drag_begin (item, target_list, GDK_ACTION_MOVE, 1, NULL);
   
-  /* TODO do something fancy here. A snapshot of the plugin or the icon name... */
+  /* set the drag context icon name */
+  icon_name = panel_module_get_icon_name_from_plugin (XFCE_PANEL_PLUGIN_PROVIDER (item));
+  gtk_drag_set_icon_name (context, icon_name ? icon_name : GTK_STOCK_DND, 0, 0); 
 
   /* release the drag list */
   gtk_target_list_unref (target_list);
@@ -564,14 +568,18 @@ panel_application_plugin_move (GtkWidget        *item,
 
 
 static void
-panel_application_plugin_provider_signal (XfcePanelPluginProvider *provider,
-                                          ProviderSignal           signal,
-                                          PanelApplication        *application)
+panel_application_plugin_provider_signal (XfcePanelPluginProvider       *provider,
+                                          XfcePanelPluginProviderSignal  signal,
+                                          PanelApplication              *application)
 {
-  GtkWidget *toplevel, *itembar;
+  GtkWidget   *itembar;
+  PanelWindow *window;
 
   panel_return_if_fail (PANEL_IS_APPLICATION (application));
   panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
+  
+  /* get the panel of the plugin */
+  window = PANEL_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (provider)));
 
   switch (signal)
     {
@@ -583,16 +591,20 @@ panel_application_plugin_provider_signal (XfcePanelPluginProvider *provider,
       case EXPAND_PLUGIN:
       case COLLAPSE_PLUGIN:
         /* get the itembar */
-        toplevel = gtk_widget_get_toplevel (GTK_WIDGET (provider));
-        itembar = gtk_bin_get_child (GTK_BIN (toplevel));
+        itembar = gtk_bin_get_child (GTK_BIN (window));
 
         /* set new expand mode */
         panel_itembar_set_child_expand (PANEL_ITEMBAR (itembar), GTK_WIDGET (provider), !!(signal == EXPAND_PLUGIN));
         break;
 
       case LOCK_PANEL:
+        /* block autohide */
+        panel_window_freeze_autohide (window);
+        break;
+        
       case UNLOCK_PANEL:
-        /* TODO: implement */
+        /* unblock autohide */
+        panel_window_thaw_autohide (window);
         break;
 
       case REMOVE_PLUGIN:
@@ -603,15 +615,12 @@ panel_application_plugin_provider_signal (XfcePanelPluginProvider *provider,
 
       case ADD_NEW_ITEMS:
         /* open the items dialog */
-        panel_item_dialog_show ();
+        panel_item_dialog_show (window);
         break;
 
       case PANEL_PREFERENCES:
-        /* get the panel window widget */
-        toplevel = gtk_widget_get_toplevel (GTK_WIDGET (provider));
-
         /* open the panel preferences */
-        panel_preferences_dialog_show (PANEL_WINDOW (toplevel));
+        panel_preferences_dialog_show (window);
         break;
 
       default:
diff --git a/panel/panel-dbus-client.c b/panel/panel-dbus-client.c
index d6f9572..8cd5370 100644
--- a/panel/panel-dbus-client.c
+++ b/panel/panel-dbus-client.c
@@ -24,6 +24,7 @@
 #include <dbus/dbus-glib.h>
 #include <libxfce4util/libxfce4util.h>
 #include <libxfce4panel/libxfce4panel.h>
+#include <libxfce4panel/xfce-panel-plugin-provider.h>
 
 #include <panel/panel-private.h>
 #include <panel/panel-dbus-client.h>
@@ -44,7 +45,7 @@ panel_dbus_client_get_proxy (GError **error)
     return NULL;
 
   /* get the proxy */
-  dbus_proxy = dbus_g_proxy_new_for_name (dbus_connection, PANEL_DBUS_SERVICE_INTERFACE,
+  dbus_proxy = dbus_g_proxy_new_for_name (dbus_connection, PANEL_DBUS_SERVICE_NAME,
                                           PANEL_DBUS_SERVICE_PATH, PANEL_DBUS_SERVICE_INTERFACE);
 
   return dbus_proxy;
@@ -52,7 +53,6 @@ panel_dbus_client_get_proxy (GError **error)
 
 
 
-
 gboolean
 panel_dbus_client_check_client_running (GError **error)
 {
diff --git a/panel/panel-dbus-service.c b/panel/panel-dbus-service.c
index c2492f2..ac9a2f8 100644
--- a/panel/panel-dbus-service.c
+++ b/panel/panel-dbus-service.c
@@ -158,19 +158,15 @@ panel_dbus_service_display_preferences_dialog (PanelDBusService  *service,
                                                GError           **error)
 {
   PanelApplication *application;
-
+  
   panel_return_val_if_fail (PANEL_IS_DBUS_SERVICE (service), FALSE);
   panel_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-  /* get the current application */
+  /* show the preferences dialog */
   application = panel_application_get ();
-
-  /* show the prefernces dialog */
   panel_preferences_dialog_show (panel_application_get_window (application, active));
-
-  /* release the application */
   g_object_unref (G_OBJECT (application));
-
+  
   return TRUE;
 }
 
@@ -181,13 +177,15 @@ panel_dbus_service_display_items_dialog (PanelDBusService  *service,
                                          guint              active,
                                          GError           **error)
 {
+  PanelApplication *application;
+  
   panel_return_val_if_fail (PANEL_IS_DBUS_SERVICE (service), FALSE);
   panel_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-  /* TODO: active window, set screen too */
-
   /* show the items dialog */
-  panel_item_dialog_show ();
+  application = panel_application_get ();
+  panel_item_dialog_show (panel_application_get_window (application, active));
+  g_object_unref (G_OBJECT (application));
 
   return TRUE;
 }
@@ -199,17 +197,13 @@ panel_dbus_service_save (PanelDBusService  *service,
                          GError           **error)
 {
   PanelApplication *application;
-
+  
   panel_return_val_if_fail (PANEL_IS_DBUS_SERVICE (service), FALSE);
   panel_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-  /* get the current application */
-  application = panel_application_get ();
-
   /* save the configuration */
+  application = panel_application_get ();
   panel_application_save (application);
-
-  /* release the application */
   g_object_unref (G_OBJECT (application));
 
   return TRUE;
@@ -224,12 +218,11 @@ panel_dbus_service_add_new_item (PanelDBusService  *service,
                                  GError           **error)
 {
   PanelApplication *application;
-
+  
   panel_return_val_if_fail (PANEL_IS_DBUS_SERVICE (service), FALSE);
   panel_return_val_if_fail (error == NULL || *error == NULL, FALSE);
   panel_return_val_if_fail (plugin_name != NULL, FALSE);
-
-  /* get the current application */
+  
   application = panel_application_get ();
 
   /* save the configuration */
@@ -237,8 +230,7 @@ panel_dbus_service_add_new_item (PanelDBusService  *service,
     panel_application_add_new_item (application, plugin_name, arguments);
   else
     panel_application_add_new_item (application, plugin_name, NULL);
-
-  /* release the application */
+    
   g_object_unref (G_OBJECT (application));
 
   return TRUE;
diff --git a/panel/panel-dbus-service.h b/panel/panel-dbus-service.h
index 0e7c95b..640cf4c 100644
--- a/panel/panel-dbus-service.h
+++ b/panel/panel-dbus-service.h
@@ -25,9 +25,6 @@
 typedef struct _PanelDBusServiceClass PanelDBusServiceClass;
 typedef struct _PanelDBusService      PanelDBusService;
 
-#define PANEL_DBUS_SERVICE_PATH      "/org/xfce/Panel"
-#define PANEL_DBUS_SERVICE_INTERFACE "org.xfce.Panel"
-
 #define PANEL_TYPE_DBUS_SERVICE            (panel_dbus_service_get_type ())
 #define PANEL_DBUS_SERVICE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PANEL_TYPE_DBUS_SERVICE, PanelDBusService))
 #define PANEL_DBUS_CLASS_SERVICE(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PANEL_TYPE_DBUS_SERVICE, PanelDBusServiceClass))
diff --git a/panel/panel-glue.c b/panel/panel-glue.c
index 754d828..faf6e0d 100644
--- a/panel/panel-glue.c
+++ b/panel/panel-glue.c
@@ -103,7 +103,7 @@ panel_glue_popup_menu (PanelWindow *window)
 
   /* add new items */
   item = gtk_image_menu_item_new_with_mnemonic (_("Add _New Items..."));
-  g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (panel_item_dialog_show), NULL);
+  g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (panel_item_dialog_show), window);
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
   gtk_widget_show (item);
 
diff --git a/panel/panel-item-dialog.c b/panel/panel-item-dialog.c
index 25766d7..811f2dd 100644
--- a/panel/panel-item-dialog.c
+++ b/panel/panel-item-dialog.c
@@ -688,20 +688,26 @@ panel_item_dialog_text_renderer (GtkTreeViewColumn *column,
 
 
 void
-panel_item_dialog_show (void)
+panel_item_dialog_show (PanelWindow *active)
 {
-  static GtkWidget *dialog = NULL;
+  static PanelItemDialog *dialog = NULL;
 
   if (G_LIKELY (dialog == NULL))
     {
       /* create new dialog singleton */
       dialog = g_object_new (PANEL_TYPE_ITEM_DIALOG, NULL);
       g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer) &dialog);
-      gtk_widget_show (dialog);
-    }
-  else
-    {
-      /* focus the window */
-      gtk_window_present (GTK_WINDOW (dialog));
     }
+  
+  if (G_UNLIKELY (active == NULL))
+    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)));
+
+  /* show the dialog */
+  gtk_widget_show (GTK_WIDGET (dialog));
+  
+  /* focus the window */
+  gtk_window_present (GTK_WINDOW (dialog));
 }
diff --git a/panel/panel-item-dialog.h b/panel/panel-item-dialog.h
index 156f50e..680b73d 100644
--- a/panel/panel-item-dialog.h
+++ b/panel/panel-item-dialog.h
@@ -21,6 +21,7 @@
 #define __PANEL_ITEM_DIALOG_H__
 
 #include <gtk/gtk.h>
+#include <panel/panel-window.h>
 
 G_BEGIN_DECLS
 
@@ -36,7 +37,7 @@ typedef struct _PanelItemDialog      PanelItemDialog;
 
 GType      panel_item_dialog_get_type (void) G_GNUC_CONST;
 
-void       panel_item_dialog_show     (void);
+void       panel_item_dialog_show     (PanelWindow *active);
 
 G_END_DECLS
 
diff --git a/panel/panel-module.c b/panel/panel-module.c
index 6722a2a..756ce06 100644
--- a/panel/panel-module.c
+++ b/panel/panel-module.c
@@ -82,6 +82,9 @@ struct _PanelModule
 };
 
 
+static GQuark module_quark = 0;
+
+
 
 G_DEFINE_TYPE (PanelModule, panel_module, G_TYPE_TYPE_MODULE);
 
@@ -100,6 +103,9 @@ panel_module_class_init (PanelModuleClass *klass)
   gtype_module_class = G_TYPE_MODULE_CLASS (klass);
   gtype_module_class->load = panel_module_load;
   gtype_module_class->unload = panel_module_unload;
+  
+  /* initialize the quark */
+  module_quark = g_quark_from_static_string ("panel-module");
 }
 
 
@@ -371,6 +377,9 @@ panel_module_create_plugin (PanelModule  *module,
       /* emit unique-changed if the plugin is unique */
       if (module->is_unique)
         panel_module_factory_emit_unique_changed (module);
+      
+      /* add link to the module */
+      g_object_set_qdata (G_OBJECT (plugin), module_quark, module);
     }
   else if (module->run_in_wrapper == FALSE)
     {
@@ -440,6 +449,22 @@ panel_module_get_icon_name (PanelModule *module)
 
 
 
+const gchar *
+panel_module_get_icon_name_from_plugin (XfcePanelPluginProvider *provider)
+{
+  PanelModule *module;
+  
+  panel_return_val_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider), NULL);
+  
+  /* get the module */
+  module = g_object_get_qdata (G_OBJECT (provider), module_quark);
+  
+  /* return the icon name */
+  return panel_module_get_icon_name (module);
+}
+
+
+
 gboolean
 panel_module_is_valid (PanelModule *module)
 {
diff --git a/panel/panel-module.h b/panel/panel-module.h
index 7a96774..24ccb52 100644
--- a/panel/panel-module.h
+++ b/panel/panel-module.h
@@ -38,30 +38,32 @@ 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,
-                                                             const gchar  *id,
-                                                             gchar       **arguments);
+XfcePanelPluginProvider *panel_module_create_plugin             (PanelModule             *module,
+                                                                 GdkScreen               *screen,
+                                                                 const gchar             *name,
+                                                                 const gchar             *id,
+                                                                 gchar                  **arguments);
 
-const gchar             *panel_module_get_internal_name     (PanelModule  *module);
+const gchar             *panel_module_get_internal_name         (PanelModule             *module);
 
-const gchar             *panel_module_get_library_filename  (PanelModule  *module);
+const gchar             *panel_module_get_library_filename      (PanelModule             *module);
 
-const gchar             *panel_module_get_name              (PanelModule  *module);
+const gchar             *panel_module_get_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);
 
-gboolean                 panel_module_is_valid              (PanelModule  *module);
+const gchar             *panel_module_get_icon_name_from_plugin (XfcePanelPluginProvider *provider);
 
-gboolean                 panel_module_is_usable             (PanelModule  *module);
+gboolean                 panel_module_is_valid                  (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 967a690..414a247 100644
--- a/panel/panel-plugin-external.c
+++ b/panel/panel-plugin-external.c
@@ -38,29 +38,29 @@
 
 
 
-static void         panel_plugin_external_class_init          (PanelPluginExternalClass     *klass);
-static void         panel_plugin_external_init                (PanelPluginExternal          *external);
-static void         panel_plugin_external_provider_init       (XfcePanelPluginProviderIface *iface);
-static void         panel_plugin_external_finalize            (GObject                      *object);
-static void         panel_plugin_external_realize             (GtkWidget                    *widget);
-static void         panel_plugin_external_unrealize           (GtkWidget                    *widget);
-static gboolean     panel_plugin_external_plug_removed        (GtkSocket                    *socket);
-static void         panel_plugin_external_plug_added          (GtkSocket                    *socket);
-static const gchar *panel_plugin_external_get_name            (XfcePanelPluginProvider      *provider);
-static const gchar *panel_plugin_external_get_id              (XfcePanelPluginProvider      *provider);
-static void         panel_plugin_external_set_size            (XfcePanelPluginProvider      *provider,
-                                                               gint                          size);
-static void         panel_plugin_external_set_orientation     (XfcePanelPluginProvider      *provider,
-                                                               GtkOrientation                orientation);
-static void         panel_plugin_external_set_screen_position (XfcePanelPluginProvider      *provider,
-                                                               XfceScreenPosition            screen_position);
-static void         panel_plugin_external_save                (XfcePanelPluginProvider      *provider);
-static void         panel_plugin_external_set_sensitive       (PanelPluginExternal          *external);
-static void         panel_plugin_external_provider_signal     (PanelPluginExternal          *external,
-                                                               ProviderSignal                signal);
-static void         panel_plugin_external_set_property        (PanelPluginExternal          *external,
-                                                               const gchar                  *property,
-                                                               const GValue                 *value);
+static void         panel_plugin_external_class_init          (PanelPluginExternalClass      *klass);
+static void         panel_plugin_external_init                (PanelPluginExternal           *external);
+static void         panel_plugin_external_provider_init       (XfcePanelPluginProviderIface  *iface);
+static void         panel_plugin_external_finalize            (GObject                       *object);
+static void         panel_plugin_external_realize             (GtkWidget                     *widget);
+static void         panel_plugin_external_unrealize           (GtkWidget                     *widget);
+static gboolean     panel_plugin_external_plug_removed        (GtkSocket                     *socket);
+static void         panel_plugin_external_plug_added          (GtkSocket                     *socket);
+static const gchar *panel_plugin_external_get_name            (XfcePanelPluginProvider       *provider);
+static const gchar *panel_plugin_external_get_id              (XfcePanelPluginProvider       *provider);
+static void         panel_plugin_external_set_size            (XfcePanelPluginProvider       *provider,
+                                                               gint                           size);
+static void         panel_plugin_external_set_orientation     (XfcePanelPluginProvider       *provider,
+                                                               GtkOrientation                 orientation);
+static void         panel_plugin_external_set_screen_position (XfcePanelPluginProvider       *provider,
+                                                               XfceScreenPosition             screen_position);
+static void         panel_plugin_external_save                (XfcePanelPluginProvider       *provider);
+static void         panel_plugin_external_set_sensitive       (PanelPluginExternal           *external);
+static void         panel_plugin_external_provider_signal     (PanelPluginExternal           *external,
+                                                               XfcePanelPluginProviderSignal  signal);
+static void         panel_plugin_external_set_property        (PanelPluginExternal           *external,
+                                                               const gchar                   *property,
+                                                               const GValue                  *value);
 
 
 
@@ -548,8 +548,8 @@ panel_plugin_external_set_sensitive (PanelPluginExternal *external)
 
 
 static void
-panel_plugin_external_provider_signal (PanelPluginExternal *external,
-                                       ProviderSignal       signal)
+panel_plugin_external_provider_signal (PanelPluginExternal           *external,
+                                       XfcePanelPluginProviderSignal  signal)
 {
   panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL (external));
 
diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c
index f31d356..7e6361f 100644
--- a/panel/panel-preferences-dialog.c
+++ b/panel/panel-preferences-dialog.c
@@ -817,7 +817,7 @@ void
 panel_preferences_dialog_show (PanelWindow *active)
 {
   static PanelPreferencesDialog *dialog = NULL;
-  gint                           idx;
+  gint                           idx = 0;
 
   panel_return_if_fail (active == NULL || PANEL_IS_WINDOW (active));
 
@@ -826,20 +826,23 @@ panel_preferences_dialog_show (PanelWindow *active)
       /* create new dialog singleton */
       dialog = g_object_new (PANEL_TYPE_PREFERENCES_DIALOG, NULL);
       g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer) &dialog);
-      gtk_widget_show (GTK_WIDGET (dialog));
     }
-  else
-    {
-      /* focus the window */
-      gtk_window_present (GTK_WINDOW (dialog));
-    }
-
+  
   /* get the active window index */
   if (G_LIKELY (active))
     idx = panel_application_get_window_index (dialog->application, active);
   else
-    idx = 0;
+    active = panel_application_get_window (dialog->application, idx);
+
+  /* show the dialog on the same screen as the panel */
+  gtk_window_set_screen (GTK_WINDOW (dialog), gtk_widget_get_screen (GTK_WIDGET (active)));
+
+  /* show the dialog */
+  gtk_widget_show (GTK_WIDGET (dialog));
 
   /* select the active window in the dialog */
   gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->selector), idx);
+
+  /* focus the window */
+  gtk_window_present (GTK_WINDOW (dialog));
 }
diff --git a/panel/panel-window.c b/panel/panel-window.c
index a02aeb1..08c79a9 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -2029,7 +2029,7 @@ panel_window_freeze_autohide (PanelWindow *window)
   window->autohide_block++;
 
   /* block autohide */
-  if (window->autohide_status != DISABLED && window->autohide_block == 1)
+  if (window->autohide_block == 1 && window->autohide_status != DISABLED)
     panel_window_autohide_queue (window, BLOCKED);
 }
 
@@ -2045,7 +2045,7 @@ panel_window_thaw_autohide (PanelWindow *window)
   window->autohide_block--;
 
   /* queue an autohide when needed */
-  if (window->autohide_status != DISABLED && window->autohide_block == 0)
+  if (window->autohide_block == 0 && window->autohide_status != DISABLED)
     panel_window_autohide_queue (window, POPDOWN_QUEUED);
 }
 
diff --git a/wrapper/main.c b/wrapper/main.c
index ecf6a93..50f7d3c 100644
--- a/wrapper/main.c
+++ b/wrapper/main.c
@@ -117,9 +117,9 @@ dbus_gproxy_provider_property_changed (DBusGProxy              *dbus_gproxy,
 
 
 static void
-dbus_gproxy_provider_signal (XfcePanelPluginProvider *provider,
-                            ProviderSignal           signal,
-                            DBusGProxy              *dbus_gproxy)
+dbus_gproxy_provider_signal (XfcePanelPluginProvider       *provider,
+                             XfcePanelPluginProviderSignal  signal,
+                             DBusGProxy                    *dbus_gproxy)
 {
   GValue       value = { 0, };
   GError      *error = NULL;
@@ -301,7 +301,8 @@ main (gint argc, gchar **argv)
 			                  "',member='NameOwnerChanged'", NULL);
 
   /* get the dbus proxy */
-  dbus_gproxy = dbus_g_proxy_new_for_name (dbus_gconnection, "org.xfce.Panel", "/org/xfce/Panel", "org.xfce.Panel");
+  dbus_gproxy = dbus_g_proxy_new_for_name (dbus_gconnection, PANEL_DBUS_SERVICE_NAME,
+                                           PANEL_DBUS_SERVICE_PATH, PANEL_DBUS_SERVICE_INTERFACE);
   if (G_UNLIKELY (dbus_gproxy == NULL))
     {
       /* print error */



More information about the Xfce4-commits mailing list