Newbie advice on fix for bug 118135

I've been working on a patch (my first!) to fix bug 118135 wherin closing a properties window out from under an open icon selector window and opening a new properties window in its place can cause a crash.

What I have so far seems to work in all but one case. It closes the open icon selector when the parent properties window is closed. It also, as a side effect, raises the existing open icon selector if there is one instead of creating another (so I only have to track one dialog).

The one problem case is if the user cancels the icon selector dialog I don't get a chance to set my tracking variable ( icon_selector ) to NULL and the user can't reopen the icon selector unless they close and open the properties dialog. I was only able to set it to NULL the callback when the user clicks OK (or the equivalent).

I'm just getting started with Gtk+ programming so I might be overlooking something obvious, but is there a way to get notification of the eel icon selector dialog cancel event without modifiying the code in eel?

Any suggestions on that or what I've done so far are appreciated.

Here is a link to the bug:

There should be an attachment here of my patch in progress too.

PS: Where in the directory tree is it customary to generate a patch for a module like nautilus? nautilus/src/file-manager ? src/file-manager ?

Chris Altmann - altmann rcsis com
Index: nautilus/src/file-manager/fm-properties-window.c
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-properties-window.c,v
retrieving revision 1.176
diff -u -r1.176 fm-properties-window.c
--- nautilus/src/file-manager/fm-properties-window.c	9 Jul 2003 17:21:26 -0000	1.176
+++ nautilus/src/file-manager/fm-properties-window.c	24 Jul 2003 05:37:47 -0000
@@ -88,6 +88,7 @@
 	GtkNotebook *notebook;
 	GtkWidget *remove_image_button;
+	GtkWidget *icon_selector_window;
 	GtkTable *basic_table;
 	GtkTable *permissions_table;
@@ -2333,6 +2334,8 @@
 			g_free (image_uri);
+		window->details->icon_selector_window = NULL;
@@ -3729,6 +3732,8 @@
 		/* re-enable the property window's clear image button */ 
 		gtk_widget_set_sensitive (properties_window->details->remove_image_button, TRUE);
+	properties_window->details->icon_selector_window = NULL;
 /* handle the "select icon" button */
@@ -3739,11 +3744,22 @@
 	g_assert (FM_IS_PROPERTIES_WINDOW (properties_window));
-	dialog = eel_gnome_icon_selector_new (_("Select an icon"),
-					      NULL,
-					      GTK_WINDOW (properties_window),
-					      (EelIconSelectionFunction) set_icon_callback,
-					      properties_window);
+	dialog = properties_window->details->icon_selector_window;
+	if (dialog) {
+		gtk_window_present (GTK_WINDOW (dialog));
+	}
+	else {
+		dialog = eel_gnome_icon_selector_new (_("Select an icon"),
+						      NULL,
+					 	      GTK_WINDOW (properties_window),
+						      (EelIconSelectionFunction) set_icon_callback,
+						      properties_window);
+		gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
+		properties_window->details->icon_selector_window = dialog;
+	}
 static void

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