wouldn't it be a good idea to add a switch for the time to wait, instead
of hard coding those 10 seconds?

I opened the source and maybe a better idea is in the enclosed patch,
which I could not test because of some broken dependencies on my system...

read the paragraph "Timeout Functions" in the page
http://developer.gnome.org/doc/GGAD/sec-mainloop.html.  if that is true,
then the idea of the patch is to keep trying looking for the child
process until it can be found.  a static variable keeps track of the
amount of times that the timeout is reached and if it is more than 12
times (2 minutes) then it complains as in the original version.

maybe better still to poll more often (in 10 seconds a user does have
the time to see, notice and click away the child window) and more times.
maybe each second, 120 times.

thanks,
(I depend on some wm dock apps...)
Mario

--- gnome-swallow-1.2/gnome-swallow.c   2006-04-27 23:08:30.000000000 +0200
+++ gnome-swallow-1.2.400265/gnome-swallow.c    2007-11-04 09:17:06.000000000 
+0100
@@ -193,6 +193,7 @@
 {
     GdkDisplay* gdkdisplay = gdk_display_get_default ();
     GdkScreen* gdkscreen = gdk_screen_get_default ();
+    static int count = 12; // max times to invoke the function
 
     struct AppletConfigure* ap = (struct AppletConfigure*)data;
 
@@ -206,16 +207,19 @@
         panel_applet_gconf_set_string(ap->applet, "applet_name", 
ap->applet_name, NULL);
 
         orientChanged(GTK_WIDGET(ap->applet), 0, ap);
+        return FALSE;  // found it, remove the timeout!
     } else {
+        // no window found...
+        if (count--) 
+            return TRUE; // but keep trying...
         GtkWidget* dialog = gtk_message_dialog_new(0, 0, GTK_MESSAGE_ERROR, 
GTK_BUTTONS_CLOSE,
                                                    "Swallower Applet: Could 
not find a window named \"%s\" (ran program \"%s\")", ap->applet_name, 
ap->program);
         g_signal_connect_swapped (GTK_OBJECT(dialog), "response",
                                   G_CALLBACK(gtk_widget_destroy),
                                   GTK_OBJECT(dialog));
         gtk_widget_show(dialog);
+        return FALSE; // remove the timeout!
     }
-
-    return FALSE;
 }
 
 void store_filename(GtkWidget* widget, struct AppletConfigure* ap)


-- 
in a free world, you would choose your operating system
 http://www.knoppix.org/



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to