[Xfce4-commits] <xfce4-panel:devel> Improve the handling of removing external plugins.
Nick Schermer
noreply at xfce.org
Mon Jan 25 15:22:03 CET 2010
Updating branch refs/heads/devel
to c7ec60606f684fb49cb7defcaef35355bf9b8480 (commit)
from e7630d29809f002c4fa883cb8fd814d8db4b9c36 (commit)
commit c7ec60606f684fb49cb7defcaef35355bf9b8480
Author: Nick Schermer <nick at xfce.org>
Date: Mon Jan 25 15:17:55 2010 +0100
Improve the handling of removing external plugins.
Add a quick signal back to the code and improve the internal
handling so the objects are better isolated.
common/panel-dbus.h | 1 +
panel/panel-application.c | 5 ++---
panel/panel-plugin-external-46.c | 8 --------
panel/panel-plugin-external.c | 24 ++++++++++++++++--------
wrapper/main.c | 2 ++
wrapper/wrapper-plug.c | 2 +-
6 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/common/panel-dbus.h b/common/panel-dbus.h
index ea941e9..2b26f58 100644
--- a/common/panel-dbus.h
+++ b/common/panel-dbus.h
@@ -38,6 +38,7 @@
#define SIGNAL_REMOVED SIGNAL_PREFIX_S "g"
#define SIGNAL_WRAPPER_SET_SENSITIVE SIGNAL_PREFIX_S "h"
#define SIGNAL_WRAPPER_BACKGROUND_ALPHA SIGNAL_PREFIX_S "i"
+#define SIGNAL_WRAPPER_QUIT SIGNAL_PREFIX_S "j"
/* special types for dbus communication */
#define PANEL_TYPE_DBUS_SET_MESSAGE dbus_g_type_get_struct ("GValueArray", \
diff --git a/panel/panel-application.c b/panel/panel-application.c
index e877ba8..2e010c6 100644
--- a/panel/panel-application.c
+++ b/panel/panel-application.c
@@ -507,9 +507,8 @@ panel_application_plugin_provider_signal (XfcePanelPluginProvider *provide
unique_id = xfce_panel_plugin_provider_get_unique_id (provider);
name = g_strdup (xfce_panel_plugin_provider_get_name (provider));
- /* destroy the plugin if it's a panel plugin (ie. not external) */
- if (XFCE_IS_PANEL_PLUGIN (provider))
- gtk_widget_destroy (GTK_WIDGET (provider));
+ /* destroy the plugin */
+ gtk_widget_destroy (GTK_WIDGET (provider));
/* remove the plugin configuration */
panel_application_plugin_delete_config (application, name, unique_id);
diff --git a/panel/panel-plugin-external-46.c b/panel/panel-plugin-external-46.c
index 1d39517..b1a7c55 100644
--- a/panel/panel-plugin-external-46.c
+++ b/panel/panel-plugin-external-46.c
@@ -409,14 +409,6 @@ panel_plugin_external_46_client_event (GtkWidget *widget,
switch (provider_signal)
{
- case PROVIDER_SIGNAL_REMOVE_PLUGIN:
- /* we're forced removing the plugin, don't ask for a restart */
- external->plug_embedded = FALSE;
-
- /* destroy ourselfs, unrealize will close the plugin */
- gtk_widget_destroy (GTK_WIDGET (external));
- break;
-
case PROVIDER_SIGNAL_SHOW_CONFIGURE:
external->show_configure = TRUE;
break;
diff --git a/panel/panel-plugin-external.c b/panel/panel-plugin-external.c
index 2f35a08..9a74ad7 100644
--- a/panel/panel-plugin-external.c
+++ b/panel/panel-plugin-external.c
@@ -62,6 +62,7 @@ static void panel_plugin_external_set_property (GObject
guint prop_id,
const GValue *value,
GParamSpec *pspec);
+static void panel_plugin_external_destroy (GtkObject *object);
static void panel_plugin_external_realize (GtkWidget *widget);
static gboolean panel_plugin_external_plug_removed (GtkSocket *socket);
static void panel_plugin_external_plug_added (GtkSocket *socket);
@@ -173,6 +174,7 @@ static void
panel_plugin_external_class_init (PanelPluginExternalClass *klass)
{
GObjectClass *gobject_class;
+ GtkObjectClass *gtkobject_class;
GtkWidgetClass *gtkwidget_class;
GtkSocketClass *gtksocket_class;
@@ -182,6 +184,9 @@ panel_plugin_external_class_init (PanelPluginExternalClass *klass)
gobject_class->set_property = panel_plugin_external_set_property;
gobject_class->get_property = panel_plugin_external_get_property;
+ gtkobject_class = GTK_OBJECT_CLASS (klass);
+ gtkobject_class->destroy = panel_plugin_external_destroy;
+
gtkwidget_class = GTK_WIDGET_CLASS (klass);
gtkwidget_class->realize = panel_plugin_external_realize;
@@ -394,6 +399,17 @@ panel_plugin_external_set_property (GObject *object,
static void
+panel_plugin_external_destroy (GtkObject *object)
+{
+ panel_plugin_external_queue_add_noop (PANEL_PLUGIN_EXTERNAL (object),
+ TRUE, SIGNAL_WRAPPER_QUIT);
+
+ (*GTK_OBJECT_CLASS (panel_plugin_external_parent_class)->destroy) (object);
+}
+
+
+
+static void
panel_plugin_external_realize (GtkWidget *widget)
{
PanelPluginExternal *external = PANEL_PLUGIN_EXTERNAL (widget);
@@ -560,14 +576,6 @@ panel_plugin_external_dbus_provider_signal (PanelPluginExternal *exte
switch (provider_signal)
{
- case PROVIDER_SIGNAL_REMOVE_PLUGIN:
- /* we're forced removing the plugin, don't ask for a restart */
- external->plug_embedded = FALSE;
-
- /* destroy ourselfs, unrealize will close the plugin */
- gtk_widget_destroy (GTK_WIDGET (external));
- break;
-
case PROVIDER_SIGNAL_SHOW_CONFIGURE:
external->show_configure = TRUE;
break;
diff --git a/wrapper/main.c b/wrapper/main.c
index bce41f2..c4e5fdd 100644
--- a/wrapper/main.c
+++ b/wrapper/main.c
@@ -108,6 +108,8 @@ wrapper_gproxy_set (DBusGProxy *dbus_gproxy,
xfce_panel_plugin_provider_removed (provider);
else if (strcmp (property, SIGNAL_WRAPPER_SET_SENSITIVE) == 0)
gtk_widget_set_sensitive (GTK_WIDGET (provider), g_value_get_boolean (value));
+ else if (strcmp (property, SIGNAL_WRAPPER_QUIT) == 0)
+ gtk_main_quit ();
else
panel_assert_not_reached ();
}
diff --git a/wrapper/wrapper-plug.c b/wrapper/wrapper-plug.c
index 963e41a..52e8f53 100644
--- a/wrapper/wrapper-plug.c
+++ b/wrapper/wrapper-plug.c
@@ -31,7 +31,7 @@
static gboolean wrapper_plug_expose_event (GtkWidget *widget,
GdkEventExpose *event);
-static void wrapper_plug_set_colormap (WrapperPlug *plug);
+static void wrapper_plug_set_colormap (WrapperPlug *plug);
More information about the Xfce4-commits
mailing list