4 * Copyright (C) 2008 The Geeqie Team
8 * This software is released under the GNU General Public License (GNU GPL).
9 * Please read the included file COPYING for more information.
10 * This software comes with no warranty of any kind, use at your own risk!
17 #include "collect-dlg.h"
18 #include "collect-io.h"
19 #include "collect-table.h"
26 #include "layout_image.h"
27 #include "pixbuf_util.h"
30 #include "ui_fileops.h"
31 #include "ui_tree_edit.h"
34 #include <gdk/gdkkeysyms.h> /* for keyboard values */
37 #define COLLECT_DEF_WIDTH 440
38 #define COLLECT_DEF_HEIGHT 450
40 static GList *collection_list = NULL;
41 static GList *collection_window_list = NULL;
43 static void collection_window_get_geometry(CollectWindow *cw);
44 static void collection_window_refresh(CollectWindow *cw);
45 static void collection_window_update_title(CollectWindow *cw);
46 static void collection_window_add(CollectWindow *cw, CollectInfo *ci);
47 static void collection_window_insert(CollectWindow *cw, CollectInfo *ci);
48 static void collection_window_remove(CollectWindow *cw, CollectInfo *ci);
49 static void collection_window_update(CollectWindow *cw, CollectInfo *ci);
51 static void collection_window_close(CollectWindow *cw);
54 *-------------------------------------------------------------------
56 *-------------------------------------------------------------------
59 CollectInfo *collection_info_new(FileData *fd, struct stat *st, GdkPixbuf *pixbuf)
65 ci = g_new0(CollectInfo, 1);
66 ci->fd = file_data_ref(fd);
69 if (ci->pixbuf) g_object_ref(ci->pixbuf);
74 void collection_info_free_thumb(CollectInfo *ci)
76 if (ci->pixbuf) g_object_unref(ci->pixbuf);
80 void collection_info_free(CollectInfo *ci)
84 file_data_unref(ci->fd);
85 collection_info_free_thumb(ci);
89 void collection_info_set_thumb(CollectInfo *ci, GdkPixbuf *pixbuf)
91 if (pixbuf) g_object_ref(pixbuf);
92 collection_info_free_thumb(ci);
96 gint collection_info_load_thumb(CollectInfo *ci)
98 if (!ci) return FALSE;
100 collection_info_free_thumb(ci);
102 printf("collection_info_load_thumb not implemented!\n(because an instant thumb loader not implemented)");
105 if (create_thumbnail(ci->fd->path, &ci->pixmap, &ci->mask) < 0) return FALSE;
107 if (ci->pixmap) gdk_pixmap_ref(ci->pixmap);
108 if (ci->mask) gdk_bitmap_ref(ci->mask);
114 void collection_list_free(GList *list)
120 collection_info_free((CollectInfo *)work->data);
126 /* an ugly static var, well what ya gonna do ? */
127 static SortType collection_list_sort_method = SORT_NAME;
129 static gint collection_list_sort_cb(gconstpointer a, gconstpointer b)
131 const CollectInfo *cia = a;
132 const CollectInfo *cib = b;
134 switch(collection_list_sort_method)
140 if (cia->fd->size < cib->fd->size) return -1;
141 if (cia->fd->size > cib->fd->size) return 1;
145 if (cia->fd->date < cib->fd->date) return -1;
146 if (cia->fd->date > cib->fd->date) return 1;
150 return CASE_SORT(cia->fd->path, cib->fd->path);
152 #ifdef HAVE_STRVERSCMP
154 return strverscmp(cia->fd->name, cib->fd->name);
159 return CASE_SORT(cia->fd->name, cib->fd->name);
166 GList *collection_list_sort(GList *list, SortType method)
168 if (method == SORT_NONE) return list;
170 collection_list_sort_method = method;
172 return g_list_sort(list, collection_list_sort_cb);
175 GList *collection_list_add(GList *list, CollectInfo *ci, SortType method)
177 if (method != SORT_NONE)
179 collection_list_sort_method = method;
180 list = g_list_insert_sorted(list, ci, collection_list_sort_cb);
184 list = g_list_append(list, ci);
190 GList *collection_list_insert(GList *list, CollectInfo *ci, CollectInfo *insert_ci, SortType method)
192 if (method != SORT_NONE)
194 collection_list_sort_method = method;
195 list = g_list_insert_sorted(list, ci, collection_list_sort_cb);
201 point = g_list_find(list, insert_ci);
202 list = uig_list_insert_link(list, point, ci);
208 GList *collection_list_remove(GList *list, CollectInfo *ci)
210 list = g_list_remove(list, ci);
211 collection_info_free(ci);
215 CollectInfo *collection_list_find(GList *list, const gchar *path)
221 CollectInfo *ci = work->data;
222 if (strcmp(ci->fd->path, path) == 0) return ci;
230 static GList *collection_list_find_link(GList *list, gchar *path)
236 CollectInfo *ci = work->data;
237 if (strcmp(ci->fd->path, path) == 0) return work;
244 static gint collection_list_find_index(GList *list, gchar *path)
251 CollectInfo *ci = work->data;
252 if (strcmp(ci->fd->path, path) == 0) return c;
261 GList *collection_list_to_filelist(GList *list)
263 GList *filelist = NULL;
268 CollectInfo *info = work->data;
269 filelist = g_list_prepend(filelist, file_data_ref(info->fd));
273 filelist = g_list_reverse(filelist);
277 CollectWindow *collection_window_find(CollectionData *cd)
281 work = collection_window_list;
284 CollectWindow *cw = work->data;
285 if (cw->cd == cd) return cw;
292 CollectWindow *collection_window_find_by_path(const gchar *path)
296 if (!path) return NULL;
298 work = collection_window_list;
301 CollectWindow *cw = work->data;
302 if (cw->cd->path && strcmp(cw->cd->path, path) == 0) return cw;
310 *-------------------------------------------------------------------
311 * please use these to actually add/remove stuff
312 *-------------------------------------------------------------------
315 CollectionData *collection_new(const gchar *path)
318 static gint untitled_counter = 0;
320 cd = g_new0(CollectionData, 1);
322 collection_list = g_list_append(collection_list, cd);
324 cd->ref = 1; /* starts with a ref of 1 */
327 cd->sort_method = SORT_NONE;
328 cd->thumb_loader = NULL;
329 cd->info_updated_func = NULL;
331 cd->window_read = FALSE;
334 cd->window_w = COLLECT_DEF_WIDTH;
335 cd->window_h = COLLECT_DEF_HEIGHT;
339 cd->existence = g_hash_table_new(NULL, NULL);
343 cd->path = g_strdup(path);
344 cd->name = g_strdup(filename_from_path(cd->path));
351 if (untitled_counter == 0)
353 cd->name = g_strdup(_("Untitled"));
357 cd->name = g_strdup_printf(_("Untitled (%d)"), untitled_counter + 1);
366 void collection_free(CollectionData *cd)
370 DEBUG_1("collection \"%s\" freed", cd->name);
372 collection_load_stop(cd);
373 collection_list_free(cd->list);
375 collection_list = g_list_remove(collection_list, cd);
377 g_hash_table_destroy(cd->existence);
385 void collection_ref(CollectionData *cd)
389 DEBUG_1("collection \"%s\" ref count = %d", cd->name, cd->ref);
392 void collection_unref(CollectionData *cd)
396 DEBUG_1("collection \"%s\" ref count = %d", cd->name, cd->ref);
404 void collection_path_changed(CollectionData *cd)
406 collection_window_update_title(collection_window_find(cd));
409 gint collection_to_number(CollectionData *cd)
411 return g_list_index(collection_list, cd);
414 CollectionData *collection_from_number(gint n)
416 return g_list_nth_data(collection_list, n);
419 CollectionData *collection_from_dnd_data(const gchar *data, GList **list, GList **info_list)
424 if (strncmp(data, "COLLECTION:", 11) != 0) return NULL;
426 n = (gint)strtol(data + 11, NULL, 10);
427 cd = collection_from_number(n);
429 if (!cd || (!list && !info_list))
440 while (data[b] != '\0' && data[b] != '\n' ) b++;
444 while (data[b] != '\0')
448 while (data[e] != '\n' && data[e] != '\0') e++;
449 n = (gint)strtol(data + b, NULL, 10);
451 info = g_list_nth_data(cd->list, n);
452 if (info && list) work = g_list_append(work, file_data_ref(info->fd));
453 if (info && info_list) infol = g_list_append(infol, info);
455 while (data[e] == '\n') e++;
458 if (list) *list = work;
459 if (info_list) *info_list = infol;
465 gchar *collection_info_list_to_dnd_data(CollectionData *cd, GList *list, gint *length)
467 gchar *uri_text = NULL;
474 n = collection_to_number(cd);
483 temp = g_list_prepend(temp, g_strdup_printf("COLLECTION:%d\n", n));
487 n = g_list_index(cd->list, work->data);
490 temp = g_list_prepend(temp, g_strdup_printf("%d\n", n));
499 total += strlen((gchar *)work->data);
504 uri_text = g_malloc(total);
507 work = g_list_last(temp);
510 gchar *text = work->data;
520 string_list_free(temp);
527 gint collection_info_valid(CollectionData *cd, CollectInfo *info)
529 if (collection_to_number(cd) < 0) return FALSE;
531 return (g_list_index(cd->list, info) != 0);
534 CollectInfo *collection_next_by_info(CollectionData *cd, CollectInfo *info)
538 work = g_list_find(cd->list, info);
540 if (!work) return NULL;
542 if (work) return work->data;
546 CollectInfo *collection_prev_by_info(CollectionData *cd, CollectInfo *info)
550 work = g_list_find(cd->list, info);
552 if (!work) return NULL;
554 if (work) return work->data;
558 CollectInfo *collection_get_first(CollectionData *cd)
560 if (cd->list) return cd->list->data;
565 CollectInfo *collection_get_last(CollectionData *cd)
569 list = g_list_last(cd->list);
571 if (list) return list->data;
576 void collection_set_sort_method(CollectionData *cd, SortType method)
580 if (cd->sort_method == method) return;
582 cd->sort_method = method;
583 cd->list = collection_list_sort(cd->list, cd->sort_method);
584 if (cd->list) cd->changed = TRUE;
586 collection_window_refresh(collection_window_find(cd));
589 void collection_set_update_info_func(CollectionData *cd,
590 void (*func)(CollectionData *, CollectInfo *, gpointer), gpointer data)
592 cd->info_updated_func = func;
593 cd->info_updated_data = data;
596 static CollectInfo *collection_info_new_if_not_exists(CollectionData *cd, struct stat *st, FileData *fd)
600 if (g_hash_table_lookup(cd->existence, fd->path)) return NULL;
602 ci = collection_info_new(fd, st, NULL);
603 if (ci) g_hash_table_insert(cd->existence, fd->path, "");
607 gint collection_add_check(CollectionData *cd, FileData *fd, gint sorted, gint must_exist)
614 valid = (stat_utf8(fd->path, &st) && !S_ISDIR(st.st_mode));
627 ci = collection_info_new_if_not_exists(cd, &st, fd);
628 if (!ci) return FALSE;
629 DEBUG_3("add to collection: %s", fd->path);
631 cd->list = collection_list_add(cd->list, ci, sorted ? cd->sort_method : SORT_NONE);
634 if (!sorted || cd->sort_method == SORT_NONE)
636 collection_window_add(collection_window_find(cd), ci);
640 collection_window_insert(collection_window_find(cd), ci);
647 gint collection_add(CollectionData *cd, FileData *fd, gint sorted)
649 return collection_add_check(cd, fd, sorted, TRUE);
652 gint collection_insert(CollectionData *cd, FileData *fd, CollectInfo *insert_ci, gint sorted)
656 if (!insert_ci) return collection_add(cd, fd, sorted);
658 if (stat_utf8(fd->path, &st) >= 0 && !S_ISDIR(st.st_mode))
662 ci = collection_info_new_if_not_exists(cd, &st, fd);
663 if (!ci) return FALSE;
665 DEBUG_3("insert in collection: %s", fd->path);
667 cd->list = collection_list_insert(cd->list, ci, insert_ci, sorted ? cd->sort_method : SORT_NONE);
670 collection_window_insert(collection_window_find(cd), ci);
678 gint collection_remove(CollectionData *cd, FileData *fd)
682 ci = collection_list_find(cd->list, fd->path);
684 if (!ci) return FALSE;
686 g_hash_table_remove(cd->existence, fd->path);
688 cd->list = g_list_remove(cd->list, ci);
691 collection_window_remove(collection_window_find(cd), ci);
692 collection_info_free(ci);
697 static void collection_remove_by_info(CollectionData *cd, CollectInfo *info)
699 if (!info || !g_list_find(cd->list, info)) return;
701 cd->list = g_list_remove(cd->list, info);
702 cd->changed = (cd->list != NULL);
704 collection_window_remove(collection_window_find(cd), info);
705 collection_info_free(info);
708 void collection_remove_by_info_list(CollectionData *cd, GList *list)
716 /* more efficient (in collect-table) to remove a single item this way */
717 collection_remove_by_info(cd, (CollectInfo *)list->data);
724 cd->list = collection_list_remove(cd->list, work->data);
727 cd->changed = (cd->list != NULL);
729 collection_window_refresh(collection_window_find(cd));
732 gint collection_rename(CollectionData *cd, FileData *fd)
735 const gchar *source = fd->change->source;
736 // const gchar *dest = fd->change->dest;
737 ci = collection_list_find(cd->list, source);
739 if (!ci) return FALSE;
742 // ci->path = g_strdup(dest); FIXME
745 collection_window_update(collection_window_find(cd), ci);
750 void collection_update_geometry(CollectionData *cd)
752 collection_window_get_geometry(collection_window_find(cd));
756 *-------------------------------------------------------------------
757 * simple maintenance for renaming, deleting
758 *-------------------------------------------------------------------
761 void collection_maint_removed(FileData *fd)
765 work = collection_list;
768 CollectionData *cd = work->data;
771 while (collection_remove(cd, fd));
774 /* Do we really need to do this? removed files are
775 * automatically ignored when loading a collection.
777 collect_manager_moved(fd, NULL);
781 void collection_maint_renamed(FileData *fd)
785 work = collection_list;
788 CollectionData *cd = work->data;
791 while (collection_rename(cd, fd));
794 collect_manager_moved(fd);
798 *-------------------------------------------------------------------
800 *-------------------------------------------------------------------
803 static gint collection_window_keypress(GtkWidget *widget, GdkEventKey *event, gpointer data)
805 CollectWindow *cw = data;
806 gint stop_signal = FALSE;
810 if (event->state & GDK_CONTROL_MASK)
813 switch (event->keyval)
846 if (event->state & GDK_SHIFT_MASK)
848 collection_table_unselect_all(cw->table);
852 collection_table_select_all(cw->table);
856 list = layout_list(NULL);
859 collection_table_add_filelist(cw->table, list);
864 file_util_copy(NULL, collection_table_selection_get_list(cw->table), NULL, cw->window);
867 file_util_move(NULL, collection_table_selection_get_list(cw->table), NULL, cw->window);
870 file_util_rename(NULL, collection_table_selection_get_list(cw->table), cw->window);
873 file_util_delete(NULL, collection_table_selection_get_list(cw->table), cw->window);
876 info_window_new(NULL, collection_table_selection_get_list(cw->table), NULL);
879 collection_dialog_save_as(NULL, cw->cd);
882 collection_window_close(cw);
892 switch (event->keyval)
894 case GDK_Return: case GDK_KP_Enter:
895 layout_image_set_collection(NULL, cw->cd,
896 collection_table_get_focus_info(cw->table));
899 view_window_new_from_collection(cw->cd,
900 collection_table_get_focus_info(cw->table));
905 collection_dialog_save_as(NULL, cw->cd);
907 else if (!collection_save(cw->cd, cw->cd->path))
909 printf("failed saving to collection path: %s\n", cw->cd->path);
913 collection_dialog_append(NULL, cw->cd);
916 collection_set_sort_method(cw->cd, SORT_NAME);
918 #ifdef HAVE_STRVERSCMP
920 collection_set_sort_method(cw->cd, SORT_NUMBER);
924 collection_set_sort_method(cw->cd, SORT_TIME);
927 collection_set_sort_method(cw->cd, SORT_SIZE);
930 if (event->state & GDK_SHIFT_MASK)
934 info = collection_table_get_focus_info(cw->table);
936 print_window_new(info->fd, collection_table_selection_get_list(cw->table),
937 collection_list_to_filelist(cw->cd->list), cw->window);
941 collection_set_sort_method(cw->cd, SORT_PATH);
944 case GDK_Delete: case GDK_KP_Delete:
945 list = g_list_copy(cw->table->selection);
948 collection_remove_by_info_list(cw->cd, list);
953 collection_remove_by_info(cw->cd, collection_table_get_focus_info(cw->table));
964 list = collection_table_selection_get_list(cw->table);
965 start_editor_from_filelist(edit_val, list);
973 *-------------------------------------------------------------------
975 *-------------------------------------------------------------------
977 static void collection_window_get_geometry(CollectWindow *cw)
984 gdk_window_get_position(cw->window->window, &cd->window_x, &cd->window_y);
985 gdk_drawable_get_size(cw->window->window, &cd->window_w, &cd->window_h);
986 cd->window_read = TRUE;
989 static void collection_window_refresh(CollectWindow *cw)
993 collection_table_refresh(cw->table);
996 static void collection_window_update_title(CollectWindow *cw)
1002 buf = g_strdup_printf(_("%s - Collection - %s"), cw->cd->name, GQ_APPNAME);
1003 gtk_window_set_title(GTK_WINDOW(cw->window), buf);
1007 static void collection_window_update_info(CollectionData *cd, CollectInfo *ci, gpointer data)
1009 CollectWindow *cw = data;
1011 collection_table_file_update(cw->table, ci);
1014 static void collection_window_add(CollectWindow *cw, CollectInfo *ci)
1018 if (!ci->pixbuf) collection_load_thumb_idle(cw->cd);
1019 collection_table_file_add(cw->table, ci);
1022 static void collection_window_insert(CollectWindow *cw, CollectInfo *ci)
1026 if (!ci->pixbuf) collection_load_thumb_idle(cw->cd);
1027 collection_table_file_insert(cw->table, ci);
1032 static void collection_window_move(CollectWindow *cw, CollectInfo *ci)
1038 static void collection_window_remove(CollectWindow *cw, CollectInfo *ci)
1042 collection_table_file_remove(cw->table, ci);
1045 static void collection_window_update(CollectWindow *cw, CollectInfo *ci)
1049 collection_table_file_update(cw->table, ci);
1050 collection_table_file_update(cw->table, NULL);
1053 static void collection_window_close_final(CollectWindow *cw)
1055 if (cw->close_dialog) return;
1057 collection_window_list = g_list_remove(collection_window_list, cw);
1058 collection_window_get_geometry(cw);
1060 gtk_widget_destroy(cw->window);
1062 collection_set_update_info_func(cw->cd, NULL, NULL);
1063 collection_unref(cw->cd);
1068 static void collection_close_save_cb(GenericDialog *gd, gpointer data)
1070 CollectWindow *cw = data;
1072 cw->close_dialog = NULL;
1073 generic_dialog_close(gd);
1077 collection_dialog_save_close(NULL, cw->cd);
1080 else if (!collection_save(cw->cd, cw->cd->path))
1083 buf = g_strdup_printf(_("Failed to save the collection:\n%s"), cw->cd->path);
1084 warning_dialog(_("Save Failed"), buf, GTK_STOCK_DIALOG_ERROR, cw->window);
1089 collection_window_close_final(cw);
1092 static void collection_close_close_cb(GenericDialog *gd, gpointer data)
1094 CollectWindow *cw = data;
1096 cw->close_dialog = NULL;
1097 generic_dialog_close(gd);
1099 collection_window_close_final(cw);
1102 static void collection_close_cancel_cb(GenericDialog *gd, gpointer data)
1104 CollectWindow *cw = data;
1106 cw->close_dialog = NULL;
1107 generic_dialog_close(gd);
1110 static void collection_close_dlg_show(CollectWindow *cw)
1114 if (cw->close_dialog)
1116 gtk_window_present(GTK_WINDOW(cw->close_dialog));
1120 gd = generic_dialog_new(_("Close collection"),
1121 GQ_WMCLASS, "close_collection", cw->window, FALSE,
1122 collection_close_cancel_cb, cw);
1123 generic_dialog_add_message(gd, GTK_STOCK_DIALOG_QUESTION,
1124 _("Close collection"),
1125 _("Collection has been modified.\nSave first?"));
1127 generic_dialog_add_button(gd, GTK_STOCK_SAVE, NULL, collection_close_save_cb, TRUE);
1128 generic_dialog_add_button(gd, GTK_STOCK_DELETE, _("_Discard"), collection_close_close_cb, FALSE);
1130 cw->close_dialog = gd->dialog;
1132 gtk_widget_show(gd->dialog);
1135 static void collection_window_close(CollectWindow *cw)
1137 if (!cw->cd->changed && !cw->close_dialog)
1139 collection_window_close_final(cw);
1143 collection_close_dlg_show(cw);
1146 void collection_window_close_by_collection(CollectionData *cd)
1150 cw = collection_window_find(cd);
1151 if (cw) collection_window_close_final(cw);
1154 gint collection_window_modified_exists(void)
1158 work = collection_window_list;
1161 CollectWindow *cw = work->data;
1162 if (cw->cd->changed) return TRUE;
1169 static gint collection_window_delete(GtkWidget *widget, GdkEvent *event, gpointer data)
1171 CollectWindow *cw = data;
1172 collection_window_close(cw);
1177 CollectWindow *collection_window_new(const gchar *path)
1182 GtkWidget *status_label;
1183 GtkWidget *extra_label;
1184 GdkGeometry geometry;
1186 cw = g_new0(CollectWindow, 1);
1188 cw->close_dialog = NULL;
1190 collection_window_list = g_list_append(collection_window_list, cw);
1192 cw->cd = collection_new(path);
1194 cw->window = window_new(GTK_WINDOW_TOPLEVEL, "collection", PIXBUF_INLINE_ICON_BOOK, NULL, NULL);
1196 geometry.min_width = 32;
1197 geometry.min_height = 32;
1198 geometry.base_width = COLLECT_DEF_WIDTH;
1199 geometry.base_height = COLLECT_DEF_HEIGHT;
1200 gtk_window_set_geometry_hints(GTK_WINDOW(cw->window), NULL, &geometry,
1201 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);
1204 if (options->layout.save_window_positions && path && collection_load_only_geometry(cw->cd, path))
1206 /* FIXME: x, y is not implemented */
1207 gtk_window_set_default_size(GTK_WINDOW(cw->window), cw->cd->window_w, cw->cd->window_h);
1211 gtk_window_set_default_size(GTK_WINDOW(cw->window), COLLECT_DEF_WIDTH, COLLECT_DEF_HEIGHT);
1214 gtk_window_set_resizable(GTK_WINDOW(cw->window), TRUE);
1215 collection_window_update_title(cw);
1216 gtk_container_set_border_width(GTK_CONTAINER(cw->window), 0);
1218 g_signal_connect(G_OBJECT(cw->window), "delete_event",
1219 G_CALLBACK(collection_window_delete), cw);
1221 g_signal_connect(G_OBJECT(cw->window), "key_press_event",
1222 G_CALLBACK(collection_window_keypress), cw);
1224 vbox = gtk_vbox_new(FALSE, 0);
1225 gtk_container_add(GTK_CONTAINER(cw->window), vbox);
1226 gtk_widget_show(vbox);
1228 cw->table = collection_table_new(cw->cd);
1229 gtk_box_pack_start(GTK_BOX(vbox), cw->table->scrolled, TRUE, TRUE, 0);
1230 gtk_widget_show(cw->table->scrolled);
1232 cw->status_box = gtk_hbox_new(TRUE, 0);
1233 gtk_box_pack_start(GTK_BOX(vbox), cw->status_box, FALSE, FALSE, 0);
1234 gtk_widget_show(cw->status_box);
1236 frame = gtk_frame_new(NULL);
1237 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
1238 gtk_box_pack_start(GTK_BOX(cw->status_box), frame, TRUE, TRUE, 0);
1239 gtk_widget_show(frame);
1241 status_label = gtk_label_new("");
1242 gtk_container_add(GTK_CONTAINER(frame), status_label);
1243 gtk_widget_show(status_label);
1245 extra_label = gtk_progress_bar_new();
1246 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(extra_label), 0.0);
1247 gtk_box_pack_start(GTK_BOX(cw->status_box), extra_label, TRUE, TRUE, 0);
1248 gtk_widget_show(extra_label);
1250 collection_table_set_labels(cw->table, status_label, extra_label);
1252 gtk_widget_show(cw->window);
1253 gtk_widget_grab_focus(cw->table->listview);
1255 collection_set_update_info_func(cw->cd, collection_window_update_info, cw);
1257 if (path && *path == '/') collection_load_begin(cw->cd, NULL, COLLECTION_LOAD_NONE);