[Nautilus-list] Patch to add a close button to the properties dialog (#72781)



Hi,

the attached patch fixes bug #72781 (show properties dialog doesn't have a
close button).

Regards,

	Benedikt
? properties_dialog.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.5216
diff -p -u -p -u -r1.5216 ChangeLog
--- ChangeLog	21 Apr 2002 14:09:34 -0000	1.5216
+++ ChangeLog	21 Apr 2002 14:25:17 -0000
@@ -1,3 +1,9 @@
+2002-04-21  Benedikt Roth  <Benedikt Roth gmx net>
+
+	* src/file-manager/fm-properties-window.c: (send_delete_event),
+	(create_properties_window):
+	Added Close button, fixes #72781.
+
 2002-04-20	Diego González  <diego pemas net
 
 	* src/nautilus-preferences-dialog.c: split "Windows & Desktop" into two
Index: src/file-manager/fm-properties-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-properties-window.c,v
retrieving revision 1.151
diff -p -u -p -u -r1.151 fm-properties-window.c
--- src/file-manager/fm-properties-window.c	20 Apr 2002 21:11:31 -0000	1.151
+++ src/file-manager/fm-properties-window.c	21 Apr 2002 14:25:19 -0000
@@ -42,6 +42,7 @@
 #include <gtk/gtkentry.h>
 #include <gtk/gtkfilesel.h>
 #include <gtk/gtkhbox.h>
+#include <gtk/gtkhbbox.h>
 #include <gtk/gtkhseparator.h>
 #include <gtk/gtkimage.h>
 #include <gtk/gtklabel.h>
@@ -50,6 +51,7 @@
 #include <gtk/gtkoptionmenu.h>
 #include <gtk/gtkscrolledwindow.h>
 #include <gtk/gtksignal.h>
+#include <gtk/gtkstock.h>
 #include <gtk/gtktable.h>
 #include <gtk/gtkvbox.h>
 #include <libgnome/gnome-i18n.h>
@@ -2151,11 +2153,33 @@ startup_data_free (StartupData *data)
 	g_free (data);
 }
 
+static void
+send_delete_event (GtkWindow *window)
+{
+	/* Synthesize delete_event to close window. */
+	
+	GdkEvent event;
+	GtkWidget *widget;
+	
+	widget = GTK_WIDGET (window);
+	
+	event.any.type = GDK_DELETE;
+	event.any.window = widget->window;
+	event.any.send_event = TRUE;
+	
+	g_object_ref (event.any.window);
+	gtk_main_do_event (&event);
+	g_object_unref (event.any.window);
+}
+
 static FMPropertiesWindow *
 create_properties_window (StartupData *startup_data)
 {
 	FMPropertiesWindow *window;
 	GList *attributes;
+	GtkWidget *vbox;
+	GtkWidget *hbox;
+	GtkWidget *button;
 
 	window = FM_PROPERTIES_WINDOW (gtk_widget_new (fm_properties_window_get_type (), NULL));
 
@@ -2194,11 +2218,17 @@ create_properties_window (StartupData *s
 					 G_CALLBACK (properties_window_file_changed_callback),
 					 window, G_CONNECT_SWAPPED);
 
+	/* Create box for notebook and button box. */
+	vbox = gtk_vbox_new (FALSE, 0);
+	gtk_widget_show (vbox);
+	gtk_container_add (GTK_CONTAINER (window), 
+			   GTK_WIDGET (vbox));
+
 	/* Create the notebook tabs. */
 	window->details->notebook = GTK_NOTEBOOK (gtk_notebook_new ());
 	gtk_widget_show (GTK_WIDGET (window->details->notebook));
-	gtk_container_add (GTK_CONTAINER (window), 
-			   GTK_WIDGET (window->details->notebook));
+	gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (window->details->notebook),
+			    TRUE, TRUE, 0);
 
 	/* Create the pages. */
 	create_basic_page (window);
@@ -2210,6 +2240,23 @@ create_properties_window (StartupData *s
 	if (should_show_permissions (window)) {
 		create_permissions_page (window);
 	}
+	
+	/* Create box for close button. */
+	hbox = gtk_hbutton_box_new ();
+	gtk_widget_show (hbox);
+	gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox),
+			    FALSE, TRUE, 5);
+	gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox),
+				   GTK_BUTTONBOX_END);  
+
+	/* Create close button. */
+	button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
+ 	gtk_widget_show (button);
+	gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (button),
+			    FALSE, TRUE, 0);
+	g_signal_connect (button, "clicked",
+			  G_CALLBACK (send_delete_event),
+			  NULL);
 
 	return window;
 }


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