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!
16 #include "collect-dlg.h"
17 #include "collect-io.h"
18 #include "collect-table.h"
24 #include "layout_image.h"
25 #include "pixbuf_util.h"
28 #include "ui_fileops.h"
29 #include "ui_tree_edit.h"
31 #include <gdk/gdkkeysyms.h> /* for keyboard values */
34 #define COLLECT_DEF_WIDTH 440
35 #define COLLECT_DEF_HEIGHT 450
37 static GList *collection_list = NULL;
38 static GList *collection_window_list = NULL;
40 static void collection_window_get_geometry(CollectWindow *cw);
41 static void collection_window_refresh(CollectWindow *cw);
42 static void collection_window_update_title(CollectWindow *cw);
43 static void collection_window_add(CollectWindow *cw, CollectInfo *ci);
44 static void collection_window_insert(CollectWindow *cw, CollectInfo *ci);
45 static void collection_window_remove(CollectWindow *cw, CollectInfo *ci);
46 static void collection_window_update(CollectWindow *cw, CollectInfo *ci);
48 static void collection_window_close(CollectWindow *cw);
51 *-------------------------------------------------------------------
53 *-------------------------------------------------------------------
56 CollectInfo *collection_info_new(FileData *fd, struct stat *st, GdkPixbuf *pixbuf)
62 ci = g_new0(CollectInfo, 1);
63 ci->fd = file_data_ref(fd);
66 if (ci->pixbuf) g_object_ref(ci->pixbuf);
71 void collection_info_free_thumb(CollectInfo *ci)
73 if (ci->pixbuf) g_object_unref(ci->pixbuf);
77 void collection_info_free(CollectInfo *ci)
81 file_data_unref(ci->fd);
82 collection_info_free_thumb(ci);
86 void collection_info_set_thumb(CollectInfo *ci, GdkPixbuf *pixbuf)
88 if (pixbuf) g_object_ref(pixbuf);
89 collection_info_free_thumb(ci);
93 gint collection_info_load_thumb(CollectInfo *ci)
95 if (!ci) return FALSE;
97 collection_info_free_thumb(ci);
99 printf("collection_info_load_thumb not implemented!\n(because an instant thumb loader not implemented)");
102 if (create_thumbnail(ci->fd->path, &ci->pixmap, &ci->mask) < 0) return FALSE;
104 if (ci->pixmap) gdk_pixmap_ref(ci->pixmap);
105 if (ci->mask) gdk_bitmap_ref(ci->mask);
111 void collection_list_free(GList *list)
117 collection_info_free((CollectInfo *)work->data);
123 /* an ugly static var, well what ya gonna do ? */
124 static SortType collection_list_sort_method = SORT_NAME;
126 static gint collection_list_sort_cb(gconstpointer a, gconstpointer b)
128 const CollectInfo *cia = a;
129 const CollectInfo *cib = b;
131 switch(collection_list_sort_method)
137 if (cia->fd->size < cib->fd->size) return -1;
138 if (cia->fd->size > cib->fd->size) return 1;
142 if (cia->fd->date < cib->fd->date) return -1;
143 if (cia->fd->date > cib->fd->date) return 1;
147 return CASE_SORT(cia->fd->path, cib->fd->path);
149 #ifdef HAVE_STRVERSCMP
151 return strverscmp(cia->fd->name, cib->fd->name);
156 return CASE_SORT(cia->fd->name, cib->fd->name);
163 GList *collection_list_sort(GList *list, SortType method)
165 if (method == SORT_NONE) return list;
167 collection_list_sort_method = method;
169 return g_list_sort(list, collection_list_sort_cb);
172 GList *collection_list_add(GList *list, CollectInfo *ci, SortType method)
174 if (method != SORT_NONE)
176 collection_list_sort_method = method;
177 list = g_list_insert_sorted(list, ci, collection_list_sort_cb);
181 list = g_list_append(list, ci);
187 GList *collection_list_insert(GList *list, CollectInfo *ci, CollectInfo *insert_ci, SortType method)
189 if (method != SORT_NONE)
191 collection_list_sort_method = method;
192 list = g_list_insert_sorted(list, ci, collection_list_sort_cb);
198 point = g_list_find(list, insert_ci);
199 list = uig_list_insert_link(list, point, ci);
205 GList *collection_list_remove(GList *list, CollectInfo *ci)
207 list = g_list_remove(list, ci);
208 collection_info_free(ci);
212 CollectInfo *collection_list_find(GList *list, const gchar *path)
218 CollectInfo *ci = work->data;
219 if (strcmp(ci->fd->path, path) == 0) return ci;
227 static GList *collection_list_find_link(GList *list, gchar *path)
233 CollectInfo *ci = work->data;
234 if (strcmp(ci->fd->path, path) == 0) return work;
241 static gint collection_list_find_index(GList *list, gchar *path)
248 CollectInfo *ci = work->data;
249 if (strcmp(ci->fd->path, path) == 0) return c;
258 GList *collection_list_to_filelist(GList *list)
260 GList *filelist = NULL;
265 CollectInfo *info = work->data;
266 filelist = g_list_prepend(filelist, file_data_ref(info->fd));
270 filelist = g_list_reverse(filelist);
274 CollectWindow *collection_window_find(CollectionData *cd)
278 work = collection_window_list;
281 CollectWindow *cw = work->data;
282 if (cw->cd == cd) return cw;
289 CollectWindow *collection_window_find_by_path(const gchar *path)
293 if (!path) return NULL;
295 work = collection_window_list;
298 CollectWindow *cw = work->data;
299 if (cw->cd->path && strcmp(cw->cd->path, path) == 0) return cw;
307 *-------------------------------------------------------------------
308 * please use these to actually add/remove stuff
309 *-------------------------------------------------------------------
312 CollectionData *collection_new(const gchar *path)
315 static gint untitled_counter = 0;
317 cd = g_new0(CollectionData, 1);
319 collection_list = g_list_append(collection_list, cd);
321 cd->ref = 1; /* starts with a ref of 1 */
324 cd->sort_method = SORT_NONE;
325 cd->thumb_loader = NULL;
326 cd->info_updated_func = NULL;
328 cd->window_read = FALSE;
331 cd->window_w = COLLECT_DEF_WIDTH;
332 cd->window_h = COLLECT_DEF_HEIGHT;
336 cd->existence = g_hash_table_new(NULL, NULL);
340 cd->path = g_strdup(path);
341 cd->name = g_strdup(filename_from_path(cd->path));
348 if (untitled_counter == 0)
350 cd->name = g_strdup(_("Untitled"));
354 cd->name = g_strdup_printf(_("Untitled (%d)"), untitled_counter + 1);
363 void collection_free(CollectionData *cd)
367 if (debug) printf("collection \"%s\" freed\n", cd->name);
369 collection_load_stop(cd);
370 collection_list_free(cd->list);
372 collection_list = g_list_remove(collection_list, cd);
374 g_hash_table_destroy(cd->existence);
382 void collection_ref(CollectionData *cd)
386 if (debug) printf("collection \"%s\" ref count = %d\n", cd->name, cd->ref);
389 void collection_unref(CollectionData *cd)
393 if (debug) printf("collection \"%s\" ref count = %d\n", cd->name, cd->ref);
401 void collection_path_changed(CollectionData *cd)
403 collection_window_update_title(collection_window_find(cd));
406 gint collection_to_number(CollectionData *cd)
408 return g_list_index(collection_list, cd);
411 CollectionData *collection_from_number(gint n)
413 return g_list_nth_data(collection_list, n);
416 CollectionData *collection_from_dnd_data(const gchar *data, GList **list, GList **info_list)
421 if (strncmp(data, "COLLECTION:", 11) != 0) return NULL;
423 n = (gint)strtol(data + 11, NULL, 10);
424 cd = collection_from_number(n);
426 if (!cd || (!list && !info_list))
437 while(data[b] != '\0' && data[b] != '\n' ) b++;
441 while (data[b] != '\0')
445 while (data[e] != '\n' && data[e] != '\0') e++;
446 n = (gint)strtol(data + b, NULL, 10);
448 info = g_list_nth_data(cd->list, n);
449 if (info && list) work = g_list_append(work, file_data_ref(info->fd));
450 if (info && info_list) infol = g_list_append(infol, info);
452 while (data[e] == '\n') e++;
455 if (list) *list = work;
456 if (info_list) *info_list = infol;
462 gchar *collection_info_list_to_dnd_data(CollectionData *cd, GList *list, gint *length)
464 gchar *uri_text = NULL;
471 n = collection_to_number(cd);
480 temp = g_list_prepend(temp, g_strdup_printf("COLLECTION:%d\n", n));
484 n = g_list_index(cd->list, work->data);
487 temp = g_list_prepend(temp, g_strdup_printf("%d\n", n));
496 total += strlen((gchar *)work->data);
501 uri_text = g_malloc(total);
504 work = g_list_last(temp);
507 gchar *text = work->data;
517 string_list_free(temp);
524 gint collection_info_valid(CollectionData *cd, CollectInfo *info)
526 if (collection_to_number(cd) < 0) return FALSE;
528 return (g_list_index(cd->list, info) != 0);
531 CollectInfo *collection_next_by_info(CollectionData *cd, CollectInfo *info)
535 work = g_list_find(cd->list, info);
537 if (!work) return NULL;
539 if (work) return work->data;
543 CollectInfo *collection_prev_by_info(CollectionData *cd, CollectInfo *info)
547 work = g_list_find(cd->list, info);
549 if (!work) return NULL;
551 if (work) return work->data;
555 CollectInfo *collection_get_first(CollectionData *cd)
557 if (cd->list) return cd->list->data;
562 CollectInfo *collection_get_last(CollectionData *cd)
566 list = g_list_last(cd->list);
568 if (list) return list->data;
573 void collection_set_sort_method(CollectionData *cd, SortType method)
577 if (cd->sort_method == method) return;
579 cd->sort_method = method;
580 cd->list = collection_list_sort(cd->list, cd->sort_method);
581 if (cd->list) cd->changed = TRUE;
583 collection_window_refresh(collection_window_find(cd));
586 void collection_set_update_info_func(CollectionData *cd,
587 void (*func)(CollectionData *, CollectInfo *, gpointer), gpointer data)
589 cd->info_updated_func = func;
590 cd->info_updated_data = data;
593 static CollectInfo *collection_info_new_if_not_exists(CollectionData *cd, struct stat *st, FileData *fd)
597 if (g_hash_table_lookup(cd->existence, fd->path)) return NULL;
599 ci = collection_info_new(fd, st, NULL);
600 if (ci) g_hash_table_insert(cd->existence, fd->path, "");
604 gint collection_add_check(CollectionData *cd, FileData *fd, gint sorted, gint must_exist)
611 valid = (stat_utf8(fd->path, &st) && !S_ISDIR(st.st_mode));
624 ci = collection_info_new_if_not_exists(cd, &st, fd);
625 if (!ci) return FALSE;
626 if (debug > 2) printf("add to collection: %s\n", fd->path);
628 cd->list = collection_list_add(cd->list, ci, sorted ? cd->sort_method : SORT_NONE);
631 if (!sorted || cd->sort_method == SORT_NONE)
633 collection_window_add(collection_window_find(cd), ci);
637 collection_window_insert(collection_window_find(cd), ci);
644 gint collection_add(CollectionData *cd, FileData *fd, gint sorted)
646 return collection_add_check(cd, fd, sorted, TRUE);
649 gint collection_insert(CollectionData *cd, FileData *fd, CollectInfo *insert_ci, gint sorted)
653 if (!insert_ci) return collection_add(cd, fd, sorted);
655 if (stat_utf8(fd->path, &st) >= 0 && !S_ISDIR(st.st_mode))
659 ci = collection_info_new_if_not_exists(cd, &st, fd);
660 if (!ci) return FALSE;
662 if (debug > 2) printf("insert in collection: %s\n", fd->path);
664 cd->list = collection_list_insert(cd->list, ci, insert_ci, sorted ? cd->sort_method : SORT_NONE);
667 collection_window_insert(collection_window_find(cd), ci);
675 gint collection_remove(CollectionData *cd, FileData *fd)
679 ci = collection_list_find(cd->list, fd->path);
681 if (!ci) return FALSE;
683 g_hash_table_remove(cd->existence, fd->path);
685 cd->list = g_list_remove(cd->list, ci);
688 collection_window_remove(collection_window_find(cd), ci);
689 collection_info_free(ci);
694 static void collection_remove_by_info(CollectionData *cd, CollectInfo *info)
696 if (!info || !g_list_find(cd->list, info)) return;
698 cd->list = g_list_remove(cd->list, info);
699 cd->changed = (cd->list != NULL);
701 collection_window_remove(collection_window_find(cd), info);
702 collection_info_free(info);
705 void collection_remove_by_info_list(CollectionData *cd, GList *list)
713 /* more efficient (in collect-table) to remove a single item this way */
714 collection_remove_by_info(cd, (CollectInfo *)list->data);
721 cd->list = collection_list_remove(cd->list, work->data);
724 cd->changed = (cd->list != NULL);
726 collection_window_refresh(collection_window_find(cd));
729 gint collection_rename(CollectionData *cd, FileData *fd)
732 const gchar *source = fd->change->source;
733 // const gchar *dest = fd->change->dest;
734 ci = collection_list_find(cd->list, source);
736 if (!ci) return FALSE;
739 // ci->path = g_strdup(dest); FIXME
742 collection_window_update(collection_window_find(cd), ci);
747 void collection_update_geometry(CollectionData *cd)
749 collection_window_get_geometry(collection_window_find(cd));
753 *-------------------------------------------------------------------
754 * simple maintenance for renaming, deleting
755 *-------------------------------------------------------------------
758 void collection_maint_removed(FileData *fd)
762 work = collection_list;
765 CollectionData *cd = work->data;
768 while(collection_remove(cd, fd));
771 /* Do we really need to do this? removed files are
772 * automatically ignored when loading a collection.
774 collect_manager_moved(fd, NULL);
778 void collection_maint_renamed(FileData *fd)
782 work = collection_list;
785 CollectionData *cd = work->data;
788 while(collection_rename(cd, fd));
791 collect_manager_moved(fd);
795 *-------------------------------------------------------------------
797 *-------------------------------------------------------------------
800 static gint collection_window_keypress(GtkWidget *widget, GdkEventKey *event, gpointer data)
802 CollectWindow *cw = data;
803 gint stop_signal = FALSE;
807 if (event->state & GDK_CONTROL_MASK)
810 switch (event->keyval)
843 if (event->state & GDK_SHIFT_MASK)
845 collection_table_unselect_all(cw->table);
849 collection_table_select_all(cw->table);
853 list = layout_list(NULL);
856 collection_table_add_filelist(cw->table, list);
861 file_util_copy(NULL, collection_table_selection_get_list(cw->table), NULL, cw->window);
864 file_util_move(NULL, collection_table_selection_get_list(cw->table), NULL, cw->window);
867 file_util_rename(NULL, collection_table_selection_get_list(cw->table), cw->window);
870 file_util_delete(NULL, collection_table_selection_get_list(cw->table), cw->window);
873 info_window_new(NULL, collection_table_selection_get_list(cw->table));
876 collection_dialog_save_as(NULL, cw->cd);
879 collection_window_close(cw);
889 switch (event->keyval)
891 case GDK_Return: case GDK_KP_Enter:
892 layout_image_set_collection(NULL, cw->cd,
893 collection_table_get_focus_info(cw->table));
896 view_window_new_from_collection(cw->cd,
897 collection_table_get_focus_info(cw->table));
902 collection_dialog_save_as(NULL, cw->cd);
904 else if (!collection_save(cw->cd, cw->cd->path))
906 printf("failed saving to collection path: %s\n", cw->cd->path);
910 collection_dialog_append(NULL, cw->cd);
913 collection_set_sort_method(cw->cd, SORT_NAME);
915 #ifdef HAVE_STRVERSCMP
917 collection_set_sort_method(cw->cd, SORT_NUMBER);
921 collection_set_sort_method(cw->cd, SORT_TIME);
924 collection_set_sort_method(cw->cd, SORT_SIZE);
927 if (event->state & GDK_SHIFT_MASK)
931 info = collection_table_get_focus_info(cw->table);
933 print_window_new(info->fd, collection_table_selection_get_list(cw->table),
934 collection_list_to_filelist(cw->cd->list), cw->window);
938 collection_set_sort_method(cw->cd, SORT_PATH);
941 case GDK_Delete: case GDK_KP_Delete:
942 list = g_list_copy(cw->table->selection);
945 collection_remove_by_info_list(cw->cd, list);
950 collection_remove_by_info(cw->cd, collection_table_get_focus_info(cw->table));
961 list = collection_table_selection_get_list(cw->table);
962 start_editor_from_filelist(edit_val, list);
970 *-------------------------------------------------------------------
972 *-------------------------------------------------------------------
974 static void collection_window_get_geometry(CollectWindow *cw)
981 gdk_window_get_position (cw->window->window, &cd->window_x, &cd->window_y);
982 gdk_drawable_get_size(cw->window->window, &cd->window_w, &cd->window_h);
983 cd->window_read = TRUE;
986 static void collection_window_refresh(CollectWindow *cw)
990 collection_table_refresh(cw->table);
993 static void collection_window_update_title(CollectWindow *cw)
999 buf = g_strdup_printf(_("%s - Collection - %s"), cw->cd->name, GQ_APPNAME);
1000 gtk_window_set_title(GTK_WINDOW(cw->window), buf);
1004 static void collection_window_update_info(CollectionData *cd, CollectInfo *ci, gpointer data)
1006 CollectWindow *cw = data;
1008 collection_table_file_update(cw->table, ci);
1011 static void collection_window_add(CollectWindow *cw, CollectInfo *ci)
1015 if (!ci->pixbuf) collection_load_thumb_idle(cw->cd);
1016 collection_table_file_add(cw->table, ci);
1019 static void collection_window_insert(CollectWindow *cw, CollectInfo *ci)
1023 if (!ci->pixbuf) collection_load_thumb_idle(cw->cd);
1024 collection_table_file_insert(cw->table, ci);
1029 static void collection_window_move(CollectWindow *cw, CollectInfo *ci)
1035 static void collection_window_remove(CollectWindow *cw, CollectInfo *ci)
1039 collection_table_file_remove(cw->table, ci);
1042 static void collection_window_update(CollectWindow *cw, CollectInfo *ci)
1046 collection_table_file_update(cw->table, ci);
1047 collection_table_file_update(cw->table, NULL);
1050 static void collection_window_close_final(CollectWindow *cw)
1052 if (cw->close_dialog) return;
1054 collection_window_list = g_list_remove(collection_window_list, cw);
1055 collection_window_get_geometry(cw);
1057 gtk_widget_destroy(cw->window);
1059 collection_set_update_info_func(cw->cd, NULL, NULL);
1060 collection_unref(cw->cd);
1065 static void collection_close_save_cb(GenericDialog *gd, gpointer data)
1067 CollectWindow *cw = data;
1069 cw->close_dialog = NULL;
1070 generic_dialog_close(gd);
1074 collection_dialog_save_close(NULL, cw->cd);
1077 else if (!collection_save(cw->cd, cw->cd->path))
1080 buf = g_strdup_printf(_("Failed to save the collection:\n%s"), cw->cd->path);
1081 warning_dialog(_("Save Failed"), buf, GTK_STOCK_DIALOG_ERROR, cw->window);
1086 collection_window_close_final(cw);
1089 static void collection_close_close_cb(GenericDialog *gd, gpointer data)
1091 CollectWindow *cw = data;
1093 cw->close_dialog = NULL;
1094 generic_dialog_close(gd);
1096 collection_window_close_final(cw);
1099 static void collection_close_cancel_cb(GenericDialog *gd, gpointer data)
1101 CollectWindow *cw = data;
1103 cw->close_dialog = NULL;
1104 generic_dialog_close(gd);
1107 static void collection_close_dlg_show(CollectWindow *cw)
1111 if (cw->close_dialog)
1113 gtk_window_present(GTK_WINDOW(cw->close_dialog));
1117 gd = generic_dialog_new(_("Close collection"),
1118 GQ_WMCLASS, "close_collection", cw->window, FALSE,
1119 collection_close_cancel_cb, cw);
1120 generic_dialog_add_message(gd, GTK_STOCK_DIALOG_QUESTION,
1121 _("Close collection"),
1122 _("Collection has been modified.\nSave first?"));
1124 generic_dialog_add_button(gd, GTK_STOCK_SAVE, NULL, collection_close_save_cb, TRUE);
1125 generic_dialog_add_button(gd, GTK_STOCK_DELETE, _("_Discard"), collection_close_close_cb, FALSE);
1127 cw->close_dialog = gd->dialog;
1129 gtk_widget_show(gd->dialog);
1132 static void collection_window_close(CollectWindow *cw)
1134 if (!cw->cd->changed && !cw->close_dialog)
1136 collection_window_close_final(cw);
1140 collection_close_dlg_show(cw);
1143 void collection_window_close_by_collection(CollectionData *cd)
1147 cw = collection_window_find(cd);
1148 if (cw) collection_window_close_final(cw);
1151 gint collection_window_modified_exists(void)
1155 work = collection_window_list;
1158 CollectWindow *cw = work->data;
1159 if (cw->cd->changed) return TRUE;
1166 static gint collection_window_delete(GtkWidget *widget, GdkEvent *event, gpointer data)
1168 CollectWindow *cw = data;
1169 collection_window_close(cw);
1174 CollectWindow *collection_window_new(const gchar *path)
1179 GtkWidget *status_label;
1180 GtkWidget *extra_label;
1181 GdkGeometry geometry;
1183 cw = g_new0(CollectWindow, 1);
1185 cw->close_dialog = NULL;
1187 collection_window_list = g_list_append(collection_window_list, cw);
1189 cw->cd = collection_new(path);
1191 cw->window = window_new(GTK_WINDOW_TOPLEVEL, "collection", PIXBUF_INLINE_ICON_BOOK, NULL, NULL);
1193 geometry.min_width = 32;
1194 geometry.min_height = 32;
1195 geometry.base_width = COLLECT_DEF_WIDTH;
1196 geometry.base_height = COLLECT_DEF_HEIGHT;
1197 gtk_window_set_geometry_hints(GTK_WINDOW(cw->window), NULL, &geometry,
1198 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);
1201 if (options->save_window_positions && path && collection_load_only_geometry(cw->cd, path))
1203 /* FIXME: x, y is not implemented */
1204 gtk_window_set_default_size(GTK_WINDOW(cw->window), cw->cd->window_w, cw->cd->window_h);
1208 gtk_window_set_default_size(GTK_WINDOW(cw->window), COLLECT_DEF_WIDTH, COLLECT_DEF_HEIGHT);
1211 gtk_window_set_resizable(GTK_WINDOW(cw->window), TRUE);
1212 collection_window_update_title(cw);
1213 gtk_container_set_border_width (GTK_CONTAINER (cw->window), 0);
1215 g_signal_connect(G_OBJECT(cw->window), "delete_event",
1216 G_CALLBACK(collection_window_delete), cw);
1218 g_signal_connect(G_OBJECT(cw->window),"key_press_event",
1219 G_CALLBACK(collection_window_keypress), cw);
1221 vbox = gtk_vbox_new(FALSE, 0);
1222 gtk_container_add(GTK_CONTAINER(cw->window), vbox);
1223 gtk_widget_show(vbox);
1225 cw->table = collection_table_new(cw->cd);
1226 gtk_box_pack_start(GTK_BOX(vbox), cw->table->scrolled, TRUE, TRUE, 0);
1227 gtk_widget_show(cw->table->scrolled);
1229 cw->status_box = gtk_hbox_new(TRUE, 0);
1230 gtk_box_pack_start(GTK_BOX(vbox), cw->status_box, FALSE, FALSE, 0);
1231 gtk_widget_show(cw->status_box);
1233 frame = gtk_frame_new(NULL);
1234 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
1235 gtk_box_pack_start(GTK_BOX(cw->status_box), frame, TRUE, TRUE, 0);
1236 gtk_widget_show(frame);
1238 status_label = gtk_label_new("");
1239 gtk_container_add(GTK_CONTAINER(frame), status_label);
1240 gtk_widget_show(status_label);
1242 extra_label = gtk_progress_bar_new();
1243 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(extra_label), 0.0);
1244 gtk_box_pack_start(GTK_BOX(cw->status_box), extra_label, TRUE, TRUE, 0);
1245 gtk_widget_show(extra_label);
1247 collection_table_set_labels(cw->table, status_label, extra_label);
1249 gtk_widget_show(cw->window);
1250 gtk_widget_grab_focus(cw->table->listview);
1252 collection_set_update_info_func(cw->cd, collection_window_update_info, cw);
1254 if (path && *path == '/') collection_load_begin(cw->cd, NULL, FALSE);