annotate src/view_file_list.c @ 327:049d6b00cc14

Rename color profile options.
author zas_
date Sat, 12 Apr 2008 08:05:44 +0000
parents b16b9b8979e5
children 767b53cd9ab7
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
281
9995c5fb202a gqview.h -> main.h
zas_
parents: 259
diff changeset
12 #include "main.h"
9
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
259
fa7d69e7d02d Comment out unused code.
zas_
parents: 250
diff changeset
107 /*
169
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
108 static gint vflist_find_sidecar_list_idx(GList *work, FileData *fd)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
109 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
110 gint i = 0;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
111 while (work)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
112 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
113 FileData *fd_p = work->data;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
114 if (fd == fd_p) return i;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
115
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
116 i++;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
117
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
118 GList *work2 = fd_p->sidecar_files;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
119 while (work2)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
120 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
121 fd_p = work2->data;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
122 if (fd == fd_p) return i;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
123
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
124 i++;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
125 work2 = work2->next;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
126 }
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
127 work = work->next;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
128 }
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
129 return -1;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
130 }
259
fa7d69e7d02d Comment out unused code.
zas_
parents: 250
diff changeset
131 */
169
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 static gint vflist_sidecar_list_count(GList *work)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
134 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
135 gint i = 0;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
136 while (work)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
137 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
138 FileData *fd = work->data;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
139 i++;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
140
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
141 GList *work2 = fd->sidecar_files;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
142 while (work2)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
143 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
144 i++;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
145 work2 = work2->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 work = work->next;
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 return i;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
150 }
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
151
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
152
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
153 static void vflist_color_set(ViewFileList *vfl, FileData *fd, gint color_set)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
154 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
156 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
157
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
158 if (vflist_find_row(vfl, fd, &iter) < 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159 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
160 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
161 }
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 static void vflist_move_cursor(ViewFileList *vfl, GtkTreeIter *iter)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
165 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166 GtkTreePath *tpath;
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 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
170 tpath = gtk_tree_model_get_path(store, iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
171 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
172 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
174
157
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
175
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
176 static gint vflist_column_idx(ViewFileList *vfl, gint store_idx)
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
177 {
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
178 GList *columns, *work;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
179 gint i = 0;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
180
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
181 columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(vfl->listview));
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
182 work = columns;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
183 while (work)
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
184 {
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
185 GtkTreeViewColumn *column = work->data;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
186 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
187 break;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
188 work = work->next;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
189 i++;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
190 }
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
191
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
192 g_list_free(columns);
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
193 return i;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
194 }
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
195
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
196
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
197 /*
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 * dnd
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 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
202
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
203 static void vflist_dnd_get(GtkWidget *widget, GdkDragContext *context,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204 GtkSelectionData *selection_data, guint info,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
205 guint time, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
206 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
208 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
209 gchar *uri_text = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
210 gint total;
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 (!vfl->click_fd) return;
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 if (vflist_row_is_selected(vfl, vfl->click_fd))
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 list = vflist_selection_get_list(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
220 list = g_list_append(NULL, file_data_ref(vfl->click_fd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
222
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
223 if (!list) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
224
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
225 uri_text = uri_text_from_filelist(list, &total, (info == TARGET_TEXT_PLAIN));
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
226 filelist_free(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
227
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
228 if (debug) printf(uri_text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
229
64
04ff0df3ad2f Mon Aug 15 17:13:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
230 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
231 8, (guchar *)uri_text, total);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
232 g_free(uri_text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
233 }
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 static void vflist_dnd_begin(GtkWidget *widget, GdkDragContext *context, gpointer 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 ViewFileList *vfl = data;
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 vflist_color_set(vfl, vfl->click_fd, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
240
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
241 if (vfl->thumbs_enabled &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
242 vfl->click_fd && vfl->click_fd->pixbuf)
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 gint items;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
245
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
246 if (vflist_row_is_selected(vfl, vfl->click_fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
247 items = vflist_selection_count(vfl, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
249 items = 1;
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 dnd_set_drag_icon(widget, context, vfl->click_fd->pixbuf, items);
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 }
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 static void vflist_dnd_end(GtkWidget *widget, GdkDragContext *context, gpointer 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 ViewFileList *vfl = data;
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 vflist_color_set(vfl, vfl->click_fd, FALSE);
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 if (context->action == GDK_ACTION_MOVE)
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 vflist_refresh(vfl);
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 }
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 static void vflist_dnd_init(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
268 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269 gtk_drag_source_set(vfl->listview, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
270 dnd_file_drag_types, dnd_file_drag_types_count,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
271 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272 g_signal_connect(G_OBJECT(vfl->listview), "drag_data_get",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
273 G_CALLBACK(vflist_dnd_get), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274 g_signal_connect(G_OBJECT(vfl->listview), "drag_begin",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275 G_CALLBACK(vflist_dnd_begin), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276 g_signal_connect(G_OBJECT(vfl->listview), "drag_end",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277 G_CALLBACK(vflist_dnd_end), vfl);
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 /*
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 * pop-up menu
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 */
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 static GList *vflist_pop_menu_file_list(ViewFileList *vfl)
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 (!vfl->click_fd) return NULL;
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 if (vflist_row_is_selected(vfl, vfl->click_fd))
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 return vflist_selection_get_list(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
295 return g_list_append(NULL, file_data_ref(vfl->click_fd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
296 }
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 static void vflist_pop_menu_edit_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
299 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
300 ViewFileList *vfl;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
301 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
302 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
303
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
304 vfl = submenu_item_get_data(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
305 n = GPOINTER_TO_INT(data);
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 if (!vfl) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
308
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
309 list = vflist_pop_menu_file_list(vfl);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
310 start_editor_from_filelist(n, list);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
311 filelist_free(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
312 }
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 static void vflist_pop_menu_info_cb(GtkWidget *widget, gpointer 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 ViewFileList *vfl = data;
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 info_window_new(NULL, vflist_pop_menu_file_list(vfl));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
319 }
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 static void vflist_pop_menu_view_cb(GtkWidget *widget, gpointer 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 ViewFileList *vfl = data;
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 if (vflist_row_is_selected(vfl, vfl->click_fd))
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 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
329 list = vflist_selection_get_list(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
330 view_window_new_from_list(list);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
331 filelist_free(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
333 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
334 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
335 view_window_new(vfl->click_fd);
9
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 }
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 static void vflist_pop_menu_copy_cb(GtkWidget *widget, gpointer 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 ViewFileList *vfl = data;
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 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
344 }
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 static void vflist_pop_menu_move_cb(GtkWidget *widget, gpointer 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 ViewFileList *vfl = data;
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 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
351 }
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 static void vflist_pop_menu_rename_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
354 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
355 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
356 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
357
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
358 list = vflist_pop_menu_file_list(vfl);
318
b16b9b8979e5 Add a new struct ConfOptions to handle options.
zas_
parents: 281
diff changeset
359 if (options->enable_in_place_rename &&
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
360 list && !list->next && vfl->click_fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
361 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
362 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
363 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
364
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
365 filelist_free(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
366
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
367 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
368 if (vflist_find_row(vfl, vfl->click_fd, &iter) >= 0)
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 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
371
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
372 tpath = gtk_tree_model_get_path(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
373 tree_edit_by_path(GTK_TREE_VIEW(vfl->listview), tpath,
157
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
374 vflist_column_idx(vfl, FILE_COLUMN_NAME), vfl->click_fd->name,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
375 vflist_row_rename_cb, vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
376 gtk_tree_path_free(tpath);
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 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
379 }
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 file_util_rename(NULL, list, vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
382 }
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 static void vflist_pop_menu_delete_cb(GtkWidget *widget, gpointer 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 ViewFileList *vfl = data;
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 file_util_delete(NULL, vflist_pop_menu_file_list(vfl), vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
389 }
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 static void vflist_pop_menu_sort_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
392 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
393 ViewFileList *vfl;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
394 SortType type;
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 111
diff changeset
395
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 111
diff changeset
396 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
397
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
398 vfl = submenu_item_get_data(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
399 if (!vfl) return;
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 type = (SortType)GPOINTER_TO_INT(data);
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 if (vfl->layout)
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 layout_sort_set(vfl->layout, type, vfl->sort_ascend);
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 else
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 vflist_sort_set(vfl, type, vfl->sort_ascend);
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 }
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 static void vflist_pop_menu_sort_ascend_cb(GtkWidget *widget, gpointer 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 ViewFileList *vfl = data;
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 if (vfl->layout)
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 layout_sort_set(vfl->layout, vfl->sort_method, !vfl->sort_ascend);
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 else
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 vflist_sort_set(vfl, vfl->sort_method, !vfl->sort_ascend);
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 }
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 static void vflist_pop_menu_icons_cb(GtkWidget *widget, gpointer 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 ViewFileList *vfl = data;
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 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
432 }
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 static void vflist_pop_menu_thumbs_cb(GtkWidget *widget, gpointer 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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
437
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
438 vflist_color_set(vfl, vfl->click_fd, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
439 if (vfl->layout)
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 layout_thumb_set(vfl->layout, !vfl->thumbs_enabled);
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 else
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 vflist_thumb_set(vfl, !vfl->thumbs_enabled);
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 }
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 static void vflist_pop_menu_refresh_cb(GtkWidget *widget, gpointer 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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
452
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
453 vflist_color_set(vfl, vfl->click_fd, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
454 vflist_refresh(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
455 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
456
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
457 static void vflist_pop_menu_sel_mark_cb(GtkWidget *widget, gpointer data)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
458 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
459 ViewFileList *vfl = data;
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
460 vflist_mark_to_selection(vfl, vfl->active_mark, MTS_MODE_SET);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
461 }
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 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
464 {
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
465 ViewFileList *vfl = data;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
466 vflist_mark_to_selection(vfl, vfl->active_mark, MTS_MODE_AND);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
467 }
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 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
470 {
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
471 ViewFileList *vfl = data;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
472 vflist_mark_to_selection(vfl, vfl->active_mark, MTS_MODE_OR);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
473 }
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 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
476 {
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
477 ViewFileList *vfl = data;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
478 vflist_mark_to_selection(vfl, vfl->active_mark, MTS_MODE_MINUS);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
479 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
480
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
481 static void vflist_pop_menu_set_mark_sel_cb(GtkWidget *widget, gpointer data)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
482 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
483 ViewFileList *vfl = data;
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
484 vflist_selection_to_mark(vfl, vfl->active_mark, STM_MODE_SET);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
485 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
486
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
487 static void vflist_pop_menu_res_mark_sel_cb(GtkWidget *widget, gpointer data)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
488 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
489 ViewFileList *vfl = data;
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
490 vflist_selection_to_mark(vfl, vfl->active_mark, STM_MODE_RESET);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
491 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
492
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
493 static void vflist_pop_menu_toggle_mark_sel_cb(GtkWidget *widget, gpointer data)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
494 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
495 ViewFileList *vfl = data;
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
496 vflist_selection_to_mark(vfl, vfl->active_mark, STM_MODE_TOGGLE);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
497 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
498
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
499
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
500 static void vflist_popup_destroy_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
501 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
502 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
503 vflist_color_set(vfl, vfl->click_fd, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
504 vfl->click_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
505 vfl->popup = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
506 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
507
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
508
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
509 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
510 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
511 GtkWidget *menu;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
512 GtkWidget *item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
513 GtkWidget *submenu;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
514 gint active;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
515
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
516 vflist_color_set(vfl, fd, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
517 active = (fd != NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
518
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
519 menu = popup_menu_short_lived();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
520 g_signal_connect(G_OBJECT(menu), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
521 G_CALLBACK(vflist_popup_destroy_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
522
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
523 if (col_idx >= FILE_COLUMN_MARKS && col_idx <= FILE_COLUMN_MARKS_LAST)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
524 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
525 gint mark = col_idx - FILE_COLUMN_MARKS;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
526 gchar *str_set_mark = g_strdup_printf(_("_Set mark %d"), mark + 1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
527 gchar *str_res_mark = g_strdup_printf(_("_Reset mark %d"), mark + 1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
528 gchar *str_toggle_mark = g_strdup_printf(_("_Toggle mark %d"), mark + 1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
529 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
530 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
531 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
532 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
533
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
534
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
535 vfl->active_mark = mark;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
536 menu_item_add_sensitive(menu, str_set_mark, active,
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
537 G_CALLBACK(vflist_pop_menu_set_mark_sel_cb), vfl);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
538
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
539 menu_item_add_sensitive(menu, str_res_mark, active,
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
540 G_CALLBACK(vflist_pop_menu_res_mark_sel_cb), vfl);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
541
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
542 menu_item_add_sensitive(menu, str_toggle_mark, active,
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
543 G_CALLBACK(vflist_pop_menu_toggle_mark_sel_cb), vfl);
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
544
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
545 menu_item_add_divider(menu);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
546
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
547 menu_item_add_sensitive(menu, str_sel_mark, active,
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
548 G_CALLBACK(vflist_pop_menu_sel_mark_cb), vfl);
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
549 menu_item_add_sensitive(menu, str_sel_mark_or, active,
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
550 G_CALLBACK(vflist_pop_menu_sel_mark_or_cb), vfl);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
551 menu_item_add_sensitive(menu, str_sel_mark_and, active,
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
552 G_CALLBACK(vflist_pop_menu_sel_mark_and_cb), vfl);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
553 menu_item_add_sensitive(menu, str_sel_mark_minus, active,
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
554 G_CALLBACK(vflist_pop_menu_sel_mark_minus_cb), vfl);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
555
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
556 menu_item_add_divider(menu);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
557
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
558 g_free(str_set_mark);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
559 g_free(str_res_mark);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
560 g_free(str_toggle_mark);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
561 g_free(str_sel_mark);
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
562 g_free(str_sel_mark_and);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
563 g_free(str_sel_mark_or);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
564 g_free(str_sel_mark_minus);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
565 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
566
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
567 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
568 gtk_widget_set_sensitive(item, active);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
569
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
570 menu_item_add_stock_sensitive(menu, _("_Properties"), GTK_STOCK_PROPERTIES, active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
571 G_CALLBACK(vflist_pop_menu_info_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
572 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
573 G_CALLBACK(vflist_pop_menu_view_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
574
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
575 menu_item_add_divider(menu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
576 menu_item_add_stock_sensitive(menu, _("_Copy..."), GTK_STOCK_COPY, active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
577 G_CALLBACK(vflist_pop_menu_copy_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
578 menu_item_add_sensitive(menu, _("_Move..."), active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
579 G_CALLBACK(vflist_pop_menu_move_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
580 menu_item_add_sensitive(menu, _("_Rename..."), active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
581 G_CALLBACK(vflist_pop_menu_rename_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
582 menu_item_add_stock_sensitive(menu, _("_Delete..."), GTK_STOCK_DELETE, active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
583 G_CALLBACK(vflist_pop_menu_delete_cb), vfl);
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 menu_item_add_divider(menu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
586
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
587 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
588 FALSE, FALSE, TRUE, vfl->sort_method);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
589 menu_item_add_divider(submenu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
590 menu_item_add_check(submenu, _("Ascending"), vfl->sort_ascend,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
591 G_CALLBACK(vflist_pop_menu_sort_ascend_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
592
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
593 item = menu_item_add(menu, _("_Sort"), NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
594 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
595
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
596 menu_item_add_check(menu, _("View as _icons"), FALSE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
597 G_CALLBACK(vflist_pop_menu_icons_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
598 menu_item_add_check(menu, _("Show _thumbnails"), vfl->thumbs_enabled,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
599 G_CALLBACK(vflist_pop_menu_thumbs_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
600 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
601
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
602 return menu;
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 /*
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 * callbacks
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 */
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 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
612 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
613 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
614 gchar *old_path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
615 gchar *new_path;
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 if (strlen(new) == 0) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
618
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
619 old_path = concat_dir_and_file(vfl->path, old);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
620 new_path = concat_dir_and_file(vfl->path, new);
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 if (strchr(new, '/') != NULL)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
623 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
624 gchar *text = g_strdup_printf(_("Invalid file name:\n%s"), new);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
625 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
626 g_free(text);
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 else if (isfile(new_path))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
629 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
630 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
631 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
632 g_free(text);
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 else
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
635 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
636 gint row = vflist_index_by_path(vfl, old_path);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
637 if (row >= 0)
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
638 {
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
639 GList *work = g_list_nth(vfl->list, row);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
640 FileData *fd = work->data;
143
0d1bf3ac6cd8 improved FileDataChangeInfo structure, check for another file operation in progress
nadvornik
parents: 142
diff changeset
641
0d1bf3ac6cd8 improved FileDataChangeInfo structure, check for another file operation in progress
nadvornik
parents: 142
diff changeset
642 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
643 {
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
644 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
645 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
646 g_free(text);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
647 }
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
648 }
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
649
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
650 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
651 g_free(old_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
652 g_free(new_path);
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 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
655 }
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 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
658 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
659 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
660 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
661 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
662 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
663 gint cw, ch;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
664
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
665 if (vflist_find_row(vfl, vfl->click_fd, &iter) < 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
666 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
667 tpath = gtk_tree_model_get_path(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
668 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
669 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
670 *y += ch;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
671 popup_menu_position_clamp(menu, x, y, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
672 }
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 static gint vflist_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
675 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
676 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
677 GtkTreePath *tpath;
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 if (event->keyval != GDK_Menu) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
680
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
681 gtk_tree_view_get_cursor(GTK_TREE_VIEW(vfl->listview), &tpath, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
682 if (tpath)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
683 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
684 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
685 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
686
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
687 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
688 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
689 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
690 gtk_tree_path_free(tpath);
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 else
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 vfl->click_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
695 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
696
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
697 vfl->popup = vflist_pop_menu(vfl, vfl->click_fd, 0);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
698 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
699
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
700 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
701 }
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 static gint vflist_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
704 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
705 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
706 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
707 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
708 FileData *fd = NULL;
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
709 GtkTreeViewColumn *column;
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
710 gint col_idx = 0;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
711
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
712 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
713 &tpath, &column, NULL, NULL))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
714 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
715 GtkTreeModel *store;
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
716 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
717
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
718 if (bevent->button == 1 &&
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
719 col_idx >= FILE_COLUMN_MARKS && col_idx <= FILE_COLUMN_MARKS_LAST)
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
720 return FALSE;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
721
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
722 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
723
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
724 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
725 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
726 #if 0
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
727 gtk_tree_view_set_cursor(GTK_TREE_VIEW(widget), tpath, NULL, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
728 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
729 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
730 }
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 vfl->click_fd = fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
733
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
734 if (bevent->button == 3)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
735 {
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
736 vfl->popup = vflist_pop_menu(vfl, vfl->click_fd, col_idx);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
737 gtk_menu_popup(GTK_MENU(vfl->popup), NULL, NULL, NULL, NULL,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
738 bevent->button, bevent->time);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
739 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
740 }
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 (!fd) return FALSE;
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 (bevent->button == 2)
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 if (!vflist_row_is_selected(vfl, fd))
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 vflist_color_set(vfl, fd, 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 return TRUE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
753
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
754 if (bevent->button == 1 && bevent->type == GDK_BUTTON_PRESS &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
755 !(bevent->state & GDK_SHIFT_MASK ) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
756 !(bevent->state & GDK_CONTROL_MASK ) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
757 vflist_row_is_selected(vfl, fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
758 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
759 gtk_widget_grab_focus(widget);
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
760 // return TRUE; // FIXME - expand
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
761 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
762
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
763 #if 0
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
764 if (bevent->button == 1 && bevent->type == GDK_2BUTTON_PRESS)
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 if (vfl->layout) layout_image_full_screen_start(vfl->layout);
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 #endif
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 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
771 }
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 static gint vflist_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
774 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
775 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
776 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
777 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
778 FileData *fd = NULL;
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 if (bevent->button == 2)
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 vflist_color_set(vfl, vfl->click_fd, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
783 }
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 if (bevent->button != 1 && bevent->button != 2)
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 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
788 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
789
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
790 if ((bevent->x != 0 || bevent->y != 0) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
791 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
792 &tpath, NULL, NULL, NULL))
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 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
795
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
796 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
797 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
798 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
799 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
800 }
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 (bevent->button == 2)
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 if (fd && vfl->click_fd == fd)
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 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
807
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
808 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
809 if (vflist_row_is_selected(vfl, fd))
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 gtk_tree_selection_unselect_iter(selection, &iter);
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 else
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 gtk_tree_selection_select_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
816 }
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 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
819 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
820
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
821 if (fd && vfl->click_fd == fd &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
822 !(bevent->state & GDK_SHIFT_MASK ) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
823 !(bevent->state & GDK_CONTROL_MASK ) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
824 vflist_row_is_selected(vfl, fd))
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 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
827
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
828 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
829 gtk_tree_selection_unselect_all(selection);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
830 gtk_tree_selection_select_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
831 vflist_move_cursor(vfl, &iter);
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
832 // return TRUE;// FIXME - expand
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
833 }
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 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
836 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
837
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
838 static void vflist_select_image(ViewFileList *vfl, FileData *sel_fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
839 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
840 FileData *read_ahead_fd = NULL;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
841 gint row;
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
842 FileData *cur_fd;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
843 if (!sel_fd) return;
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
844
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
845 cur_fd = layout_image_get_fd(vfl->layout);
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
846 if (sel_fd == cur_fd) return; /* no change */
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
847
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
848 row = g_list_index(vfl->list, sel_fd);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
849 // FIXME sidecar data
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
850
318
b16b9b8979e5 Add a new struct ConfOptions to handle options.
zas_
parents: 281
diff changeset
851 if (sel_fd && options->enable_read_ahead && row >= 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
852 {
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
853 if (row > g_list_index(vfl->list, cur_fd) &&
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
854 row + 1 < vflist_count(vfl, NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
855 {
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
856 read_ahead_fd = vflist_index_get_data(vfl, row + 1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
857 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
858 else if (row > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
859 {
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
860 read_ahead_fd = vflist_index_get_data(vfl, row - 1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
861 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
862 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
863
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
864 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
865 }
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 static gint vflist_select_idle_cb(gpointer 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 ViewFileList *vfl = data;
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 if (!vfl->layout)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
872 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
873 vfl->select_idle_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
874 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
875 }
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 vflist_send_update(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
878
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
879 if (vfl->select_fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
880 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
881 vflist_select_image(vfl, vfl->select_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
882 vfl->select_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
883 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
884
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
885 vfl->select_idle_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
886 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
887 }
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 static void vflist_select_idle_cancel(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
890 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
891 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
892 vfl->select_idle_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
893 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
894
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
895 static gboolean vflist_select_cb(GtkTreeSelection *selection, GtkTreeModel *store, GtkTreePath *tpath,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
896 gboolean path_currently_selected, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
897 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
898 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
899 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
900
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
901 if (!path_currently_selected &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
902 gtk_tree_model_get_iter(store, &iter, tpath))
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 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
905 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
906 else
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 vfl->select_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
909 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
910
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
911 if (vfl->layout &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
912 vfl->select_idle_id == -1)
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 vfl->select_idle_id = g_idle_add(vflist_select_idle_cb, vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
915 }
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 return TRUE;
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 /*
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 * misc
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
923 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
924 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
925
259
fa7d69e7d02d Comment out unused code.
zas_
parents: 250
diff changeset
926 /*
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
927 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
928 gboolean path_currently_selected, gpointer data)
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
929 {
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
930 return TRUE;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
931 }
259
fa7d69e7d02d Comment out unused code.
zas_
parents: 250
diff changeset
932 */
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
933
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
934
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
935 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
936 {
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
937 int i;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
938 gchar *size;
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
939 gchar *sidecars = NULL;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
940
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
941 if (fd->sidecar_files)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
942 sidecars = sidecar_file_data_list_to_string(fd);
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
943 size = text_from_size(fd->size);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
944
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
945 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
946 FILE_COLUMN_THUMB, (vfl->thumbs_enabled) ? fd->pixbuf : NULL,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
947 FILE_COLUMN_NAME, fd->name,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
948 FILE_COLUMN_SIDECARS, sidecars,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
949 FILE_COLUMN_SIZE, size,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
950 FILE_COLUMN_DATE, text_from_time(fd->date),
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
951 FILE_COLUMN_COLOR, FALSE, -1);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
952 for (i = 0; i < FILEDATA_MARKS_SIZE; i++)
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
953 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
954
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
955 g_free(size);
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
956 if (sidecars)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
957 g_free(sidecars);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
958 }
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
959
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
960 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
961 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
962 GList *work;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
963 GtkTreeIter s_iter;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
964 gint valid;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
965
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
966 vflist_setup_iter(vfl, store, iter, fd);
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
967
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
968
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
969 /* this is almost the same code as in vflist_populate_view
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
970 maybe it should be made more generic and used in both places */
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
971
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
972
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
973 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
974
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
975 work = fd->sidecar_files;
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
976 while (work)
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
977 {
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
978 gint match;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
979 FileData *sfd = work->data;
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
980 gint done = FALSE;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
981
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
982 while (!done)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
983 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
984 FileData *old_sfd = NULL;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
985
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
986 if (valid)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
987 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
988 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
989
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
990 if (sfd == old_sfd)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
991 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
992 match = 0;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
993 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
994 else
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
995 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
996 match = filelist_sort_compare_filedata_full(sfd, old_sfd, SORT_NAME, TRUE);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
997 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
998 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
999
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1000 else
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1001 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1002 match = -1;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1003 }
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1004
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1005 if (match < 0)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1006 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1007 GtkTreeIter new;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1008
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1009 if (valid)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1010 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1011 gtk_tree_store_insert_before(store, &new, iter, &s_iter);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1012 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1013 else
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1014 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1015 gtk_tree_store_append(store, &new, iter);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1016 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1017
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1018 vflist_setup_iter(vfl, store, &new, sfd);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1019
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1020 done = TRUE;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1021 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1022 else if (match > 0)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1023 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1024 valid = gtk_tree_store_remove(store, &s_iter);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1025 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1026 else
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1027 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1028 vflist_setup_iter(vfl, store, &s_iter, sfd);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1029
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1030 if (valid) valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &s_iter);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1031
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1032 done = TRUE;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1033 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1034 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1035 work = work->next;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1036 }
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1037
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1038 while (valid)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1039 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1040 valid = gtk_tree_store_remove(store, &s_iter);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1041 }
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1042 }
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1043
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1044 void vflist_sort_set(ViewFileList *vfl, SortType type, gint ascend)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1045 {
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1046 gint i;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1047 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
1048 gint *new_order;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1049 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1050 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1051
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1052 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
1053 if (!vfl->list) return;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1054
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1055 work = vfl->list;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1056 i = 0;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1057 while (work)
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1058 {
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1059 FileData *fd = work->data;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1060 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
1061 i++;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1062 work = work->next;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1063 }
9
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->sort_method = type;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1066 vfl->sort_ascend = ascend;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1067
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1068 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
1069
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1070 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
1071
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1072 work = vfl->list;
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1073 i = 0;
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1074 while (work)
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1075 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1076 FileData *fd = work->data;
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1077 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
1078 i++;
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1079 work = work->next;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1080 }
168
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 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
1083 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
1084
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1085 g_free(new_order);
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1086 g_hash_table_destroy(fd_idx_hash);
9
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
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 * thumb updates
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1092 *-----------------------------------------------------------------------------
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1095 static gint vflist_thumb_next(ViewFileList *vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1096
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1097 static void vflist_thumb_status(ViewFileList *vfl, gdouble val, const gchar *text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1098 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1099 if (vfl->func_thumb_status)
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 vfl->func_thumb_status(vfl, val, text, vfl->data_thumb_status);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1102 }
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1105 static void vflist_thumb_cleanup(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1106 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1107 vflist_thumb_status(vfl, 0.0, NULL);
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 vfl->thumbs_count = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1110 vfl->thumbs_running = FALSE;
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 thumb_loader_free(vfl->thumbs_loader);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1113 vfl->thumbs_loader = NULL;
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 vfl->thumbs_filedata = NULL;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1118 static void vflist_thumb_stop(ViewFileList *vfl)
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 if (vfl->thumbs_running) vflist_thumb_cleanup(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1121 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1122
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1123 static void vflist_thumb_do(ViewFileList *vfl, ThumbLoader *tl, FileData *fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1124 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1125 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1126 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1127
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1128 if (!fd || vflist_find_row(vfl, fd, &iter) < 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1129
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1130 if (fd->pixbuf) g_object_unref(fd->pixbuf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1131 fd->pixbuf = thumb_loader_get_pixbuf(tl, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1132
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1133 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
1134 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
1135
169
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1136 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
1137 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1138
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1139 static void vflist_thumb_error_cb(ThumbLoader *tl, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1140 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1141 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1142
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1143 if (vfl->thumbs_filedata && vfl->thumbs_loader == tl)
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 vflist_thumb_do(vfl, tl, vfl->thumbs_filedata);
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 while (vflist_thumb_next(vfl));
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1151 static void vflist_thumb_done_cb(ThumbLoader *tl, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1152 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1153 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1154
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1155 if (vfl->thumbs_filedata && vfl->thumbs_loader == tl)
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 vflist_thumb_do(vfl, tl, vfl->thumbs_filedata);
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 while (vflist_thumb_next(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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1163 static gint vflist_thumb_next(ViewFileList *vfl)
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 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1166 FileData *fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1167
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1168 /* first check the visible files */
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 if (GTK_WIDGET_REALIZED(vfl->listview) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1171 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
1172 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1173 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1174 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1175 gint valid = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1176
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1177 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1178 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1179 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1180
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1181 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
1182 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1183 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1184 if (fd->pixbuf) fd = NULL;
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 valid = gtk_tree_model_iter_next(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1187 }
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1190 /* then find first undone */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1191
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1192 if (!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 GList *work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1195 while (work && !fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1196 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1197 FileData *fd_p = work->data;
169
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1198 if (!fd_p->pixbuf)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1199 fd = fd_p;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1200 else
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1201 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1202 GList *work2 = fd_p->sidecar_files;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1203
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1204 while (work2 && !fd)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1205 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1206 fd_p = work2->data;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1207 if (!fd_p->pixbuf) fd = fd_p;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1208 work2 = work2->next;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1209 }
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1210 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1211 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1212 }
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1215 if (!fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1216 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1217 /* done */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1218 vflist_thumb_cleanup(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1219 return FALSE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1222 vfl->thumbs_count++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1223
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1224 vfl->thumbs_filedata = fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1225
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1226 thumb_loader_free(vfl->thumbs_loader);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1227
318
b16b9b8979e5 Add a new struct ConfOptions to handle options.
zas_
parents: 281
diff changeset
1228 vfl->thumbs_loader = thumb_loader_new(options->thumb_max_width, options->thumb_max_height);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1229 thumb_loader_set_callbacks(vfl->thumbs_loader,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1230 vflist_thumb_done_cb,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1231 vflist_thumb_error_cb,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1232 NULL,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1233 vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1234
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1235 if (!thumb_loader_start(vfl->thumbs_loader, fd->path))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1236 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1237 /* set icon to unknown, continue */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1238 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
1239 vflist_thumb_do(vfl, vfl->thumbs_loader, fd);
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 TRUE;
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 return FALSE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1247 static void vflist_thumb_update(ViewFileList *vfl)
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_stop(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1250 if (!vfl->thumbs_enabled) return;
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 vflist_thumb_status(vfl, 0.0, _("Loading thumbs..."));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1253 vfl->thumbs_running = TRUE;
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 while (vflist_thumb_next(vfl));
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
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 * row stuff
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1261 *-----------------------------------------------------------------------------
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1264 FileData *vflist_index_get_data(ViewFileList *vfl, gint row)
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 return g_list_nth_data(vfl->list, 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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1269 gchar *vflist_index_get_path(ViewFileList *vfl, gint row)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1270 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1271 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1272
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1273 fd = g_list_nth_data(vfl->list, row);
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 return (fd ? fd->path : NULL);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1278 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
1279 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1280 gint p = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1281 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1282
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1283 if (!path) return -1;
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 work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1286 while (work)
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 FileData *fd_n = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1289 if (strcmp(path, fd_n->path) == 0)
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 if (fd) *fd = fd_n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1292 return 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 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1295 p++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1296 }
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 if (fd) *fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1299 return -1;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1302 gint vflist_index_by_path(ViewFileList *vfl, const gchar *path)
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 return vflist_row_by_path(vfl, path, NULL);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1307 gint vflist_count(ViewFileList *vfl, gint64 *bytes)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1308 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1309 if (bytes)
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 gint64 b = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1312 GList *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 work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1315 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1316 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1317 FileData *fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1318 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1319 b += fd->size;
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 *bytes = b;
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 return g_list_length(vfl->list);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1328 GList *vflist_get_list(ViewFileList *vfl)
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 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1331 GList *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 work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1334 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1335 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1336 FileData *fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1337 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1338
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1339 list = g_list_prepend(list, file_data_ref(fd));
9
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 return g_list_reverse(list);
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
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 * selections
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1348 *-----------------------------------------------------------------------------
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1351 static gint vflist_row_is_selected(ViewFileList *vfl, FileData *fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1352 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1353 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1354 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1355 GList *slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1356 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1357 gint found = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1358
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1359 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1360 slist = gtk_tree_selection_get_selected_rows(selection, &store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1361 work = slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1362 while (!found && work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1363 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1364 GtkTreePath *tpath = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1365 FileData *fd_n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1366 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1367
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1368 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1369 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd_n, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1370 if (fd_n == fd) found = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1371 work = work->next;
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 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1374 g_list_free(slist);
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 return found;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1379 gint vflist_index_is_selected(ViewFileList *vfl, gint row)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1380 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1381 FileData *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 fd = vflist_index_get_data(vfl, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1384 return vflist_row_is_selected(vfl, fd);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1387 gint vflist_selection_count(ViewFileList *vfl, gint64 *bytes)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1388 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1389 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1390 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1391 GList *slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1392 gint count;
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 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1395 slist = gtk_tree_selection_get_selected_rows(selection, &store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1396
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1397 if (bytes)
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 gint64 b = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1400 GList *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 work = slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1403 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1404 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1405 GtkTreePath *tpath = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1406 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1407 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1408
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1409 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1410 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1411 b += fd->size;
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 work = work->next;
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 *bytes = b;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1417 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1418
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1419 count = g_list_length(slist);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1420 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1421 g_list_free(slist);
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 return count;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1426 GList *vflist_selection_get_list(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1427 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1428 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1429 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1430 GList *slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1431 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1432 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1433
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1434 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1435 slist = gtk_tree_selection_get_selected_rows(selection, &store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1436 work = slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1437 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1438 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1439 GtkTreePath *tpath = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1440 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1441 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1442
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1443 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1444 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1445
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1446 list = g_list_prepend(list, file_data_ref(fd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1447
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1448 work = work->next;
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 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1451 g_list_free(slist);
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 return g_list_reverse(list);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1456 GList *vflist_selection_get_list_by_index(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1457 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1458 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1459 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1460 GList *slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1461 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1462 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1463
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1464 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1465 slist = gtk_tree_selection_get_selected_rows(selection, &store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1466 work = slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1467 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1468 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1469 GtkTreePath *tpath = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1470 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1471 GtkTreeIter iter;
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 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1474 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1475
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1476 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
1477
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1478 work = work->next;
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 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1481 g_list_free(slist);
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 return g_list_reverse(list);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1486 void vflist_select_all(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1487 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1488 GtkTreeSelection *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 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1491 gtk_tree_selection_select_all(selection);
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 vfl->select_fd = NULL;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1496 void vflist_select_none(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1497 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1498 GtkTreeSelection *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 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1501 gtk_tree_selection_unselect_all(selection);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1504 void vflist_select_by_path(ViewFileList *vfl, const gchar *path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1505 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1506 FileData *fd;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1507
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1508 if (vflist_row_by_path(vfl, path, &fd) < 0) return;
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 vflist_select_by_fd(vfl, fd);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1511 }
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1512
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1513 void vflist_select_by_fd(ViewFileList *vfl, FileData *fd)
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1514 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1515 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1516
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1517 if (vflist_find_row(vfl, fd, &iter) < 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1518
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1519 tree_view_row_make_visible(GTK_TREE_VIEW(vfl->listview), &iter, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1520
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1521 if (!vflist_row_is_selected(vfl, fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1522 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1523 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1524 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1525 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1526
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1527 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1528 gtk_tree_selection_unselect_all(selection);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1529 gtk_tree_selection_select_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1530 vflist_move_cursor(vfl, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1531
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1532 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1533 tpath = gtk_tree_model_get_path(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1534 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
1535 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1536 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1537 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1538
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1539 void vflist_mark_to_selection(ViewFileList *vfl, gint mark, MarkToSelectionMode mode)
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1540 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1541 GtkTreeModel *store;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1542 GtkTreeIter iter;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1543 GtkTreeSelection *selection;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1544 gint valid;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1545
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1546 g_assert(mark >= 0 && mark < FILEDATA_MARKS_SIZE);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1547
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1548 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1549 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1550
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1551 valid = gtk_tree_model_get_iter_first(store, &iter);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1552 while (valid)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1553 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1554 FileData *fd;
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1555 gboolean mark_val, selected;
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1556 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
1557
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1558 mark_val = fd->marks[mark];
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1559 selected = gtk_tree_selection_iter_is_selected(selection, &iter);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1560
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1561 switch (mode)
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1562 {
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1563 case MTS_MODE_SET: selected = mark_val;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1564 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1565 case MTS_MODE_OR: selected = mark_val | selected;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1566 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1567 case MTS_MODE_AND: selected = mark_val & selected;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1568 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1569 case MTS_MODE_MINUS: selected = !mark_val & selected;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1570 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1571 }
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1572
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1573 if (selected)
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1574 gtk_tree_selection_select_iter(selection, &iter);
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1575 else
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1576 gtk_tree_selection_unselect_iter(selection, &iter);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1577
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1578 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1579 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1580 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1581
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1582 void vflist_selection_to_mark(ViewFileList *vfl, gint mark, SelectionToMarkMode mode)
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1583 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1584 GtkTreeModel *store;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1585 GtkTreeSelection *selection;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1586 GList *slist;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1587 GList *work;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1588
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1589 g_assert(mark >= 0 && mark < FILEDATA_MARKS_SIZE);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1590
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1591 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1592 slist = gtk_tree_selection_get_selected_rows(selection, &store);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1593 work = slist;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1594 while (work)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1595 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1596 GtkTreePath *tpath = work->data;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1597 FileData *fd;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1598 GtkTreeIter iter;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1599
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1600 gtk_tree_model_get_iter(store, &iter, tpath);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1601 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1602
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1603 switch (mode)
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1604 {
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1605 case STM_MODE_SET: fd->marks[mark] = 1;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1606 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1607 case STM_MODE_RESET: fd->marks[mark] = 0;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1608 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1609 case STM_MODE_TOGGLE: fd->marks[mark] = !fd->marks[mark];
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1610 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1611 }
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1612
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1613 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
1614
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1615 work = work->next;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1616 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1617 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1618 g_list_free(slist);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1619 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1620
9
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 * core (population)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1624 *-----------------------------------------------------------------------------
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1627 static void vflist_listview_set_height(GtkWidget *listview, gint thumb)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1628 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1629 GtkTreeViewColumn *column;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1630 GtkCellRenderer *cell;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1631 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1632
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1633 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
1634 if (!column) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1635
318
b16b9b8979e5 Add a new struct ConfOptions to handle options.
zas_
parents: 281
diff changeset
1636 gtk_tree_view_column_set_fixed_width(column, ((thumb) ? options->thumb_max_width : 4) + 10);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1637
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1638 list = gtk_tree_view_column_get_cell_renderers(column);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1639 if (!list) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1640 cell = list->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1641 g_list_free(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1642
318
b16b9b8979e5 Add a new struct ConfOptions to handle options.
zas_
parents: 281
diff changeset
1643 g_object_set(G_OBJECT(cell), "height", (thumb) ? options->thumb_max_height : -1, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1644 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1645 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1646
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1647 static void vflist_populate_view(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1648 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1649 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1650 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1651 gint thumbs;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1652 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1653 GtkTreeRowReference *visible_row = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1654 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1655 gint valid;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1656
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1657 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
1658 thumbs = vfl->thumbs_enabled;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1659
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1660 vflist_thumb_stop(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1661
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1662 if (!vfl->list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1663 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1664 gtk_tree_store_clear(store);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1665 vflist_send_update(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1666 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1667 }
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 if (GTK_WIDGET_REALIZED(vfl->listview) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1670 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
1671 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1672 visible_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1673 gtk_tree_path_free(tpath);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1676 vflist_listview_set_height(vfl->listview, thumbs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1677
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1678 valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter);
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 work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1681 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1682 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1683 gint match;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1684 FileData *fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1685 gint done = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1686
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1687 while (!done)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1688 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1689 FileData *old_fd = NULL;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1690
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1691 if (valid)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1692 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1693 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
1694
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1695 if (fd == old_fd)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1696 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1697 match = 0;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1698 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1699 else
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1700 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1701 match = filelist_sort_compare_filedata_full(fd, old_fd, vfl->sort_method, vfl->sort_ascend);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1702 if (match == 0)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1703 match = -1; /* probably should not happen*/
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1704 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1705 }
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1706
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1707 else
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 match = -1;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1712 if (match < 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1713 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1714 GtkTreeIter new;
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1715
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1716 if (valid)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1717 {
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1718 gtk_tree_store_insert_before(store, &new, NULL, &iter);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1719 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1720 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1721 {
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1722 gtk_tree_store_append(store, &new, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1723 }
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1724 vflist_setup_iter_with_sidecars(vfl, store, &new, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1725
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1726 done = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1727 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1728 else if (match > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1729 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1730 valid = gtk_tree_store_remove(store, &iter);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1731 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1732 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1733 {
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1734 vflist_setup_iter_with_sidecars(vfl, store, &iter, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1735
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1736 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
1737
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1738 done = TRUE;
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 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1742 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1743
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1744 while (valid)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1745 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1746 valid = gtk_tree_store_remove(store, &iter);
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1749 if (visible_row)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1750 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1751 if (gtk_tree_row_reference_valid(visible_row))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1752 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1753 tpath = gtk_tree_row_reference_get_path(visible_row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1754 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
1755 gtk_tree_path_free(tpath);
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 gtk_tree_row_reference_free(visible_row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1758 }
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 vflist_send_update(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1761 vflist_thumb_update(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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1764 gint vflist_refresh(ViewFileList *vfl)
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 GList *old_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1767 gint ret = TRUE;
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 old_list = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1770 vfl->list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1771
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1772 if (vfl->path)
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 ret = filelist_read(vfl->path, &vfl->list, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1775 }
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 vfl->list = filelist_sort(vfl->list, vfl->sort_method, vfl->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1778 vflist_populate_view(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1779
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1780 filelist_free(old_list);
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 return ret;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1785 /* 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
1786
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1787 #define CELL_HEIGHT_OVERRIDE 512
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1788
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1789 static void cell_renderer_height_override(GtkCellRenderer *renderer)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1790 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1791 GParamSpec *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 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
1794 if (spec && G_IS_PARAM_SPEC_INT(spec))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1795 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1796 GParamSpecInt *spec_int;
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 spec_int = G_PARAM_SPEC_INT(spec);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1799 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
1800 }
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1803 static GdkColor *vflist_listview_color_shifted(GtkWidget *widget)
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 static GdkColor color;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1806 static GtkWidget *done = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1807
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1808 if (done != widget)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1809 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1810 GtkStyle *style;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1811
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1812 style = gtk_widget_get_style(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1813 memcpy(&color, &style->base[GTK_STATE_NORMAL], sizeof(color));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1814 shift_color(&color, -1, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1815 done = widget;
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 return &color;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1819 }
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 static void vflist_listview_color_cb(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1822 GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1825 gboolean set;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1826
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1827 gtk_tree_model_get(tree_model, iter, FILE_COLUMN_COLOR, &set, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1828 g_object_set(G_OBJECT(cell),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1829 "cell-background-gdk", vflist_listview_color_shifted(vfl->listview),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1830 "cell-background-set", set, NULL);
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
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1833 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
1834 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1835 GtkTreeViewColumn *column;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1836 GtkCellRenderer *renderer;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1837
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1838 column = gtk_tree_view_column_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1839 gtk_tree_view_column_set_title(column, title);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1840 gtk_tree_view_column_set_min_width(column, 4);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1841
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1842 if (!image)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1843 {
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1844 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
1845 renderer = gtk_cell_renderer_text_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1846 if (right_justify)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1847 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1848 g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1849 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1850 gtk_tree_view_column_pack_start(column, renderer, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1851 gtk_tree_view_column_add_attribute(column, renderer, "text", n);
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1852 if (expand)
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1853 gtk_tree_view_column_set_expand(column, TRUE);
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1854 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1855 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1856 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1857 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1858 renderer = gtk_cell_renderer_pixbuf_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1859 cell_renderer_height_override(renderer);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1860 gtk_tree_view_column_pack_start(column, renderer, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1861 gtk_tree_view_column_add_attribute(column, renderer, "pixbuf", n);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1862 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1863
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1864 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
1865 g_object_set_data (G_OBJECT (column), "column_store_idx", GUINT_TO_POINTER(n));
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1866 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
1867
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1868 gtk_tree_view_append_column(GTK_TREE_VIEW(vfl->listview), column);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1869 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1870
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1871 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
1872 {
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1873 GtkTreePath *path = gtk_tree_path_new_from_string(path_str);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1874 GtkTreeIter iter;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1875 FileData *fd;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1876 gboolean mark;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1877 guint col_idx;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1878
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1879 if (!path || !gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path))
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1880 return;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1881
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1882 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
1883
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1884 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
1885
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1886 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
1887 mark = !mark;
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1888 fd->marks[col_idx - FILE_COLUMN_MARKS] = mark;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1889
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1890 gtk_tree_store_set(store, &iter, col_idx, mark, -1);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1891 gtk_tree_path_free(path);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1892 }
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1893
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1894 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
1895 {
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1896 GtkTreeViewColumn *column;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1897 GtkCellRenderer *renderer;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1898 GtkTreeStore *store;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1899 gint index;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1900
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1901 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
1902
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1903 renderer = gtk_cell_renderer_toggle_new();
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1904 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
1905
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1906 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1907 g_object_set_data (G_OBJECT (column), "column_store_idx", GUINT_TO_POINTER(n));
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1908 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
1909
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1910 index = gtk_tree_view_append_column(GTK_TREE_VIEW(vfl->listview), column);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1911 gtk_tree_view_column_set_fixed_width(column, 16);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1912 gtk_tree_view_column_set_visible(column, vfl->marks_enabled);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1913
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1914
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1915 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
1916 }
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1917
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1918 /*
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 * base
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 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1923
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1924 gint vflist_set_path(ViewFileList *vfl, const gchar *path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1925 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1926 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1927
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1928 if (!path) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1929 if (vfl->path && strcmp(path, vfl->path) == 0) return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1930
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1931 g_free(vfl->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1932 vfl->path = g_strdup(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1933
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1934 /* force complete reload */
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1935 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
1936 gtk_tree_store_clear(store);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1937
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1938 filelist_free(vfl->list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1939 vfl->list = NULL;
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 return vflist_refresh(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1942 }
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 static void vflist_destroy_cb(GtkWidget *widget, gpointer 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 ViewFileList *vfl = data;
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 if (vfl->popup)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1949 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1950 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
1951 0, 0, 0, NULL, vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1952 gtk_widget_destroy(vfl->popup);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1953 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1954
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1955 vflist_select_idle_cancel(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1956 vflist_thumb_stop(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1957
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1958 g_free(vfl->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1959 filelist_free(vfl->list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1960 g_free(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1961 }
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 *vflist_new(const gchar *path, gint thumbs)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1964 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1965 ViewFileList *vfl;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1966 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1967 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1968
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1969 GType flist_types[FILE_COLUMN_COUNT];
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1970 int i;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1971
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1972 vfl = g_new0(ViewFileList, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1973
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1974 vfl->path = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1975 vfl->list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1976 vfl->click_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1977 vfl->select_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1978 vfl->sort_method = SORT_NAME;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1979 vfl->sort_ascend = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1980 vfl->thumbs_enabled = thumbs;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1981
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1982 vfl->thumbs_running = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1983 vfl->thumbs_count = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1984 vfl->thumbs_loader = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1985 vfl->thumbs_filedata = NULL;
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->select_idle_id = -1;
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->popup = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1990
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1991 vfl->widget = gtk_scrolled_window_new(NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1992 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
1993 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vfl->widget),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1994 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1995 g_signal_connect(G_OBJECT(vfl->widget), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1996 G_CALLBACK(vflist_destroy_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1997
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1998 flist_types[FILE_COLUMN_POINTER] = G_TYPE_POINTER;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1999 flist_types[FILE_COLUMN_THUMB] = GDK_TYPE_PIXBUF;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2000 flist_types[FILE_COLUMN_NAME] = G_TYPE_STRING;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2001 flist_types[FILE_COLUMN_SIDECARS] = G_TYPE_STRING;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2002 flist_types[FILE_COLUMN_SIZE] = G_TYPE_STRING;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2003 flist_types[FILE_COLUMN_DATE] = G_TYPE_STRING;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2004 flist_types[FILE_COLUMN_COLOR] = G_TYPE_BOOLEAN;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2005 for (i = FILE_COLUMN_MARKS; i < FILE_COLUMN_MARKS + FILEDATA_MARKS_SIZE; i++)
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2006 flist_types[i] = G_TYPE_BOOLEAN;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2007
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2008 store = gtk_tree_store_newv(FILE_COLUMN_COUNT, flist_types);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2009
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2010 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
2011 g_object_unref(store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2012
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2013 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2014 gtk_tree_selection_set_mode(GTK_TREE_SELECTION(selection), GTK_SELECTION_MULTIPLE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2015 gtk_tree_selection_set_select_function(selection, vflist_select_cb, vfl, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2016
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2017 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
2018 gtk_tree_view_set_enable_search(GTK_TREE_VIEW(vfl->listview), FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2019
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2020 vflist_listview_add_column(vfl, FILE_COLUMN_THUMB, "", TRUE, FALSE, FALSE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2021
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2022 for(i = 0; i < FILEDATA_MARKS_SIZE;i++)
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2023 vflist_listview_add_column_toggle(vfl, i + FILE_COLUMN_MARKS, "");
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2024
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2025 vflist_listview_add_column(vfl, FILE_COLUMN_NAME, _("Name"), FALSE, FALSE, FALSE);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2026 vflist_listview_add_column(vfl, FILE_COLUMN_SIDECARS, _("SC"), FALSE, FALSE, FALSE);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2027
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2028 vflist_listview_add_column(vfl, FILE_COLUMN_SIZE, _("Size"), FALSE, TRUE, FALSE);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2029 vflist_listview_add_column(vfl, FILE_COLUMN_DATE, _("Date"), FALSE, TRUE, FALSE);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2030
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2031
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2032 g_signal_connect(G_OBJECT(vfl->listview), "key_press_event",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2033 G_CALLBACK(vflist_press_key_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2034
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2035 gtk_container_add (GTK_CONTAINER(vfl->widget), vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2036 gtk_widget_show(vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2037
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2038 vflist_dnd_init(vfl);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2039
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2040 g_signal_connect(G_OBJECT(vfl->listview), "button_press_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2041 G_CALLBACK(vflist_press_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2042 g_signal_connect(G_OBJECT(vfl->listview), "button_release_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2043 G_CALLBACK(vflist_release_cb), vfl);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2044
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2045
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2046 if (path) vflist_set_path(vfl, path);
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 return vfl;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2049 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2050
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2051 void vflist_set_status_func(ViewFileList *vfl,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2052 void (*func)(ViewFileList *vfl, gpointer data), gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2053 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2054 vfl->func_status = func;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2055 vfl->data_status = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2056 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2057
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2058 void vflist_set_thumb_status_func(ViewFileList *vfl,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2059 void (*func)(ViewFileList *vfl, gdouble val, const gchar *text, gpointer data),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2060 gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2061 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2062 vfl->func_thumb_status = func;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2063 vfl->data_thumb_status = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2064 }
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 void vflist_thumb_set(ViewFileList *vfl, gint enable)
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 if (vfl->thumbs_enabled == enable) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2069
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2070 vfl->thumbs_enabled = enable;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2071 vflist_refresh(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2072 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2073
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2074 void vflist_marks_set(ViewFileList *vfl, gint enable)
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2075 {
149
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
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
2170 if (g_list_index(vfl->list, fd) < 0) return FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2171
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2172 source_base = remove_level_from_path(fd->change->source);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2173 dest_base = remove_level_from_path(fd->change->dest);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2174
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 if (strcmp(source_base, dest_base) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2177 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2178 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2179 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2180 GtkTreeIter position;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2181 gint old_row;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2182 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2183
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2184 old_row = g_list_index(vfl->list, fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2185
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2186 vfl->list = g_list_remove(vfl->list, fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2187
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2188 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
2189 n = g_list_index(vfl->list, fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2190
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2191 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
2192 if (vflist_find_row(vfl, fd, &iter) >= 0 &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2193 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
2194 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2195 if (old_row >= n)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2196 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2197 gtk_tree_store_move_before(store, &iter, &position);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2198 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2199 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2200 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2201 gtk_tree_store_move_after(store, &iter, &position);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2202 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2203 }
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2204 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
2205
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2206 ret = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2207 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2208 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2209 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2210 ret = vflist_maint_removed(vfl, fd, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2211 }
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 g_free(source_base);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2214 g_free(dest_base);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2215
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2216 return ret;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2217 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2218
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2219 gint vflist_maint_removed(ViewFileList *vfl, FileData *fd, GList *ignore_list)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2220 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2221 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2222 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2223 gint row;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2224 gint new_row = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2225
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2226 row = g_list_index(vfl->list, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2227 if (row < 0) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2228
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2229 if (vflist_index_is_selected(vfl, row) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2230 layout_image_get_collection(vfl->layout, NULL) == NULL)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2231 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2232 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2233
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2234 n = vflist_count(vfl, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2235 if (ignore_list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2236 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2237 new_row = vflist_maint_find_closest(vfl, row, n, ignore_list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2238 if (debug) printf("row = %d, closest is %d\n", row, new_row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2239 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2240 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2241 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2242 if (row + 1 < n)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2243 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2244 new_row = row + 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2245 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2246 else if (row > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2247 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2248 new_row = row - 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2249 }
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 vflist_select_none(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2252 if (new_row >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2253 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2254 fd = vflist_index_get_data(vfl, new_row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2255 if (vflist_find_row(vfl, fd, &iter) >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2256 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2257 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2258
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2259 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2260 gtk_tree_selection_select_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2261 vflist_move_cursor(vfl, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2262 }
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 fd = vflist_index_get_data(vfl, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2267 if (vflist_find_row(vfl, fd, &iter) >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2268 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2269 GtkTreeStore *store;
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2270 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
2271 gtk_tree_store_remove(store, &iter);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2272 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2273 list = g_list_nth(vfl->list, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2274 fd = list->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2275
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2276 /* thumbnail loader check */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2277 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
2278 if (vfl->thumbs_count > 0) vfl->thumbs_count--;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2279
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2280 vfl->list = g_list_remove(vfl->list, fd);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2281 file_data_unref(fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2282
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2283 vflist_send_update(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2284
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2285 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2286 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2287
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2288 gint vflist_maint_moved(ViewFileList *vfl, FileData *fd, GList *ignore_list)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2289 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2290 gint ret = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2291 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2292
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2293 if (!fd->change->source || !vfl->path) return FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2294
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2295 buf = remove_level_from_path(fd->change->source);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2296
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2297 if (strcmp(buf, vfl->path) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2298 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2299 ret = vflist_maint_removed(vfl, fd, ignore_list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2300 }
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 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2303
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2304 return ret;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2305 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2306