annotate src/view_file_list.c @ 208:fa0e05f985c3

set user-defined color as image background - patch by Laurent MONIN
author nadvornik
date Sat, 29 Mar 2008 10:38:15 +0000
parents f6e307c7bad6
children 22ed43d4c849
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1 /*
196
f6e307c7bad6 rename GQview -> Geeqie over the code
nadvornik
parents: 169
diff changeset
2 * Geeqie
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
3 * (C) 2004 John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
4 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 * Author: John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * This software comes with no warranty of any kind, use at your own risk!
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
10 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
11
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
12 #include "gqview.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
13 #include "view_file_list.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15 #include "cache_maint.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16 #include "dnd.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
17 #include "editors.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
18 #include "img-view.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 #include "info.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
20 #include "layout.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21 #include "layout_image.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 #include "menu.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 #include "thumb.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 #include "utilops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25 #include "ui_bookmark.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
27 #include "ui_menu.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28 #include "ui_tree_edit.h"
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
29 #include "typedefs.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31 #include <gdk/gdkkeysyms.h> /* for keyboard values */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
34 enum {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
35 FILE_COLUMN_POINTER = 0,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
36 FILE_COLUMN_THUMB,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
37 FILE_COLUMN_NAME,
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
38 FILE_COLUMN_SIDECARS,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39 FILE_COLUMN_SIZE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
40 FILE_COLUMN_DATE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
41 FILE_COLUMN_COLOR,
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
42 FILE_COLUMN_MARKS,
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
43 FILE_COLUMN_MARKS_LAST = FILE_COLUMN_MARKS + FILEDATA_MARKS_SIZE - 1,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
44 FILE_COLUMN_COUNT
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
45 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
47
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
48 static gint vflist_row_is_selected(ViewFileList *vfl, FileData *fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49 static gint vflist_row_rename_cb(TreeEditData *td, const gchar *old, const gchar *new, gpointer data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50 static void vflist_populate_view(ViewFileList *vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
52 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
53 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54 * signals
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
55 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
56 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
57
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
58 static void vflist_send_update(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
59 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
60 if (vfl->func_status) vfl->func_status(vfl, vfl->data_status);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
61 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
62
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
63 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
64 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
65 * misc
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
66 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
67 */
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
68 typedef struct {
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
69 FileData *fd;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
70 GtkTreeIter *iter;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
71 gint found;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
72 gint row;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
73 } ViewFileListFindRowData;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
74
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
75 static gboolean vflist_find_row_cb(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
76 {
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
77 ViewFileListFindRowData *find = data;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
78 FileData *fd;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
79 gtk_tree_model_get(model, iter, FILE_COLUMN_POINTER, &fd, -1);
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
80 if (fd == find->fd)
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
81 {
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
82 *find->iter = *iter;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
83 find->found = 1;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
84 return TRUE;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
85 }
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
86 find->row++;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
87 return FALSE;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
88 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
90 static gint vflist_find_row(ViewFileList *vfl, FileData *fd, GtkTreeIter *iter)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
91 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
92 GtkTreeModel *store;
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
93 ViewFileListFindRowData data = {fd, iter, 0, 0};
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
94
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
95 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
96 gtk_tree_model_foreach(store, vflist_find_row_cb, &data);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
97
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
98 if (data.found)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
99 {
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
100 return data.row;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
101 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
102
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
103 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
104 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
105
169
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
106
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
107 static gint vflist_find_sidecar_list_idx(GList *work, FileData *fd)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
108 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
109 gint i = 0;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
110 while (work)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
111 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
112 FileData *fd_p = work->data;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
113 if (fd == fd_p) return i;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
114
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
115 i++;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
116
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
117 GList *work2 = fd_p->sidecar_files;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
118 while (work2)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
119 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
120 fd_p = work2->data;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
121 if (fd == fd_p) return i;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
122
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
123 i++;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
124 work2 = work2->next;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
125 }
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
126 work = work->next;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
127 }
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
128 return -1;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
129 }
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
130
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
131 static gint vflist_sidecar_list_count(GList *work)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
132 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
133 gint i = 0;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
134 while (work)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
135 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
136 FileData *fd = work->data;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
137 i++;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
138
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
139 GList *work2 = fd->sidecar_files;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
140 while (work2)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
141 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
142 i++;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
143 work2 = work2->next;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
144 }
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
145 work = work->next;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
146 }
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
147 return i;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
148 }
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
149
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
150
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
151 static void vflist_color_set(ViewFileList *vfl, FileData *fd, gint color_set)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
152 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
153 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
154 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
156 if (vflist_find_row(vfl, fd, &iter) < 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
157 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
158 gtk_tree_store_set(GTK_TREE_STORE(store), &iter, FILE_COLUMN_COLOR, color_set, -1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
160
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
161 static void vflist_move_cursor(ViewFileList *vfl, GtkTreeIter *iter)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
162 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
163 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
165
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
167
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
168 tpath = gtk_tree_model_get_path(store, iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169 gtk_tree_view_set_cursor(GTK_TREE_VIEW(vfl->listview), tpath, NULL, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
170 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
171 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
172
157
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
173
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
174 static gint vflist_column_idx(ViewFileList *vfl, gint store_idx)
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
175 {
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
176 GList *columns, *work;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
177 gint i = 0;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
178
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
179 columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(vfl->listview));
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
180 work = columns;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
181 while (work)
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
182 {
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
183 GtkTreeViewColumn *column = work->data;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
184 if (store_idx == GPOINTER_TO_INT(g_object_get_data (G_OBJECT(column), "column_store_idx")))
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
185 break;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
186 work = work->next;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
187 i++;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
188 }
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
189
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
190 g_list_free(columns);
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
191 return i;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
192 }
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
193
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
194
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
195 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
196 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
197 * dnd
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
198 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
199 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
200
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
201 static void vflist_dnd_get(GtkWidget *widget, GdkDragContext *context,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
202 GtkSelectionData *selection_data, guint info,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
203 guint time, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
205 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
206 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207 gchar *uri_text = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
208 gint total;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
209
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
210 if (!vfl->click_fd) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
211
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
212 if (vflist_row_is_selected(vfl, vfl->click_fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
213 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214 list = vflist_selection_get_list(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
215 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
218 list = g_list_append(NULL, file_data_ref(vfl->click_fd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221 if (!list) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
222
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
223 uri_text = uri_text_from_filelist(list, &total, (info == TARGET_TEXT_PLAIN));
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
224 filelist_free(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
225
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
226 if (debug) printf(uri_text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
227
64
04ff0df3ad2f Mon Aug 15 17:13:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
228 gtk_selection_data_set(selection_data, selection_data->target,
04ff0df3ad2f Mon Aug 15 17:13:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
229 8, (guchar *)uri_text, total);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230 g_free(uri_text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
231 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
232
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
233 static void vflist_dnd_begin(GtkWidget *widget, GdkDragContext *context, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
235 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
236
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
237 vflist_color_set(vfl, vfl->click_fd, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
238
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239 if (vfl->thumbs_enabled &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
240 vfl->click_fd && vfl->click_fd->pixbuf)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
241 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
242 gint items;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
243
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
244 if (vflist_row_is_selected(vfl, vfl->click_fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
245 items = vflist_selection_count(vfl, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
246 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
247 items = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
249 dnd_set_drag_icon(widget, context, vfl->click_fd->pixbuf, items);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
250 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
252
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
253 static void vflist_dnd_end(GtkWidget *widget, GdkDragContext *context, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
254 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
255 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
256
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
257 vflist_color_set(vfl, vfl->click_fd, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
258
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
259 if (context->action == GDK_ACTION_MOVE)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
260 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
261 vflist_refresh(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
262 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
263 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
264
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
265 static void vflist_dnd_init(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
266 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
267 gtk_drag_source_set(vfl->listview, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
268 dnd_file_drag_types, dnd_file_drag_types_count,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
270 g_signal_connect(G_OBJECT(vfl->listview), "drag_data_get",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
271 G_CALLBACK(vflist_dnd_get), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272 g_signal_connect(G_OBJECT(vfl->listview), "drag_begin",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
273 G_CALLBACK(vflist_dnd_begin), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274 g_signal_connect(G_OBJECT(vfl->listview), "drag_end",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275 G_CALLBACK(vflist_dnd_end), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
278 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
279 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
280 * pop-up menu
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
281 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
282 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
283
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
284 static GList *vflist_pop_menu_file_list(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
285 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
286 if (!vfl->click_fd) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
287
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
288 if (vflist_row_is_selected(vfl, vfl->click_fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
289 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
290 return vflist_selection_get_list(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
291 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
293 return g_list_append(NULL, file_data_ref(vfl->click_fd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
295
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
296 static void vflist_pop_menu_edit_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
297 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
298 ViewFileList *vfl;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
299 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
300 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
301
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
302 vfl = submenu_item_get_data(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
303 n = GPOINTER_TO_INT(data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
304
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
305 if (!vfl) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
306
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
307 list = vflist_pop_menu_file_list(vfl);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
308 start_editor_from_filelist(n, list);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
309 filelist_free(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
310 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
311
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
312 static void vflist_pop_menu_info_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
313 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
314 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
315
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
316 info_window_new(NULL, vflist_pop_menu_file_list(vfl));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
317 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
318
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
319 static void vflist_pop_menu_view_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
320 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
321 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
322
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
323 if (vflist_row_is_selected(vfl, vfl->click_fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
324 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
325 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
326
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
327 list = vflist_selection_get_list(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328 view_window_new_from_list(list);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
329 filelist_free(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
330 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
331 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
333 view_window_new(vfl->click_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
334 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
335 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
336
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
337 static void vflist_pop_menu_copy_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
338 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
339 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
340
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
341 file_util_copy(NULL, vflist_pop_menu_file_list(vfl), NULL, vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
342 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
343
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
344 static void vflist_pop_menu_move_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
345 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
346 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
347
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
348 file_util_move(NULL, vflist_pop_menu_file_list(vfl), NULL, vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
349 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
350
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
351 static void vflist_pop_menu_rename_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
352 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
353 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
354 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
355
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
356 list = vflist_pop_menu_file_list(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
357 if (enable_in_place_rename &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
358 list && !list->next && vfl->click_fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
359 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
360 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
361 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
362
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
363 filelist_free(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
364
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
365 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
366 if (vflist_find_row(vfl, vfl->click_fd, &iter) >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
367 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
368 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
369
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
370 tpath = gtk_tree_model_get_path(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
371 tree_edit_by_path(GTK_TREE_VIEW(vfl->listview), tpath,
157
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
372 vflist_column_idx(vfl, FILE_COLUMN_NAME), vfl->click_fd->name,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
373 vflist_row_rename_cb, vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
374 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
375 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
376 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
377 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
378
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
379 file_util_rename(NULL, list, vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
380 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
381
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
382 static void vflist_pop_menu_delete_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
383 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
384 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
385
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
386 file_util_delete(NULL, vflist_pop_menu_file_list(vfl), vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
387 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
388
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
389 static void vflist_pop_menu_sort_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
390 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
391 ViewFileList *vfl;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
392 SortType type;
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 111
diff changeset
393
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 111
diff changeset
394 if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
395
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
396 vfl = submenu_item_get_data(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
397 if (!vfl) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
398
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
399 type = (SortType)GPOINTER_TO_INT(data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
400
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
401 if (vfl->layout)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
402 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
403 layout_sort_set(vfl->layout, type, vfl->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
404 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
405 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
406 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
407 vflist_sort_set(vfl, type, vfl->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
408 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
409 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
410
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
411 static void vflist_pop_menu_sort_ascend_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
412 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
413 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
414
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
415 if (vfl->layout)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
416 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
417 layout_sort_set(vfl->layout, vfl->sort_method, !vfl->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
418 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
419 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
420 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
421 vflist_sort_set(vfl, vfl->sort_method, !vfl->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
422 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
423 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
424
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
425 static void vflist_pop_menu_icons_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
426 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
427 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
428
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
429 if (vfl->layout) layout_views_set(vfl->layout, vfl->layout->tree_view, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
430 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
431
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
432 static void vflist_pop_menu_thumbs_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
433 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
434 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
435
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
436 vflist_color_set(vfl, vfl->click_fd, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
437 if (vfl->layout)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
438 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
439 layout_thumb_set(vfl->layout, !vfl->thumbs_enabled);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
440 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
441 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
442 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
443 vflist_thumb_set(vfl, !vfl->thumbs_enabled);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
444 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
445 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
446
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
447 static void vflist_pop_menu_refresh_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
448 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
449 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
450
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
451 vflist_color_set(vfl, vfl->click_fd, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
452 vflist_refresh(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
453 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
454
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
455 static void vflist_pop_menu_sel_mark_cb(GtkWidget *widget, gpointer data)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
456 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
457 ViewFileList *vfl = data;
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
458 vflist_mark_to_selection(vfl, vfl->active_mark, MTS_MODE_SET);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
459 }
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
460
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
461 static void vflist_pop_menu_sel_mark_and_cb(GtkWidget *widget, gpointer data)
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
462 {
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
463 ViewFileList *vfl = data;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
464 vflist_mark_to_selection(vfl, vfl->active_mark, MTS_MODE_AND);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
465 }
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
466
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
467 static void vflist_pop_menu_sel_mark_or_cb(GtkWidget *widget, gpointer data)
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
468 {
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
469 ViewFileList *vfl = data;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
470 vflist_mark_to_selection(vfl, vfl->active_mark, MTS_MODE_OR);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
471 }
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
472
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
473 static void vflist_pop_menu_sel_mark_minus_cb(GtkWidget *widget, gpointer data)
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
474 {
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
475 ViewFileList *vfl = data;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
476 vflist_mark_to_selection(vfl, vfl->active_mark, MTS_MODE_MINUS);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
477 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
478
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
479 static void vflist_pop_menu_set_mark_sel_cb(GtkWidget *widget, gpointer data)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
480 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
481 ViewFileList *vfl = data;
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
482 vflist_selection_to_mark(vfl, vfl->active_mark, STM_MODE_SET);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
483 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
484
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
485 static void vflist_pop_menu_res_mark_sel_cb(GtkWidget *widget, gpointer data)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
486 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
487 ViewFileList *vfl = data;
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
488 vflist_selection_to_mark(vfl, vfl->active_mark, STM_MODE_RESET);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
489 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
490
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
491 static void vflist_pop_menu_toggle_mark_sel_cb(GtkWidget *widget, gpointer data)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
492 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
493 ViewFileList *vfl = data;
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
494 vflist_selection_to_mark(vfl, vfl->active_mark, STM_MODE_TOGGLE);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
495 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
496
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
497
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
498 static void vflist_popup_destroy_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
499 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
500 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
501 vflist_color_set(vfl, vfl->click_fd, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
502 vfl->click_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
503 vfl->popup = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
504 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
505
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
506
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
507 static GtkWidget *vflist_pop_menu(ViewFileList *vfl, FileData *fd, gint col_idx)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
508 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
509 GtkWidget *menu;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
510 GtkWidget *item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
511 GtkWidget *submenu;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
512 gint active;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
513
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
514 vflist_color_set(vfl, fd, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
515 active = (fd != NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
516
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
517 menu = popup_menu_short_lived();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
518 g_signal_connect(G_OBJECT(menu), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
519 G_CALLBACK(vflist_popup_destroy_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
520
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
521 if (col_idx >= FILE_COLUMN_MARKS && col_idx <= FILE_COLUMN_MARKS_LAST)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
522 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
523 gint mark = col_idx - FILE_COLUMN_MARKS;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
524 gchar *str_set_mark = g_strdup_printf(_("_Set mark %d"), mark + 1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
525 gchar *str_res_mark = g_strdup_printf(_("_Reset mark %d"), mark + 1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
526 gchar *str_toggle_mark = g_strdup_printf(_("_Toggle mark %d"), mark + 1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
527 gchar *str_sel_mark = g_strdup_printf(_("_Select mark %d"), mark + 1);
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
528 gchar *str_sel_mark_or = g_strdup_printf(_("_Add mark %d"), mark + 1);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
529 gchar *str_sel_mark_and = g_strdup_printf(_("_Intersection with mark %d"), mark + 1);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
530 gchar *str_sel_mark_minus = g_strdup_printf(_("_Unselect mark %d"), mark + 1);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
531
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
532
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
533 vfl->active_mark = mark;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
534 menu_item_add_sensitive(menu, str_set_mark, active,
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
535 G_CALLBACK(vflist_pop_menu_set_mark_sel_cb), vfl);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
536
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
537 menu_item_add_sensitive(menu, str_res_mark, active,
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
538 G_CALLBACK(vflist_pop_menu_res_mark_sel_cb), vfl);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
539
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
540 menu_item_add_sensitive(menu, str_toggle_mark, active,
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
541 G_CALLBACK(vflist_pop_menu_toggle_mark_sel_cb), vfl);
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
542
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
543 menu_item_add_divider(menu);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
544
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
545 menu_item_add_sensitive(menu, str_sel_mark, active,
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
546 G_CALLBACK(vflist_pop_menu_sel_mark_cb), vfl);
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
547 menu_item_add_sensitive(menu, str_sel_mark_or, active,
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
548 G_CALLBACK(vflist_pop_menu_sel_mark_or_cb), vfl);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
549 menu_item_add_sensitive(menu, str_sel_mark_and, active,
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
550 G_CALLBACK(vflist_pop_menu_sel_mark_and_cb), vfl);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
551 menu_item_add_sensitive(menu, str_sel_mark_minus, active,
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
552 G_CALLBACK(vflist_pop_menu_sel_mark_minus_cb), vfl);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
553
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
554 menu_item_add_divider(menu);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
555
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
556 g_free(str_set_mark);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
557 g_free(str_res_mark);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
558 g_free(str_toggle_mark);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
559 g_free(str_sel_mark);
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
560 g_free(str_sel_mark_and);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
561 g_free(str_sel_mark_or);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
562 g_free(str_sel_mark_minus);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
563 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
564
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
565 submenu_add_edit(menu, &item, G_CALLBACK(vflist_pop_menu_edit_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
566 gtk_widget_set_sensitive(item, active);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
567
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
568 menu_item_add_stock_sensitive(menu, _("_Properties"), GTK_STOCK_PROPERTIES, active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
569 G_CALLBACK(vflist_pop_menu_info_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
570 menu_item_add_stock_sensitive(menu, _("View in _new window"), GTK_STOCK_NEW, active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
571 G_CALLBACK(vflist_pop_menu_view_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
572
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
573 menu_item_add_divider(menu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
574 menu_item_add_stock_sensitive(menu, _("_Copy..."), GTK_STOCK_COPY, active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
575 G_CALLBACK(vflist_pop_menu_copy_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
576 menu_item_add_sensitive(menu, _("_Move..."), active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
577 G_CALLBACK(vflist_pop_menu_move_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
578 menu_item_add_sensitive(menu, _("_Rename..."), active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
579 G_CALLBACK(vflist_pop_menu_rename_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
580 menu_item_add_stock_sensitive(menu, _("_Delete..."), GTK_STOCK_DELETE, active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
581 G_CALLBACK(vflist_pop_menu_delete_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
582
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
583 menu_item_add_divider(menu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
584
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
585 submenu = submenu_add_sort(NULL, G_CALLBACK(vflist_pop_menu_sort_cb), vfl,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
586 FALSE, FALSE, TRUE, vfl->sort_method);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
587 menu_item_add_divider(submenu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
588 menu_item_add_check(submenu, _("Ascending"), vfl->sort_ascend,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
589 G_CALLBACK(vflist_pop_menu_sort_ascend_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
590
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
591 item = menu_item_add(menu, _("_Sort"), NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
592 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
593
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
594 menu_item_add_check(menu, _("View as _icons"), FALSE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
595 G_CALLBACK(vflist_pop_menu_icons_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
596 menu_item_add_check(menu, _("Show _thumbnails"), vfl->thumbs_enabled,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
597 G_CALLBACK(vflist_pop_menu_thumbs_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
598 menu_item_add_stock(menu, _("Re_fresh"), GTK_STOCK_REFRESH, G_CALLBACK(vflist_pop_menu_refresh_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
599
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
600 return menu;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
601 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
602
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
603 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
604 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
605 * callbacks
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
606 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
607 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
608
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
609 static gint vflist_row_rename_cb(TreeEditData *td, const gchar *old, const gchar *new, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
610 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
611 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
612 gchar *old_path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
613 gchar *new_path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
614
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
615 if (strlen(new) == 0) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
616
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
617 old_path = concat_dir_and_file(vfl->path, old);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
618 new_path = concat_dir_and_file(vfl->path, new);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
619
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
620 if (strchr(new, '/') != NULL)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
621 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
622 gchar *text = g_strdup_printf(_("Invalid file name:\n%s"), new);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
623 file_util_warning_dialog(_("Error renaming file"), text, GTK_STOCK_DIALOG_ERROR, vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
624 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
625 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
626 else if (isfile(new_path))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
627 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
628 gchar *text = g_strdup_printf(_("A file with name %s already exists."), new);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
629 file_util_warning_dialog(_("Error renaming file"), text, GTK_STOCK_DIALOG_ERROR, vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
630 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
631 }
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
632 else
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
633 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
634 gint row = vflist_index_by_path(vfl, old_path);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
635 if (row >= 0)
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
636 {
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
637 GList *work = g_list_nth(vfl->list, row);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
638 FileData *fd = work->data;
143
0d1bf3ac6cd8 improved FileDataChangeInfo structure, check for another file operation in progress
nadvornik
parents: 142
diff changeset
639
0d1bf3ac6cd8 improved FileDataChangeInfo structure, check for another file operation in progress
nadvornik
parents: 142
diff changeset
640 if (!file_data_add_change_info(fd, FILEDATA_CHANGE_RENAME, old_path, new_path) || !rename_file_ext(fd))
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
641 {
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
642 gchar *text = g_strdup_printf(_("Unable to rename file:\n%s\nto:\n%s"), old, new);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
643 file_util_warning_dialog(_("Error renaming file"), text, GTK_STOCK_DIALOG_ERROR, vfl->listview);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
644 g_free(text);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
645 }
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
646 }
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
647
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
648 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
649 g_free(old_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
650 g_free(new_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
651
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
652 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
653 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
654
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
655 static void vflist_menu_position_cb(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
656 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
657 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
658 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
659 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
660 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
661 gint cw, ch;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
662
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
663 if (vflist_find_row(vfl, vfl->click_fd, &iter) < 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
664 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
665 tpath = gtk_tree_model_get_path(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
666 tree_view_get_cell_clamped(GTK_TREE_VIEW(vfl->listview), tpath, FILE_COLUMN_NAME - 1, TRUE, x, y, &cw, &ch);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
667 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
668 *y += ch;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
669 popup_menu_position_clamp(menu, x, y, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
670 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
671
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
672 static gint vflist_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
673 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
674 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
675 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
676
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
677 if (event->keyval != GDK_Menu) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
678
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
679 gtk_tree_view_get_cursor(GTK_TREE_VIEW(vfl->listview), &tpath, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
680 if (tpath)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
681 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
682 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
683 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
684
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
685 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
686 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
687 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &vfl->click_fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
688 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
689 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
690 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
691 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
692 vfl->click_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
693 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
694
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
695 vfl->popup = vflist_pop_menu(vfl, vfl->click_fd, 0);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
696 gtk_menu_popup(GTK_MENU(vfl->popup), NULL, NULL, vflist_menu_position_cb, vfl, 0, GDK_CURRENT_TIME);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
697
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
698 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
699 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
700
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
701 static gint vflist_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
702 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
703 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
704 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
705 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
706 FileData *fd = NULL;
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
707 GtkTreeViewColumn *column;
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
708 gint col_idx = 0;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
709
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
710 if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget), bevent->x, bevent->y,
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
711 &tpath, &column, NULL, NULL))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
712 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
713 GtkTreeModel *store;
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
714 col_idx = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(column), "column_store_idx"));
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
715
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
716 if (bevent->button == 1 &&
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
717 col_idx >= FILE_COLUMN_MARKS && col_idx <= FILE_COLUMN_MARKS_LAST)
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
718 return FALSE;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
719
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
720 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
721
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
722 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
723 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
724 #if 0
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
725 gtk_tree_view_set_cursor(GTK_TREE_VIEW(widget), tpath, NULL, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
726 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
727 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
728 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
729
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
730 vfl->click_fd = fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
731
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
732 if (bevent->button == 3)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
733 {
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
734 vfl->popup = vflist_pop_menu(vfl, vfl->click_fd, col_idx);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
735 gtk_menu_popup(GTK_MENU(vfl->popup), NULL, NULL, NULL, NULL,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
736 bevent->button, bevent->time);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
737 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
738 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
739
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
740 if (!fd) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
741
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
742 if (bevent->button == 2)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
743 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
744 if (!vflist_row_is_selected(vfl, fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
745 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
746 vflist_color_set(vfl, fd, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
747 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
748 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
749 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
750
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
751
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
752 if (bevent->button == 1 && bevent->type == GDK_BUTTON_PRESS &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
753 !(bevent->state & GDK_SHIFT_MASK ) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
754 !(bevent->state & GDK_CONTROL_MASK ) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
755 vflist_row_is_selected(vfl, fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
756 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
757 gtk_widget_grab_focus(widget);
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
758 // return TRUE; // FIXME - expand
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
759 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
760
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
761 #if 0
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
762 if (bevent->button == 1 && bevent->type == GDK_2BUTTON_PRESS)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
763 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
764 if (vfl->layout) layout_image_full_screen_start(vfl->layout);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
765 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
766 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
767
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
768 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
769 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
770
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
771 static gint vflist_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
772 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
773 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
774 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
775 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
776 FileData *fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
777
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
778 if (bevent->button == 2)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
779 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
780 vflist_color_set(vfl, vfl->click_fd, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
781 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
782
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
783 if (bevent->button != 1 && bevent->button != 2)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
784 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
785 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
786 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
787
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
788 if ((bevent->x != 0 || bevent->y != 0) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
789 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget), bevent->x, bevent->y,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
790 &tpath, NULL, NULL, NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
791 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
792 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
793
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
794 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
795 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
796 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
797 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
798 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
799
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
800 if (bevent->button == 2)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
801 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
802 if (fd && vfl->click_fd == fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
803 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
804 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
805
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
806 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
807 if (vflist_row_is_selected(vfl, fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
808 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
809 gtk_tree_selection_unselect_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
810 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
811 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
812 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
813 gtk_tree_selection_select_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
814 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
815 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
816 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
817 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
818
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
819 if (fd && vfl->click_fd == fd &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
820 !(bevent->state & GDK_SHIFT_MASK ) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
821 !(bevent->state & GDK_CONTROL_MASK ) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
822 vflist_row_is_selected(vfl, fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
823 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
824 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
825
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
826 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
827 gtk_tree_selection_unselect_all(selection);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
828 gtk_tree_selection_select_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
829 vflist_move_cursor(vfl, &iter);
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
830 // return TRUE;// FIXME - expand
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
831 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
832
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
833 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
834 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
835
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
836 static void vflist_select_image(ViewFileList *vfl, FileData *sel_fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
837 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
838 FileData *read_ahead_fd = NULL;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
839 gint row;
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
840 FileData *cur_fd;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
841 if (!sel_fd) return;
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
842
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
843 cur_fd = layout_image_get_fd(vfl->layout);
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
844 if (sel_fd == cur_fd) return; /* no change */
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
845
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
846 row = g_list_index(vfl->list, sel_fd);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
847 // FIXME sidecar data
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
848
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
849 if (sel_fd && enable_read_ahead && row >= 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
850 {
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
851 if (row > g_list_index(vfl->list, cur_fd) &&
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
852 row + 1 < vflist_count(vfl, NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
853 {
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
854 read_ahead_fd = vflist_index_get_data(vfl, row + 1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
855 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
856 else if (row > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
857 {
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
858 read_ahead_fd = vflist_index_get_data(vfl, row - 1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
859 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
860 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
861
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
862 layout_image_set_with_ahead(vfl->layout, sel_fd, read_ahead_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
863 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
864
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
865 static gint vflist_select_idle_cb(gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
866 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
867 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
868
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
869 if (!vfl->layout)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
870 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
871 vfl->select_idle_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
872 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
873 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
874
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
875 vflist_send_update(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
876
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
877 if (vfl->select_fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
878 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
879 vflist_select_image(vfl, vfl->select_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
880 vfl->select_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
881 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
882
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
883 vfl->select_idle_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
884 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
885 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
886
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
887 static void vflist_select_idle_cancel(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
888 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
889 if (vfl->select_idle_id != -1) g_source_remove(vfl->select_idle_id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
890 vfl->select_idle_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
891 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
892
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
893 static gboolean vflist_select_cb(GtkTreeSelection *selection, GtkTreeModel *store, GtkTreePath *tpath,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
894 gboolean path_currently_selected, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
895 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
896 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
897 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
898
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
899 if (!path_currently_selected &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
900 gtk_tree_model_get_iter(store, &iter, tpath))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
901 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
902 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &vfl->select_fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
903 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
904 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
905 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
906 vfl->select_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
907 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
908
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
909 if (vfl->layout &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
910 vfl->select_idle_id == -1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
911 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
912 vfl->select_idle_id = g_idle_add(vflist_select_idle_cb, vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
913 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
914
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
915 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
916 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
917
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
918 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
919 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
920 * misc
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
921 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
922 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
923
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
924 static gboolean vflist_dummy_select_cb(GtkTreeSelection *selection, GtkTreeModel *store, GtkTreePath *tpath,
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
925 gboolean path_currently_selected, gpointer data)
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
926 {
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
927 return TRUE;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
928 }
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
929
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
930
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
931 static void vflist_setup_iter(ViewFileList *vfl, GtkTreeStore *store, GtkTreeIter *iter, FileData *fd)
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
932 {
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
933 int i;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
934 gchar *size;
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
935 gchar *sidecars = NULL;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
936
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
937 if (fd->sidecar_files)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
938 sidecars = sidecar_file_data_list_to_string(fd);
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
939 size = text_from_size(fd->size);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
940
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
941 gtk_tree_store_set(store, iter, FILE_COLUMN_POINTER, fd,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
942 FILE_COLUMN_THUMB, (vfl->thumbs_enabled) ? fd->pixbuf : NULL,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
943 FILE_COLUMN_NAME, fd->name,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
944 FILE_COLUMN_SIDECARS, sidecars,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
945 FILE_COLUMN_SIZE, size,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
946 FILE_COLUMN_DATE, text_from_time(fd->date),
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
947 FILE_COLUMN_COLOR, FALSE, -1);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
948 for (i = 0; i < FILEDATA_MARKS_SIZE; i++)
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
949 gtk_tree_store_set(store, iter, FILE_COLUMN_MARKS + i, fd->marks[i], -1);
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
950
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
951 g_free(size);
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
952 if (sidecars)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
953 g_free(sidecars);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
954 }
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
955
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
956 static void vflist_setup_iter_with_sidecars(ViewFileList *vfl, GtkTreeStore *store, GtkTreeIter *iter, FileData *fd)
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
957 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
958 GList *work;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
959 GtkTreeIter new;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
960 GtkTreeIter s_iter;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
961 gint valid;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
962
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
963 vflist_setup_iter(vfl, store, iter, fd);
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
964
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
965
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
966 /* this is almost the same code as in vflist_populate_view
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
967 maybe it should be made more generic and used in both places */
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
968
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
969
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
970 valid = gtk_tree_model_iter_children(GTK_TREE_MODEL(store), &s_iter, iter);
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
971
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
972 work = fd->sidecar_files;
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
973 while (work)
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
974 {
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
975 gint match;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
976 FileData *sfd = work->data;
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
977 gint done = FALSE;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
978
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
979 while (!done)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
980 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
981 FileData *old_sfd = NULL;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
982
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
983 if (valid)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
984 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
985 gtk_tree_model_get(GTK_TREE_MODEL(store), &s_iter, FILE_COLUMN_POINTER, &old_sfd, -1);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
986
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
987 if (sfd == old_sfd)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
988 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
989 match = 0;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
990 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
991 else
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
992 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
993 match = filelist_sort_compare_filedata_full(sfd, old_sfd, SORT_NAME, TRUE);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
994 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
995 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
996
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
997 else
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
998 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
999 match = -1;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1000 }
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1001
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1002 if (match < 0)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1003 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1004 GtkTreeIter new;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1005
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1006 if (valid)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1007 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1008 gtk_tree_store_insert_before(store, &new, iter, &s_iter);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1009 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1010 else
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1011 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1012 gtk_tree_store_append(store, &new, iter);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1013 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1014
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1015 vflist_setup_iter(vfl, store, &new, sfd);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1016
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1017 done = TRUE;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1018 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1019 else if (match > 0)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1020 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1021 valid = gtk_tree_store_remove(store, &s_iter);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1022 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1023 else
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1024 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1025 vflist_setup_iter(vfl, store, &s_iter, sfd);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1026
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1027 if (valid) valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &s_iter);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1028
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1029 done = TRUE;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1030 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1031 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1032 work = work->next;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1033 }
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1034
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1035 while (valid)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1036 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1037 valid = gtk_tree_store_remove(store, &s_iter);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1038 }
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1039 }
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1040
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1041 void vflist_sort_set(ViewFileList *vfl, SortType type, gint ascend)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1042 {
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1043 gint i;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1044 GHashTable *fd_idx_hash = g_hash_table_new(NULL, NULL);
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1045 gint *new_order;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1046 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1047 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1048
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1049 if (vfl->sort_method == type && vfl->sort_ascend == ascend) return;
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1050 if (!vfl->list) return;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1051
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1052 work = vfl->list;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1053 i = 0;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1054 while (work)
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1055 {
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1056 FileData *fd = work->data;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1057 g_hash_table_insert(fd_idx_hash, fd, GINT_TO_POINTER(i));
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1058 i++;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1059 work = work->next;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1060 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1061
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1062 vfl->sort_method = type;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1063 vfl->sort_ascend = ascend;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1064
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1065 vfl->list = filelist_sort(vfl->list, vfl->sort_method, vfl->sort_ascend);
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1066
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1067 new_order = g_malloc(i * sizeof(gint));
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1068
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1069 work = vfl->list;
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1070 i = 0;
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1071 while (work)
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1072 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1073 FileData *fd = work->data;
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1074 new_order[i] = GPOINTER_TO_INT(g_hash_table_lookup(fd_idx_hash, fd));
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1075 i++;
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1076 work = work->next;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1077 }
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1078
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1079 store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview)));
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1080 gtk_tree_store_reorder(store, NULL, new_order);
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1081
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1082 g_free(new_order);
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1083 g_hash_table_destroy(fd_idx_hash);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1084 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1085
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1086 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1087 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1088 * thumb updates
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1089 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1090 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1091
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1092 static gint vflist_thumb_next(ViewFileList *vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1093
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1094 static void vflist_thumb_status(ViewFileList *vfl, gdouble val, const gchar *text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1095 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1096 if (vfl->func_thumb_status)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1097 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1098 vfl->func_thumb_status(vfl, val, text, vfl->data_thumb_status);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1099 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1100 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1101
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1102 static void vflist_thumb_cleanup(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1103 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1104 vflist_thumb_status(vfl, 0.0, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1105
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1106 vfl->thumbs_count = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1107 vfl->thumbs_running = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1108
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1109 thumb_loader_free(vfl->thumbs_loader);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1110 vfl->thumbs_loader = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1111
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1112 vfl->thumbs_filedata = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1113 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1114
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1115 static void vflist_thumb_stop(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1116 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1117 if (vfl->thumbs_running) vflist_thumb_cleanup(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1118 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1119
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1120 static void vflist_thumb_do(ViewFileList *vfl, ThumbLoader *tl, FileData *fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1121 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1122 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1123 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1124
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1125 if (!fd || vflist_find_row(vfl, fd, &iter) < 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1126
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1127 if (fd->pixbuf) g_object_unref(fd->pixbuf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1128 fd->pixbuf = thumb_loader_get_pixbuf(tl, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1129
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1130 store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview)));
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1131 gtk_tree_store_set(store, &iter, FILE_COLUMN_THUMB, fd->pixbuf, -1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1132
169
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1133 vflist_thumb_status(vfl, (gdouble)(vfl->thumbs_count) / vflist_sidecar_list_count(vfl->list), _("Loading thumbs..."));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1134 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1135
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1136 static void vflist_thumb_error_cb(ThumbLoader *tl, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1137 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1138 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1139
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1140 if (vfl->thumbs_filedata && vfl->thumbs_loader == tl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1141 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1142 vflist_thumb_do(vfl, tl, vfl->thumbs_filedata);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1143 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1144
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1145 while (vflist_thumb_next(vfl));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1146 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1147
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1148 static void vflist_thumb_done_cb(ThumbLoader *tl, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1149 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1150 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1151
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1152 if (vfl->thumbs_filedata && vfl->thumbs_loader == tl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1153 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1154 vflist_thumb_do(vfl, tl, vfl->thumbs_filedata);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1155 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1156
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1157 while (vflist_thumb_next(vfl));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1158 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1159
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1160 static gint vflist_thumb_next(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1161 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1162 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1163 FileData *fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1164
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1165 /* first check the visible files */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1166
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1167 if (GTK_WIDGET_REALIZED(vfl->listview) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1168 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(vfl->listview), 0, 0, &tpath, NULL, NULL, NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1169 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1170 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1171 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1172 gint valid = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1173
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1174 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1175 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1176 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1177
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1178 while (!fd && valid && tree_view_row_get_visibility(GTK_TREE_VIEW(vfl->listview), &iter, FALSE) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1179 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1180 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1181 if (fd->pixbuf) fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1182
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1183 valid = gtk_tree_model_iter_next(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1184 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1185 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1186
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1187 /* then find first undone */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1188
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1189 if (!fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1190 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1191 GList *work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1192 while (work && !fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1193 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1194 FileData *fd_p = work->data;
169
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1195 if (!fd_p->pixbuf)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1196 fd = fd_p;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1197 else
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1198 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1199 GList *work2 = fd_p->sidecar_files;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1200
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1201 while (work2 && !fd)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1202 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1203 fd_p = work2->data;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1204 if (!fd_p->pixbuf) fd = fd_p;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1205 work2 = work2->next;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1206 }
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1207 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1208 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1209 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1210 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1211
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1212 if (!fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1213 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1214 /* done */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1215 vflist_thumb_cleanup(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1216 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1217 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1218
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1219 vfl->thumbs_count++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1220
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1221 vfl->thumbs_filedata = fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1222
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1223 thumb_loader_free(vfl->thumbs_loader);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1224
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1225 vfl->thumbs_loader = thumb_loader_new(thumb_max_width, thumb_max_height);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1226 thumb_loader_set_callbacks(vfl->thumbs_loader,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1227 vflist_thumb_done_cb,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1228 vflist_thumb_error_cb,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1229 NULL,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1230 vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1231
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1232 if (!thumb_loader_start(vfl->thumbs_loader, fd->path))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1233 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1234 /* set icon to unknown, continue */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1235 if (debug) printf("thumb loader start failed %s\n", vfl->thumbs_loader->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1236 vflist_thumb_do(vfl, vfl->thumbs_loader, fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1237
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1238 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1239 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1240
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1241 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1242 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1243
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1244 static void vflist_thumb_update(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1245 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1246 vflist_thumb_stop(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1247 if (!vfl->thumbs_enabled) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1248
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1249 vflist_thumb_status(vfl, 0.0, _("Loading thumbs..."));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1250 vfl->thumbs_running = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1251
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1252 while (vflist_thumb_next(vfl));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1253 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1254
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1255 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1256 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1257 * row stuff
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1258 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1259 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1260
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1261 FileData *vflist_index_get_data(ViewFileList *vfl, gint row)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1262 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1263 return g_list_nth_data(vfl->list, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1264 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1265
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1266 gchar *vflist_index_get_path(ViewFileList *vfl, gint row)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1267 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1268 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1269
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1270 fd = g_list_nth_data(vfl->list, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1271
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1272 return (fd ? fd->path : NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1273 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1274
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1275 static gint vflist_row_by_path(ViewFileList *vfl, const gchar *path, FileData **fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1276 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1277 gint p = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1278 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1279
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1280 if (!path) return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1281
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1282 work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1283 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1284 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1285 FileData *fd_n = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1286 if (strcmp(path, fd_n->path) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1287 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1288 if (fd) *fd = fd_n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1289 return p;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1290 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1291 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1292 p++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1293 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1294
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1295 if (fd) *fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1296 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1297 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1298
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1299 gint vflist_index_by_path(ViewFileList *vfl, const gchar *path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1300 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1301 return vflist_row_by_path(vfl, path, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1302 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1303
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1304 gint vflist_count(ViewFileList *vfl, gint64 *bytes)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1305 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1306 if (bytes)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1307 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1308 gint64 b = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1309 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1310
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1311 work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1312 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1313 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1314 FileData *fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1315 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1316 b += fd->size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1317 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1318
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1319 *bytes = b;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1320 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1321
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1322 return g_list_length(vfl->list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1323 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1324
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1325 GList *vflist_get_list(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1326 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1327 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1328 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1329
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1330 work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1331 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1332 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1333 FileData *fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1334 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1335
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1336 list = g_list_prepend(list, file_data_ref(fd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1337 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1338
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1339 return g_list_reverse(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1340 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1341
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1342 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1343 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1344 * selections
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1345 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1346 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1347
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1348 static gint vflist_row_is_selected(ViewFileList *vfl, FileData *fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1349 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1350 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1351 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1352 GList *slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1353 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1354 gint found = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1355
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1356 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1357 slist = gtk_tree_selection_get_selected_rows(selection, &store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1358 work = slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1359 while (!found && work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1360 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1361 GtkTreePath *tpath = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1362 FileData *fd_n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1363 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1364
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1365 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1366 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd_n, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1367 if (fd_n == fd) found = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1368 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1369 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1370 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1371 g_list_free(slist);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1372
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1373 return found;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1374 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1375
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1376 gint vflist_index_is_selected(ViewFileList *vfl, gint row)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1377 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1378 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1379
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1380 fd = vflist_index_get_data(vfl, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1381 return vflist_row_is_selected(vfl, fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1382 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1383
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1384 gint vflist_selection_count(ViewFileList *vfl, gint64 *bytes)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1385 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1386 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1387 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1388 GList *slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1389 gint count;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1390
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1391 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1392 slist = gtk_tree_selection_get_selected_rows(selection, &store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1393
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1394 if (bytes)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1395 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1396 gint64 b = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1397 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1398
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1399 work = slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1400 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1401 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1402 GtkTreePath *tpath = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1403 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1404 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1405
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1406 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1407 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1408 b += fd->size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1409
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1410 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1411 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1412
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1413 *bytes = b;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1414 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1415
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1416 count = g_list_length(slist);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1417 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1418 g_list_free(slist);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1419
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1420 return count;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1421 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1422
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1423 GList *vflist_selection_get_list(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1424 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1425 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1426 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1427 GList *slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1428 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1429 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1430
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1431 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1432 slist = gtk_tree_selection_get_selected_rows(selection, &store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1433 work = slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1434 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1435 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1436 GtkTreePath *tpath = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1437 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1438 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1439
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1440 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1441 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1442
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1443 list = g_list_prepend(list, file_data_ref(fd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1444
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1445 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1446 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1447 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1448 g_list_free(slist);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1449
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1450 return g_list_reverse(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1451 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1452
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1453 GList *vflist_selection_get_list_by_index(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1454 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1455 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1456 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1457 GList *slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1458 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1459 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1460
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1461 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1462 slist = gtk_tree_selection_get_selected_rows(selection, &store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1463 work = slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1464 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1465 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1466 GtkTreePath *tpath = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1467 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1468 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1469
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1470 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1471 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1472
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1473 list = g_list_prepend(list, GINT_TO_POINTER(g_list_index(vfl->list, fd)));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1474
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1475 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1476 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1477 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1478 g_list_free(slist);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1479
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1480 return g_list_reverse(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1481 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1482
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1483 void vflist_select_all(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1484 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1485 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1486
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1487 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1488 gtk_tree_selection_select_all(selection);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1489
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1490 vfl->select_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1491 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1492
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1493 void vflist_select_none(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1494 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1495 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1496
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1497 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1498 gtk_tree_selection_unselect_all(selection);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1499 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1500
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1501 void vflist_select_by_path(ViewFileList *vfl, const gchar *path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1502 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1503 FileData *fd;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1504
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1505 if (vflist_row_by_path(vfl, path, &fd) < 0) return;
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1506
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1507 vflist_select_by_fd(vfl, fd);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1508 }
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1509
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1510 void vflist_select_by_fd(ViewFileList *vfl, FileData *fd)
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1511 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1512 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1513
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1514 if (vflist_find_row(vfl, fd, &iter) < 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1515
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1516 tree_view_row_make_visible(GTK_TREE_VIEW(vfl->listview), &iter, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1517
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1518 if (!vflist_row_is_selected(vfl, fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1519 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1520 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1521 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1522 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1523
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1524 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1525 gtk_tree_selection_unselect_all(selection);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1526 gtk_tree_selection_select_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1527 vflist_move_cursor(vfl, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1528
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1529 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1530 tpath = gtk_tree_model_get_path(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1531 gtk_tree_view_set_cursor(GTK_TREE_VIEW(vfl->listview), tpath, NULL, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1532 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1533 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1534 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1535
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1536 void vflist_mark_to_selection(ViewFileList *vfl, gint mark, MarkToSelectionMode mode)
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1537 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1538 GtkTreeModel *store;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1539 GtkTreeIter iter;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1540 GtkTreeSelection *selection;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1541 gint valid;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1542
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1543 g_assert(mark >= 0 && mark < FILEDATA_MARKS_SIZE);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1544
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1545 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1546 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1547
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1548 valid = gtk_tree_model_get_iter_first(store, &iter);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1549 while (valid)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1550 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1551 FileData *fd;
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1552 gboolean mark_val, selected;
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1553 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, FILE_COLUMN_POINTER, &fd, -1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1554
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1555 mark_val = fd->marks[mark];
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1556 selected = gtk_tree_selection_iter_is_selected(selection, &iter);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1557
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1558 switch (mode)
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1559 {
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1560 case MTS_MODE_SET: selected = mark_val;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1561 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1562 case MTS_MODE_OR: selected = mark_val | selected;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1563 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1564 case MTS_MODE_AND: selected = mark_val & selected;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1565 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1566 case MTS_MODE_MINUS: selected = !mark_val & selected;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1567 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1568 }
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1569
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1570 if (selected)
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1571 gtk_tree_selection_select_iter(selection, &iter);
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1572 else
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1573 gtk_tree_selection_unselect_iter(selection, &iter);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1574
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1575 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1576 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1577 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1578
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1579 void vflist_selection_to_mark(ViewFileList *vfl, gint mark, SelectionToMarkMode mode)
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1580 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1581 GtkTreeModel *store;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1582 GtkTreeSelection *selection;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1583 GList *slist;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1584 GList *work;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1585
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1586 g_assert(mark >= 0 && mark < FILEDATA_MARKS_SIZE);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1587
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1588 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1589 slist = gtk_tree_selection_get_selected_rows(selection, &store);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1590 work = slist;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1591 while (work)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1592 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1593 GtkTreePath *tpath = work->data;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1594 FileData *fd;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1595 GtkTreeIter iter;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1596
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1597 gtk_tree_model_get_iter(store, &iter, tpath);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1598 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1599
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1600 switch (mode)
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1601 {
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1602 case STM_MODE_SET: fd->marks[mark] = 1;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1603 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1604 case STM_MODE_RESET: fd->marks[mark] = 0;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1605 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1606 case STM_MODE_TOGGLE: fd->marks[mark] = !fd->marks[mark];
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1607 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1608 }
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1609
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1610 gtk_tree_store_set(GTK_TREE_STORE(store), &iter, FILE_COLUMN_MARKS + mark, fd->marks[mark], -1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1611
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1612 work = work->next;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1613 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1614 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1615 g_list_free(slist);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1616 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1617
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1618 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1619 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1620 * core (population)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1621 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1622 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1623
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1624 static void vflist_listview_set_height(GtkWidget *listview, gint thumb)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1625 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1626 GtkTreeViewColumn *column;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1627 GtkCellRenderer *cell;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1628 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1629
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1630 column = gtk_tree_view_get_column(GTK_TREE_VIEW(listview), FILE_COLUMN_THUMB - 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1631 if (!column) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1632
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1633 gtk_tree_view_column_set_fixed_width(column, ((thumb) ? thumb_max_width : 4) + 10);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1634
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1635 list = gtk_tree_view_column_get_cell_renderers(column);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1636 if (!list) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1637 cell = list->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1638 g_list_free(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1639
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1640 g_object_set(G_OBJECT(cell), "height", (thumb) ? thumb_max_height : -1, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1641 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1642 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1643
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1644 static void vflist_populate_view(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1645 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1646 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1647 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1648 gint thumbs;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1649 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1650 GtkTreeRowReference *visible_row = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1651 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1652 gint valid;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1653
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1654 store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview)));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1655 thumbs = vfl->thumbs_enabled;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1656
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1657 vflist_thumb_stop(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1658
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1659 if (!vfl->list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1660 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1661 gtk_tree_store_clear(store);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1662 vflist_send_update(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1663 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1664 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1665
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1666 if (GTK_WIDGET_REALIZED(vfl->listview) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1667 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(vfl->listview), 0, 0, &tpath, NULL, NULL, NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1668 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1669 visible_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1670 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1671 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1672
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1673 vflist_listview_set_height(vfl->listview, thumbs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1674
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1675 valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1676
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1677 work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1678 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1679 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1680 gint match;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1681 FileData *fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1682 gint done = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1683
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1684 while (!done)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1685 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1686 FileData *old_fd = NULL;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1687
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1688 if (valid)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1689 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1690 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, FILE_COLUMN_POINTER, &old_fd, -1);
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1691
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1692 if (fd == old_fd)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1693 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1694 match = 0;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1695 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1696 else
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1697 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1698 match = filelist_sort_compare_filedata_full(fd, old_fd, vfl->sort_method, vfl->sort_ascend);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1699 if (match == 0)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1700 match = -1; /* probably should not happen*/
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1701 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1702 }
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1703
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1704 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1705 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1706 match = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1707 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1708
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1709 if (match < 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1710 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1711 GtkTreeIter new;
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1712
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1713 if (valid)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1714 {
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1715 gtk_tree_store_insert_before(store, &new, NULL, &iter);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1716 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1717 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1718 {
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1719 gtk_tree_store_append(store, &new, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1720 }
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1721 vflist_setup_iter_with_sidecars(vfl, store, &new, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1722
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1723 done = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1724 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1725 else if (match > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1726 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1727 valid = gtk_tree_store_remove(store, &iter);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1728 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1729 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1730 {
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1731 vflist_setup_iter_with_sidecars(vfl, store, &iter, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1732
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1733 if (valid) valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1734
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1735 done = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1736 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1737 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1738 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1739 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1740
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1741 while (valid)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1742 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1743 valid = gtk_tree_store_remove(store, &iter);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1744 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1745
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1746 if (visible_row)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1747 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1748 if (gtk_tree_row_reference_valid(visible_row))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1749 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1750 tpath = gtk_tree_row_reference_get_path(visible_row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1751 gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(vfl->listview), tpath, NULL, TRUE, 0.0, 0.0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1752 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1753 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1754 gtk_tree_row_reference_free(visible_row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1755 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1756
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1757 vflist_send_update(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1758 vflist_thumb_update(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1759 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1760
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1761 gint vflist_refresh(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1762 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1763 GList *old_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1764 gint ret = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1765
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1766 old_list = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1767 vfl->list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1768
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1769 if (vfl->path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1770 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1771 ret = filelist_read(vfl->path, &vfl->list, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1772 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1773
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1774 vfl->list = filelist_sort(vfl->list, vfl->sort_method, vfl->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1775 vflist_populate_view(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1776
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1777 filelist_free(old_list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1778
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1779 return ret;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1780 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1781
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1782 /* this overrides the low default of a GtkCellRenderer from 100 to CELL_HEIGHT_OVERRIDE, something sane for our purposes */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1783
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1784 #define CELL_HEIGHT_OVERRIDE 512
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1785
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1786 static void cell_renderer_height_override(GtkCellRenderer *renderer)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1787 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1788 GParamSpec *spec;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1789
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1790 spec = g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(renderer)), "height");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1791 if (spec && G_IS_PARAM_SPEC_INT(spec))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1792 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1793 GParamSpecInt *spec_int;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1794
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1795 spec_int = G_PARAM_SPEC_INT(spec);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1796 if (spec_int->maximum < CELL_HEIGHT_OVERRIDE) spec_int->maximum = CELL_HEIGHT_OVERRIDE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1797 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1798 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1799
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1800 static GdkColor *vflist_listview_color_shifted(GtkWidget *widget)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1801 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1802 static GdkColor color;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1803 static GtkWidget *done = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1804
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1805 if (done != widget)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1806 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1807 GtkStyle *style;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1808
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1809 style = gtk_widget_get_style(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1810 memcpy(&color, &style->base[GTK_STATE_NORMAL], sizeof(color));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1811 shift_color(&color, -1, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1812 done = widget;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1813 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1814
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1815 return &color;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1816 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1817
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1818 static void vflist_listview_color_cb(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1819 GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1820 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1821 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1822 gboolean set;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1823
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1824 gtk_tree_model_get(tree_model, iter, FILE_COLUMN_COLOR, &set, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1825 g_object_set(G_OBJECT(cell),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1826 "cell-background-gdk", vflist_listview_color_shifted(vfl->listview),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1827 "cell-background-set", set, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1828 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1829
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1830 static void vflist_listview_add_column(ViewFileList *vfl, gint n, const gchar *title, gint image, gint right_justify, gint expand)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1831 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1832 GtkTreeViewColumn *column;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1833 GtkCellRenderer *renderer;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1834
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1835 column = gtk_tree_view_column_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1836 gtk_tree_view_column_set_title(column, title);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1837 gtk_tree_view_column_set_min_width(column, 4);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1838
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1839 if (!image)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1840 {
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1841 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1842 renderer = gtk_cell_renderer_text_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1843 if (right_justify)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1844 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1845 g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1846 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1847 gtk_tree_view_column_pack_start(column, renderer, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1848 gtk_tree_view_column_add_attribute(column, renderer, "text", n);
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1849 if (expand)
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1850 gtk_tree_view_column_set_expand(column, TRUE);
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1851 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1852 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1853 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1854 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1855 renderer = gtk_cell_renderer_pixbuf_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1856 cell_renderer_height_override(renderer);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1857 gtk_tree_view_column_pack_start(column, renderer, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1858 gtk_tree_view_column_add_attribute(column, renderer, "pixbuf", n);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1859 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1860
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1861 gtk_tree_view_column_set_cell_data_func(column, renderer, vflist_listview_color_cb, vfl, NULL);
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1862 g_object_set_data (G_OBJECT (column), "column_store_idx", GUINT_TO_POINTER(n));
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1863 g_object_set_data (G_OBJECT (renderer), "column_store_idx", GUINT_TO_POINTER(n));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1864
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1865 gtk_tree_view_append_column(GTK_TREE_VIEW(vfl->listview), column);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1866 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1867
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1868 static void vflist_listview_mark_toggled(GtkCellRendererToggle *cell, gchar *path_str, GtkTreeStore *store)
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1869 {
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1870 GtkTreePath *path = gtk_tree_path_new_from_string(path_str);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1871 guint *marks;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1872 GtkTreeIter iter;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1873 FileData *fd;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1874 gboolean mark;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1875 guint col_idx;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1876
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1877 if (!path || !gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path))
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1878 return;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1879
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1880 col_idx = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(cell), "column_store_idx"));
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1881
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1882 g_assert(col_idx >= FILE_COLUMN_MARKS && col_idx <= FILE_COLUMN_MARKS_LAST);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1883
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1884 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, FILE_COLUMN_POINTER, &fd, col_idx, &mark, -1);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1885 mark = !mark;
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1886 fd->marks[col_idx - FILE_COLUMN_MARKS] = mark;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1887
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1888 gtk_tree_store_set(store, &iter, col_idx, mark, -1);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1889 gtk_tree_path_free(path);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1890 }
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1891
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1892 static void vflist_listview_add_column_toggle(ViewFileList *vfl, gint n, const gchar *title)
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1893 {
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1894 GtkTreeViewColumn *column;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1895 GtkCellRenderer *renderer;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1896 GtkTreeStore *store;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1897 gint index;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1898
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1899 store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview)));
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1900
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1901 renderer = gtk_cell_renderer_toggle_new();
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1902 column = gtk_tree_view_column_new_with_attributes(title, renderer, "active", n, NULL);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1903
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1904 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1905 g_object_set_data (G_OBJECT (column), "column_store_idx", GUINT_TO_POINTER(n));
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1906 g_object_set_data (G_OBJECT (renderer), "column_store_idx", GUINT_TO_POINTER(n));
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1907
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1908 index = gtk_tree_view_append_column(GTK_TREE_VIEW(vfl->listview), column);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1909 gtk_tree_view_column_set_fixed_width(column, 16);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1910 gtk_tree_view_column_set_visible(column, vfl->marks_enabled);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1911
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1912
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1913 g_signal_connect(G_OBJECT(renderer), "toggled", G_CALLBACK(vflist_listview_mark_toggled), store);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1914 }
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1915
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1916 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1917 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1918 * base
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1919 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1920 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1921
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1922 gint vflist_set_path(ViewFileList *vfl, const gchar *path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1923 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1924 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1925
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1926 if (!path) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1927 if (vfl->path && strcmp(path, vfl->path) == 0) return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1928
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1929 g_free(vfl->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1930 vfl->path = g_strdup(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1931
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1932 /* force complete reload */
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1933 store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview)));
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1934 gtk_tree_store_clear(store);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1935
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1936 filelist_free(vfl->list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1937 vfl->list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1938
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1939 return vflist_refresh(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1940 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1941
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1942 static void vflist_destroy_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1943 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1944 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1945
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1946 if (vfl->popup)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1947 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1948 g_signal_handlers_disconnect_matched(G_OBJECT(vfl->popup), G_SIGNAL_MATCH_DATA,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1949 0, 0, 0, NULL, vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1950 gtk_widget_destroy(vfl->popup);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1951 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1952
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1953 vflist_select_idle_cancel(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1954 vflist_thumb_stop(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1955
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1956 g_free(vfl->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1957 filelist_free(vfl->list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1958 g_free(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1959 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1960
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1961 ViewFileList *vflist_new(const gchar *path, gint thumbs)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1962 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1963 ViewFileList *vfl;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1964 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1965 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1966
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1967 GType flist_types[FILE_COLUMN_COUNT];
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1968 int i;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1969
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1970 vfl = g_new0(ViewFileList, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1971
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1972 vfl->path = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1973 vfl->list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1974 vfl->click_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1975 vfl->select_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1976 vfl->sort_method = SORT_NAME;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1977 vfl->sort_ascend = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1978 vfl->thumbs_enabled = thumbs;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1979
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1980 vfl->thumbs_running = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1981 vfl->thumbs_count = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1982 vfl->thumbs_loader = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1983 vfl->thumbs_filedata = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1984
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1985 vfl->select_idle_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1986
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1987 vfl->popup = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1988
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1989 vfl->widget = gtk_scrolled_window_new(NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1990 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vfl->widget), GTK_SHADOW_IN);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1991 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vfl->widget),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1992 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1993 g_signal_connect(G_OBJECT(vfl->widget), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1994 G_CALLBACK(vflist_destroy_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1995
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1996 flist_types[FILE_COLUMN_POINTER] = G_TYPE_POINTER;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1997 flist_types[FILE_COLUMN_THUMB] = GDK_TYPE_PIXBUF;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1998 flist_types[FILE_COLUMN_NAME] = G_TYPE_STRING;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1999 flist_types[FILE_COLUMN_SIDECARS] = G_TYPE_STRING;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2000 flist_types[FILE_COLUMN_SIZE] = G_TYPE_STRING;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2001 flist_types[FILE_COLUMN_DATE] = G_TYPE_STRING;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2002 flist_types[FILE_COLUMN_COLOR] = G_TYPE_BOOLEAN;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2003 for (i = FILE_COLUMN_MARKS; i < FILE_COLUMN_MARKS + FILEDATA_MARKS_SIZE; i++)
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2004 flist_types[i] = G_TYPE_BOOLEAN;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2005
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2006 store = gtk_tree_store_newv(FILE_COLUMN_COUNT, flist_types);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2007
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2008 vfl->listview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2009 g_object_unref(store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2010
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2011 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2012 gtk_tree_selection_set_mode(GTK_TREE_SELECTION(selection), GTK_SELECTION_MULTIPLE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2013 gtk_tree_selection_set_select_function(selection, vflist_select_cb, vfl, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2014
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2015 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(vfl->listview), FALSE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2016 gtk_tree_view_set_enable_search(GTK_TREE_VIEW(vfl->listview), FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2017
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2018 vflist_listview_add_column(vfl, FILE_COLUMN_THUMB, "", TRUE, FALSE, FALSE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2019
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2020 for(i = 0; i < FILEDATA_MARKS_SIZE;i++)
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2021 vflist_listview_add_column_toggle(vfl, i + FILE_COLUMN_MARKS, "");
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2022
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2023 vflist_listview_add_column(vfl, FILE_COLUMN_NAME, _("Name"), FALSE, FALSE, FALSE);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2024 vflist_listview_add_column(vfl, FILE_COLUMN_SIDECARS, _("SC"), FALSE, FALSE, FALSE);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2025
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2026 vflist_listview_add_column(vfl, FILE_COLUMN_SIZE, _("Size"), FALSE, TRUE, FALSE);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2027 vflist_listview_add_column(vfl, FILE_COLUMN_DATE, _("Date"), FALSE, TRUE, FALSE);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2028
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2029
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2030 g_signal_connect(G_OBJECT(vfl->listview), "key_press_event",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2031 G_CALLBACK(vflist_press_key_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2032
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2033 gtk_container_add (GTK_CONTAINER(vfl->widget), vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2034 gtk_widget_show(vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2035
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2036 vflist_dnd_init(vfl);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2037
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2038 g_signal_connect(G_OBJECT(vfl->listview), "button_press_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2039 G_CALLBACK(vflist_press_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2040 g_signal_connect(G_OBJECT(vfl->listview), "button_release_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2041 G_CALLBACK(vflist_release_cb), vfl);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2042
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2043
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2044 if (path) vflist_set_path(vfl, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2045
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2046 return vfl;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2047 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2048
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2049 void vflist_set_status_func(ViewFileList *vfl,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2050 void (*func)(ViewFileList *vfl, gpointer data), gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2051 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2052 vfl->func_status = func;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2053 vfl->data_status = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2054 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2055
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2056 void vflist_set_thumb_status_func(ViewFileList *vfl,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2057 void (*func)(ViewFileList *vfl, gdouble val, const gchar *text, gpointer data),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2058 gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2059 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2060 vfl->func_thumb_status = func;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2061 vfl->data_thumb_status = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2062 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2063
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2064 void vflist_thumb_set(ViewFileList *vfl, gint enable)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2065 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2066 if (vfl->thumbs_enabled == enable) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2067
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2068 vfl->thumbs_enabled = enable;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2069 vflist_refresh(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2070 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2071
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2072 void vflist_marks_set(ViewFileList *vfl, gint enable)
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2073 {
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2074 GtkTreeStore *store;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2075 GtkTreeViewColumn *column;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2076 GList *columns, *work;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2077
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2078 if (vfl->marks_enabled == enable) return;
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2079
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2080 vfl->marks_enabled = enable;
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2081
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2082 columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(vfl->listview));
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2083
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2084 work = columns;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2085 while (work)
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2086 {
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2087 GtkTreeViewColumn *column = work->data;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2088 gint col_idx = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(column), "column_store_idx"));
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2089 work = work->next;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2090
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2091 if (col_idx <= FILE_COLUMN_MARKS_LAST && col_idx >= FILE_COLUMN_MARKS)
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2092 gtk_tree_view_column_set_visible(column, enable);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2093 }
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2094
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2095 g_list_free(columns);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2096 //vflist_refresh(vfl);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2097 }
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2098
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2099 void vflist_set_layout(ViewFileList *vfl, LayoutWindow *layout)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2100 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2101 vfl->layout = layout;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2102 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2103
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2104 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2105 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2106 * maintenance (for rename, move, remove)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2107 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2108 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2109
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2110 static gint vflist_maint_find_closest(ViewFileList *vfl, gint row, gint count, GList *ignore_list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2111 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2112 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2113 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2114 gint rev = row - 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2115 row ++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2116
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2117 work = ignore_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2118 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2119 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2120 gint f = vflist_index_by_path(vfl, work->data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2121 if (f >= 0) list = g_list_prepend(list, GINT_TO_POINTER(f));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2122 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2123 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2124
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2125 while (list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2126 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2127 gint c = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2128 work = list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2129 while (work && c)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2130 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2131 gpointer p = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2132 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2133 if (row == GPOINTER_TO_INT(p))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2134 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2135 row++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2136 c = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2137 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2138 if (rev == GPOINTER_TO_INT(p))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2139 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2140 rev--;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2141 c = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2142 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2143 if (!c) list = g_list_remove(list, p);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2144 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2145 if (c && list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2146 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2147 g_list_free(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2148 list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2149 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2150 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2151 if (row > count - 1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2152 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2153 if (rev < 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2154 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2155 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2156 return rev;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2157 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2158 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2159 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2160 return row;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2161 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2162 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2163
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2164 gint vflist_maint_renamed(ViewFileList *vfl, FileData *fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2165 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2166 gint ret = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2167 gchar *source_base;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2168 gchar *dest_base;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2169 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2170
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
2171 if (g_list_index(vfl->list, fd) < 0) return FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2172
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2173 source_base = remove_level_from_path(fd->change->source);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2174 dest_base = remove_level_from_path(fd->change->dest);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2175
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2176
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2177 if (strcmp(source_base, dest_base) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2178 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2179 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2180 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2181 GtkTreeIter position;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2182 gint old_row;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2183 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2184
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2185 old_row = g_list_index(vfl->list, fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2186
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2187 vfl->list = g_list_remove(vfl->list, fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2188
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2189 vfl->list = filelist_insert_sort(vfl->list, fd, vfl->sort_method, vfl->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2190 n = g_list_index(vfl->list, fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2191
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2192 store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview)));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2193 if (vflist_find_row(vfl, fd, &iter) >= 0 &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2194 gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &position, NULL, n))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2195 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2196 if (old_row >= n)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2197 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2198 gtk_tree_store_move_before(store, &iter, &position);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2199 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2200 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2201 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2202 gtk_tree_store_move_after(store, &iter, &position);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2203 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2204 }
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2205 gtk_tree_store_set(store, &iter, FILE_COLUMN_NAME, fd->name, -1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2206
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2207 ret = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2208 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2209 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2210 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2211 ret = vflist_maint_removed(vfl, fd, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2212 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2213
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2214 g_free(source_base);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2215 g_free(dest_base);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2216
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2217 return ret;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2218 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2219
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2220 gint vflist_maint_removed(ViewFileList *vfl, FileData *fd, GList *ignore_list)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2221 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2222 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2223 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2224 gint row;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2225 gint new_row = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2226
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2227 row = g_list_index(vfl->list, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2228 if (row < 0) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2229
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2230 if (vflist_index_is_selected(vfl, row) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2231 layout_image_get_collection(vfl->layout, NULL) == NULL)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2232 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2233 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2234
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2235 n = vflist_count(vfl, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2236 if (ignore_list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2237 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2238 new_row = vflist_maint_find_closest(vfl, row, n, ignore_list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2239 if (debug) printf("row = %d, closest is %d\n", row, new_row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2240 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2241 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2242 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2243 if (row + 1 < n)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2244 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2245 new_row = row + 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2246 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2247 else if (row > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2248 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2249 new_row = row - 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2250 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2251 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2252 vflist_select_none(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2253 if (new_row >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2254 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2255 fd = vflist_index_get_data(vfl, new_row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2256 if (vflist_find_row(vfl, fd, &iter) >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2257 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2258 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2259
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2260 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2261 gtk_tree_selection_select_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2262 vflist_move_cursor(vfl, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2263 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2264 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2265 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2266
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2267 fd = vflist_index_get_data(vfl, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2268 if (vflist_find_row(vfl, fd, &iter) >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2269 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2270 GtkTreeStore *store;
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2271 store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview)));
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2272 gtk_tree_store_remove(store, &iter);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2273 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2274 list = g_list_nth(vfl->list, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2275 fd = list->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2276
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2277 /* thumbnail loader check */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2278 if (fd == vfl->thumbs_filedata) vfl->thumbs_filedata = NULL;
111
3a69a7a3f461 Wed Nov 15 02:05:27 2006 John Ellis <johne@verizon.net>
gqview
parents: 93
diff changeset
2279 if (vfl->thumbs_count > 0) vfl->thumbs_count--;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2280
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2281 vfl->list = g_list_remove(vfl->list, fd);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2282 file_data_unref(fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2283
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2284 vflist_send_update(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2285
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2286 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2287 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2288
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2289 gint vflist_maint_moved(ViewFileList *vfl, FileData *fd, GList *ignore_list)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2290 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2291 gint ret = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2292 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2293
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2294 if (!fd->change->source || !vfl->path) return FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2295
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2296 buf = remove_level_from_path(fd->change->source);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2297
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2298 if (strcmp(buf, vfl->path) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2299 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2300 ret = vflist_maint_removed(vfl, fd, ignore_list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2301 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2302
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2303 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2304
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2305 return ret;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2306 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2307