[nautilus] window: make gear-menu a window action instead of an app action
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] window: make gear-menu a window action instead of an app action
- Date: Tue, 31 Jul 2012 16:19:35 +0000 (UTC)
commit a04dc1d0dcee164f287bb2789abf93e68ac74953
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Jul 31 18:16:53 2012 +0200
window: make gear-menu a window action instead of an app action
Otherwise clicking on the gear menu will activate it on every window at
the same time.
src/nautilus-application.c | 16 +---------------
src/nautilus-toolbar.c | 2 +-
src/nautilus-window-menus.c | 21 +++++++++++++++++++++
3 files changed, 23 insertions(+), 16 deletions(-)
---
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 43b463b..a8bd7f9 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -899,21 +899,7 @@ 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 },
@@ -932,7 +918,7 @@ nautilus_application_init_actions (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);
+ gtk_application_add_accelerator (GTK_APPLICATION (self), "F10", "win.gear-menu", NULL);
builder = gtk_builder_new ();
gtk_builder_add_from_resource (builder, "/org/gnome/nautilus/nautilus-app-menu.ui", &error);
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 085ee40..3268c1d 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -205,7 +205,7 @@ 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_actionable_set_action_name (GTK_ACTIONABLE (tool_button), "win.gear-menu");
gtk_container_add (GTK_CONTAINER (tool_item), tool_button);
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_item));
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index 34ac23f..e65d62c 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -667,6 +667,23 @@ window_menus_set_bindings (NautilusWindow *window)
G_SETTINGS_BIND_DEFAULT);
}
+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);
+}
+
+const GActionEntry win_entries[] = {
+ { "gear-menu", action_toggle_state, NULL, "false", NULL },
+};
+
void
nautilus_window_initialize_actions (NautilusWindow *window)
{
@@ -676,6 +693,10 @@ nautilus_window_initialize_actions (NautilusWindow *window)
NAUTILUS_ACTION_SEARCH, NULL
};
+ g_action_map_add_action_entries (G_ACTION_MAP (window),
+ win_entries, G_N_ELEMENTS (win_entries),
+ window);
+
action_group = nautilus_window_get_main_action_group (window);
window->details->nav_state = nautilus_navigation_state_new (action_group,
nav_state_actions);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]