changeset 1729:672ee190869e

improved printing of selection
author nadvornik
date Fri, 28 Aug 2009 21:01:29 +0000
parents 94ced97edf0b
children 67145eade000
files src/filedata.c src/filedata.h src/print.c src/utilops.c
diffstat 4 files changed, 23 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/filedata.c	Fri Aug 28 20:18:46 2009 +0000
+++ b/src/filedata.c	Fri Aug 28 21:01:29 2009 +0000
@@ -2466,23 +2466,26 @@
 }
 #endif
 
-GList *file_data_process_groups_in_selection(GList *list, GList **ungrouped_list)
+GList *file_data_process_groups_in_selection(GList *list, gboolean ungroup, GList **ungrouped_list)
 {
 	GList *out = NULL;
 	GList *work = list;
 
 	/* change partial groups to independent files */
-	while (work)
+	if (ungroup)
 		{
-		FileData *fd = work->data;
-		work = work->next;
+		while (work)
+			{
+			FileData *fd = work->data;
+			work = work->next;
 		
-		if (!file_data_list_contains_whole_group(list, fd)) 
-			{
-			file_data_disable_grouping(fd, TRUE);
-			if (ungrouped_list) 
+			if (!file_data_list_contains_whole_group(list, fd)) 
 				{
-				*ungrouped_list = g_list_prepend(*ungrouped_list, file_data_ref(fd));
+				file_data_disable_grouping(fd, TRUE);
+				if (ungrouped_list) 
+					{
+					*ungrouped_list = g_list_prepend(*ungrouped_list, file_data_ref(fd));
+					}
 				}
 			}
 		}
@@ -2495,17 +2498,14 @@
 		FileData *fd = work->data;
 		work = work->next;
 		
-		if (!fd->parent)
+		if (!fd->parent ||
+		    (!ungroup && !file_data_list_contains_whole_group(list, fd)))
 			{
-			out = g_list_prepend(out, fd);
-			}
-		else
-			{
-			file_data_unref(fd);
+			out = g_list_prepend(out, file_data_ref(fd));
 			}
 		}
 		
-	g_list_free(list);
+	filelist_free(list);
 	out = g_list_reverse(out);
 
 	return out;
--- a/src/filedata.h	Fri Aug 28 20:18:46 2009 +0000
+++ b/src/filedata.h	Fri Aug 28 21:01:29 2009 +0000
@@ -127,7 +127,7 @@
 void file_data_sc_free_ci(FileData *fd);
 void file_data_sc_free_ci_list(GList *fd_list);
 
-GList *file_data_process_groups_in_selection(GList *list, GList **ungrouped);
+GList *file_data_process_groups_in_selection(GList *list, gboolean ungroup, GList **ungrouped);
 
 
 typedef void (*FileDataNotifyFunc)(FileData *fd, NotifyType type, gpointer data);
--- a/src/print.c	Fri Aug 28 20:18:46 2009 +0000
+++ b/src/print.c	Fri Aug 28 21:01:29 2009 +0000
@@ -3356,7 +3356,7 @@
 	pw = g_new0(PrintWindow, 1);
 
 	pw->source_fd = file_data_ref(fd);
-	pw->source_selection = selection;
+	pw->source_selection = file_data_process_groups_in_selection(selection, FALSE, NULL);
 	pw->source_list = list;
 
 	pw->source = print_pref_int(PRINT_PREF_SOURCE, PRINT_SOURCE_SELECTION);
--- a/src/utilops.c	Fri Aug 28 20:18:46 2009 +0000
+++ b/src/utilops.c	Fri Aug 28 21:01:29 2009 +0000
@@ -1955,7 +1955,7 @@
 
 	if (!flist) return;
 	
-	flist = file_data_process_groups_in_selection(flist, &ungrouped);
+	flist = file_data_process_groups_in_selection(flist, TRUE, &ungrouped);
 	
 	if (!file_data_sc_add_ci_delete_list(flist))
 		{
@@ -2045,7 +2045,7 @@
 
 	if (!flist) return;
 
-	flist = file_data_process_groups_in_selection(flist, &ungrouped);
+	flist = file_data_process_groups_in_selection(flist, TRUE, &ungrouped);
 
 	if (!file_data_sc_add_ci_move_list(flist, dest_path))
 		{
@@ -2094,7 +2094,7 @@
 	if (file_util_write_metadata_first(UTILITY_TYPE_COPY, phase, flist, dest_path, NULL, parent))
 		return;
 
-	flist = file_data_process_groups_in_selection(flist, &ungrouped);
+	flist = file_data_process_groups_in_selection(flist, TRUE, &ungrouped);
 
 	if (!file_data_sc_add_ci_copy_list(flist, dest_path))
 		{
@@ -2140,7 +2140,7 @@
 
 	if (!flist) return;
 
-	flist = file_data_process_groups_in_selection(flist, &ungrouped);
+	flist = file_data_process_groups_in_selection(flist, TRUE, &ungrouped);
 
 	if (!file_data_sc_add_ci_rename_list(flist, dest_path))
 		{
@@ -2217,7 +2217,7 @@
 	if (file_util_write_metadata_first(UTILITY_TYPE_FILTER, phase, flist, dest_path, key, parent))
 		return;
 
-	flist = file_data_process_groups_in_selection(flist, &ungrouped);
+	flist = file_data_process_groups_in_selection(flist, TRUE, &ungrouped);
 
 	if (!file_data_sc_add_ci_unspecified_list(flist, dest_path))
 		{