Revision: 1722
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1722&view=rev
Author:   nadvornik
Date:     2009-06-03 20:05:19 +0000 (Wed, 03 Jun 2009)

Log Message:
-----------
regroup sidecar files when an operation on partial group is finished

Modified Paths:
--------------
    trunk/src/filedata.c
    trunk/src/filedata.h
    trunk/src/typedefs.h
    trunk/src/utilops.c

Modified: trunk/src/filedata.c
===================================================================
--- trunk/src/filedata.c        2009-06-02 22:33:53 UTC (rev 1721)
+++ trunk/src/filedata.c        2009-06-03 20:05:19 UTC (rev 1722)
@@ -1429,6 +1429,8 @@
        if (!fdci) return;
 
        file_data_planned_change_remove(fd);
+       
+       if (fdci->regroup_when_finished) file_data_disable_grouping(fd, FALSE);
 
        g_free(fdci->source);
        g_free(fdci->dest);
@@ -1438,6 +1440,12 @@
        fd->change = NULL;
 }
 
+void file_data_set_regroup_when_finished(FileData *fd, gboolean enable)
+{
+       FileDataChangeInfo *fdci = fd->change;
+       if (!fdci) return;
+       fdci->regroup_when_finished = enable;
+}
 
 static gboolean file_data_sc_add_ci(FileData *fd, FileDataChangeType type)
 {
@@ -2373,7 +2381,7 @@
 }
 #endif
 
