[nautilus/wip/antoniof/gtk4-preparation-step-event-controllers: 15/22] window: Add media key shortcut to Starred




commit 0a384d02f6449d78bd5ee8c65dd3c19bf139125d
Author: António Fernandes <antoniof gnome org>
Date:   Sun Aug 8 10:39:47 2021 +0100

    window: Add media key shortcut to Starred
    
    The Favorites media key is set as an accel for the "win.bookmarks"
    action, which has been removed many years ago along with the bookmarks
    editor.
    
    But now we have a Starred view, which fits nicely.

 src/nautilus-window.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 0a02347f4..1e1e16f30 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -172,7 +172,6 @@ static const struct
 {
     /* Window actions */
     { GDK_KEY_AddFavorite, "bookmark-current-location" },
-    { GDK_KEY_Favorites, "bookmarks" },
     { GDK_KEY_Go, "enter-location" },
     { GDK_KEY_HomePage, "go-home" },
     { GDK_KEY_OpenURL, "enter-location" },
@@ -224,6 +223,20 @@ action_go_home (GSimpleAction *action,
     g_object_unref (home);
 }
 
+static void
+action_go_starred (GSimpleAction *action,
+                   GVariant      *state,
+                   gpointer       user_data)
+{
+    NautilusWindow *window;
+    g_autoptr (GFile) starred = NULL;
+
+    window = NAUTILUS_WINDOW (user_data);
+    starred = g_file_new_for_uri ("starred:///");
+
+    nautilus_window_open_location_full (window, starred, 0, NULL, NULL);
+}
+
 static void
 action_reload (GSimpleAction *action,
                GVariant      *state,
@@ -2018,6 +2031,7 @@ const GActionEntry win_entries[] =
     /* Only accesible by shorcuts */
     { "close-current-view", action_close_current_view },
     { "go-home", action_go_home },
+    { "go-starred", action_go_starred },
     { "tab-previous", action_tab_previous },
     { "tab-next", action_tab_next },
     { "tab-move-left", action_tab_move_left },
@@ -2079,6 +2093,7 @@ nautilus_window_initialize_actions (NautilusWindow *window)
     nautilus_application_set_accelerator (app, "win.bookmark-current-location", "<control>d");
     nautilus_application_set_accelerator (app, "win.up", "<alt>Up");
     nautilus_application_set_accelerator (app, "win.go-home", "<alt>Home");
+    nautilus_application_set_accelerator (app, "win.go-starred", "Favorites");
     nautilus_application_set_accelerator (app, "win.tab-previous", "<control>Page_Up");
     nautilus_application_set_accelerator (app, "win.tab-next", "<control>Page_Down");
     nautilus_application_set_accelerator (app, "win.tab-move-left", "<shift><control>Page_Up");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]