Re: Patch for bug 118135



I think I figured it out. Use eel_add_weak_pointer(). I'll get the hang of this eventually.

Another question. If you select the properties of the same file twice, Nautilus will reuse an existing properties window if there is one. With this patch, if this existing window has an open icon selector window, the properties window still gets the focus, not the icon selector window. Should the focus go to the icon selector instead?

--
Chris Altmann - altmann rcsis com
Index: 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
--- src/file-manager/fm-properties-window.c	9 Jul 2003 17:21:26 -0000	1.176
+++ src/file-manager/fm-properties-window.c	24 Jul 2003 18:28:05 -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;
 	}
 }
 
@@ -3739,11 +3742,23 @@
 
 	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;
+
+		eel_add_weak_pointer (&properties_window->details->icon_selector_window);
+	}
 }
 
 static void


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