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"
25 #include "layout_image.h"
26 #include "pixbuf_util.h"
29 #include "ui_fileops.h"
30 #include "ui_tree_edit.h"
33 #include <gdk/gdkkeysyms.h> /* for keyboard values */
36 #define COLLECT_DEF_WIDTH 440
37 #define COLLECT_DEF_HEIGHT 450
39 static GList *collection_list = NULL;
40 static GList *collection_window_list = NULL;
42 static void collection_window_get_geometry(CollectWindow *cw);
43 static void collection_window_refresh(CollectWindow *cw);
44 static void collection_window_update_title(CollectWindow *cw);
45 static void collection_window_add(CollectWindow *cw, CollectInfo *ci);
46 static void collection_window_insert(CollectWindow *cw, CollectInfo *ci);
47 static void collection_window_remove(CollectWindow *cw, CollectInfo *ci);
48 static void collection_window_update(CollectWindow *cw, CollectInfo *ci);
50 static void collection_window_close(CollectWindow *cw);
52 static void collection_notify_cb(FileData *fd, NotifyType type, gpointer data);
55 *-------------------------------------------------------------------
57 *-------------------------------------------------------------------
60 CollectInfo *collection_info_new(FileData *fd, struct stat *st, GdkPixbuf *pixbuf)
66 ci = g_new0(CollectInfo, 1);
67 ci->fd = file_data_ref(fd);
70 if (ci->pixbuf) g_object_ref(ci->pixbuf);
75 void collection_info_free_thumb(CollectInfo *ci)
77 if (ci->pixbuf) g_object_unref(ci->pixbuf);
81 void collection_info_free(CollectInfo *ci)
85 file_data_unref(ci->fd);
86 collection_info_free_thumb(ci);
90 void collection_info_set_thumb(CollectInfo *ci, GdkPixbuf *pixbuf)
92 if (pixbuf) g_object_ref(pixbuf);
93 collection_info_free_thumb(ci);
97 gint collection_info_load_thumb(CollectInfo *ci)
99 if (!ci) return FALSE;
101 collection_info_free_thumb(ci);
103 log_printf("collection_info_load_thumb not implemented!\n(because an instant thumb loader not implemented)");
106 if (create_thumbnail(ci->fd->path, &ci->pixmap, &ci->mask) < 0) return FALSE;
108 if (ci->pixmap) gdk_pixmap_ref(ci->pixmap);
109 if (ci->mask) gdk_bitmap_ref(ci->mask);
115 void collection_list_free(GList *list)
121 collection_info_free((CollectInfo *)work->data);
127 /* an ugly static var, well what ya gonna do ? */
128 static SortType collection_list_sort_method = SORT_NAME;
130 static gint collection_list_sort_cb(gconstpointer a, gconstpointer b)
132 const CollectInfo *cia = a;
133 const CollectInfo *cib = b;
135 switch(collection_list_sort_method)
143 if (cia->fd->size < cib->fd->size) return -1;
144 if (cia->fd->size > cib->fd->size) return 1;
148 if (cia->fd->date < cib->fd->date) return -1;
149 if (cia->fd->date > cib->fd->date) return 1;
153 return utf8_compare(cia->fd->path, cib->fd->path, options->file_sort.case_sensitive);
155 #ifdef HAVE_STRVERSCMP
157 return strverscmp(cia->fd->name, cib->fd->name);
164 if (options->file_sort.case_sensitive)
165 return strcmp(cia->fd->collate_key_name, cib->fd->collate_key_name);
167 return strcmp(cia->fd->collate_key_name_nocase, cib->fd->collate_key_name_nocase);
170 GList *collection_list_sort(GList *list, SortType method)
172 if (method == SORT_NONE) return list;
174 collection_list_sort_method = method;
176 return g_list_sort(list, collection_list_sort_cb);
179 GList *collection_list_add(GList *list, CollectInfo *ci, SortType method)
181 if (method != SORT_NONE)
183 collection_list_sort_method = method;
184 list = g_list_insert_sorted(list, ci, collection_list_sort_cb);
188 list = g_list_append(list, ci);
194 GList *collection_list_insert(GList *list, CollectInfo *ci, CollectInfo *insert_ci, SortType method)
196 if (method != SORT_NONE)
198 collection_list_sort_method = method;
199 list = g_list_insert_sorted(list, ci, collection_list_sort_cb);
205 point = g_list_find(list, insert_ci);
206 list = uig_list_insert_link(list, point, ci);
212 GList *collection_list_remove(GList *list, CollectInfo *ci)
214 list = g_list_remove(list, ci);
215 collection_info_free(ci);
219 CollectInfo *collection_list_find_fd(GList *list, FileData *fd)
225 CollectInfo *ci = work->data;
226 if (ci->fd == fd) return ci;
234 static GList *collection_list_find_link(GList *list, gchar *path)
240 CollectInfo *ci = work->data;
241 if (strcmp(ci->fd->path, path) == 0) return work;
248 static gint collection_list_find_index(GList *list, gchar *path)
255 CollectInfo *ci = work->data;
256 if (strcmp(ci->fd->path, path) == 0) return c;
265 GList *collection_list_to_filelist(GList *list)
267 GList *filelist = NULL;
272 CollectInfo *info = work->data;
273 filelist = g_list_prepend(filelist, file_data_ref(info->fd));
277 filelist = g_list_reverse(filelist);
281 CollectWindow *collection_window_find(CollectionData *cd)
285 work = collection_window_list;
288 CollectWindow *cw = work->data;
289 if (cw->cd == cd) return cw;
296 CollectWindow *collection_window_find_by_path(const gchar *path)
300 if (!path) return NULL;
302 work = collection_window_list;
305 CollectWindow *cw = work->data;
306 if (cw->cd->path && strcmp(cw->cd->path, path) == 0) return cw;
314 *-------------------------------------------------------------------
315 * please use these to actually add/remove stuff
316 *-------------------------------------------------------------------
319 CollectionData *collection_new(const gchar *path)
322 static gint untitled_counter = 0;
324 cd = g_new0(CollectionData, 1);
326 collection_list = g_list_append(collection_list, cd);
328 cd->ref = 1; /* starts with a ref of 1 */
331 cd->sort_method = SORT_NONE;
332 cd->thumb_loader = NULL;
333 cd->info_updated_func = NULL;
335 cd->window_read = FALSE;
338 cd->window_w = COLLECT_DEF_WIDTH;
339 cd->window_h = COLLECT_DEF_HEIGHT;
343 cd->existence = g_hash_table_new(NULL, NULL);
347 cd->path = g_strdup(path);
348 cd->name = g_strdup(filename_from_path(cd->path));
355 if (untitled_counter == 0)
357 cd->name = g_strdup(_("Untitled"));
361 cd->name = g_strdup_printf(_("Untitled (%d)"), untitled_counter + 1);
367 file_data_register_notify_func(collection_notify_cb, cd, NOTIFY_PRIORITY_MEDIUM);
372 void collection_free(CollectionData *cd)
376 DEBUG_1("collection \"%s\" freed", cd->name);
378 collection_load_stop(cd);
379 collection_list_free(cd->list);
381 file_data_unregister_notify_func(collection_notify_cb, cd);
383 collection_list = g_list_remove(collection_list, cd);
385 g_hash_table_destroy(cd->existence);
393 void collection_ref(CollectionData *cd)
397 DEBUG_1("collection \"%s\" ref count = %d", cd->name, cd->ref);
400 void collection_unref(CollectionData *cd)
404 DEBUG_1("collection \"%s\" ref count = %d", cd->name, cd->ref);
412 void collection_path_changed(CollectionData *cd)
414 collection_window_update_title(collection_window_find(cd));
417 gint collection_to_number(CollectionData *cd)
419 return g_list_index(collection_list, cd);
422 CollectionData *collection_from_number(gint n)
424 return g_list_nth_data(collection_list, n);
427 CollectionData *collection_from_dnd_data(const gchar *data, GList **list, GList **info_list)
432 if (strncmp(data, "COLLECTION:", 11) != 0) return NULL;
434 n = (gint)strtol(data + 11, NULL, 10);
435 cd = collection_from_number(n);
437 if (!cd || (!list && !info_list))
448 while (data[b] != '\0' && data[b] != '\n' ) b++;
452 while (data[b] != '\0')
456 while (data[e] != '\n' && data[e] != '\0') e++;
457 n = (gint)strtol(data + b, NULL, 10);
459 info = g_list_nth_data(cd->list, n);
460 if (info && list) work = g_list_append(work, file_data_ref(info->fd));
461 if (info && info_list) infol = g_list_append(infol, info);
463 while (data[e] == '\n') e++;
466 if (list) *list = work;
467 if (info_list) *info_list = infol;
473 gchar *collection_info_list_to_dnd_data(CollectionData *cd, GList *list, gint *length)
475 gchar *uri_text = NULL;
482 n = collection_to_number(cd);
491 temp = g_list_prepend(temp, g_strdup_printf("COLLECTION:%d\n", n));
495 n = g_list_index(cd->list, work->data);
498 temp = g_list_prepend(temp, g_strdup_printf("%d\n", n));
507 total += strlen((gchar *)work->data);
512 uri_text = g_malloc(total);
515 work = g_list_last(temp);
518 gchar *text = work->data;
528 string_list_free(temp);
535 gint collection_info_valid(CollectionData *cd, CollectInfo *info)
537 if (collection_to_number(cd) < 0) return FALSE;
539 return (g_list_index(cd->list, info) != 0);
542 CollectInfo *collection_next_by_info(CollectionData *cd, CollectInfo *info)
546 work = g_list_find(cd->list, info);
548 if (!work) return NULL;
550 if (work) return work->data;
554 CollectInfo *collection_prev_by_info(CollectionData *cd, CollectInfo *info)
558 work = g_list_find(cd->list, info);
560 if (!work) return NULL;
562 if (work) return work->data;
566 CollectInfo *collection_get_first(CollectionData *cd)
568 if (cd->list) return cd->list->data;
573 CollectInfo *collection_get_last(CollectionData *cd)
577 list = g_list_last(cd->list);
579 if (list) return list->data;
584 void collection_set_sort_method(CollectionData *cd, SortType method)
588 if (cd->sort_method == method) return;
590 cd->sort_method = method;
591 cd->list = collection_list_sort(cd->list, cd->sort_method);
592 if (cd->list) cd->changed = TRUE;
594 collection_window_refresh(collection_window_find(cd));
597 void collection_set_update_info_func(CollectionData *cd,
598 void (*func)(CollectionData *, CollectInfo *, gpointer), gpointer data)
600 cd->info_updated_func = func;
601 cd->info_updated_data = data;
604 static CollectInfo *collection_info_new_if_not_exists(CollectionData *cd, struct stat *st, FileData *fd)
608 if (g_hash_table_lookup(cd->existence, fd->path)) return NULL;
610 ci = collection_info_new(fd, st, NULL);
611 if (ci) g_hash_table_insert(cd->existence, fd->path, "");
615 gint collection_add_check(CollectionData *cd, FileData *fd, gint sorted, gint must_exist)
622 valid = (stat_utf8(fd->path, &st) && !S_ISDIR(st.st_mode));
635 ci = collection_info_new_if_not_exists(cd, &st, fd);
636 if (!ci) return FALSE;
637 DEBUG_3("add to collection: %s", fd->path);
639 cd->list = collection_list_add(cd->list, ci, sorted ? cd->sort_method : SORT_NONE);
642 if (!sorted || cd->sort_method == SORT_NONE)
644 collection_window_add(collection_window_find(cd), ci);
648 collection_window_insert(collection_window_find(cd), ci);
655 gint collection_add(CollectionData *cd, FileData *fd, gint sorted)
657 return collection_add_check(cd, fd, sorted, TRUE);
660 gint collection_insert(CollectionData *cd, FileData *fd, CollectInfo *insert_ci, gint sorted)
664 if (!insert_ci) return collection_add(cd, fd, sorted);
666 if (stat_utf8(fd->path, &st) >= 0 && !S_ISDIR(st.st_mode))
670 ci = collection_info_new_if_not_exists(cd, &st, fd);
671 if (!ci) return FALSE;
673 DEBUG_3("insert in collection: %s", fd->path);
675 cd->list = collection_list_insert(cd->list, ci, insert_ci, sorted ? cd->sort_method : SORT_NONE);
678 collection_window_insert(collection_window_find(cd), ci);
686 gint collection_remove(CollectionData *cd, FileData *fd)
690 ci = collection_list_find_fd(cd->list, fd);
692 if (!ci) return FALSE;
694 g_hash_table_remove(cd->existence, fd->path);
696 cd->list = g_list_remove(cd->list, ci);
699 collection_window_remove(collection_window_find(cd), ci);
700 collection_info_free(ci);
705 static void collection_remove_by_info(CollectionData *cd, CollectInfo *info)
707 if (!info || !g_list_find(cd->list, info)) return;
709 cd->list = g_list_remove(cd->list, info);
710 cd->changed = (cd->list != NULL);
712 collection_window_remove(collection_window_find(cd), info);
713 collection_info_free(info);
716 void collection_remove_by_info_list(CollectionData *cd, GList *list)
724 /* more efficient (in collect-table) to remove a single item this way */
725 collection_remove_by_info(cd, (CollectInfo *)list->data);
732 cd->list = collection_list_remove(cd->list, work->data);
735 cd->changed = (cd->list != NULL);
737 collection_window_refresh(collection_window_find(cd));
740 gint collection_rename(CollectionData *cd, FileData *fd)
743 ci = collection_list_find_fd(cd->list, fd);
745 if (!ci) return FALSE;
749 collection_window_update(collection_window_find(cd), ci);
754 void collection_update_geometry(CollectionData *cd)
756 collection_window_get_geometry(collection_window_find(cd));
760 *-------------------------------------------------------------------
761 * simple maintenance for renaming, deleting
762 *-------------------------------------------------------------------
765 static void collection_notify_cb(FileData *fd, NotifyType type, gpointer data)
767 CollectionData *cd = data;
769 if (type != NOTIFY_TYPE_CHANGE || !fd->change) return;
771 switch(fd->change->type)
773 case FILEDATA_CHANGE_MOVE:
774 case FILEDATA_CHANGE_RENAME:
775 collection_rename(cd, fd);
777 case FILEDATA_CHANGE_COPY:
779 case FILEDATA_CHANGE_DELETE:
780 while (collection_remove(cd, fd));
782 case FILEDATA_CHANGE_UNSPECIFIED:
790 *-------------------------------------------------------------------
792 *-------------------------------------------------------------------
795 static gint collection_window_keypress(GtkWidget *widget, GdkEventKey *event, gpointer data)
797 CollectWindow *cw = data;
798 gint stop_signal = FALSE;
802 if (event->state & GDK_CONTROL_MASK)
805 switch (event->keyval)
838 if (event->state & GDK_SHIFT_MASK)
840 collection_table_unselect_all(cw->table);
844 collection_table_select_all(cw->table);
848 list = layout_list(NULL);
851 collection_table_add_filelist(cw->table, list);
856 file_util_copy(NULL, collection_table_selection_get_list(cw->table), NULL, cw->window);
859 file_util_move(NULL, collection_table_selection_get_list(cw->table), NULL, cw->window);
862 file_util_rename(NULL, collection_table_selection_get_list(cw->table), cw->window);
865 file_util_delete(NULL, collection_table_selection_get_list(cw->table), cw->window);
868 info_window_new(NULL, collection_table_selection_get_list(cw->table), NULL);
871 collection_dialog_save_as(NULL, cw->cd);
874 collection_window_close(cw);
884 switch (event->keyval)
886 case GDK_Return: case GDK_KP_Enter:
887 layout_image_set_collection(NULL, cw->cd,
888 collection_table_get_focus_info(cw->table));
891 view_window_new_from_collection(cw->cd,
892 collection_table_get_focus_info(cw->table));
897 collection_dialog_save_as(NULL, cw->cd);
899 else if (!collection_save(cw->cd, cw->cd->path))
901 log_printf("failed saving to collection path: %s\n", cw->cd->path);
905 collection_dialog_append(NULL, cw->cd);
908 collection_set_sort_method(cw->cd, SORT_NAME);
910 #ifdef HAVE_STRVERSCMP
912 collection_set_sort_method(cw->cd, SORT_NUMBER);
916 collection_set_sort_method(cw->cd, SORT_TIME);
919 collection_set_sort_method(cw->cd, SORT_SIZE);
922 if (event->state & GDK_SHIFT_MASK)
926 info = collection_table_get_focus_info(cw->table);
928 print_window_new(info->fd, collection_table_selection_get_list(cw->table),
929 collection_list_to_filelist(cw->cd->list), cw->window);
933 collection_set_sort_method(cw->cd, SORT_PATH);
936 case GDK_Delete: case GDK_KP_Delete:
937 list = g_list_copy(cw->table->selection);
940 collection_remove_by_info_list(cw->cd, list);
945 collection_remove_by_info(cw->cd, collection_table_get_focus_info(cw->table));
956 list = collection_table_selection_get_list(cw->table);
957 file_util_start_editor_from_filelist(edit_val, list, cw->window);
965 *-------------------------------------------------------------------
967 *-------------------------------------------------------------------
969 static void collection_window_get_geometry(CollectWindow *cw)
976 gdk_window_get_position(cw->window->window, &cd->window_x, &cd->window_y);
977 gdk_drawable_get_size(cw->window->window, &cd->window_w, &cd->window_h);
978 cd->window_read = TRUE;
981 static void collection_window_refresh(CollectWindow *cw)
985 collection_table_refresh(cw->table);
988 static void collection_window_update_title(CollectWindow *cw)
994 buf = g_strdup_printf(_("%s - Collection - %s"), cw->cd->name, GQ_APPNAME);
995 gtk_window_set_title(GTK_WINDOW(cw->window), buf);
999 static void collection_window_update_info(CollectionData *cd, CollectInfo *ci, gpointer data)
1001 CollectWindow *cw = data;
1003 collection_table_file_update(cw->table, ci);
1006 static void collection_window_add(CollectWindow *cw, CollectInfo *ci)
1010 if (!ci->pixbuf) collection_load_thumb_idle(cw->cd);
1011 collection_table_file_add(cw->table, ci);
1014 static void collection_window_insert(CollectWindow *cw, CollectInfo *ci)
1018 if (!ci->pixbuf) collection_load_thumb_idle(cw->cd);
1019 collection_table_file_insert(cw->table, ci);
1024 static void collection_window_move(CollectWindow *cw, CollectInfo *ci)
1030 static void collection_window_remove(CollectWindow *cw, CollectInfo *ci)
1034 collection_table_file_remove(cw->table, ci);
1037 static void collection_window_update(CollectWindow *cw, CollectInfo *ci)
1041 collection_table_file_update(cw->table, ci);
1042 collection_table_file_update(cw->table, NULL);
1045 static void collection_window_close_final(CollectWindow *cw)
1047 if (cw->close_dialog) return;
1049 collection_window_list = g_list_remove(collection_window_list, cw);
1050 collection_window_get_geometry(cw);
1052 gtk_widget_destroy(cw->window);
1054 collection_set_update_info_func(cw->cd, NULL, NULL);
1055 collection_unref(cw->cd);
1060 static void collection_close_save_cb(GenericDialog *gd, gpointer data)
1062 CollectWindow *cw = data;
1064 cw->close_dialog = NULL;
1065 generic_dialog_close(gd);
1069 collection_dialog_save_close(NULL, cw->cd);
1072 else if (!collection_save(cw->cd, cw->cd->path))
1075 buf = g_strdup_printf(_("Failed to save the collection:\n%s"), cw->cd->path);
1076 warning_dialog(_("Save Failed"), buf, GTK_STOCK_DIALOG_ERROR, cw->window);
1081 collection_window_close_final(cw);
1084 static void collection_close_close_cb(GenericDialog *gd, gpointer data)
1086 CollectWindow *cw = data;
1088 cw->close_dialog = NULL;
1089 generic_dialog_close(gd);
1091 collection_window_close_final(cw);
1094 static void collection_close_cancel_cb(GenericDialog *gd, gpointer data)
1096 CollectWindow *cw = data;
1098 cw->close_dialog = NULL;
1099 generic_dialog_close(gd);
1102 static void collection_close_dlg_show(CollectWindow *cw)
1106 if (cw->close_dialog)
1108 gtk_window_present(GTK_WINDOW(cw->close_dialog));
1112 gd = generic_dialog_new(_("Close collection"),
1113 GQ_WMCLASS, "close_collection", cw->window, FALSE,
1114 collection_close_cancel_cb, cw);
1115 generic_dialog_add_message(gd, GTK_STOCK_DIALOG_QUESTION,
1116 _("Close collection"),
1117 _("Collection has been modified.\nSave first?"));
1119 generic_dialog_add_button(gd, GTK_STOCK_SAVE, NULL, collection_close_save_cb, TRUE);
1120 generic_dialog_add_button(gd, GTK_STOCK_DELETE, _("_Discard"), collection_close_close_cb, FALSE);
1122 cw->close_dialog = gd->dialog;
1124 gtk_widget_show(gd->dialog);
1127 static void collection_window_close(CollectWindow *cw)
1129 if (!cw->cd->changed && !cw->close_dialog)
1131 collection_window_close_final(cw);
1135 collection_close_dlg_show(cw);
1138 void collection_window_close_by_collection(CollectionData *cd)
1142 cw = collection_window_find(cd);
1143 if (cw) collection_window_close_final(cw);
1146 gint collection_window_modified_exists(void)
1150 work = collection_window_list;
1153 CollectWindow *cw = work->data;
1154 if (cw->cd->changed) return TRUE;
1161 static gint collection_window_delete(GtkWidget *widget, GdkEvent *event, gpointer data)
1163 CollectWindow *cw = data;
1164 collection_window_close(cw);
1169 CollectWindow *collection_window_new(const gchar *path)
1174 GtkWidget *status_label;
1175 GtkWidget *extra_label;
1176 GdkGeometry geometry;
1178 cw = g_new0(CollectWindow, 1);
1180 cw->close_dialog = NULL;
1182 collection_window_list = g_list_append(collection_window_list, cw);
1184 cw->cd = collection_new(path);
1186 cw->window = window_new(GTK_WINDOW_TOPLEVEL, "collection", PIXBUF_INLINE_ICON_BOOK, NULL, NULL);
1188 geometry.min_width = 32;
1189 geometry.min_height = 32;
1190 geometry.base_width = COLLECT_DEF_WIDTH;
1191 geometry.base_height = COLLECT_DEF_HEIGHT;
1192 gtk_window_set_geometry_hints(GTK_WINDOW(cw->window), NULL, &geometry,
1193 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);
1196 if (options->layout.save_window_positions && path && collection_load_only_geometry(cw->cd, path))
1198 /* FIXME: x, y is not implemented */
1199 gtk_window_set_default_size(GTK_WINDOW(cw->window), cw->cd->window_w, cw->cd->window_h);
1203 gtk_window_set_default_size(GTK_WINDOW(cw->window), COLLECT_DEF_WIDTH, COLLECT_DEF_HEIGHT);
1206 gtk_window_set_resizable(GTK_WINDOW(cw->window), TRUE);
1207 collection_window_update_title(cw);
1208 gtk_container_set_border_width(GTK_CONTAINER(cw->window), 0);
1210 g_signal_connect(G_OBJECT(cw->window), "delete_event",
1211 G_CALLBACK(collection_window_delete), cw);
1213 g_signal_connect(G_OBJECT(cw->window), "key_press_event",
1214 G_CALLBACK(collection_window_keypress), cw);
1216 vbox = gtk_vbox_new(FALSE, 0);
1217 gtk_container_add(GTK_CONTAINER(cw->window), vbox);
1218 gtk_widget_show(vbox);
1220 cw->table = collection_table_new(cw->cd);
1221 gtk_box_pack_start(GTK_BOX(vbox), cw->table->scrolled, TRUE, TRUE, 0);
1222 gtk_widget_show(cw->table->scrolled);
1224 cw->status_box = gtk_hbox_new(TRUE, 0);
1225 gtk_box_pack_start(GTK_BOX(vbox), cw->status_box, FALSE, FALSE, 0);
1226 gtk_widget_show(cw->status_box);
1228 frame = gtk_frame_new(NULL);
1229 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
1230 gtk_box_pack_start(GTK_BOX(cw->status_box), frame, TRUE, TRUE, 0);
1231 gtk_widget_show(frame);
1233 status_label = gtk_label_new("");
1234 gtk_container_add(GTK_CONTAINER(frame), status_label);
1235 gtk_widget_show(status_label);
1237 extra_label = gtk_progress_bar_new();
1238 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(extra_label), 0.0);
1239 gtk_box_pack_start(GTK_BOX(cw->status_box), extra_label, TRUE, TRUE, 0);
1240 gtk_widget_show(extra_label);
1242 collection_table_set_labels(cw->table, status_label, extra_label);
1244 gtk_widget_show(cw->window);
1245 gtk_widget_grab_focus(cw->table->listview);
1247 collection_set_update_info_func(cw->cd, collection_window_update_info, cw);
1249 if (path && *path == G_DIR_SEPARATOR) collection_load_begin(cw->cd, NULL, COLLECTION_LOAD_NONE);