[gthumb/gthumb-3-4] file store: fixed reordering after changing metadata



commit 91040e1e254e69de82e716345069f8676a889673
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Sep 25 09:38:11 2016 +0200

    file store: fixed reordering after changing metadata

 gthumb/gth-file-store.c |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/gthumb/gth-file-store.c b/gthumb/gth-file-store.c
index 50beb2a..2c2afed 100644
--- a/gthumb/gth-file-store.c
+++ b/gthumb/gth-file-store.c
@@ -825,18 +825,6 @@ g_print ("UPDATE VISIBILITY\n");
                j++;
        }
 
-       /* reorder
-        *
-        * if there is no ordering (file_store->priv->cmp_func == NULL) make
-        * sure all_rows preserve the order of the visible rows, sorting by
-        * position (compare_by_pos) */
-
-       g_qsort_with_data (all_rows,
-                          all_rows_n,
-                          (gsize) sizeof (GthFileRow *),
-                          (file_store->priv->cmp_func == NULL) ? compare_by_pos : compare_row_func,
-                          file_store);
-
        /* old_rows is equal to file_store->priv->rows but points to
         * the rows of all_rows */
 
@@ -850,6 +838,24 @@ g_print ("UPDATE VISIBILITY\n");
                }
        }
 
+       /* make sure old_rows preserve the order of the visible rows, sorting by
+        * position (compare_by_pos) */
+
+       g_qsort_with_data (old_rows,
+                          old_rows_n,
+                          (gsize) sizeof (GthFileRow *),
+                          compare_by_pos,
+                          file_store);
+
+       /* sort */
+
+       if (file_store->priv->cmp_func != NULL)
+               g_qsort_with_data (all_rows,
+                                  all_rows_n,
+                                  (gsize) sizeof (GthFileRow *),
+                                  compare_row_func,
+                                  file_store);
+
        /* filter */
 
        /* store the new_rows file positions in an hash table for


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]