Mercurial > geeqie
annotate src/view_dir_tree.c @ 99:d19b0de6d0bb
Sat Nov 4 17:14:47 2006 John Ellis <johne@verizon.net>
* pan-view.c: Always recalculate canvas size when displaying popups.
* README: Updates.
* po/eo.po: Mark translation for 'Command Line' not fuzzy.
* configure.in: Release 2.1.4 (quick bug fix for pan view).
author | gqview |
---|---|
date | Sat, 04 Nov 2006 22:24:47 +0000 |
parents | 04ff0df3ad2f |
children | b15d4c18168f |
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_dir_tree.h" | |
14 | |
15 | |
16 #include "dnd.h" | |
17 #include "dupe.h" | |
18 #include "filelist.h" | |
19 #include "layout.h" | |
20 #include "layout_image.h" | |
21 #include "layout_util.h" | |
22 #include "utilops.h" | |
23 #include "ui_bookmark.h" | |
24 #include "ui_fileops.h" | |
25 #include "ui_menu.h" | |
26 #include "ui_tree_edit.h" | |
27 | |
28 #include <gdk/gdkkeysyms.h> /* for keyboard values */ | |
29 | |
30 | |
31 #define VDTREE_INDENT 14 | |
32 #define VDTREE_PAD 4 | |
33 | |
34 enum { | |
35 DIR_COLUMN_POINTER = 0, | |
36 DIR_COLUMN_ICON, | |
37 DIR_COLUMN_NAME, | |
38 DIR_COLUMN_COLOR, | |
39 DIR_COLUMN_COUNT | |
40 }; | |
41 | |
42 | |
43 typedef struct _PathData PathData; | |
44 struct _PathData | |
45 { | |
46 gchar *name; | |
47 FileData *node; | |
48 }; | |
49 | |
50 typedef struct _NodeData NodeData; | |
51 struct _NodeData | |
52 { | |
53 FileData *fd; | |
54 gint expanded; | |
55 time_t last_update; | |
56 }; | |
57 | |
58 | |
59 static gint vdtree_populate_path_by_iter(ViewDirTree *vdt, GtkTreeIter *iter, gint force, const gchar *target_path); | |
60 static FileData *vdtree_populate_path(ViewDirTree *vdt, const gchar *path, gint expand, gint force); | |
61 | |
62 | |
63 /* | |
64 *---------------------------------------------------------------------------- | |
65 * utils | |
66 *---------------------------------------------------------------------------- | |
67 */ | |
68 | |
69 static void set_cursor(GtkWidget *widget, GdkCursorType cursor_type) | |
70 { | |
71 GdkCursor *cursor = NULL; | |
72 | |
73 if (!widget || !widget->window) return; | |
74 | |
75 if (cursor_type > -1) cursor = gdk_cursor_new (cursor_type); | |
76 gdk_window_set_cursor (widget->window, cursor); | |
77 if (cursor) gdk_cursor_unref(cursor); | |
78 gdk_flush(); | |
79 } | |
80 | |
81 static void vdtree_busy_push(ViewDirTree *vdt) | |
82 { | |
83 if (vdt->busy_ref == 0) set_cursor(vdt->treeview, GDK_WATCH); | |
84 vdt->busy_ref++; | |
85 } | |
86 | |
87 static void vdtree_busy_pop(ViewDirTree *vdt) | |
88 { | |
89 if (vdt->busy_ref == 1) set_cursor(vdt->treeview, -1); | |
90 if (vdt->busy_ref > 0) vdt->busy_ref--; | |
91 } | |
92 | |
93 static gint vdtree_find_row(ViewDirTree *vdt, FileData *fd, GtkTreeIter *iter, GtkTreeIter *parent) | |
94 { | |
95 GtkTreeModel *store; | |
96 gint valid; | |
97 | |
98 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->treeview)); | |
99 if (parent) | |
100 { | |
101 valid = gtk_tree_model_iter_children(store, iter, parent); | |
102 } | |
103 else | |
104 { | |
105 valid = gtk_tree_model_get_iter_first(store, iter); | |
106 } | |
107 while (valid) | |
108 { | |
109 NodeData *nd; | |
110 GtkTreeIter found; | |
111 | |
112 gtk_tree_model_get(GTK_TREE_MODEL(store), iter, DIR_COLUMN_POINTER, &nd, -1); | |
113 if (nd->fd == fd) return TRUE; | |
114 | |
115 if (vdtree_find_row(vdt, fd, &found, iter)) | |
116 { | |
117 memcpy(iter, &found, sizeof(found)); | |
118 return TRUE; | |
119 } | |
120 | |
121 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), iter); | |
122 } | |
123 | |
124 return FALSE; | |
125 } | |
126 | |
127 static void vdtree_icon_set_by_iter(ViewDirTree *vdt, GtkTreeIter *iter, GdkPixbuf *pixbuf) | |
128 { | |
129 GtkTreeModel *store; | |
130 GdkPixbuf *old; | |
131 | |
132 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->treeview)); | |
133 gtk_tree_model_get(store, iter, DIR_COLUMN_ICON, &old, -1); | |
134 if (old != vdt->pf->deny) | |
135 { | |
136 gtk_tree_store_set(GTK_TREE_STORE(store), iter, DIR_COLUMN_ICON, pixbuf, -1); | |
137 } | |
138 } | |
139 | |
140 static void vdtree_expand_by_iter(ViewDirTree *vdt, GtkTreeIter *iter, gint expand) | |
141 { | |
142 GtkTreeModel *store; | |
143 GtkTreePath *tpath; | |
144 | |
145 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->treeview)); | |
146 tpath = gtk_tree_model_get_path(store, iter); | |
147 if (expand) | |
148 { | |
149 gtk_tree_view_expand_row(GTK_TREE_VIEW(vdt->treeview), tpath, FALSE); | |
150 vdtree_icon_set_by_iter(vdt, iter, vdt->pf->open); | |
151 } | |
152 else | |
153 { | |
154 gtk_tree_view_collapse_row(GTK_TREE_VIEW(vdt->treeview), tpath); | |
155 } | |
156 gtk_tree_path_free(tpath); | |
157 } | |
158 | |
159 static void vdtree_expand_by_data(ViewDirTree *vdt, FileData *fd, gint expand) | |
160 { | |
161 GtkTreeIter iter; | |
162 | |
163 if (vdtree_find_row(vdt, fd, &iter, NULL)) | |
164 { | |
165 vdtree_expand_by_iter(vdt, &iter, expand); | |
166 } | |
167 } | |
168 | |
169 static void vdtree_color_set(ViewDirTree *vdt, FileData *fd, gint color_set) | |
170 { | |
171 GtkTreeModel *store; | |
172 GtkTreeIter iter; | |
173 | |
174 if (!vdtree_find_row(vdt, fd, &iter, NULL)) return; | |
175 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->treeview)); | |
176 gtk_tree_store_set(GTK_TREE_STORE(store), &iter, DIR_COLUMN_COLOR, color_set, -1); | |
177 } | |
178 | |
179 static gint vdtree_rename_row_cb(TreeEditData *td, const gchar *old, const gchar *new, gpointer data) | |
180 { | |
181 ViewDirTree *vdt = data; | |
182 GtkTreeModel *store; | |
183 GtkTreeIter iter; | |
184 NodeData *nd; | |
185 gchar *old_path; | |
186 gchar *new_path; | |
187 gchar *base; | |
188 | |
189 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->treeview)); | |
190 if (!gtk_tree_model_get_iter(store, &iter, td->path)) return FALSE; | |
191 gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &nd, -1); | |
192 if (!nd) return FALSE; | |
193 | |
194 old_path = g_strdup(nd->fd->path); | |
195 | |
196 base = remove_level_from_path(old_path); | |
197 new_path = concat_dir_and_file(base, new); | |
198 g_free(base); | |
199 | |
44
458e396d3f35
Wed May 18 19:36:49 2005 John Ellis <johne@verizon.net>
gqview
parents:
25
diff
changeset
|
200 if (file_util_rename_dir(old_path, new_path, vdt->treeview)) |
9 | 201 { |
202 vdtree_populate_path(vdt, new_path, TRUE, TRUE); | |
203 | |
204 if (vdt->layout && strcmp(vdt->path, old_path) == 0) | |
205 { | |
206 layout_set_path(vdt->layout, new_path); | |
207 } | |
208 } | |
209 | |
210 g_free(old_path); | |
211 g_free(new_path); | |
212 | |
213 return FALSE; | |
214 } | |
215 | |
216 static void vdtree_rename_by_data(ViewDirTree *vdt, FileData *fd) | |
217 { | |
218 GtkTreeModel *store; | |
219 GtkTreePath *tpath; | |
220 GtkTreeIter iter; | |
221 | |
222 if (!fd || | |
223 !vdtree_find_row(vdt, fd, &iter, NULL)) return; | |
224 | |
225 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->treeview)); | |
226 tpath = gtk_tree_model_get_path(store, &iter); | |
227 | |
228 tree_edit_by_path(GTK_TREE_VIEW(vdt->treeview), tpath, 0, fd->name, | |
229 vdtree_rename_row_cb, vdt); | |
230 gtk_tree_path_free(tpath); | |
231 } | |
232 | |
233 static void vdtree_node_free(NodeData *nd) | |
234 { | |
235 if (!nd) return; | |
236 | |
237 file_data_free(nd->fd); | |
238 g_free(nd); | |
239 } | |
240 | |
241 static void vdtree_popup_destroy_cb(GtkWidget *widget, gpointer data) | |
242 { | |
243 ViewDirTree *vdt = data; | |
244 | |
245 vdtree_color_set(vdt, vdt->click_fd, FALSE); | |
246 vdt->click_fd = NULL; | |
247 vdt->popup = NULL; | |
248 | |
249 vdtree_color_set(vdt, vdt->drop_fd, FALSE); | |
250 path_list_free(vdt->drop_list); | |
251 vdt->drop_list = NULL; | |
252 vdt->drop_fd = NULL; | |
253 } | |
254 | |
255 /* | |
256 *----------------------------------------------------------------------------- | |
257 * drop menu (from dnd) | |
258 *----------------------------------------------------------------------------- | |
259 */ | |
260 | |
261 static void vdtree_drop_menu_copy_cb(GtkWidget *widget, gpointer data) | |
262 { | |
263 ViewDirTree *vdt = data; | |
264 const gchar *path; | |
265 GList *list; | |
266 | |
267 if (!vdt->drop_fd) return; | |
268 | |
269 path = vdt->drop_fd->path; | |
270 list = vdt->drop_list; | |
271 | |
272 vdt->drop_list = NULL; | |
273 | |
274 file_util_copy_simple(list, path); | |
275 } | |
276 | |
277 static void vdtree_drop_menu_move_cb(GtkWidget *widget, gpointer data) | |
278 { | |
279 ViewDirTree *vdt = data; | |
280 const gchar *path; | |
281 GList *list; | |
282 | |
283 if (!vdt->drop_fd) return; | |
284 | |
285 path = vdt->drop_fd->path; | |
286 list = vdt->drop_list; | |
287 | |
288 vdt->drop_list = NULL; | |
289 | |
290 file_util_move_simple(list, path); | |
291 } | |
292 | |
293 static GtkWidget *vdtree_drop_menu(ViewDirTree *vdt, gint active) | |
294 { | |
295 GtkWidget *menu; | |
296 | |
297 menu = popup_menu_short_lived(); | |
298 g_signal_connect(G_OBJECT(menu), "destroy", | |
299 G_CALLBACK(vdtree_popup_destroy_cb), vdt); | |
300 | |
301 menu_item_add_stock_sensitive(menu, _("_Copy"), GTK_STOCK_COPY, active, | |
302 G_CALLBACK(vdtree_drop_menu_copy_cb), vdt); | |
303 menu_item_add_sensitive(menu, _("_Move"), active, G_CALLBACK(vdtree_drop_menu_move_cb), vdt); | |
304 | |
305 menu_item_add_divider(menu); | |
306 menu_item_add_stock(menu, _("Cancel"), GTK_STOCK_CANCEL, NULL, vdt); | |
307 | |
308 return menu; | |
309 } | |
310 | |
311 /* | |
312 *----------------------------------------------------------------------------- | |
313 * pop-up menu | |
314 *----------------------------------------------------------------------------- | |
315 */ | |
316 | |
317 static void vdtree_pop_menu_up_cb(GtkWidget *widget, gpointer data) | |
318 { | |
319 ViewDirTree *vdt = data; | |
320 gchar *path; | |
321 | |
322 if (!vdt->path || strcmp(vdt->path, "/") == 0) return; | |
323 path = remove_level_from_path(vdt->path); | |
324 | |
325 if (vdt->select_func) | |
326 { | |
327 vdt->select_func(vdt, path, vdt->select_data); | |
328 } | |
329 | |
330 g_free(path); | |
331 } | |
332 | |
333 static void vdtree_pop_menu_slide_cb(GtkWidget *widget, gpointer data) | |
334 { | |
335 ViewDirTree *vdt = data; | |
336 gchar *path; | |
337 | |
338 if (!vdt->layout) return; | |
339 | |
340 if (!vdt->click_fd) return; | |
341 path = g_strdup(vdt->click_fd->path); | |
342 | |
343 layout_set_path(vdt->layout, path); | |
344 layout_select_none(vdt->layout); | |
345 layout_image_slideshow_stop(vdt->layout); | |
346 layout_image_slideshow_start(vdt->layout); | |
347 | |
348 g_free(path); | |
349 } | |
350 | |
351 static void vdtree_pop_menu_slide_rec_cb(GtkWidget *widget, gpointer data) | |
352 { | |
353 ViewDirTree *vdt = data; | |
354 gchar *path; | |
355 GList *list; | |
356 | |
357 if (!vdt->layout) return; | |
358 | |
359 if (!vdt->click_fd) return; | |
360 path = g_strdup(vdt->click_fd->path); | |
361 | |
362 list = path_list_recursive(path); | |
363 | |
364 layout_image_slideshow_stop(vdt->layout); | |
365 layout_image_slideshow_start_from_list(vdt->layout, list); | |
366 | |
367 g_free(path); | |
368 } | |
369 | |
370 static void vdtree_pop_menu_dupe(ViewDirTree *vdt, gint recursive) | |
371 { | |
372 DupeWindow *dw; | |
373 const gchar *path; | |
374 GList *list = NULL; | |
375 | |
376 if (!vdt->click_fd) return; | |
377 path = vdt->click_fd->path; | |
378 | |
379 if (recursive) | |
380 { | |
381 list = g_list_append(list, g_strdup(path)); | |
382 } | |
383 else | |
384 { | |
385 path_list(path, &list, NULL); | |
386 list = path_list_filter(list, FALSE); | |
387 } | |
388 | |
389 dw = dupe_window_new(DUPE_MATCH_NAME); | |
390 dupe_window_add_files(dw, list, recursive); | |
391 | |
392 path_list_free(list); | |
393 } | |
394 | |
395 static void vdtree_pop_menu_dupe_cb(GtkWidget *widget, gpointer data) | |
396 { | |
397 ViewDirTree *vdt = data; | |
398 vdtree_pop_menu_dupe(vdt, FALSE); | |
399 } | |
400 | |
401 static void vdtree_pop_menu_dupe_rec_cb(GtkWidget *widget, gpointer data) | |
402 { | |
403 ViewDirTree *vdt = data; | |
404 vdtree_pop_menu_dupe(vdt, TRUE); | |
405 } | |
406 | |
407 static void vdtree_pop_menu_new_cb(GtkWidget *widget, gpointer data) | |
408 { | |
409 ViewDirTree *vdt = data; | |
410 const gchar *path; | |
411 gchar *new_path; | |
412 gchar *buf; | |
413 | |
414 if (!vdt->click_fd) return; | |
415 path = vdt->click_fd->path; | |
416 | |
417 buf = concat_dir_and_file(path, _("new_folder")); | |
418 new_path = unique_filename(buf, NULL, NULL, FALSE); | |
419 g_free(buf); | |
420 if (!new_path) return; | |
421 | |
422 if (!mkdir_utf8(new_path, 0755)) | |
423 { | |
424 gchar *text; | |
425 | |
426 text = g_strdup_printf(_("Unable to create folder:\n%s"), new_path); | |
427 file_util_warning_dialog(_("Error creating folder"), text, GTK_STOCK_DIALOG_ERROR, vdt->treeview); | |
428 g_free(text); | |
429 } | |
430 else | |
431 { | |
432 FileData *fd; | |
433 | |
434 fd = vdtree_populate_path(vdt, new_path, TRUE, TRUE); | |
435 | |
436 vdtree_rename_by_data(vdt, fd); | |
437 } | |
438 | |
439 g_free(new_path); | |
440 } | |
441 | |
442 static void vdtree_pop_menu_rename_cb(GtkWidget *widget, gpointer data) | |
443 { | |
444 ViewDirTree *vdt = data; | |
445 | |
446 vdtree_rename_by_data(vdt, vdt->click_fd); | |
447 } | |
448 | |
449 static void vdtree_pop_menu_tree_cb(GtkWidget *widget, gpointer data) | |
450 { | |
451 ViewDirTree *vdt = data; | |
452 | |
453 if (vdt->layout) layout_views_set(vdt->layout, FALSE, vdt->layout->icon_view); | |
454 } | |
455 | |
456 static void vdtree_pop_menu_refresh_cb(GtkWidget *widget, gpointer data) | |
457 { | |
458 ViewDirTree *vdt = data; | |
459 | |
460 if (vdt->layout) layout_refresh(vdt->layout); | |
461 } | |
462 | |
463 static GtkWidget *vdtree_pop_menu(ViewDirTree *vdt, FileData *fd) | |
464 { | |
465 GtkWidget *menu; | |
466 gint active; | |
467 | |
468 active = (fd != NULL); | |
469 | |
470 menu = popup_menu_short_lived(); | |
471 g_signal_connect(G_OBJECT(menu), "destroy", | |
472 G_CALLBACK(vdtree_popup_destroy_cb), vdt); | |
473 | |
474 menu_item_add_stock_sensitive(menu, _("_Up to parent"), GTK_STOCK_GO_UP, | |
475 (vdt->path && strcmp(vdt->path, "/") != 0), | |
476 G_CALLBACK(vdtree_pop_menu_up_cb), vdt); | |
477 | |
478 menu_item_add_divider(menu); | |
479 menu_item_add_sensitive(menu, _("_Slideshow"), active, | |
480 G_CALLBACK(vdtree_pop_menu_slide_cb), vdt); | |
481 menu_item_add_sensitive(menu, _("Slideshow recursive"), active, | |
482 G_CALLBACK(vdtree_pop_menu_slide_rec_cb), vdt); | |
483 | |
484 menu_item_add_divider(menu); | |
485 menu_item_add_stock_sensitive(menu, _("Find _duplicates..."), GTK_STOCK_FIND, active, | |
486 G_CALLBACK(vdtree_pop_menu_dupe_cb), vdt); | |
487 menu_item_add_stock_sensitive(menu, _("Find duplicates recursive..."), GTK_STOCK_FIND, active, | |
488 G_CALLBACK(vdtree_pop_menu_dupe_rec_cb), vdt); | |
489 | |
490 menu_item_add_divider(menu); | |
491 | |
492 active = (fd && | |
493 access_file(fd->path, W_OK | X_OK)); | |
494 menu_item_add_sensitive(menu, _("_New folder..."), active, | |
495 G_CALLBACK(vdtree_pop_menu_new_cb), vdt); | |
496 | |
497 menu_item_add_sensitive(menu, _("_Rename..."), active, | |
498 G_CALLBACK(vdtree_pop_menu_rename_cb), vdt); | |
499 | |
500 menu_item_add_divider(menu); | |
501 menu_item_add_check(menu, _("View as _tree"), TRUE, | |
502 G_CALLBACK(vdtree_pop_menu_tree_cb), vdt); | |
503 menu_item_add_stock(menu, _("Re_fresh"), GTK_STOCK_REFRESH, | |
504 G_CALLBACK(vdtree_pop_menu_refresh_cb), vdt); | |
505 | |
506 return menu; | |
507 } | |
508 | |
509 /* | |
510 *---------------------------------------------------------------------------- | |
511 * dnd | |
512 *---------------------------------------------------------------------------- | |
513 */ | |
514 | |
515 static GtkTargetEntry vdtree_dnd_drop_types[] = { | |
516 { "text/uri-list", 0, TARGET_URI_LIST } | |
517 }; | |
518 static gint vdtree_dnd_drop_types_count = 1; | |
519 | |
520 | |
521 static void vdtree_dest_set(ViewDirTree *vdt, gint enable) | |
522 { | |
523 if (enable) | |
524 { | |
525 gtk_drag_dest_set(vdt->treeview, | |
526 GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, | |
527 vdtree_dnd_drop_types, vdtree_dnd_drop_types_count, | |
528 GDK_ACTION_MOVE | GDK_ACTION_COPY); | |
529 } | |
530 else | |
531 { | |
532 gtk_drag_dest_unset(vdt->treeview); | |
533 } | |
534 } | |
535 | |
536 static void vdtree_dnd_get(GtkWidget *widget, GdkDragContext *context, | |
537 GtkSelectionData *selection_data, guint info, | |
538 guint time, gpointer data) | |
539 { | |
540 ViewDirTree *vdt = data; | |
541 gchar *path; | |
542 GList *list; | |
543 gchar *uri_text = NULL; | |
544 gint length = 0; | |
545 | |
546 if (!vdt->click_fd) return; | |
547 path = vdt->click_fd->path; | |
548 | |
549 switch (info) | |
550 { | |
551 case TARGET_URI_LIST: | |
552 case TARGET_TEXT_PLAIN: | |
553 list = g_list_prepend(NULL, path); | |
554 uri_text = uri_text_from_list(list, &length, (info == TARGET_TEXT_PLAIN)); | |
555 g_list_free(list); | |
556 break; | |
557 } | |
558 | |
559 if (uri_text) | |
560 { | |
561 gtk_selection_data_set(selection_data, selection_data->target, | |
64
04ff0df3ad2f
Mon Aug 15 17:13:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
63
diff
changeset
|
562 8, (guchar *)uri_text, length); |
9 | 563 g_free(uri_text); |
564 } | |
565 } | |
566 | |
567 static void vdtree_dnd_begin(GtkWidget *widget, GdkDragContext *context, gpointer data) | |
568 { | |
569 ViewDirTree *vdt = data; | |
570 | |
571 vdtree_color_set(vdt, vdt->click_fd, TRUE); | |
572 vdtree_dest_set(vdt, FALSE); | |
573 } | |
574 | |
575 static void vdtree_dnd_end(GtkWidget *widget, GdkDragContext *context, gpointer data) | |
576 { | |
577 ViewDirTree *vdt = data; | |
578 | |
579 vdtree_color_set(vdt, vdt->click_fd, FALSE); | |
580 vdtree_dest_set(vdt, TRUE); | |
581 } | |
582 | |
583 static void vdtree_dnd_drop_receive(GtkWidget *widget, | |
584 GdkDragContext *context, gint x, gint y, | |
585 GtkSelectionData *selection_data, guint info, | |
586 guint time, gpointer data) | |
587 { | |
588 ViewDirTree *vdt = data; | |
589 GtkTreePath *tpath; | |
590 GtkTreeIter iter; | |
591 FileData *fd = NULL; | |
592 | |
593 vdt->click_fd = NULL; | |
594 | |
595 if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget), x, y, | |
596 &tpath, NULL, NULL, NULL)) | |
597 { | |
598 GtkTreeModel *store; | |
599 NodeData *nd; | |
600 | |
601 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); | |
602 gtk_tree_model_get_iter(store, &iter, tpath); | |
603 gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &nd, -1); | |
604 gtk_tree_path_free(tpath); | |
605 | |
606 fd = (nd) ? nd->fd : NULL; | |
607 } | |
608 | |
609 if (!fd) return; | |
610 | |
611 if (info == TARGET_URI_LIST) | |
612 { | |
613 GList *list; | |
614 gint active; | |
615 | |
64
04ff0df3ad2f
Mon Aug 15 17:13:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
63
diff
changeset
|
616 list = uri_list_from_text((gchar *)selection_data->data, TRUE); |
9 | 617 if (!list) return; |
618 | |
619 active = access_file(fd->path, W_OK | X_OK); | |
620 | |
621 vdtree_color_set(vdt, fd, TRUE); | |
622 vdt->popup = vdtree_drop_menu(vdt, active); | |
623 gtk_menu_popup(GTK_MENU(vdt->popup), NULL, NULL, NULL, NULL, 0, time); | |
624 | |
625 vdt->drop_fd = fd; | |
626 vdt->drop_list = list; | |
627 } | |
628 } | |
629 | |
630 static gint vdtree_dnd_drop_expand_cb(gpointer data) | |
631 { | |
632 ViewDirTree *vdt = data; | |
633 GtkTreeIter iter; | |
634 | |
635 if (vdt->drop_fd && | |
636 vdtree_find_row(vdt, vdt->drop_fd, &iter, NULL)) | |
637 { | |
638 vdtree_populate_path_by_iter(vdt, &iter, FALSE, vdt->path); | |
639 vdtree_expand_by_data(vdt, vdt->drop_fd, TRUE); | |
640 } | |
641 | |
642 vdt->drop_expand_id = -1; | |
643 return FALSE; | |
644 } | |
645 | |
646 static void vdtree_dnd_drop_expand_cancel(ViewDirTree *vdt) | |
647 { | |
648 if (vdt->drop_expand_id != -1) g_source_remove(vdt->drop_expand_id); | |
649 vdt->drop_expand_id = -1; | |
650 } | |
651 | |
652 static void vdtree_dnd_drop_expand(ViewDirTree *vdt) | |
653 { | |
654 vdtree_dnd_drop_expand_cancel(vdt); | |
655 vdt->drop_expand_id = g_timeout_add(1000, vdtree_dnd_drop_expand_cb, vdt); | |
656 } | |
657 | |
658 static void vdtree_drop_update(ViewDirTree *vdt, gint x, gint y) | |
659 { | |
660 GtkTreePath *tpath; | |
661 GtkTreeIter iter; | |
662 FileData *fd = NULL; | |
663 | |
664 if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(vdt->treeview), x, y, | |
665 &tpath, NULL, NULL, NULL)) | |
666 { | |
667 GtkTreeModel *store; | |
668 NodeData *nd; | |
669 | |
670 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->treeview)); | |
671 gtk_tree_model_get_iter(store, &iter, tpath); | |
672 gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &nd, -1); | |
673 gtk_tree_path_free(tpath); | |
674 | |
675 fd = (nd) ? nd->fd : NULL; | |
676 } | |
677 | |
678 if (fd != vdt->drop_fd) | |
679 { | |
680 vdtree_color_set(vdt, vdt->drop_fd, FALSE); | |
681 vdtree_color_set(vdt, fd, TRUE); | |
682 if (fd) vdtree_dnd_drop_expand(vdt); | |
683 } | |
684 | |
685 vdt->drop_fd = fd; | |
686 } | |
687 | |
688 static void vdtree_dnd_drop_scroll_cancel(ViewDirTree *vdt) | |
689 { | |
690 if (vdt->drop_scroll_id != -1) g_source_remove(vdt->drop_scroll_id); | |
691 vdt->drop_scroll_id = -1; | |
692 } | |
693 | |
694 static gint vdtree_auto_scroll_idle_cb(gpointer data) | |
695 { | |
696 ViewDirTree *vdt = data; | |
697 | |
698 if (vdt->drop_fd) | |
699 { | |
700 GdkWindow *window; | |
701 gint x, y; | |
702 gint w, h; | |
703 | |
704 window = vdt->treeview->window; | |
705 gdk_window_get_pointer(window, &x, &y, NULL); | |
706 gdk_drawable_get_size(window, &w, &h); | |
707 if (x >= 0 && x < w && y >= 0 && y < h) | |
708 { | |
709 vdtree_drop_update(vdt, x, y); | |
710 } | |
711 } | |
712 | |
713 vdt->drop_scroll_id = -1; | |
714 return FALSE; | |
715 } | |
716 | |
717 static gint vdtree_auto_scroll_notify_cb(GtkWidget *widget, gint x, gint y, gpointer data) | |
718 { | |
719 ViewDirTree *vdt = data; | |
720 | |
721 if (!vdt->drop_fd || vdt->drop_list) return FALSE; | |
722 | |
723 if (vdt->drop_scroll_id == -1) vdt->drop_scroll_id = g_idle_add(vdtree_auto_scroll_idle_cb, vdt); | |
724 | |
725 return TRUE; | |
726 } | |
727 | |
728 static gint vdtree_dnd_drop_motion(GtkWidget *widget, GdkDragContext *context, | |
729 gint x, gint y, guint time, gpointer data) | |
730 { | |
731 ViewDirTree *vdt = data; | |
732 | |
733 vdt->click_fd = NULL; | |
734 | |
735 if (gtk_drag_get_source_widget(context) == vdt->treeview) | |
736 { | |
737 gdk_drag_status(context, 0, time); | |
738 return TRUE; | |
739 } | |
740 else | |
741 { | |
742 gdk_drag_status(context, context->suggested_action, time); | |
743 } | |
744 | |
745 vdtree_drop_update(vdt, x, y); | |
746 | |
747 if (vdt->drop_fd) | |
748 { | |
749 GtkAdjustment *adj = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(vdt->treeview)); | |
750 widget_auto_scroll_start(vdt->treeview, adj, -1, -1, vdtree_auto_scroll_notify_cb, vdt); | |
751 } | |
752 | |
753 return FALSE; | |
754 } | |
755 | |
756 static void vdtree_dnd_drop_leave(GtkWidget *widget, GdkDragContext *context, guint time, gpointer data) | |
757 { | |
758 ViewDirTree *vdt = data; | |
759 | |
760 if (vdt->drop_fd != vdt->click_fd) vdtree_color_set(vdt, vdt->drop_fd, FALSE); | |
761 | |
762 vdt->drop_fd = NULL; | |
763 | |
764 vdtree_dnd_drop_expand_cancel(vdt); | |
765 } | |
766 | |
767 static void vdtree_dnd_init(ViewDirTree *vdt) | |
768 { | |
769 gtk_drag_source_set(vdt->treeview, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK, | |
770 dnd_file_drag_types, dnd_file_drag_types_count, | |
771 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK); | |
772 g_signal_connect(G_OBJECT(vdt->treeview), "drag_data_get", | |
773 G_CALLBACK(vdtree_dnd_get), vdt); | |
774 g_signal_connect(G_OBJECT(vdt->treeview), "drag_begin", | |
775 G_CALLBACK(vdtree_dnd_begin), vdt); | |
776 g_signal_connect(G_OBJECT(vdt->treeview), "drag_end", | |
777 G_CALLBACK(vdtree_dnd_end), vdt); | |
778 | |
779 vdtree_dest_set(vdt, TRUE); | |
780 g_signal_connect(G_OBJECT(vdt->treeview), "drag_data_received", | |
781 G_CALLBACK(vdtree_dnd_drop_receive), vdt); | |
782 g_signal_connect(G_OBJECT(vdt->treeview), "drag_motion", | |
783 G_CALLBACK(vdtree_dnd_drop_motion), vdt); | |
784 g_signal_connect(G_OBJECT(vdt->treeview), "drag_leave", | |
785 G_CALLBACK(vdtree_dnd_drop_leave), vdt); | |
786 } | |
787 | |
788 /* | |
789 *---------------------------------------------------------------------------- | |
790 * parts lists | |
791 *---------------------------------------------------------------------------- | |
792 */ | |
793 | |
794 static GList *parts_list(const gchar *path) | |
795 { | |
796 GList *list = NULL; | |
797 const gchar *strb, *strp; | |
798 gint l; | |
799 | |
800 strp = path; | |
801 | |
802 if (*strp != '/') return NULL; | |
803 | |
804 strp++; | |
805 strb = strp; | |
806 l = 0; | |
807 | |
808 while (*strp != '\0') | |
809 { | |
810 if (*strp == '/') | |
811 { | |
812 if (l > 0) list = g_list_prepend(list, g_strndup(strb, l)); | |
813 strp++; | |
814 strb = strp; | |
815 l = 0; | |
816 } | |
817 else | |
818 { | |
819 strp++; | |
820 l++; | |
821 } | |
822 } | |
823 if (l > 0) list = g_list_prepend(list, g_strndup(strb, l)); | |
824 | |
825 list = g_list_reverse(list); | |
826 | |
827 list = g_list_prepend(list, g_strdup("/")); | |
828 | |
829 return list; | |
830 } | |
831 | |
832 static void parts_list_free(GList *list) | |
833 { | |
834 GList *work = list; | |
835 while (work) | |
836 { | |
837 PathData *pd = work->data; | |
838 g_free(pd->name); | |
839 g_free(pd); | |
840 work = work->next; | |
841 } | |
842 | |
843 g_list_free(list); | |
844 } | |
845 | |
846 static GList *parts_list_add_node_points(ViewDirTree *vdt, GList *list) | |
847 { | |
848 GList *work; | |
849 GtkTreeModel *store; | |
850 GtkTreeIter iter; | |
851 gint valid; | |
852 | |
853 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->treeview)); | |
854 valid = gtk_tree_model_get_iter_first(store, &iter); | |
855 | |
856 work = list; | |
857 while (work) | |
858 { | |
859 PathData *pd; | |
860 FileData *fd = NULL; | |
861 | |
862 pd = g_new0(PathData, 1); | |
863 pd->name = work->data; | |
864 | |
865 while (valid && !fd) | |
866 { | |
867 NodeData *nd; | |
868 | |
869 gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &nd, -1); | |
870 if (strcmp(nd->fd->name, pd->name) == 0) | |
871 { | |
872 fd = nd->fd; | |
873 } | |
874 else | |
875 { | |
876 valid = gtk_tree_model_iter_next(store, &iter); | |
877 } | |
878 } | |
879 | |
880 pd->node = fd; | |
881 work->data = pd; | |
882 | |
883 if (fd) | |
884 { | |
885 GtkTreeIter parent; | |
886 memcpy(&parent, &iter, sizeof(parent)); | |
887 valid = gtk_tree_model_iter_children(store, &iter, &parent); | |
888 } | |
889 | |
890 work = work->next; | |
891 } | |
892 | |
893 return list; | |
894 } | |
895 | |
896 /* | |
897 *---------------------------------------------------------------------------- | |
898 * misc | |
899 *---------------------------------------------------------------------------- | |
900 */ | |
901 | |
902 #if 0 | |
903 static void vdtree_row_deleted_cb(GtkTreeModel *tree_model, GtkTreePath *tpath, gpointer data) | |
904 { | |
905 GtkTreeIter iter; | |
906 NodeData *nd; | |
907 | |
908 gtk_tree_model_get_iter(tree_model, &iter, tpath); | |
909 gtk_tree_model_get(tree_model, &iter, DIR_COLUMN_POINTER, &nd, -1); | |
910 | |
911 if (!nd) return; | |
912 | |
913 file_data_free(nd->fd); | |
914 g_free(nd); | |
915 } | |
916 #endif | |
917 | |
918 /* | |
919 *---------------------------------------------------------------------------- | |
920 * node traversal, management | |
921 *---------------------------------------------------------------------------- | |
922 */ | |
923 | |
924 static gint vdtree_find_iter_by_data(ViewDirTree *vdt, GtkTreeIter *parent, NodeData *nd, GtkTreeIter *iter) | |
925 { | |
926 GtkTreeModel *store; | |
927 | |
928 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->treeview)); | |
929 if (!nd || !gtk_tree_model_iter_children(store, iter, parent)) return -1; | |
930 do { | |
931 NodeData *cnd; | |
932 | |
933 gtk_tree_model_get(store, iter, DIR_COLUMN_POINTER, &cnd, -1); | |
934 if (cnd == nd) return TRUE; | |
935 } while (gtk_tree_model_iter_next(store, iter)); | |
936 | |
937 return FALSE; | |
938 } | |
939 | |
940 static NodeData *vdtree_find_iter_by_name(ViewDirTree *vdt, GtkTreeIter *parent, const gchar *name, GtkTreeIter *iter) | |
941 { | |
942 GtkTreeModel *store; | |
943 | |
944 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->treeview)); | |
945 if (!name || !gtk_tree_model_iter_children(store, iter, parent)) return NULL; | |
946 do { | |
947 NodeData *nd; | |
948 | |
949 gtk_tree_model_get(store, iter, DIR_COLUMN_POINTER, &nd, -1); | |
950 if (nd && strcmp(nd->fd->name, name) == 0) return nd; | |
951 } while (gtk_tree_model_iter_next(store, iter)); | |
952 | |
953 return NULL; | |
954 } | |
955 | |
956 static void vdtree_add_by_data(ViewDirTree *vdt, FileData *fd, GtkTreeIter *parent) | |
957 { | |
958 GtkTreeStore *store; | |
959 GtkTreeIter child; | |
960 GList *list; | |
961 NodeData *nd; | |
962 GdkPixbuf *pixbuf; | |
963 NodeData *end; | |
964 GtkTreeIter empty; | |
965 | |
966 if (!fd) return; | |
967 | |
968 list = parts_list(fd->path); | |
969 if (!list) return; | |
970 | |
971 if (access_file(fd->path, R_OK | X_OK)) | |
972 { | |
973 pixbuf = vdt->pf->close; | |
974 } | |
975 else | |
976 { | |
977 pixbuf = vdt->pf->deny; | |
978 } | |
979 | |
980 nd = g_new0(NodeData, 1); | |
981 nd->fd = fd; | |
982 nd->expanded = FALSE; | |
983 nd->last_update = time(NULL); | |
984 | |
985 store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->treeview))); | |
986 gtk_tree_store_append(store, &child, parent); | |
987 gtk_tree_store_set(store, &child, DIR_COLUMN_POINTER, nd, | |
988 DIR_COLUMN_ICON, pixbuf, | |
989 DIR_COLUMN_NAME, nd->fd->name, | |
990 DIR_COLUMN_COLOR, FALSE, -1); | |
991 | |
992 /* all nodes are created with an "empty" node, so that the expander is shown | |
993 * this is removed when the child is populated */ | |
994 end = g_new0(NodeData, 1); | |
995 end->fd = g_new0(FileData, 1); | |
996 end->fd->path = g_strdup(""); | |
997 end->fd->name = end->fd->path; | |
998 end->expanded = TRUE; | |
999 | |
1000 gtk_tree_store_append(store, &empty, &child); | |
1001 gtk_tree_store_set(store, &empty, DIR_COLUMN_POINTER, end, | |
1002 DIR_COLUMN_NAME, "empty", -1); | |
1003 | |
1004 if (parent) | |
1005 { | |
1006 NodeData *pnd; | |
1007 GtkTreePath *tpath; | |
1008 | |
1009 gtk_tree_model_get(GTK_TREE_MODEL(store), parent, DIR_COLUMN_POINTER, &pnd, -1); | |
1010 tpath = gtk_tree_model_get_path(GTK_TREE_MODEL(store), parent); | |
1011 if (tree_descend_subdirs && | |
1012 gtk_tree_view_row_expanded(GTK_TREE_VIEW(vdt->treeview), tpath) && | |
1013 !nd->expanded) | |
1014 { | |
1015 vdtree_populate_path_by_iter(vdt, &child, FALSE, vdt->path); | |
1016 } | |
1017 gtk_tree_path_free(tpath); | |
1018 } | |
1019 } | |
1020 | |
1021 static gint vdtree_populate_path_by_iter(ViewDirTree *vdt, GtkTreeIter *iter, gint force, const gchar *target_path) | |
1022 { | |
1023 GtkTreeModel *store; | |
1024 GList *list; | |
1025 GList *work; | |
1026 GList *old; | |
1027 time_t current_time; | |
1028 GtkTreeIter child; | |
1029 NodeData *nd; | |
1030 | |
1031 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->treeview)); | |
1032 gtk_tree_model_get(store, iter, DIR_COLUMN_POINTER, &nd, -1); | |
1033 | |
1034 if (!nd) return FALSE; | |
1035 | |
1036 current_time = time(NULL); | |
1037 | |
1038 if (nd->expanded) | |
1039 { | |
1040 if (!force && current_time - nd->last_update < 10) return TRUE; | |
1041 if (!isdir(nd->fd->path)) | |
1042 { | |
1043 if (vdt->click_fd == nd->fd) vdt->click_fd = NULL; | |
1044 if (vdt->drop_fd == nd->fd) vdt->drop_fd = NULL; | |
1045 gtk_tree_store_remove(GTK_TREE_STORE(store), iter); | |
1046 vdtree_node_free(nd); | |
1047 return FALSE; | |
1048 } | |
1049 if (!force && filetime(nd->fd->path) == nd->fd->date) return TRUE; | |
1050 } | |
1051 | |
1052 vdtree_busy_push(vdt); | |
1053 | |
1054 list = NULL; | |
1055 filelist_read(nd->fd->path, NULL, &list); | |
1056 | |
1057 /* when hidden files are not enabled, and the user enters a hidden path, | |
1058 * allow the tree to display that path by specifically inserting the hidden entries | |
1059 */ | |
1060 if (!show_dot_files && | |
1061 target_path && | |
1062 strncmp(nd->fd->path, target_path, strlen(nd->fd->path)) == 0) | |
1063 { | |
1064 gint n; | |
1065 | |
1066 n = strlen(nd->fd->path); | |
1067 if (target_path[n] == '/' && target_path[n+1] == '.') | |
1068 { | |
1069 gchar *name8; | |
1070 gchar *namel; | |
1071 struct stat sbuf; | |
1072 | |
1073 n++; | |
1074 | |
1075 while (target_path[n] != '\0' && target_path[n] != '/') n++; | |
1076 name8 = g_strndup(target_path, n); | |
1077 namel = path_from_utf8(name8); | |
1078 | |
1079 if (stat_utf8(name8, &sbuf)) | |
1080 { | |
1081 list = g_list_prepend(list, file_data_new(namel, &sbuf)); | |
1082 } | |
1083 | |
1084 g_free(namel); | |
1085 g_free(name8); | |
1086 } | |
1087 } | |
1088 | |
1089 old = NULL; | |
1090 if (gtk_tree_model_iter_children(store, &child, iter)) | |
1091 { | |
1092 do { | |
1093 NodeData *cnd; | |
1094 | |
1095 gtk_tree_model_get(store, &child, DIR_COLUMN_POINTER, &cnd, -1); | |
1096 old = g_list_prepend(old, cnd); | |
1097 } while (gtk_tree_model_iter_next(store, &child)); | |
1098 } | |
1099 | |
1100 work = list; | |
1101 while (work) | |
1102 { | |
1103 FileData *fd; | |
1104 | |
1105 fd = work->data; | |
1106 work = work->next; | |
1107 | |
1108 if (strcmp(fd->name, ".") == 0 || strcmp(fd->name, "..") == 0) | |
1109 { | |
1110 file_data_free(fd); | |
1111 } | |
1112 else | |
1113 { | |
1114 NodeData *cnd; | |
1115 | |
1116 cnd = vdtree_find_iter_by_name(vdt, iter, fd->name, &child); | |
1117 if (cnd) | |
1118 { | |
1119 old = g_list_remove(old, cnd); | |
1120 if (cnd->expanded && cnd->fd->date != fd->date && | |
1121 vdtree_populate_path_by_iter(vdt, &child, FALSE, target_path)) | |
1122 { | |
1123 cnd->fd->size = fd->size; | |
1124 cnd->fd->date = fd->date; | |
1125 } | |
1126 | |
1127 file_data_free(fd); | |
1128 } | |
1129 else | |
1130 { | |
1131 vdtree_add_by_data(vdt, fd, iter); | |
1132 } | |
1133 } | |
1134 } | |
1135 | |
1136 work = old; | |
1137 while (work) | |
1138 { | |
1139 NodeData *cnd = work->data; | |
1140 work = work->next; | |
1141 | |
1142 if (vdt->click_fd == cnd->fd) vdt->click_fd = NULL; | |
1143 if (vdt->drop_fd == cnd->fd) vdt->drop_fd = NULL; | |
1144 | |
1145 if (vdtree_find_iter_by_data(vdt, iter, cnd, &child)) | |
1146 { | |
1147 gtk_tree_store_remove(GTK_TREE_STORE(store), &child); | |
1148 vdtree_node_free(cnd); | |
1149 } | |
1150 } | |
1151 | |
1152 g_list_free(old); | |
1153 g_list_free(list); | |
1154 | |
1155 vdtree_busy_pop(vdt); | |
1156 | |
1157 nd->expanded = TRUE; | |
1158 nd->last_update = current_time; | |
1159 | |
1160 return TRUE; | |
1161 } | |
1162 | |
1163 static FileData *vdtree_populate_path(ViewDirTree *vdt, const gchar *path, gint expand, gint force) | |
1164 { | |
1165 GList *list; | |
1166 GList *work; | |
1167 FileData *fd = NULL; | |
1168 | |
1169 if (!path) return NULL; | |
1170 | |
1171 vdtree_busy_push(vdt); | |
1172 | |
1173 list = parts_list(path); | |
1174 list = parts_list_add_node_points(vdt, list); | |
1175 | |
1176 work = list; | |
1177 while (work) | |
1178 { | |
1179 PathData *pd = work->data; | |
1180 if (pd->node == NULL) | |
1181 { | |
1182 PathData *parent_pd; | |
1183 GtkTreeIter parent_iter; | |
1184 GtkTreeIter iter; | |
1185 NodeData *nd; | |
1186 | |
1187 if (work == list) | |
1188 { | |
1189 /* should not happen */ | |
1190 printf("vdtree warning, root node not found\n"); | |
1191 parts_list_free(list); | |
1192 vdtree_busy_pop(vdt); | |
1193 return NULL; | |
1194 } | |
1195 | |
1196 parent_pd = work->prev->data; | |
1197 | |
1198 if (!vdtree_find_row(vdt, parent_pd->node, &parent_iter, NULL) || | |
1199 !vdtree_populate_path_by_iter(vdt, &parent_iter, force, path) || | |
1200 (nd = vdtree_find_iter_by_name(vdt, &parent_iter, pd->name, &iter)) == NULL) | |
1201 { | |
1202 printf("vdtree warning, aborted at %s\n", parent_pd->name); | |
1203 parts_list_free(list); | |
1204 vdtree_busy_pop(vdt); | |
1205 return NULL; | |
1206 } | |
1207 | |
1208 pd->node = nd->fd; | |
1209 | |
1210 if (pd->node) | |
1211 { | |
1212 if (expand) | |
1213 { | |
1214 vdtree_expand_by_iter(vdt, &parent_iter, TRUE); | |
1215 vdtree_expand_by_iter(vdt, &iter, TRUE); | |
1216 } | |
1217 vdtree_populate_path_by_iter(vdt, &iter, force, path); | |
1218 } | |
1219 } | |
1220 else | |
1221 { | |
1222 GtkTreeIter iter; | |
1223 | |
1224 if (vdtree_find_row(vdt, pd->node, &iter, NULL)) | |
1225 { | |
1226 if (expand) vdtree_expand_by_iter(vdt, &iter, TRUE); | |
1227 vdtree_populate_path_by_iter(vdt, &iter, force, path); | |
1228 } | |
1229 } | |
1230 | |
1231 work = work->next; | |
1232 } | |
1233 | |
1234 work = g_list_last(list); | |
1235 if (work) | |
1236 { | |
1237 PathData *pd = work->data; | |
1238 fd = pd->node; | |
1239 } | |
1240 parts_list_free(list); | |
1241 | |
1242 vdtree_busy_pop(vdt); | |
1243 | |
1244 return fd; | |
1245 } | |
1246 | |
1247 /* | |
1248 *---------------------------------------------------------------------------- | |
1249 * access | |
1250 *---------------------------------------------------------------------------- | |
1251 */ | |
1252 | |
1253 static gint selection_is_ok = FALSE; | |
1254 | |
1255 static gboolean vdtree_select_cb(GtkTreeSelection *selection, GtkTreeModel *store, GtkTreePath *tpath, | |
1256 gboolean path_currently_selected, gpointer data) | |
1257 { | |
1258 return selection_is_ok; | |
1259 } | |
1260 | |
1261 static void vdtree_select_row(ViewDirTree *vdt, FileData *fd) | |
1262 { | |
1263 GtkTreeSelection *selection; | |
1264 GtkTreeIter iter; | |
1265 | |
1266 if (!vdtree_find_row(vdt, fd, &iter, NULL)) return; | |
1267 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vdt->treeview)); | |
1268 | |
1269 /* hack, such that selection is only allowed to be changed from here */ | |
1270 selection_is_ok = TRUE; | |
1271 gtk_tree_selection_select_iter(selection, &iter); | |
1272 selection_is_ok = FALSE; | |
1273 | |
1274 if (!vdtree_populate_path_by_iter(vdt, &iter, FALSE, vdt->path)) return; | |
1275 | |
1276 vdtree_expand_by_iter(vdt, &iter, TRUE); | |
1277 | |
1278 if (fd && vdt->select_func) | |
1279 { | |
1280 vdt->select_func(vdt, fd->path, vdt->select_data); | |
1281 } | |
1282 } | |
1283 | |
1284 gint vdtree_set_path(ViewDirTree *vdt, const gchar *path) | |
1285 { | |
1286 FileData *fd; | |
1287 GtkTreeIter iter; | |
1288 | |
1289 if (!path) return FALSE; | |
1290 if (vdt->path && strcmp(path, vdt->path) == 0) return TRUE; | |
1291 | |
1292 g_free(vdt->path); | |
1293 vdt->path = g_strdup(path); | |
1294 | |
63
e29c291e106b
Mon Aug 15 16:35:15 2005 John Ellis <johne@verizon.net>
gqview
parents:
44
diff
changeset
|
1295 fd = vdtree_populate_path(vdt, vdt->path, TRUE, FALSE); |
9 | 1296 |
1297 if (!fd) return FALSE; | |
1298 | |
1299 if (vdtree_find_row(vdt, fd, &iter, NULL)) | |
1300 { | |
1301 GtkTreeModel *store; | |
1302 GtkTreePath *tpath; | |
1303 | |
1304 tree_view_row_make_visible(GTK_TREE_VIEW(vdt->treeview), &iter, TRUE); | |
1305 | |
1306 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->treeview)); | |
1307 tpath = gtk_tree_model_get_path(store, &iter); | |
1308 gtk_tree_view_set_cursor(GTK_TREE_VIEW(vdt->treeview), tpath, NULL, FALSE); | |
1309 gtk_tree_path_free(tpath); | |
1310 | |
1311 vdtree_select_row(vdt, fd); | |
1312 } | |
1313 | |
1314 return TRUE; | |
1315 } | |
1316 | |
1317 #if 0 | |
1318 const gchar *vdtree_get_path(ViewDirTree *vdt) | |
1319 { | |
1320 return vdt->path; | |
1321 } | |
1322 #endif | |
1323 | |
1324 void vdtree_refresh(ViewDirTree *vdt) | |
1325 { | |
1326 vdtree_populate_path(vdt, vdt->path, FALSE, TRUE); | |
1327 } | |
1328 | |
1329 const gchar *vdtree_row_get_path(ViewDirTree *vdt, gint row) | |
1330 { | |
1331 printf("FIXME: no get row path\n"); | |
1332 return NULL; | |
1333 } | |
1334 | |
1335 /* | |
1336 *---------------------------------------------------------------------------- | |
1337 * callbacks | |
1338 *---------------------------------------------------------------------------- | |
1339 */ | |
1340 | |
1341 static void vdtree_menu_position_cb(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data) | |
1342 { | |
1343 ViewDirTree *vdt = data; | |
1344 GtkTreeModel *store; | |
1345 GtkTreeIter iter; | |
1346 GtkTreePath *tpath; | |
1347 gint cw, ch; | |
1348 | |
1349 if (vdtree_find_row(vdt, vdt->click_fd, &iter, NULL) < 0) return; | |
1350 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->treeview)); | |
1351 tpath = gtk_tree_model_get_path(store, &iter); | |
1352 tree_view_get_cell_clamped(GTK_TREE_VIEW(vdt->treeview), tpath, 0, TRUE, x, y, &cw, &ch); | |
1353 gtk_tree_path_free(tpath); | |
1354 *y += ch; | |
1355 popup_menu_position_clamp(menu, x, y, 0); | |
1356 } | |
1357 | |
1358 static gint vdtree_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) | |
1359 { | |
1360 ViewDirTree *vdt = data; | |
1361 GtkTreePath *tpath; | |
1362 GtkTreeIter iter; | |
1363 FileData *fd = NULL; | |
1364 | |
1365 gtk_tree_view_get_cursor(GTK_TREE_VIEW(vdt->treeview), &tpath, NULL); | |
1366 if (tpath) | |
1367 { | |
1368 GtkTreeModel *store; | |
1369 NodeData *nd; | |
1370 | |
1371 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); | |
1372 gtk_tree_model_get_iter(store, &iter, tpath); | |
1373 gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &nd, -1); | |
1374 | |
1375 gtk_tree_path_free(tpath); | |
1376 | |
1377 fd = (nd) ? nd->fd : NULL; | |
1378 } | |
1379 | |
1380 switch (event->keyval) | |
1381 { | |
1382 case GDK_Menu: | |
1383 vdt->click_fd = fd; | |
1384 vdtree_color_set(vdt, vdt->click_fd, TRUE); | |
1385 | |
1386 vdt->popup = vdtree_pop_menu(vdt, vdt->click_fd); | |
1387 gtk_menu_popup(GTK_MENU(vdt->popup), NULL, NULL, vdtree_menu_position_cb, vdt, 0, GDK_CURRENT_TIME); | |
1388 | |
1389 return TRUE; | |
1390 break; | |
1391 case GDK_plus: | |
1392 case GDK_Right: | |
1393 case GDK_KP_Add: | |
1394 if (fd) | |
1395 { | |
1396 vdtree_populate_path_by_iter(vdt, &iter, FALSE, vdt->path); | |
1397 vdtree_icon_set_by_iter(vdt, &iter, vdt->pf->open); | |
1398 } | |
1399 break; | |
1400 } | |
1401 | |
1402 return FALSE; | |
1403 } | |
1404 | |
1405 static gint vdtree_clicked_on_expander(GtkTreeView *treeview, GtkTreePath *tpath, | |
1406 GtkTreeViewColumn *column, gint x, gint y, gint *left_of_expander) | |
1407 { | |
1408 gint depth; | |
1409 gint size; | |
1410 gint sep; | |
1411 gint exp_width; | |
1412 | |
1413 if (column != gtk_tree_view_get_expander_column(treeview)) return FALSE; | |
1414 | |
1415 gtk_widget_style_get(GTK_WIDGET(treeview), "expander-size", &size, "horizontal-separator", &sep, NULL); | |
1416 depth = gtk_tree_path_get_depth(tpath); | |
1417 | |
1418 exp_width = sep + size + sep; | |
1419 | |
1420 if (x <= depth * exp_width) | |
1421 { | |
1422 if (left_of_expander) *left_of_expander = !(x >= (depth - 1) * exp_width); | |
1423 return TRUE; | |
1424 } | |
1425 | |
1426 return FALSE; | |
1427 } | |
1428 | |
1429 static gint vdtree_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) | |
1430 { | |
1431 ViewDirTree *vdt = data; | |
1432 GtkTreePath *tpath; | |
1433 GtkTreeViewColumn *column; | |
1434 GtkTreeIter iter; | |
1435 NodeData *nd = NULL; | |
1436 | |
1437 if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget), bevent->x, bevent->y, | |
1438 &tpath, &column, NULL, NULL)) | |
1439 { | |
1440 GtkTreeModel *store; | |
1441 gint left_of_expander; | |
1442 | |
1443 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); | |
1444 gtk_tree_model_get_iter(store, &iter, tpath); | |
1445 gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &nd, -1); | |
1446 gtk_tree_view_set_cursor(GTK_TREE_VIEW(widget), tpath, NULL, FALSE); | |
1447 | |
1448 if (vdtree_clicked_on_expander(GTK_TREE_VIEW(widget), tpath, column, bevent->x, bevent->y, &left_of_expander)) | |
1449 { | |
1450 vdt->click_fd = NULL; | |
1451 | |
1452 /* clicking this region should automatically reveal an expander, if necessary | |
1453 * treeview bug: the expander will not expand until a button_motion_event highlights it. | |
1454 */ | |
1455 if (bevent->button == 1 && | |
1456 !left_of_expander && | |
1457 !gtk_tree_view_row_expanded(GTK_TREE_VIEW(vdt->treeview), tpath)) | |
1458 { | |
1459 vdtree_populate_path_by_iter(vdt, &iter, FALSE, vdt->path); | |
1460 vdtree_icon_set_by_iter(vdt, &iter, vdt->pf->open); | |
1461 } | |
1462 | |
1463 gtk_tree_path_free(tpath); | |
1464 return FALSE; | |
1465 } | |
1466 | |
1467 gtk_tree_path_free(tpath); | |
1468 } | |
1469 | |
1470 vdt->click_fd = (nd) ? nd->fd : NULL; | |
1471 vdtree_color_set(vdt, vdt->click_fd, TRUE); | |
1472 | |
1473 if (bevent->button == 3) | |
1474 { | |
1475 vdt->popup = vdtree_pop_menu(vdt, vdt->click_fd); | |
1476 gtk_menu_popup(GTK_MENU(vdt->popup), NULL, NULL, NULL, NULL, | |
1477 bevent->button, bevent->time); | |
1478 } | |
1479 | |
1480 return (bevent->button != 1); | |
1481 } | |
1482 | |
1483 static gint vdtree_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) | |
1484 { | |
1485 ViewDirTree *vdt = data; | |
1486 GtkTreePath *tpath; | |
1487 GtkTreeIter iter; | |
1488 NodeData *nd = NULL; | |
1489 | |
1490 if (!vdt->click_fd) return FALSE; | |
1491 vdtree_color_set(vdt, vdt->click_fd, FALSE); | |
1492 | |
1493 if (bevent->button != 1) return TRUE; | |
1494 | |
1495 if ((bevent->x != 0 || bevent->y != 0) && | |
1496 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget), bevent->x, bevent->y, | |
1497 &tpath, NULL, NULL, NULL)) | |
1498 { | |
1499 GtkTreeModel *store; | |
1500 | |
1501 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); | |
1502 gtk_tree_model_get_iter(store, &iter, tpath); | |
1503 gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &nd, -1); | |
1504 gtk_tree_path_free(tpath); | |
1505 } | |
1506 | |
1507 if (nd && vdt->click_fd == nd->fd) | |
1508 { | |
1509 vdtree_select_row(vdt, vdt->click_fd); | |
1510 } | |
1511 | |
1512 return FALSE; | |
1513 } | |
1514 | |
1515 static void vdtree_row_expanded(GtkTreeView *treeview, GtkTreeIter *iter, GtkTreePath *tpath, gpointer data) | |
1516 { | |
1517 ViewDirTree *vdt = data; | |
1518 | |
25
0c3b353b666e
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
1519 vdtree_populate_path_by_iter(vdt, iter, FALSE, NULL); |
9 | 1520 vdtree_icon_set_by_iter(vdt, iter, vdt->pf->open); |
1521 } | |
1522 | |
1523 static void vdtree_row_collapsed(GtkTreeView *treeview, GtkTreeIter *iter, GtkTreePath *tpath, gpointer data) | |
1524 { | |
1525 ViewDirTree *vdt = data; | |
1526 | |
1527 vdtree_icon_set_by_iter(vdt, iter, vdt->pf->close); | |
1528 } | |
1529 | |
1530 static gint vdtree_sort_cb(GtkTreeModel *store, GtkTreeIter *a, GtkTreeIter *b, gpointer data) | |
1531 { | |
1532 NodeData *nda; | |
1533 NodeData *ndb; | |
1534 | |
1535 gtk_tree_model_get(store, a, DIR_COLUMN_POINTER, &nda, -1); | |
1536 gtk_tree_model_get(store, b, DIR_COLUMN_POINTER, &ndb, -1); | |
1537 | |
1538 return CASE_SORT(nda->fd->name, ndb->fd->name); | |
1539 } | |
1540 | |
1541 /* | |
1542 *---------------------------------------------------------------------------- | |
1543 * core | |
1544 *---------------------------------------------------------------------------- | |
1545 */ | |
1546 | |
1547 static void vdtree_setup_root(ViewDirTree *vdt) | |
1548 { | |
1549 const gchar *path = "/"; | |
1550 FileData *fd; | |
1551 | |
1552 fd = g_new0(FileData, 1); | |
1553 fd->path = g_strdup(path); | |
1554 fd->name = fd->path; | |
1555 fd->size = 0; | |
1556 fd->date = filetime(path); | |
1557 vdtree_add_by_data(vdt, fd, NULL); | |
1558 | |
1559 vdtree_expand_by_data(vdt, fd, TRUE); | |
1560 vdtree_populate_path(vdt, path, FALSE, FALSE); | |
1561 } | |
1562 | |
1563 static void vdtree_activate_cb(GtkTreeView *tview, GtkTreePath *tpath, GtkTreeViewColumn *column, gpointer data) | |
1564 { | |
1565 ViewDirTree *vdt = data; | |
1566 GtkTreeModel *store; | |
1567 GtkTreeIter iter; | |
1568 NodeData *nd; | |
1569 | |
1570 store = gtk_tree_view_get_model(tview); | |
1571 gtk_tree_model_get_iter(store, &iter, tpath); | |
1572 gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &nd, -1); | |
1573 | |
1574 vdtree_select_row(vdt, nd->fd); | |
1575 } | |
1576 | |
1577 static GdkColor *vdtree_color_shifted(GtkWidget *widget) | |
1578 { | |
1579 static GdkColor color; | |
1580 static GtkWidget *done = NULL; | |
1581 | |
1582 if (done != widget) | |
1583 { | |
1584 GtkStyle *style; | |
1585 | |
1586 style = gtk_widget_get_style(widget); | |
1587 memcpy(&color, &style->base[GTK_STATE_NORMAL], sizeof(color)); | |
1588 shift_color(&color, -1, 0); | |
1589 done = widget; | |
1590 } | |
1591 | |
1592 return &color; | |
1593 } | |
1594 | |
1595 static void vdtree_color_cb(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, | |
1596 GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) | |
1597 { | |
1598 ViewDirTree *vdt = data; | |
1599 gboolean set; | |
1600 | |
1601 gtk_tree_model_get(tree_model, iter, DIR_COLUMN_COLOR, &set, -1); | |
1602 g_object_set(G_OBJECT(cell), | |
1603 "cell-background-gdk", vdtree_color_shifted(vdt->treeview), | |
1604 "cell-background-set", set, NULL); | |
1605 } | |
1606 | |
1607 static gboolean vdtree_destroy_node_cb(GtkTreeModel *store, GtkTreePath *tpath, GtkTreeIter *iter, gpointer data) | |
1608 { | |
1609 NodeData *nd; | |
1610 | |
1611 gtk_tree_model_get(store, iter, DIR_COLUMN_POINTER, &nd, -1); | |
1612 vdtree_node_free(nd); | |
1613 | |
1614 return FALSE; | |
1615 } | |
1616 | |
1617 static void vdtree_destroy_cb(GtkWidget *widget, gpointer data) | |
1618 { | |
1619 ViewDirTree *vdt = data; | |
1620 GtkTreeModel *store; | |
1621 | |
1622 if (vdt->popup) | |
1623 { | |
1624 g_signal_handlers_disconnect_matched(G_OBJECT(vdt->popup), G_SIGNAL_MATCH_DATA, | |
1625 0, 0, 0, NULL, vdt); | |
1626 gtk_widget_destroy(vdt->popup); | |
1627 } | |
1628 | |
1629 vdtree_dnd_drop_expand_cancel(vdt); | |
1630 vdtree_dnd_drop_scroll_cancel(vdt); | |
1631 widget_auto_scroll_stop(vdt->treeview); | |
1632 | |
1633 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vdt->treeview)); | |
1634 gtk_tree_model_foreach(store, vdtree_destroy_node_cb, vdt); | |
1635 | |
1636 path_list_free(vdt->drop_list); | |
1637 | |
1638 folder_icons_free(vdt->pf); | |
1639 | |
1640 g_free(vdt->path); | |
1641 g_free(vdt); | |
1642 } | |
1643 | |
1644 ViewDirTree *vdtree_new(const gchar *path, gint expand) | |
1645 { | |
1646 ViewDirTree *vdt; | |
1647 GtkTreeStore *store; | |
1648 GtkTreeSelection *selection; | |
1649 GtkTreeViewColumn *column; | |
1650 GtkCellRenderer *renderer; | |
1651 | |
1652 vdt = g_new0(ViewDirTree, 1); | |
1653 | |
1654 vdt->path = NULL; | |
1655 vdt->click_fd = NULL; | |
1656 | |
1657 vdt->drop_fd = NULL; | |
1658 vdt->drop_list = NULL; | |
1659 vdt->drop_scroll_id = -1; | |
1660 vdt->drop_expand_id = -1; | |
1661 | |
1662 vdt->popup = NULL; | |
1663 | |
1664 vdt->busy_ref = 0; | |
1665 | |
1666 vdt->widget = gtk_scrolled_window_new(NULL, NULL); | |
1667 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vdt->widget), GTK_SHADOW_IN); | |
1668 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vdt->widget), | |
1669 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); | |
1670 g_signal_connect(G_OBJECT(vdt->widget), "destroy", | |
1671 G_CALLBACK(vdtree_destroy_cb), vdt); | |
1672 | |
1673 store = gtk_tree_store_new(4, G_TYPE_POINTER, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT); | |
1674 vdt->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); | |
1675 g_object_unref(store); | |
1676 | |
1677 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(vdt->treeview), FALSE); | |
1678 gtk_tree_view_set_enable_search(GTK_TREE_VIEW(vdt->treeview), FALSE); | |
1679 gtk_tree_sortable_set_default_sort_func(GTK_TREE_SORTABLE(store), vdtree_sort_cb, vdt, NULL); | |
1680 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), | |
1681 GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, GTK_SORT_ASCENDING); | |
1682 | |
1683 g_signal_connect(G_OBJECT(vdt->treeview), "row_activated", | |
1684 G_CALLBACK(vdtree_activate_cb), vdt); | |
1685 g_signal_connect(G_OBJECT(vdt->treeview), "row_expanded", | |
1686 G_CALLBACK(vdtree_row_expanded), vdt); | |
1687 g_signal_connect(G_OBJECT(vdt->treeview), "row_collapsed", | |
1688 G_CALLBACK(vdtree_row_collapsed), vdt); | |
1689 #if 0 | |
1690 g_signal_connect(G_OBJECT(store), "row_deleted", | |
1691 G_CALLBACK(vdtree_row_deleted_cb), vdt); | |
1692 #endif | |
1693 | |
1694 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vdt->treeview)); | |
1695 gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); | |
1696 gtk_tree_selection_set_select_function(selection, vdtree_select_cb, vdt, NULL); | |
1697 | |
1698 column = gtk_tree_view_column_new(); | |
1699 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY); | |
1700 | |
1701 renderer = gtk_cell_renderer_pixbuf_new(); | |
1702 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
1703 gtk_tree_view_column_add_attribute(column, renderer, "pixbuf", DIR_COLUMN_ICON); | |
1704 gtk_tree_view_column_set_cell_data_func(column, renderer, vdtree_color_cb, vdt, NULL); | |
1705 | |
1706 renderer = gtk_cell_renderer_text_new(); | |
1707 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
1708 gtk_tree_view_column_add_attribute(column, renderer, "text", DIR_COLUMN_NAME); | |
1709 gtk_tree_view_column_set_cell_data_func(column, renderer, vdtree_color_cb, vdt, NULL); | |
1710 | |
1711 gtk_tree_view_append_column(GTK_TREE_VIEW(vdt->treeview), column); | |
1712 | |
1713 g_signal_connect(G_OBJECT(vdt->treeview), "key_press_event", | |
1714 G_CALLBACK(vdtree_press_key_cb), vdt); | |
1715 | |
1716 gtk_container_add(GTK_CONTAINER(vdt->widget), vdt->treeview); | |
1717 gtk_widget_show(vdt->treeview); | |
1718 | |
1719 vdt->pf = folder_icons_new(); | |
1720 | |
1721 vdtree_setup_root(vdt); | |
1722 | |
1723 vdtree_dnd_init(vdt); | |
1724 | |
1725 g_signal_connect(G_OBJECT(vdt->treeview), "button_press_event", | |
1726 G_CALLBACK(vdtree_press_cb), vdt); | |
1727 g_signal_connect(G_OBJECT(vdt->treeview), "button_release_event", | |
1728 G_CALLBACK(vdtree_release_cb), vdt); | |
1729 | |
1730 vdtree_set_path(vdt, path); | |
1731 | |
1732 return vdt; | |
1733 } | |
1734 | |
1735 void vdtree_set_select_func(ViewDirTree *vdt, | |
1736 void (*func)(ViewDirTree *vdt, const gchar *path, gpointer data), gpointer data) | |
1737 { | |
1738 vdt->select_func = func; | |
1739 vdt->select_data = data; | |
1740 } | |
1741 | |
1742 #if 0 | |
1743 void vdtree_set_click_func(ViewDirTree *vdt, | |
1744 void (*func)(ViewDirTree *vdt, GdkEventButton *event, FileData *fd, gpointer), gpointer data) | |
1745 { | |
1746 if (!td) return; | |
1747 vdt->click_func = func; | |
1748 vdt->click_data = data; | |
1749 } | |
1750 #endif | |
1751 | |
1752 void vdtree_set_layout(ViewDirTree *vdt, LayoutWindow *layout) | |
1753 { | |
1754 vdt->layout = layout; | |
1755 } | |
1756 |