1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
diff -Nur geeqie-1.0-orig/src/view_file_list.c geeqie-1.0/src/view_file_list.c
--- geeqie-1.0-orig/src/view_file_list.c 2010-02-17 22:21:19.000000000 +0100
+++ geeqie-1.0/src/view_file_list.c 2011-04-15 13:47:10.727936556 +0200
@@ -943,8 +943,6 @@
GList *work;
GtkTreeIter iter;
gboolean valid;
- gint num_ordered = 0;
- gint num_prepended = 0;
valid = gtk_tree_model_iter_children(GTK_TREE_MODEL(store), &iter, parent_iter);
@@ -993,17 +991,11 @@
if (valid)
{
- num_ordered++;
gtk_tree_store_insert_before(store, &new, parent_iter, &iter);
}
else
{
- /*
- here should be used gtk_tree_store_append, but this function seems to be O(n)
- and it seems to be much faster to add new entries to the beginning and reorder later
- */
- num_prepended++;
- gtk_tree_store_prepend(store, &new, parent_iter);
+ gtk_tree_store_append(store, &new, parent_iter);
}
vflist_setup_iter(vf, store, &new, file_data_ref(fd));
@@ -1026,7 +1018,6 @@
}
else
{
- num_ordered++;
if (fd->version != old_version || force)
{
vflist_setup_iter(vf, store, &iter, fd);
@@ -1043,31 +1034,12 @@
while (valid)
{
- FileData *old_fd;
+ FileData *old_fd = NULL;
gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, FILE_COLUMN_POINTER, &old_fd, -1);
file_data_unref(old_fd);
valid = gtk_tree_store_remove(store, &iter);
}
-
- /* move the prepended entries to the correct position */
- if (num_prepended)
- {
- gint i;
- gint num_total = num_prepended + num_ordered;
- gint *new_order = g_malloc(num_total * sizeof(gint));
-
- for (i = 0; i < num_total; i++)
- {
- if (i < num_ordered)
- new_order[i] = num_prepended + i;
- else
- new_order[i] = num_total - 1 - i;
- }
- gtk_tree_store_reorder(store, parent_iter, new_order);
-
- g_free(new_order);
- }
}
void vflist_sort_set(ViewFile *vf, SortType type, gboolean ascend)
|