-GList *file_data_process_groups(GList *list)
+GList *file_data_process_groups_in_selection(GList *list, GList 
**ungrouped_list)
 {
        GList *out = NULL;
        GList *work = list;
@@ -2385,7 +2393,13 @@
                work = work->next;
                
                if (!file_data_list_contains_whole_group(list, fd)) 
+                       {
                        file_data_disable_grouping(fd, TRUE);
+                       if (ungrouped_list) 
+                               {
+                               *ungrouped_list = 
g_list_prepend(*ungrouped_list, file_data_ref(fd));
+                               }
+                       }
                }
        
        /* remove sidecars from the list, 

Modified: trunk/src/filedata.h
===================================================================
--- trunk/src/filedata.h        2009-06-02 22:33:53 UTC (rev 1721)
+++ trunk/src/filedata.h        2009-06-03 20:05:19 UTC (rev 1722)
@@ -118,6 +118,7 @@
 void file_data_free_ci(FileData *fd);
 void file_data_free_ci_list(GList *fd_list);
 
+void file_data_set_regroup_when_finished(FileData *fd, gboolean enable);
 
 gint file_data_sc_verify_ci(FileData *fd);
 
@@ -126,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(GList *list);
+GList *file_data_process_groups_in_selection(GList *list, GList **ungrouped);
 
 
 typedef void (*FileDataNotifyFunc)(FileData *fd, NotifyType type, gpointer 
data);

Modified: trunk/src/typedefs.h
===================================================================
--- trunk/src/typedefs.h        2009-06-02 22:33:53 UTC (rev 1721)
+++ trunk/src/typedefs.h        2009-06-03 20:05:19 UTC (rev 1722)
@@ -450,6 +450,7 @@
        gchar *source;
        gchar *dest;
        gint error;
+       gboolean regroup_when_finished;
 };
 
 struct _FileData {

Modified: trunk/src/utilops.c
===================================================================
--- trunk/src/utilops.c 2009-06-02 22:33:53 UTC (rev 1721)
+++ trunk/src/utilops.c 2009-06-03 20:05:19 UTC (rev 1722)
@@ -1919,24 +1919,41 @@
        g_free(message2);
 }
 
+
+static void file_util_mark_ungrouped_files(GList *work)
+{
+       while (work)
+               {
+               FileData *fd = work->data;
+               file_data_set_regroup_when_finished(fd, TRUE);
+               work = work->next;
+               }
+}
+
 static void file_util_delete_full(FileData *source_fd, GList *source_list, 
GtkWidget *parent, UtilityPhase phase)
 {
        UtilityData *ud;
        GList *flist = filelist_copy(source_list);
+       GList *ungrouped = NULL;
        
        if (source_fd)
                flist = g_list_append(flist, file_data_ref(source_fd));
 
        if (!flist) return;
        
-       flist = file_data_process_groups(flist);
+       flist = file_data_process_groups_in_selection(flist, &ungrouped);
        
        if (!file_data_sc_add_ci_delete_list(flist))
                {
                file_util_warn_op_in_progress(_("File deletion failed"));
+               file_data_disable_grouping_list(ungrouped, FALSE);
                filelist_free(flist);
+               filelist_free(ungrouped);
                return;
                }
+       
+       file_util_mark_ungrouped_files(ungrouped);
+       filelist_free(ungrouped);
 
        ud = file_util_data_new(UTILITY_TYPE_DELETE);
        
@@ -2005,25 +2022,30 @@
        file_util_dialog_run(ud);
 }
 
-
 static void file_util_move_full(FileData *source_fd, GList *source_list, const 
gchar *dest_path, GtkWidget *parent, UtilityPhase phase)
 {
        UtilityData *ud;
        GList *flist = filelist_copy(source_list);
+       GList *ungrouped = NULL;
        
        if (source_fd)
                flist = g_list_append(flist, file_data_ref(source_fd));
 
        if (!flist) return;
 
-       flist = file_data_process_groups(flist);
+       flist = file_data_process_groups_in_selection(flist, &ungrouped);
 
        if (!file_data_sc_add_ci_move_list(flist, dest_path))
                {
                file_util_warn_op_in_progress(_("Move failed"));
+               file_data_disable_grouping_list(ungrouped, FALSE);
                filelist_free(flist);
+               filelist_free(ungrouped);
                return;
                }
+       
+       file_util_mark_ungrouped_files(ungrouped);
+       filelist_free(ungrouped);
 
        ud = file_util_data_new(UTILITY_TYPE_MOVE);
 
@@ -2051,21 +2073,27 @@
 {
        UtilityData *ud;
        GList *flist = filelist_copy(source_list);
+       GList *ungrouped = NULL;
        
        if (source_fd)
                flist = g_list_append(flist, file_data_ref(source_fd));
 
        if (!flist) return;
 
-       flist = file_data_process_groups(flist);
+       flist = file_data_process_groups_in_selection(flist, &ungrouped);
 
        if (!file_data_sc_add_ci_copy_list(flist, dest_path))
                {
                file_util_warn_op_in_progress(_("Copy failed"));
+               file_data_disable_grouping_list(ungrouped, FALSE);
                filelist_free(flist);
+               filelist_free(ungrouped);
                return;
                }
 
+       file_util_mark_ungrouped_files(ungrouped);
+       filelist_free(ungrouped);
+
        ud = file_util_data_new(UTILITY_TYPE_COPY);
 
        ud->phase = phase;
@@ -2092,21 +2120,27 @@
 {
        UtilityData *ud;
        GList *flist = filelist_copy(source_list);
+       GList *ungrouped = NULL;
        
        if (source_fd)
                flist = g_list_append(flist, file_data_ref(source_fd));
 
        if (!flist) return;
 
-       flist = file_data_process_groups(flist);
+       flist = file_data_process_groups_in_selection(flist, &ungrouped);
 
        if (!file_data_sc_add_ci_rename_list(flist, dest_path))
                {
                file_util_warn_op_in_progress(_("Rename failed"));
+               file_data_disable_grouping_list(ungrouped, FALSE);
                filelist_free(flist);
+               filelist_free(ungrouped);
                return;
                }
 
+       file_util_mark_ungrouped_files(ungrouped);
+       filelist_free(ungrouped);
+
        ud = file_util_data_new(UTILITY_TYPE_RENAME);
 
        ud->phase = phase;
@@ -2133,6 +2167,7 @@
 {
        UtilityData *ud;
        GList *flist;
+       GList *ungrouped = NULL;
        
        if (editor_no_param(key))
                {
@@ -2148,15 +2183,20 @@
 
        if (!flist) return;
 
-       flist = file_data_process_groups(flist);
+       flist = file_data_process_groups_in_selection(flist, &ungrouped);
 
        if (!file_data_sc_add_ci_unspecified_list(flist, dest_path))
                {
                file_util_warn_op_in_progress(_("Can't run external editor"));
+               file_data_disable_grouping_list(ungrouped, FALSE);
                filelist_free(flist);
+               filelist_free(ungrouped);
                return;
                }
 
+       file_util_mark_ungrouped_files(ungrouped);
+       filelist_free(ungrouped);
+
        if (editor_is_filter(key))
                ud = file_util_data_new(UTILITY_TYPE_FILTER);
        else


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to