[Nautilus-list] Simple patch for Nautilus



The attached patch allows you to close fileselector window in theme
selector with Escape key. Ok to commit?


Zbigniew
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.4561
diff -u -r1.4561 ChangeLog
--- ChangeLog	2001/05/02 18:38:50	1.4561
+++ ChangeLog	2001/05/02 20:22:44
@@ -1,1 +1,7 @@
+2001-05-02  Zbigniew Chyla  <cyba gnome pl>
+
+	* src/nautilus-theme-selector.c (install_theme_button_clicked_callback,
+	file_selection_key_pressed_callback): Destroy fileselector after
+	pressing escape key.
+
 2001-05-02  Darin Adler  <darin eazel com>
Index: src/nautilus-theme-selector.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-theme-selector.c,v
retrieving revision 1.51
diff -u -r1.51 nautilus-theme-selector.c
--- src/nautilus-theme-selector.c	2001/04/26 23:20:52	1.51
+++ src/nautilus-theme-selector.c	2001/05/02 20:22:46
@@ -35,6 +35,7 @@
 #include <eel/eel-stock-dialogs.h>
 #include <eel/eel-string.h>
 #include <eel/eel-viewport.h>
+#include <gdk/gdkkeysyms.h>
 #include <gtk/gtkalignment.h>
 #include <gtk/gtkbutton.h>
 #include <gtk/gtkfilesel.h>
@@ -318,6 +319,20 @@
 	gtk_widget_destroy (GTK_WIDGET (callback_data));
 }
 
+static int
+file_selection_key_pressed_callback (GtkWidget *file_selection_dialog,
+                                     GdkEventKey *event)
+{
+	g_return_val_if_fail (GTK_IS_FILE_SELECTION (file_selection_dialog), 0);
+
+	if (event->keyval == GDK_Escape) {
+		gtk_widget_destroy (GTK_WIDGET (file_selection_dialog));
+		return 1;
+	} else {
+		return 0;
+	}
+}
+
 static void
 install_theme_button_clicked_callback (GtkWidget *button,
 				       gpointer callback_data)
@@ -344,6 +359,11 @@
 			    "clicked",
 			    GTK_SIGNAL_FUNC (file_selection_cancel_clicked_callback),
 			    file_selection_dialog);
+
+	gtk_signal_connect (GTK_OBJECT (file_selection_dialog),
+			    "key_press_event",
+			    GTK_SIGNAL_FUNC (file_selection_key_pressed_callback),
+			    NULL);
 	
 	gtk_window_set_position (GTK_WINDOW (file_selection_dialog), GTK_WIN_POS_MOUSE);
 	if (theme_selector->details->parent_window != NULL) {


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