summaryrefslogtreecommitdiff
path: root/thunar/thunar-launcher.c
diff options
context:
space:
mode:
Diffstat (limited to 'thunar/thunar-launcher.c')
-rw-r--r--thunar/thunar-launcher.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/thunar/thunar-launcher.c b/thunar/thunar-launcher.c
index eb97d995..b07296c1 100644
--- a/thunar/thunar-launcher.c
+++ b/thunar/thunar-launcher.c
@@ -133,6 +133,7 @@ static void thunar_launcher_action_sendto_desktop (Thuna
static void thunar_launcher_action_properties (ThunarLauncher *launcher);
static void thunar_launcher_action_sendto_device (ThunarLauncher *launcher,
GObject *object);
+static void thunar_launcher_action_add_shortcuts (ThunarLauncher *launcher);
static void thunar_launcher_action_make_link (ThunarLauncher *launcher);
static void thunar_launcher_action_duplicate (ThunarLauncher *launcher);
static void thunar_launcher_action_rename (ThunarLauncher *launcher);
@@ -237,6 +238,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", "", XFCE_GTK_MENU_ITEM, NULL, NULL, "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), },
@@ -1695,6 +1697,32 @@ thunar_launcher_action_sendto_device (ThunarLauncher *launcher,
}
+static void
+thunar_launcher_action_add_shortcuts (ThunarLauncher *launcher)
+{
+ GList *lp;
+ GtkWidget *window;
+ const GtkWidget *sidepane;
+
+ _thunar_return_if_fail (THUNAR_IS_LAUNCHER (launcher));
+
+ /* determine the toplevel window we belong to */
+ window = gtk_widget_get_toplevel (launcher->widget);
+ if (THUNAR_IS_WINDOW (window) == FALSE)
+ return;
+ if (thunar_window_has_shortcut_sidepane (THUNAR_WINDOW (window)) == FALSE)
+ return;
+
+ sidepane = thunar_window_get_sidepane (THUNAR_WINDOW (window));
+ if (sidepane != NULL && THUNAR_IS_SHORTCUTS_PANE (sidepane))
+ {
+ for (lp = launcher->selected_files; lp != NULL; lp = lp->next)
+ thunar_shortcuts_pane_add_shortcut (THUNAR_SHORTCUTS_PANE (sidepane), lp->data);
+ }
+
+}
+
+
static GtkWidget*
thunar_launcher_build_sendto_submenu (ThunarLauncher *launcher)
@@ -1718,6 +1746,25 @@ thunar_launcher_build_sendto_submenu (ThunarLauncher *launcher)
submenu = gtk_menu_new();
+ /* show "sent to shortcut" if only directories are selected */
+ if (launcher->n_selected_directories > 0 && launcher->n_selected_directories == launcher->n_selected_files)
+ {
+ /* determine the toplevel window we belong to */
+ window = gtk_widget_get_toplevel (launcher->widget);
+ if (THUNAR_IS_WINDOW (window) && thunar_window_has_shortcut_sidepane (THUNAR_WINDOW (window)))
+ {
+ action_entry = get_action_entry (THUNAR_LAUNCHER_ACTION_SENDTO_SHORTCUTS);
+ if (action_entry != NULL)
+ {
+ label_text = ngettext ("Side Pane (Create Shortcut)", "Side Pane (Create Shortcuts)", launcher->n_selected_files);
+ tooltip_text = ngettext ("Add the selected folder to the shortcuts side pane",
+ "Add the selected folders to the shortcuts side pane", launcher->n_selected_files);
+ item = xfce_gtk_image_menu_item_new_from_icon_name (label_text, tooltip_text, action_entry->accel_path, action_entry->callback,
+ G_OBJECT (launcher), action_entry->menu_item_icon_name, GTK_MENU_SHELL (submenu));
+ }
+ }
+ }
+
/* Check whether at least one files is located in the trash (to en-/disable the "sendto-desktop" action). */
for (lp = launcher->selected_files; lp != NULL; lp = lp->next)
{