[nautilus] toolbar: add a F10 keybinding for the gear menu
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] toolbar: add a F10 keybinding for the gear menu
- Date: Wed, 25 Jul 2012 09:39:17 +0000 (UTC)
commit 55e2cdde737054302cdcad840f7ea843c813b266
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Jul 25 05:37:08 2012 -0400
toolbar: add a F10 keybinding for the gear menu
F10 should activate the gear menu, or there's no way to get to it using
the keyboard.
https://bugzilla.gnome.org/show_bug.cgi?id=680568
src/nautilus-application.c | 19 +++++++++++++++++--
src/nautilus-toolbar.c | 2 ++
2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 69a77cf..43b463b 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -899,7 +899,21 @@ action_quit (GSimpleAction *action,
g_list_foreach (windows, (GFunc) nautilus_window_close, NULL);
}
+static void
+action_toggle_state (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GVariant *state;
+
+ state = g_action_get_state (G_ACTION (action));
+ g_action_change_state (G_ACTION (action),
+ g_variant_new_boolean (!g_variant_get_boolean (state)));
+ g_variant_unref (state);
+}
+
static GActionEntry app_entries[] = {
+ { "gear-menu", action_toggle_state, NULL, "false", NULL },
{ "new-window", action_new_window, NULL, NULL, NULL },
{ "connect-to-server", action_connect_to_server, NULL, NULL, NULL },
{ "preferences", action_preferences, NULL, NULL, NULL },
@@ -910,7 +924,7 @@ static GActionEntry app_entries[] = {
};
static void
-nautilus_application_init_app_menu (NautilusApplication *self)
+nautilus_application_init_actions (NautilusApplication *self)
{
GtkBuilder *builder;
GError *error = NULL;
@@ -918,6 +932,7 @@ nautilus_application_init_app_menu (NautilusApplication *self)
g_action_map_add_action_entries (G_ACTION_MAP (self),
app_entries, G_N_ELEMENTS (app_entries),
self);
+ gtk_application_add_accelerator (GTK_APPLICATION (self), "F10", "app.gear-menu", NULL);
builder = gtk_builder_new ();
gtk_builder_add_from_resource (builder, "/org/gnome/nautilus/nautilus-app-menu.ui", &error);
@@ -1394,7 +1409,7 @@ nautilus_application_startup (GApplication *app)
do_upgrades_once (self);
- nautilus_application_init_app_menu (self);
+ nautilus_application_init_actions (self);
}
static void
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 9daf1a2..085ee40 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -205,6 +205,8 @@ nautilus_toolbar_constructed (GObject *obj)
tool_button = toolbar_create_toolbutton (self, TRUE, FALSE, "emblem-system-symbolic");
menu = gtk_ui_manager_get_widget (self->priv->ui_manager, "/ViewMenu");
gtk_menu_button_set_menu (GTK_MENU_BUTTON (tool_button), menu);
+ gtk_actionable_set_action_name (GTK_ACTIONABLE (tool_button), "app.gear-menu");
+
gtk_container_add (GTK_CONTAINER (tool_item), tool_button);
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_item));
gtk_widget_show_all (GTK_WIDGET (tool_item));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]