[nautilus] toolbar: Toggle the gear menu off when F10 is pressed again
- From: Lionel Landwerlin <llandwerlin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] toolbar: Toggle the gear menu off when F10 is pressed again
- Date: Wed, 20 Feb 2013 11:03:03 +0000 (UTC)
commit d2540761164b52531ab742889410ac12b135c9df
Author: Michael Wood <michael g wood intel com>
Date: Thu Feb 7 19:40:59 2013 +0000
toolbar: Toggle the gear menu off when F10 is pressed again
The GtkMenu gets the key focus so the F10 action associated with the window
doesn't get run so listen to the key event on the widget it's self just
for closing.
https://bugzilla.gnome.org/show_bug.cgi?id=686755
src/nautilus-toolbar.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index aff618a..15575fd 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -381,6 +381,21 @@ navigation_button_setup_menu (NautilusToolbar *self,
G_CALLBACK (tool_button_release_cb), self);
}
+static gboolean
+gear_menu_key_press (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer user_data)
+{
+ GdkModifierType mask = gtk_accelerator_get_default_mod_mask ();
+
+ if ((event->state & mask) == 0 && (event->keyval == GDK_KEY_F10)) {
+ gtk_menu_shell_deactivate (GTK_MENU_SHELL (widget));
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void
nautilus_toolbar_constructed (GObject *obj)
{
@@ -492,6 +507,7 @@ nautilus_toolbar_constructed (GObject *obj)
gtk_widget_set_halign (menu, GTK_ALIGN_END);
gtk_menu_button_set_popup (GTK_MENU_BUTTON (tool_button), menu);
gtk_actionable_set_action_name (GTK_ACTIONABLE (tool_button), "win.gear-menu");
+ g_signal_connect (menu, "key-press-event", G_CALLBACK (gear_menu_key_press), self);
gtk_container_add (GTK_CONTAINER (tool_item), tool_button);
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_item));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]