From 039f7f905b3c2c377ea34166a60a27f213cd05d8 Mon Sep 17 00:00:00 2001 From: Sergios - Anestis Kefalidis <sergioskefalidis@gmail.com> Date: Tue, 18 May 2021 19:01:25 +0300 Subject: [PATCH] Move bookmarks into a separate Bookmarks menu (Issue #572) MR !109 Issue #572 --- thunar/thunar-launcher.c | 2 +- thunar/thunar-window.c | 25 ++++++++++++++++++++++--- thunar/thunar-window.h | 1 + 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/thunar/thunar-launcher.c b/thunar/thunar-launcher.c index 9ac8d1d65..51b3061c2 100644 --- a/thunar/thunar-launcher.c +++ b/thunar/thunar-launcher.c @@ -271,7 +271,7 @@ static XfceGtkActionEntry thunar_launcher_action_entries[] = /* For backward compatibility the old accel paths are re-used. Currently not possible to automatically migrate to new accel paths. */ /* Waiting for https://gitlab.gnome.org/GNOME/gtk/issues/2375 to be able to fix that */ { THUNAR_LAUNCHER_ACTION_SENDTO_MENU, "<Actions>/ThunarWindow/sendto-menu", "", XFCE_GTK_MENU_ITEM, N_ ("_Send To"), NULL, NULL, NULL, }, - { THUNAR_LAUNCHER_ACTION_SENDTO_SHORTCUTS, "<Actions>/ThunarShortcutsPane/sendto-shortcuts", "<Primary>D", XFCE_GTK_IMAGE_MENU_ITEM, N_ ("Add _Bookmark"), N_ ("Create bookmarks for all selected folders in the sidepane. If nothing is selected, the current directory is bookmarked."), "bookmark-new", G_CALLBACK (thunar_launcher_action_add_shortcuts), }, + { THUNAR_LAUNCHER_ACTION_SENDTO_SHORTCUTS, "<Actions>/ThunarShortcutsPane/sendto-shortcuts", "<Primary>D", XFCE_GTK_IMAGE_MENU_ITEM, N_ ("_Add Bookmark"), N_ ("Create bookmarks for all selected folders in the sidepane. If nothing is selected, the current directory is bookmarked."), "bookmark-new", G_CALLBACK (thunar_launcher_action_add_shortcuts), }, { THUNAR_LAUNCHER_ACTION_SENDTO_DESKTOP, "<Actions>/ThunarLauncher/sendto-desktop", "", XFCE_GTK_MENU_ITEM, NULL, NULL, "user-desktop", G_CALLBACK (thunar_launcher_action_sendto_desktop), }, { THUNAR_LAUNCHER_ACTION_PROPERTIES, "<Actions>/ThunarStandardView/properties", "<Alt>Return", XFCE_GTK_IMAGE_MENU_ITEM, N_ ("_Properties..."), N_ ("View the properties of the selected file"), "document-properties", G_CALLBACK (thunar_launcher_action_properties), }, { THUNAR_LAUNCHER_ACTION_MAKE_LINK, "<Actions>/ThunarStandardView/make-link", "", XFCE_GTK_MENU_ITEM, N_ ("Ma_ke Link"), NULL, NULL, G_CALLBACK (thunar_launcher_action_make_link), }, diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c index 456d7d441..b63edc511 100644 --- a/thunar/thunar-window.c +++ b/thunar/thunar-window.c @@ -259,6 +259,8 @@ static void thunar_window_update_view_menu (ThunarWindow GtkWidget *menu); static void thunar_window_update_go_menu (ThunarWindow *window, GtkWidget *menu); +static void thunar_window_update_bookmarks_menu (ThunarWindow *window, + GtkWidget *menu); static void thunar_window_update_help_menu (ThunarWindow *window, GtkWidget *menu); static void thunar_window_binding_create (ThunarWindow *window, @@ -431,6 +433,7 @@ static XfceGtkActionEntry thunar_window_action_entries[] = { THUNAR_WINDOW_ACTION_VIEW_AS_COMPACT_LIST, "<Actions>/ThunarWindow/view-as-compact-list", "<Primary>3", XFCE_GTK_RADIO_MENU_ITEM, N_ ("_Compact View"), N_ ("Display folder content in a compact list view"), NULL, G_CALLBACK (thunar_window_action_compact_view), }, { THUNAR_WINDOW_ACTION_GO_MENU, "<Actions>/ThunarWindow/go-menu", "", XFCE_GTK_MENU_ITEM, N_ ("_Go"), NULL, NULL, NULL }, + { THUNAR_WINDOW_ACTION_BOOKMARKS_MENU, "<Actions>/ThunarWindow/bookmarks-menu", "", XFCE_GTK_MENU_ITEM, N_ ("_Bookmarks"), NULL, NULL, NULL }, { THUNAR_WINDOW_ACTION_OPEN_FILE_SYSTEM, "<Actions>/ThunarWindow/open-file-system", "", XFCE_GTK_IMAGE_MENU_ITEM, N_ ("File System"), N_ ("Browse the file system"), "drive-harddisk", G_CALLBACK (thunar_window_action_open_file_system), }, { THUNAR_WINDOW_ACTION_OPEN_HOME, "<Actions>/ThunarWindow/open-home", "<Alt>Home", XFCE_GTK_IMAGE_MENU_ITEM, N_ ("_Home"), N_ ("Go to the home folder"), "go-home-symbolic", G_CALLBACK (thunar_window_action_open_home), }, { THUNAR_WINDOW_ACTION_OPEN_DESKTOP, "<Actions>/ThunarWindow/open-desktop", "", XFCE_GTK_IMAGE_MENU_ITEM, N_ ("Desktop"), N_ ("Go to the desktop folder"), "user-desktop", G_CALLBACK (thunar_window_action_open_desktop), }, @@ -753,6 +756,7 @@ thunar_window_init (ThunarWindow *window) thunar_window_create_menu (window, THUNAR_WINDOW_ACTION_EDIT_MENU, G_CALLBACK (thunar_window_update_edit_menu)); thunar_window_create_menu (window, THUNAR_WINDOW_ACTION_VIEW_MENU, G_CALLBACK (thunar_window_update_view_menu)); thunar_window_create_menu (window, THUNAR_WINDOW_ACTION_GO_MENU, G_CALLBACK (thunar_window_update_go_menu)); + thunar_window_create_menu (window, THUNAR_WINDOW_ACTION_BOOKMARKS_MENU, G_CALLBACK (thunar_window_update_bookmarks_menu)); thunar_window_create_menu (window, THUNAR_WINDOW_ACTION_HELP_MENU, G_CALLBACK (thunar_window_update_help_menu)); gtk_widget_show_all (window->menubar); @@ -1216,15 +1220,30 @@ thunar_window_update_go_menu (ThunarWindow *window, } xfce_gtk_menu_item_new_from_action_entry (get_action_entry (THUNAR_WINDOW_ACTION_OPEN_TEMPLATES), G_OBJECT (window), GTK_MENU_SHELL (menu)); xfce_gtk_menu_append_seperator (GTK_MENU_SHELL (menu)); - thunar_window_menu_add_bookmarks (window, GTK_MENU_SHELL (menu)); - xfce_gtk_menu_append_seperator (GTK_MENU_SHELL (menu)); xfce_gtk_menu_item_new_from_action_entry (get_action_entry (THUNAR_WINDOW_ACTION_OPEN_FILE_SYSTEM), G_OBJECT (window), GTK_MENU_SHELL (menu)); xfce_gtk_menu_append_seperator (GTK_MENU_SHELL (menu)); xfce_gtk_menu_item_new_from_action_entry (get_action_entry (THUNAR_WINDOW_ACTION_OPEN_NETWORK), G_OBJECT (window), GTK_MENU_SHELL (menu)); xfce_gtk_menu_append_seperator (GTK_MENU_SHELL (menu)); + xfce_gtk_menu_item_new_from_action_entry (get_action_entry (THUNAR_WINDOW_ACTION_OPEN_LOCATION), G_OBJECT (window), GTK_MENU_SHELL (menu)); + gtk_widget_show_all (GTK_WIDGET (menu)); + + thunar_window_redirect_menu_tooltips_to_statusbar (window, GTK_MENU (menu)); +} + + + +static void +thunar_window_update_bookmarks_menu (ThunarWindow *window, + GtkWidget *menu) +{ + _thunar_return_if_fail (THUNAR_IS_WINDOW (window)); + + thunar_gtk_menu_clean (GTK_MENU (menu)); + thunar_launcher_append_menu_item (window->launcher, GTK_MENU_SHELL (menu),THUNAR_LAUNCHER_ACTION_SENDTO_SHORTCUTS, FALSE); xfce_gtk_menu_append_seperator (GTK_MENU_SHELL (menu)); - xfce_gtk_menu_item_new_from_action_entry (get_action_entry (THUNAR_WINDOW_ACTION_OPEN_LOCATION), G_OBJECT (window), GTK_MENU_SHELL (menu)); + thunar_window_menu_add_bookmarks (window, GTK_MENU_SHELL (menu)); + gtk_widget_show_all (GTK_WIDGET (menu)); thunar_window_redirect_menu_tooltips_to_statusbar (window, GTK_MENU (menu)); diff --git a/thunar/thunar-window.h b/thunar/thunar-window.h index 4b1237a76..66cde9322 100644 --- a/thunar/thunar-window.h +++ b/thunar/thunar-window.h @@ -76,6 +76,7 @@ typedef enum THUNAR_WINDOW_ACTION_VIEW_AS_DETAILED_LIST, THUNAR_WINDOW_ACTION_VIEW_AS_COMPACT_LIST, THUNAR_WINDOW_ACTION_GO_MENU, + THUNAR_WINDOW_ACTION_BOOKMARKS_MENU, THUNAR_WINDOW_ACTION_OPEN_PARENT, THUNAR_WINDOW_ACTION_BACK, THUNAR_WINDOW_ACTION_BACK_ALT, -- GitLab