changeset 2580:f3f04883dc07

Append file selection to collection Additional right-click menu item to append file selection to a collection window
author Colin Clark <colin.clark@cclark.uk>
date Tue, 15 Aug 2017 20:07:40 +0100
parents 04e8bfac3367
children e6847b39721f
files src/collect-table.c
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/collect-table.c	Mon Aug 14 16:46:55 2017 +0100
+++ b/src/collect-table.c	Tue Aug 15 20:07:40 2017 +0100
@@ -39,6 +39,7 @@
 #include "ui_menu.h"
 #include "ui_tree_edit.h"
 #include "uri_utils.h"
+#include "view_file.h"
 
 #include "icons/marker.xpm"
 #define MARKER_WIDTH 26
@@ -841,6 +842,23 @@
 		}
 }
 
+static void collection_table_popup_add_file_selection_cb(GtkWidget *widget, gpointer data)
+{
+	CollectTable *ct = data;
+	GList *list;
+	LayoutWindow *lw = NULL;
+
+	if (!layout_valid(&lw)) return;
+
+	list = vf_selection_get_list(lw->vf);
+
+	if (list)
+		{
+		collection_table_add_filelist(ct, list);
+		filelist_free(list);
+		}
+}
+
 static void collection_table_popup_add_collection_cb(GtkWidget *widget, gpointer data)
 {
 	CollectTable *ct = data;
@@ -909,6 +927,8 @@
 	menu_item_add_stock_sensitive(menu, _("Rem_ove"), GTK_STOCK_REMOVE, over_icon,
 			G_CALLBACK(collection_table_popup_remove_cb), ct);
 
+	menu_item_add_stock(menu, _("Append from file selection"), GTK_STOCK_ADD,
+			G_CALLBACK(collection_table_popup_add_file_selection_cb), ct);
 	menu_item_add_stock(menu, _("Append from file list"), GTK_STOCK_ADD,
 			G_CALLBACK(collection_table_popup_add_filelist_cb), ct);
 	menu_item_add_stock(menu, _("Append from collection..."), GTK_STOCK_OPEN,