annotate src/view_file_list.c @ 486:c5144a2f38be

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