Commit 55e2cdde by Cosimo Cecchi

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
parent 55a6e553
......@@ -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
......
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment