4 * Copyright (C) 2008 - 2012 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"
24 #include "layout_image.h"
26 #include "pixbuf_util.h"
28 #include "ui_fileops.h"
29 #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 gboolean 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)");
107 void collection_list_free(GList *list)
113 collection_info_free((CollectInfo *)work->data);
119 /* an ugly static var, well what ya gonna do ? */
120 static SortType collection_list_sort_method = SORT_NAME;
122 static gint collection_list_sort_cb(gconstpointer a, gconstpointer b)
124 const CollectInfo *cia = a;
125 const CollectInfo *cib = b;
127 switch (collection_list_sort_method)
135 if (cia->fd->size < cib->fd->size) return -1;
136 if (cia->fd->size > cib->fd->size) return 1;
140 if (cia->fd->date < cib->fd->date) return -1;
141 if (cia->fd->date > cib->fd->date) return 1;
145 if (cia->fd->cdate < cib->fd->cdate) return -1;
146 if (cia->fd->cdate > cib->fd->cdate) return 1;
150 return utf8_compare(cia->fd->path, cib->fd->path, options->file_sort.case_sensitive);
152 #ifdef HAVE_STRVERSCMP
154 return strverscmp(cia->fd->name, cib->fd->name);
161 if (options->file_sort.case_sensitive)
162 return strcmp(cia->fd->collate_key_name, cib->fd->collate_key_name);
164 return strcmp(cia->fd->collate_key_name_nocase, cib->fd->collate_key_name_nocase);
167 GList *collection_list_sort(GList *list, SortType method)
169 if (method == SORT_NONE) return list;
171 collection_list_sort_method = method;
173 return g_list_sort(list, collection_list_sort_cb);
176 GList *collection_list_randomize(GList *list)
178 guint random, length, i;
180 GList *nlist, *olist;
182 length = g_list_length(list);
183 if (!length) return NULL;
185 srand((unsigned int)time(NULL)); // Initialize random generator (hasn't to be that much strong)
187 for (i = 0; i < length; i++)
189 random = (guint) (1.0 * length * rand()/(RAND_MAX + 1.0));
190 olist = g_list_nth(list, i);
191 nlist = g_list_nth(list, random);
193 olist->data = nlist->data;
200 GList *collection_list_add(GList *list, CollectInfo *ci, SortType method)
202 if (method != SORT_NONE)
204 collection_list_sort_method = method;
205 list = g_list_insert_sorted(list, ci, collection_list_sort_cb);
209 list = g_list_append(list, ci);
215 GList *collection_list_insert(GList *list, CollectInfo *ci, CollectInfo *insert_ci, SortType method)
217 if (method != SORT_NONE)
219 collection_list_sort_method = method;
220 list = g_list_insert_sorted(list, ci, collection_list_sort_cb);
226 point = g_list_find(list, insert_ci);
227 list = uig_list_insert_link(list, point, ci);
233 GList *collection_list_remove(GList *list, CollectInfo *ci)
235 list = g_list_remove(list, ci);
236 collection_info_free(ci);
240 CollectInfo *collection_list_find_fd(GList *list, FileData *fd)
246 CollectInfo *ci = work->data;
247 if (ci->fd == fd) return ci;
254 GList *collection_list_to_filelist(GList *list)
256 GList *filelist = NULL;
261 CollectInfo *info = work->data;
262 filelist = g_list_prepend(filelist, file_data_ref(info->fd));
266 filelist = g_list_reverse(filelist);
270 CollectWindow *collection_window_find(CollectionData *cd)
274 work = collection_window_list;
277 CollectWindow *cw = work->data;
278 if (cw->cd == cd) return cw;
285 CollectWindow *collection_window_find_by_path(const gchar *path)
289 if (!path) return NULL;
291 work = collection_window_list;
294 CollectWindow *cw = work->data;
295 if (cw->cd->path && strcmp(cw->cd->path, path) == 0) return cw;
303 *-------------------------------------------------------------------
304 * please use these to actually add/remove stuff
305 *-------------------------------------------------------------------
308 CollectionData *collection_new(const gchar *path)
311 static gint untitled_counter = 0;
313 cd = g_new0(CollectionData, 1);
315 cd->ref = 1; /* starts with a ref of 1 */
316 cd->sort_method = SORT_NONE;
317 cd->window_w = COLLECT_DEF_WIDTH;
318 cd->window_h = COLLECT_DEF_HEIGHT;
319 cd->existence = g_hash_table_new(NULL, NULL);
323 cd->path = g_strdup(path);
324 cd->name = g_strdup(filename_from_path(cd->path));
329 if (untitled_counter == 0)
331 cd->name = g_strdup(_("Untitled"));
335 cd->name = g_strdup_printf(_("Untitled (%d)"), untitled_counter + 1);
341 file_data_register_notify_func(collection_notify_cb, cd, NOTIFY_PRIORITY_MEDIUM);
344 collection_list = g_list_append(collection_list, cd);
349 void collection_free(CollectionData *cd)
353 DEBUG_1("collection \"%s\" freed", cd->name);
355 collection_load_stop(cd);
356 collection_list_free(cd->list);
358 file_data_unregister_notify_func(collection_notify_cb, cd);
360 collection_list = g_list_remove(collection_list, cd);
362 g_hash_table_destroy(cd->existence);
370 void collection_ref(CollectionData *cd)
374 DEBUG_1("collection \"%s\" ref count = %d", cd->name, cd->ref);
377 void collection_unref(CollectionData *cd)
381 DEBUG_1("collection \"%s\" ref count = %d", cd->name, cd->ref);
389 void collection_path_changed(CollectionData *cd)
391 collection_window_update_title(collection_window_find(cd));
394 gint collection_to_number(CollectionData *cd)
396 return g_list_index(collection_list, cd);
399 CollectionData *collection_from_number(gint n)
401 return g_list_nth_data(collection_list, n);
404 CollectionData *collection_from_dnd_data(const gchar *data, GList **list, GList **info_list)
407 gint collection_number;
410 if (list) *list = NULL;
411 if (info_list) *info_list = NULL;
413 if (strncmp(data, "COLLECTION:", 11) != 0) return NULL;
417 collection_number = atoi(ptr);
418 cd = collection_from_number(collection_number);
419 if (!cd) return NULL;
421 if (!list && !info_list) return cd;
423 while (*ptr != '\0' && *ptr != '\n' ) ptr++;
424 if (*ptr == '\0') return cd;
432 item_number = (guint) atoi(ptr);
433 while (*ptr != '\n' && *ptr != '\0') ptr++;
437 while (*ptr == '\n') ptr++;
439 info = g_list_nth_data(cd->list, item_number);
442 if (list) *list = g_list_append(*list, file_data_ref(info->fd));
443 if (info_list) *info_list = g_list_append(*info_list, info);
449 gchar *collection_info_list_to_dnd_data(CollectionData *cd, GList *list, gint *length)
456 gint collection_number;
459 if (!list) return NULL;
461 collection_number = collection_to_number(cd);
462 if (collection_number < 0) return NULL;
464 text = g_strdup_printf("COLLECTION:%d\n", collection_number);
465 *length += strlen(text);
466 temp = g_list_prepend(temp, text);
471 gint item_number = g_list_index(cd->list, work->data);
475 if (item_number < 0) continue;
477 text = g_strdup_printf("%d\n", item_number);
478 temp = g_list_prepend(temp, text);
479 *length += strlen(text);
482 *length += 1; /* ending nul char */
484 uri_text = g_malloc(*length);
487 work = g_list_last(temp);
491 gchar *text = work->data;
496 memcpy(ptr, text, len);
502 string_list_free(temp);
507 gint collection_info_valid(CollectionData *cd, CollectInfo *info)
509 if (collection_to_number(cd) < 0) return FALSE;
511 return (g_list_index(cd->list, info) != 0);
514 CollectInfo *collection_next_by_info(CollectionData *cd, CollectInfo *info)
518 work = g_list_find(cd->list, info);
520 if (!work) return NULL;
522 if (work) return work->data;
526 CollectInfo *collection_prev_by_info(CollectionData *cd, CollectInfo *info)
530 work = g_list_find(cd->list, info);
532 if (!work) return NULL;
534 if (work) return work->data;
538 CollectInfo *collection_get_first(CollectionData *cd)
540 if (cd->list) return cd->list->data;
545 CollectInfo *collection_get_last(CollectionData *cd)
549 list = g_list_last(cd->list);
551 if (list) return list->data;
556 void collection_set_sort_method(CollectionData *cd, SortType method)
560 if (cd->sort_method == method) return;
562 cd->sort_method = method;
563 cd->list = collection_list_sort(cd->list, cd->sort_method);
564 if (cd->list) cd->changed = TRUE;
566 collection_window_refresh(collection_window_find(cd));
569 void collection_randomize(CollectionData *cd)
573 cd->list = collection_list_randomize(cd->list);
574 cd->sort_method = SORT_NONE;
575 if (cd->list) cd->changed = TRUE;
577 collection_window_refresh(collection_window_find(cd));
580 void collection_set_update_info_func(CollectionData *cd,
581 void (*func)(CollectionData *, CollectInfo *, gpointer), gpointer data)
583 cd->info_updated_func = func;
584 cd->info_updated_data = data;
587 static CollectInfo *collection_info_new_if_not_exists(CollectionData *cd, struct stat *st, FileData *fd)
591 if (g_hash_table_lookup(cd->existence, fd->path)) return NULL;
593 ci = collection_info_new(fd, st, NULL);
594 if (ci) g_hash_table_insert(cd->existence, fd->path, "");
598 gboolean collection_add_check(CollectionData *cd, FileData *fd, gboolean sorted, gboolean must_exist)
603 if (!fd) return FALSE;
605 g_assert(fd->magick == FD_MAGICK);
609 valid = (stat_utf8(fd->path, &st) && !S_ISDIR(st.st_mode));
622 ci = collection_info_new_if_not_exists(cd, &st, fd);
623 if (!ci) return FALSE;
624 DEBUG_3("add to collection: %s", fd->path);
626 cd->list = collection_list_add(cd->list, ci, sorted ? cd->sort_method : SORT_NONE);
629 if (!sorted || cd->sort_method == SORT_NONE)
631 collection_window_add(collection_window_find(cd), ci);
635 collection_window_insert(collection_window_find(cd), ci);
642 gboolean collection_add(CollectionData *cd, FileData *fd, gboolean sorted)
644 return collection_add_check(cd, fd, sorted, TRUE);
647 gboolean collection_insert(CollectionData *cd, FileData *fd, CollectInfo *insert_ci, gboolean sorted)
651 if (!insert_ci) return collection_add(cd, fd, sorted);
653 if (stat_utf8(fd->path, &st) >= 0 && !S_ISDIR(st.st_mode))
657 ci = collection_info_new_if_not_exists(cd, &st, fd);
658 if (!ci) return FALSE;
660 DEBUG_3("insert in collection: %s", fd->path);
662 cd->list = collection_list_insert(cd->list, ci, insert_ci, sorted ? cd->sort_method : SORT_NONE);
665 collection_window_insert(collection_window_find(cd), ci);
673 gboolean collection_remove(CollectionData *cd, FileData *fd)
677 ci = collection_list_find_fd(cd->list, fd);
679 if (!ci) return FALSE;
681 g_hash_table_remove(cd->existence, fd->path);
683 cd->list = g_list_remove(cd->list, ci);
686 collection_window_remove(collection_window_find(cd), ci);
687 collection_info_free(ci);
692 static void collection_remove_by_info(CollectionData *cd, CollectInfo *info)
694 if (!info || !g_list_find(cd->list, info)) return;
696 cd->list = g_list_remove(cd->list, info);
697 cd->changed = (cd->list != NULL);
699 collection_window_remove(collection_window_find(cd), info);
700 collection_info_free(info);
703 void collection_remove_by_info_list(CollectionData *cd, GList *list)
711 /* more efficient (in collect-table) to remove a single item this way */
712 collection_remove_by_info(cd, (CollectInfo *)list->data);
719 cd->list = collection_list_remove(cd->list, work->data);
722 cd->changed = (cd->list != NULL);
724 collection_window_refresh(collection_window_find(cd));
727 gboolean collection_rename(CollectionData *cd, FileData *fd)
730 ci = collection_list_find_fd(cd->list, fd);
732 if (!ci) return FALSE;
736 collection_window_update(collection_window_find(cd), ci);
741 void collection_update_geometry(CollectionData *cd)
743 collection_window_get_geometry(collection_window_find(cd));
747 *-------------------------------------------------------------------
748 * simple maintenance for renaming, deleting
749 *-------------------------------------------------------------------
752 static void collection_notify_cb(FileData *fd, NotifyType type, gpointer data)
754 CollectionData *cd = data;
756 if (!(type & NOTIFY_CHANGE) || !fd->change) return;
758 DEBUG_1("Notify collection: %s %04x", fd->path, type);
760 switch (fd->change->type)
762 case FILEDATA_CHANGE_MOVE:
763 case FILEDATA_CHANGE_RENAME:
764 collection_rename(cd, fd);
766 case FILEDATA_CHANGE_COPY:
768 case FILEDATA_CHANGE_DELETE:
769 while (collection_remove(cd, fd));
771 case FILEDATA_CHANGE_UNSPECIFIED:
772 case FILEDATA_CHANGE_WRITE_METADATA:
780 *-------------------------------------------------------------------
782 *-------------------------------------------------------------------
785 static gboolean collection_window_keypress(GtkWidget *widget, GdkEventKey *event, gpointer data)
787 CollectWindow *cw = data;
788 gboolean stop_signal = FALSE;
791 if (event->state & GDK_CONTROL_MASK)
794 switch (event->keyval)
808 if (event->state & GDK_SHIFT_MASK)
810 collection_table_unselect_all(cw->table);
814 collection_table_select_all(cw->table);
818 list = layout_list(NULL);
821 collection_table_add_filelist(cw->table, list);
826 file_util_copy(NULL, collection_table_selection_get_list(cw->table), NULL, cw->window);
829 file_util_move(NULL, collection_table_selection_get_list(cw->table), NULL, cw->window);
832 file_util_rename(NULL, collection_table_selection_get_list(cw->table), cw->window);
835 file_util_delete(NULL, collection_table_selection_get_list(cw->table), cw->window);
838 collection_dialog_save_as(NULL, cw->cd);
841 collection_window_close(cw);
851 switch (event->keyval)
853 case GDK_KEY_Return: case GDK_KEY_KP_Enter:
854 layout_image_set_collection(NULL, cw->cd,
855 collection_table_get_focus_info(cw->table));
858 view_window_new_from_collection(cw->cd,
859 collection_table_get_focus_info(cw->table));
864 collection_dialog_save_as(NULL, cw->cd);
866 else if (!collection_save(cw->cd, cw->cd->path))
868 log_printf("failed saving to collection path: %s\n", cw->cd->path);
872 collection_dialog_append(NULL, cw->cd);
875 collection_set_sort_method(cw->cd, SORT_NAME);
877 #ifdef HAVE_STRVERSCMP
879 collection_set_sort_method(cw->cd, SORT_NUMBER);
883 collection_set_sort_method(cw->cd, SORT_TIME);
886 collection_set_sort_method(cw->cd, SORT_SIZE);
889 if (event->state & GDK_SHIFT_MASK)
893 info = collection_table_get_focus_info(cw->table);
895 print_window_new(info->fd, collection_table_selection_get_list(cw->table),
896 collection_list_to_filelist(cw->cd->list), cw->window);
900 collection_set_sort_method(cw->cd, SORT_PATH);
903 case GDK_KEY_Delete: case GDK_KEY_KP_Delete:
904 list = g_list_copy(cw->table->selection);
907 collection_remove_by_info_list(cw->cd, list);
912 collection_remove_by_info(cw->cd, collection_table_get_focus_info(cw->table));
924 *-------------------------------------------------------------------
926 *-------------------------------------------------------------------
928 static void collection_window_get_geometry(CollectWindow *cw)
936 window = gtk_widget_get_window(cw->window);
937 gdk_window_get_position(window, &cd->window_x, &cd->window_y);
938 cd->window_w = gdk_window_get_width(window);
939 cd->window_h = gdk_window_get_height(window);
940 cd->window_read = TRUE;
943 static void collection_window_refresh(CollectWindow *cw)
947 collection_table_refresh(cw->table);
950 static void collection_window_update_title(CollectWindow *cw)
952 gboolean free_name = FALSE;
958 if (file_extension_match(cw->cd->name, GQ_COLLECTION_EXT))
960 name = remove_extension_from_path(cw->cd->name);
968 buf = g_strdup_printf(_("%s - Collection - %s"), name, GQ_APPNAME);
969 if (free_name) g_free(name);
970 gtk_window_set_title(GTK_WINDOW(cw->window), buf);
974 static void collection_window_update_info(CollectionData *cd, CollectInfo *ci, gpointer data)
976 CollectWindow *cw = data;
978 collection_table_file_update(cw->table, ci);
981 static void collection_window_add(CollectWindow *cw, CollectInfo *ci)
985 if (!ci->pixbuf) collection_load_thumb_idle(cw->cd);
986 collection_table_file_add(cw->table, ci);
989 static void collection_window_insert(CollectWindow *cw, CollectInfo *ci)
993 if (!ci->pixbuf) collection_load_thumb_idle(cw->cd);
994 collection_table_file_insert(cw->table, ci);
998 static void collection_window_remove(CollectWindow *cw, CollectInfo *ci)
1002 collection_table_file_remove(cw->table, ci);
1005 static void collection_window_update(CollectWindow *cw, CollectInfo *ci)
1009 collection_table_file_update(cw->table, ci);
1010 collection_table_file_update(cw->table, NULL);
1013 static void collection_window_close_final(CollectWindow *cw)
1015 if (cw->close_dialog) return;
1017 collection_window_list = g_list_remove(collection_window_list, cw);
1018 collection_window_get_geometry(cw);
1020 gtk_widget_destroy(cw->window);
1022 collection_set_update_info_func(cw->cd, NULL, NULL);
1023 collection_unref(cw->cd);
1028 static void collection_close_save_cb(GenericDialog *gd, gpointer data)
1030 CollectWindow *cw = data;
1032 cw->close_dialog = NULL;
1033 generic_dialog_close(gd);
1037 collection_dialog_save_close(NULL, cw->cd);
1040 else if (!collection_save(cw->cd, cw->cd->path))
1043 buf = g_strdup_printf(_("Failed to save the collection:\n%s"), cw->cd->path);
1044 warning_dialog(_("Save Failed"), buf, GTK_STOCK_DIALOG_ERROR, cw->window);
1049 collection_window_close_final(cw);
1052 static void collection_close_close_cb(GenericDialog *gd, gpointer data)
1054 CollectWindow *cw = data;
1056 cw->close_dialog = NULL;
1057 generic_dialog_close(gd);
1059 collection_window_close_final(cw);
1062 static void collection_close_cancel_cb(GenericDialog *gd, gpointer data)
1064 CollectWindow *cw = data;
1066 cw->close_dialog = NULL;
1067 generic_dialog_close(gd);
1070 static void collection_close_dlg_show(CollectWindow *cw)
1074 if (cw->close_dialog)
1076 gtk_window_present(GTK_WINDOW(cw->close_dialog));
1080 gd = generic_dialog_new(_("Close collection"),
1081 "close_collection", cw->window, FALSE,
1082 collection_close_cancel_cb, cw);
1083 generic_dialog_add_message(gd, GTK_STOCK_DIALOG_QUESTION,
1084 _("Close collection"),
1085 _("Collection has been modified.\nSave first?"));
1087 generic_dialog_add_button(gd, GTK_STOCK_SAVE, NULL, collection_close_save_cb, TRUE);
1088 generic_dialog_add_button(gd, GTK_STOCK_DELETE, _("_Discard"), collection_close_close_cb, FALSE);
1090 cw->close_dialog = gd->dialog;
1092 gtk_widget_show(gd->dialog);
1095 static void collection_window_close(CollectWindow *cw)
1097 if (!cw->cd->changed && !cw->close_dialog)
1099 collection_window_close_final(cw);
1103 collection_close_dlg_show(cw);
1106 void collection_window_close_by_collection(CollectionData *cd)
1110 cw = collection_window_find(cd);
1111 if (cw) collection_window_close_final(cw);
1114 gboolean collection_window_modified_exists(void)
1118 work = collection_window_list;
1121 CollectWindow *cw = work->data;
1122 if (cw->cd->changed) return TRUE;
1129 static gboolean collection_window_delete(GtkWidget *widget, GdkEvent *event, gpointer data)
1131 CollectWindow *cw = data;
1132 collection_window_close(cw);
1137 CollectWindow *collection_window_new(const gchar *path)
1142 GtkWidget *status_label;
1143 GtkWidget *extra_label;
1144 GdkGeometry geometry;
1146 cw = g_new0(CollectWindow, 1);
1148 collection_window_list = g_list_append(collection_window_list, cw);
1150 cw->cd = collection_new(path);
1152 cw->window = window_new(GTK_WINDOW_TOPLEVEL, "collection", PIXBUF_INLINE_ICON_BOOK, NULL, NULL);
1154 geometry.min_width = DEFAULT_MINIMAL_WINDOW_SIZE;
1155 geometry.min_height = DEFAULT_MINIMAL_WINDOW_SIZE;
1156 geometry.base_width = COLLECT_DEF_WIDTH;
1157 geometry.base_height = COLLECT_DEF_HEIGHT;
1158 gtk_window_set_geometry_hints(GTK_WINDOW(cw->window), NULL, &geometry,
1159 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);
1162 if (options->save_window_positions && path && collection_load_only_geometry(cw->cd, path))
1164 /* FIXME: x, y is not implemented */
1165 gtk_window_set_default_size(GTK_WINDOW(cw->window), cw->cd->window_w, cw->cd->window_h);
1169 gtk_window_set_default_size(GTK_WINDOW(cw->window), COLLECT_DEF_WIDTH, COLLECT_DEF_HEIGHT);
1172 gtk_window_set_resizable(GTK_WINDOW(cw->window), TRUE);
1173 collection_window_update_title(cw);
1174 gtk_container_set_border_width(GTK_CONTAINER(cw->window), 0);
1176 g_signal_connect(G_OBJECT(cw->window), "delete_event",
1177 G_CALLBACK(collection_window_delete), cw);
1179 g_signal_connect(G_OBJECT(cw->window), "key_press_event",
1180 G_CALLBACK(collection_window_keypress), cw);
1182 vbox = gtk_vbox_new(FALSE, 0);
1183 gtk_container_add(GTK_CONTAINER(cw->window), vbox);
1184 gtk_widget_show(vbox);
1186 cw->table = collection_table_new(cw->cd);
1187 gtk_box_pack_start(GTK_BOX(vbox), cw->table->scrolled, TRUE, TRUE, 0);
1188 gtk_widget_show(cw->table->scrolled);
1190 cw->status_box = gtk_hbox_new(TRUE, 0);
1191 gtk_box_pack_start(GTK_BOX(vbox), cw->status_box, FALSE, FALSE, 0);
1192 gtk_widget_show(cw->status_box);
1194 frame = gtk_frame_new(NULL);
1195 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
1196 gtk_box_pack_start(GTK_BOX(cw->status_box), frame, TRUE, TRUE, 0);
1197 gtk_widget_show(frame);
1199 status_label = gtk_label_new("");
1200 gtk_container_add(GTK_CONTAINER(frame), status_label);
1201 gtk_widget_show(status_label);
1203 extra_label = gtk_progress_bar_new();
1204 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(extra_label), 0.0);
1205 gtk_box_pack_start(GTK_BOX(cw->status_box), extra_label, TRUE, TRUE, 0);
1206 gtk_widget_show(extra_label);
1208 collection_table_set_labels(cw->table, status_label, extra_label);
1210 gtk_widget_show(cw->window);
1211 gtk_widget_grab_focus(cw->table->listview);
1213 collection_set_update_info_func(cw->cd, collection_window_update_info, cw);
1215 if (path && *path == G_DIR_SEPARATOR) collection_load_begin(cw->cd, NULL, COLLECTION_LOAD_NONE);
1219 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */