[Xfce4-commits] <xfce4-embed-plugin:master> Fixed GTK errors when applying new search criteria after popping out.

David Schneider noreply at xfce.org
Wed Feb 1 10:50:02 CET 2012


Updating branch refs/heads/master
         to 51b579d06066b30e1146174d387f241cf0a0f467 (commit)
       from aa809016aad7026e3ba2d6b0ea762f278aa44510 (commit)

commit 51b579d06066b30e1146174d387f241cf0a0f467
Author: David Schneider <dnschneid at gmail.com>
Date:   Wed Feb 1 01:48:50 2012 -0800

    Fixed GTK errors when applying new search criteria after popping out.

 panel-plugin/embed.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/panel-plugin/embed.c b/panel-plugin/embed.c
index a1beebd..6991447 100644
--- a/panel-plugin/embed.c
+++ b/panel-plugin/embed.c
@@ -577,6 +577,10 @@ embed_launch_command (EmbedPlugin *embed)
 static void
 embed_start_search (GtkWidget *socket, EmbedPlugin *embed)
 {
+  if (embed->search_timer) {
+    DBG ("search already started");
+    return;
+  }
   if (embed->disable_search) {
     DBG ("search disabled");
     return;
@@ -753,6 +757,16 @@ embed_add_socket_and_resize (EmbedPlugin *embed)
 
 
 
+/* Idle wrapper function for embed_start_search. */
+static gboolean
+embed_start_search_idle (EmbedPlugin *embed)
+{
+  embed_start_search (embed->socket, embed);
+  return FALSE;
+}
+
+
+
 /* Callback for when a plug is removed.  This is either automatically called by
  * the GtkSocket, or manually when a plug is popped out or destroyed.
  * Does everything that should happen when a plug is removed, including all UI
@@ -897,6 +911,18 @@ embed_popout (GtkMenuItem *popout_menu, EmbedPlugin *embed)
 
   DBG (".");
 
+  /* This function is expected to trigger an asynchronous embed_start_search
+   * (although disable_search may or may not be enabled when it happens), but if
+   * there's no plug to pop out, the requisite events won't happen.
+   * So we shortcut it by triggering the events ourself. */
+  if (!embed->has_plug) {
+    if (!embed->socket)
+      g_idle_add ((GSourceFunc)embed_add_socket_and_resize, embed);
+    else
+      g_idle_add ((GSourceFunc)embed_start_search_idle, embed);
+    return;
+  }
+
   if (!embed->plug_is_gtkplug) {
     /* Since we're not hosting a gtkplug, we should reparent the window so we
      * don't break the program we were hosting.


More information about the Xfce4-commits mailing list