[nautilus] Enter key when combo box has focus validates new media dialog (#589436)
- From: Marcus Carlson <mdc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] Enter key when combo box has focus validates new media dialog (#589436)
- Date: Mon, 26 Jul 2010 20:26:50 +0000 (UTC)
commit 52cf8ee6614dc311412ccecd8ea229d7b8c2a091
Author: Marcus Carlson <mdc src gnome org>
Date: Sun Jul 25 23:52:02 2010 +0200
Enter key when combo box has focus validates new media dialog (#589436)
libnautilus-private/nautilus-autorun.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/libnautilus-private/nautilus-autorun.c b/libnautilus-private/nautilus-autorun.c
index c65f9e6..710ae76 100644
--- a/libnautilus-private/nautilus-autorun.c
+++ b/libnautilus-private/nautilus-autorun.c
@@ -30,6 +30,7 @@
#include <gdk/gdkx.h>
#include <gio/gdesktopappinfo.h>
#include <X11/XKBlib.h>
+#include <gdk/gdkkeysyms.h>
#include <eel/eel-glib-extensions.h>
#include <eel/eel-stock-dialogs.h>
@@ -837,6 +838,15 @@ autorun_always_toggled (GtkToggleButton *togglebutton, AutorunDialogData *data)
data->remember = gtk_toggle_button_get_active (togglebutton);
}
+static gboolean
+combo_box_enter_ok (GtkWidget *togglebutton, GdkEventKey *event, GtkDialog *dialog)
+{
+ if (event->keyval == GDK_KP_Enter || event->keyval == GDK_Return) {
+ gtk_dialog_response (dialog, GTK_RESPONSE_OK);
+ return TRUE;
+ }
+ return FALSE;
+}
/* returns TRUE if a folder window should be opened */
static gboolean
@@ -997,6 +1007,11 @@ show_dialog:
combo_box = gtk_combo_box_new ();
nautilus_autorun_prepare_combo_box (combo_box, x_content_type, FALSE, TRUE, FALSE, autorun_combo_changed, data);
+ g_signal_connect (G_OBJECT (combo_box),
+ "key-press-event",
+ G_CALLBACK (combo_box_enter_ok),
+ dialog);
+
gtk_box_pack_start (GTK_BOX (vbox), combo_box, TRUE, TRUE, 0);
always_check_button = gtk_check_button_new_with_mnemonic (_("_Always perform this action"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]