[Xfce4-commits] <xfce4-panel:master> Improve handing when plugins are unrealized.
Nick Schermer
noreply at xfce.org
Sun Apr 18 21:02:01 CEST 2010
Updating branch refs/heads/master
to 62b86c08dcf3bb104376a71843c092806caf6e6d (commit)
from 1cb46cb53d06ff42624e70c6d76253ea57e58364 (commit)
commit 62b86c08dcf3bb104376a71843c092806caf6e6d
Author: Nick Schermer <nick at xfce.org>
Date: Sun Apr 18 20:43:52 2010 +0200
Improve handing when plugins are unrealized.
Force a quit of an unrealized plugin, so it can be properly
restarted when realized again. Also add some debugging
information for this.
libxfce4panel/xfce-panel-macros-46.h | 23 ++++++++++++++++++++---
panel/panel-plugin-external-46.c | 11 ++++++++++-
panel/panel-plugin-external.c | 5 +++++
3 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/libxfce4panel/xfce-panel-macros-46.h b/libxfce4panel/xfce-panel-macros-46.h
index d36678e..2a6f3e5 100644
--- a/libxfce4panel/xfce-panel-macros-46.h
+++ b/libxfce4panel/xfce-panel-macros-46.h
@@ -49,7 +49,8 @@ enum /*< skip >*/
PANEL_CLIENT_EVENT_SET_SENSITIVE,
PANEL_CLIENT_EVENT_SET_SIZE,
PANEL_CLIENT_EVENT_SHOW_ABOUT,
- PANEL_CLIENT_EVENT_SHOW_CONFIGURE
+ PANEL_CLIENT_EVENT_SHOW_CONFIGURE,
+ PANEL_CLIENT_EVENT_QUIT
};
/*< private >*/
@@ -277,6 +278,18 @@ enum /*< skip >*/
static gdouble _xpp_alpha = 1.00; \
static gboolean _xpp_composited = FALSE; \
\
+ static void \
+ _xpp_quit_main_loop (void) \
+ { \
+ static gboolean quiting = FALSE; \
+ \
+ if (!quiting) \
+ { \
+ quiting = TRUE; \
+ gtk_main_quit (); \
+ } \
+ } \
+ \
static gboolean \
_xpp_client_event (GtkWidget *plug, \
GdkEventClient *event, \
@@ -340,6 +353,10 @@ enum /*< skip >*/
xfce_panel_plugin_provider_show_configure (provider); \
break; \
\
+ case PANEL_CLIENT_EVENT_QUIT: \
+ _xpp_quit_main_loop (); \
+ break; \
+ \
default: \
g_warning ("Received unknow client event %d", message); \
break; \
@@ -433,7 +450,7 @@ enum /*< skip >*/
g_return_if_fail (GTK_IS_PLUG (plug)); \
\
if (!gtk_plug_get_embedded (plug)) \
- gtk_main_quit (); \
+ _xpp_quit_main_loop (); \
} \
\
gint \
@@ -502,7 +519,7 @@ enum /*< skip >*/
g_signal_connect_after (G_OBJECT (xpp), "realize", \
G_CALLBACK (_xpp_realize), NULL); \
g_signal_connect_after (G_OBJECT (xpp), "destroy", \
- G_CALLBACK (gtk_main_quit), NULL); \
+ G_CALLBACK (_xpp_quit_main_loop), NULL); \
g_signal_connect (G_OBJECT (xpp), "provider-signal", \
G_CALLBACK (_xpp_provider_signal), plug); \
gtk_widget_show (xpp); \
diff --git a/panel/panel-plugin-external-46.c b/panel/panel-plugin-external-46.c
index b6f58c5..415d615 100644
--- a/panel/panel-plugin-external-46.c
+++ b/panel/panel-plugin-external-46.c
@@ -414,18 +414,27 @@ panel_plugin_external_46_realize (GtkWidget *widget)
static void
panel_plugin_external_46_unrealize (GtkWidget *widget)
{
- PanelPluginExternal46 *external = PANEL_PLUGIN_EXTERNAL_46 (widget);
+ PanelPluginExternal46 *external = PANEL_PLUGIN_EXTERNAL_46 (widget);
/* the plug is not embedded anymore */
external->plug_embedded = FALSE;
+ panel_debug (PANEL_DEBUG_DOMAIN_EXTERNAL46,
+ "Plugin %s-%d unrealized, quiting GtkPlug",
+ panel_module_get_name (external->module),
+ external->unique_id);
+
if (external->watch_id != 0)
{
/* remove the child watch so we don't leave zomies */
g_source_remove (external->watch_id);
g_child_watch_add (external->pid, (GChildWatchFunc) g_spawn_close_pid, NULL);
+ external->pid = 0;
}
+ /* quit the plugin */
+ panel_plugin_external_46_send_client_event (external, PANEL_CLIENT_EVENT_QUIT, FALSE);
+
(*GTK_WIDGET_CLASS (panel_plugin_external_46_parent_class)->unrealize) (widget);
}
diff --git a/panel/panel-plugin-external.c b/panel/panel-plugin-external.c
index e860c57..a31dc45 100644
--- a/panel/panel-plugin-external.c
+++ b/panel/panel-plugin-external.c
@@ -515,6 +515,11 @@ panel_plugin_external_unrealize (GtkWidget *widget)
panel_plugin_external_queue_add_noop (PANEL_PLUGIN_EXTERNAL (widget),
TRUE, SIGNAL_WRAPPER_QUIT);
+ panel_debug (PANEL_DEBUG_DOMAIN_EXTERNAL,
+ "Plugin %s-%d unrealized, quiting wrapper",
+ panel_module_get_name (external->module),
+ external->unique_id);
+
(*GTK_WIDGET_CLASS (panel_plugin_external_parent_class)->unrealize) (widget);
}
More information about the Xfce4-commits
mailing list