[Xfce4-commits] <xfce4-panel:master> Improve debugging in external plugins.

Nick Schermer noreply at xfce.org
Sun Mar 14 20:16:01 CET 2010


Updating branch refs/heads/master
         to 097baaf3c366822485774e9fa87289f0ce288719 (commit)
       from 1f920bb698455a7d504003c00fba2727b31a010e (commit)

commit 097baaf3c366822485774e9fa87289f0ce288719
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Mar 14 18:20:04 2010 +0100

    Improve debugging in external plugins.

 panel/panel-plugin-external-46.c |    9 ++++++++-
 panel/panel-plugin-external.c    |   13 +++++++++++--
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/panel/panel-plugin-external-46.c b/panel/panel-plugin-external-46.c
index d75627e..b6f58c5 100644
--- a/panel/panel-plugin-external-46.c
+++ b/panel/panel-plugin-external-46.c
@@ -350,11 +350,14 @@ panel_plugin_external_46_realize (GtkWidget *widget)
   guint                   argc = PLUGIN_ARGV_ARGUMENTS;
   guint                   i;
 
+  panel_return_if_fail (external->pid == 0);
+  panel_return_if_fail (!external->plug_embedded);
+
   /* realize the socket first */
   (*GTK_WIDGET_CLASS (panel_plugin_external_46_parent_class)->realize) (widget);
 
   /* get the socket id and unique id in a string */
-  socket_id = g_strdup_printf ("%d", gtk_socket_get_id (GTK_SOCKET (widget)));
+  socket_id = g_strdup_printf ("%u", gtk_socket_get_id (GTK_SOCKET (widget)));
   unique_id = g_strdup_printf ("%d", external->unique_id);
 
   /* add the number of arguments to the argc count */
@@ -540,6 +543,10 @@ panel_plugin_external_46_plug_added (GtkSocket *socket)
   /* plug has been added */
   external->plug_embedded = TRUE;
 
+  panel_debug (PANEL_DEBUG_DOMAIN_EXTERNAL46,
+               "plugin  %d has been embedded, %d values in queue",
+               external->unique_id, g_slist_length (external->queue));
+
   /* send all the messages in the queue */
   if (external->queue != NULL)
     {
diff --git a/panel/panel-plugin-external.c b/panel/panel-plugin-external.c
index c6c214f..e860c57 100644
--- a/panel/panel-plugin-external.c
+++ b/panel/panel-plugin-external.c
@@ -434,11 +434,14 @@ panel_plugin_external_realize (GtkWidget *widget)
   guint                 argc = PLUGIN_ARGV_ARGUMENTS;
   GPid                  pid;
 
+  panel_return_if_fail (external->pid == 0);
+  panel_return_if_fail (!external->plug_embedded);
+
   /* realize the socket first */
   (*GTK_WIDGET_CLASS (panel_plugin_external_parent_class)->realize) (widget);
 
   /* get the socket id and unique id in a string */
-  socket_id = g_strdup_printf ("%d", gtk_socket_get_id (GTK_SOCKET (widget)));
+  socket_id = g_strdup_printf ("%u", gtk_socket_get_id (GTK_SOCKET (widget)));
   unique_id = g_strdup_printf ("%d", external->unique_id);
 
   /* add the number of arguments to the argc count */
@@ -505,6 +508,7 @@ panel_plugin_external_unrealize (GtkWidget *widget)
       /* 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 */
@@ -538,6 +542,7 @@ panel_plugin_external_plug_removed (GtkSocket *socket)
       /* 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;
     }
 
   window = gtk_widget_get_toplevel (GTK_WIDGET (socket));
@@ -588,6 +593,11 @@ panel_plugin_external_plug_added (GtkSocket *socket)
   /* plug has been added */
   external->plug_embedded = TRUE;
 
+  panel_debug (PANEL_DEBUG_DOMAIN_EXTERNAL,
+               "%d has been embedded, %d values in queue",
+               external->unique_id,
+               external->queue != NULL ? external->queue->len : 0);
+
   if (external->queue != NULL)
     panel_plugin_external_dbus_set (external, FALSE);
 }
@@ -670,7 +680,6 @@ panel_plugin_external_queue_add (PanelPluginExternal *external,
 
   panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL (external));
   panel_return_if_fail (G_TYPE_CHECK_VALUE (value));
-  panel_return_if_fail (!force || external->queue == NULL);
 
   if (external->queue == NULL)
     external->queue = g_ptr_array_sized_new (1);



More information about the Xfce4-commits mailing list