diff src/gtkutil.c @ 59102:0096c58ce34a

* xmenu.c (popup_get_selection): Pop down on C-g. (set_frame_menubar): Install translations for Lucid/Motif/Lesstif that pops down menu on C-g. (xdialog_show): If dialog popped down and no button in the dialog was pushed, call Fsignal to quit. (xmenu_show): In no toolkit version, if menu returns NO_SELECT call Fsignal to quit. * xfns.c (Fx_file_dialog): Motif/Lesstif version: Pop down on C-g. * gtkutil.c (xg_initialize): Install bindings for C-g so that dialogs and menus pop down.
author Jan Djärv <jan.h.d@swipnet.se>
date Mon, 27 Dec 2004 15:24:12 +0000
parents 6a0b8f23858b
children ecb6689e04bf 95879cc1ed20
line wrap: on
line diff
--- a/src/gtkutil.c	Mon Dec 27 15:23:22 2004 +0000
+++ b/src/gtkutil.c	Mon Dec 27 15:24:12 2004 +0000
@@ -3578,6 +3578,8 @@
 void
 xg_initialize ()
 {
+  GtkBindingSet *binding_set;
+
   xg_ignore_gtk_scrollbar = 0;
   xg_detached_menus = 0;
   xg_menu_cb_list.prev = xg_menu_cb_list.next =
@@ -3600,6 +3602,17 @@
                                     "gtk-key-theme-name",
                                     "Emacs",
                                     EMACS_CLASS);
+
+  /* Make dialogs close on C-g.  Since file dialog inherits from
+     dialog, this works for them also.  */
+  binding_set = gtk_binding_set_by_class (gtk_type_class (GTK_TYPE_DIALOG));
+  gtk_binding_entry_add_signal (binding_set, GDK_g, GDK_CONTROL_MASK,
+                                "close", 0);
+
+  /* Make menus close on C-g.  */
+  binding_set = gtk_binding_set_by_class (gtk_type_class (GTK_TYPE_MENU_SHELL));
+  gtk_binding_entry_add_signal (binding_set, GDK_g, GDK_CONTROL_MASK,
+                                "cancel", 0);
 }
 
 #endif /* USE_GTK */