[patch]: geyes property box behaviour fix



Hi there...

This patch stops gnome-applets/geyes from opening multiple property
boxes, which the existing code allows. If you actually do open multiple
property boxes, screwy things happen like being unable to apply changes
in one of them, weird gtk/gnome warnings, etc...

=)
Peter
Index: themes.c
===================================================================
RCS file: /cvs/gnome/gnome-applets/geyes/themes.c,v
retrieving revision 1.5
diff -u -r1.5 themes.c
--- themes.c	2000/01/28 03:53:25	1.5
+++ themes.c	2000/02/12 07:12:45
@@ -162,6 +162,13 @@
 	data = NULL;
 }
 
+static void
+destroy_cb(GtkWidget *widget, gpointer userdata)
+{
+	/* Record that the property window no longer exists */
+        eyes_applet.prop_box.pbox = NULL;
+}
+
 void
 properties_cb (AppletWidget *applet, gpointer data)
 {
@@ -174,10 +181,21 @@
         int i;
         gchar filename [PATH_MAX];
         
+	/* Check if there is already a property box open... if so, raise it */
+	if (eyes_applet.prop_box.pbox != NULL)
+	{
+		gdk_window_raise( eyes_applet.prop_box.pbox->window );
+		return;
+	}
+
         pbox = gnome_property_box_new ();
         gtk_signal_connect (GTK_OBJECT (pbox),
                             "apply",
                             GTK_SIGNAL_FUNC (apply_cb),
+                            NULL);
+        gtk_signal_connect (GTK_OBJECT (pbox),
+                            "destroy",
+                            GTK_SIGNAL_FUNC (destroy_cb),
                             NULL);
         
         gtk_window_set_title (GTK_WINDOW (pbox),
Index: geyes.c
===================================================================
RCS file: /cvs/gnome/gnome-applets/geyes/geyes.c,v
retrieving revision 1.9
diff -u -r1.9 geyes.c
--- geyes.c	2000/01/28 03:53:25	1.9
+++ geyes.c	2000/02/12 07:12:21
@@ -382,6 +382,10 @@
                                                NULL);
         
         gtk_widget_realize (eyes_applet.applet);
+
+	/* Intialise state of property box to NULL */
+	eyes_applet.prop_box.pbox = NULL;
+
 }
 
 int 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]