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