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 return utf8_compare(cia->fd->path, cib->fd->path, options->file_sort.case_sensitive);
147 #ifdef HAVE_STRVERSCMP
149 return strverscmp(cia->fd->name, cib->fd->name);
156 if (options->file_sort.case_sensitive)
157 return strcmp(cia->fd->collate_key_name, cib->fd->collate_key_name);
159 return strcmp(cia->fd->collate_key_name_nocase, cib->fd->collate_key_name_nocase);
162 GList *collection_list_sort(GList *list, SortType method)
164 if (method == SORT_NONE) return list;
166 collection_list_sort_method = method;
168 return g_list_sort(list, collection_list_sort_cb);
171 GList *collection_list_randomize(GList *list)
173 guint random, length, i;
175 GList *nlist, *olist;
177 length = g_list_length(list);
178 if (!length) return NULL;
180 srand((unsigned int)time(NULL)); // Initialize random generator (hasn't to be that much strong)
182 for (i = 0; i < length; i++)
184 random = (guint) (1.0 * length * rand()/(RAND_MAX + 1.0));
185 olist = g_list_nth(list, i);
186 nlist = g_list_nth(list, random);
188 olist->data = nlist->data;
195 GList *collection_list_add(GList *list, CollectInfo *ci, SortType method)
197 if (method != SORT_NONE)
199 collection_list_sort_method = method;
200 list = g_list_insert_sorted(list, ci, collection_list_sort_cb);
204 list = g_list_append(list, ci);
210 GList *collection_list_insert(GList *list, CollectInfo *ci, CollectInfo *insert_ci, SortType method)
212 if (method != SORT_NONE)
214 collection_list_sort_method = method;
215 list = g_list_insert_sorted(list, ci, collection_list_sort_cb);
221 point = g_list_find(list, insert_ci);
222 list = uig_list_insert_link(list, point, ci);
228 GList *collection_list_remove(GList *list, CollectInfo *ci)
230 list = g_list_remove(list, ci);
231 collection_info_free(ci);
235 CollectInfo *collection_list_find_fd(GList *list, FileData *fd)
241 CollectInfo *ci = work->data;
242 if (ci->fd == fd) return ci;
249 GList *collection_list_to_filelist(GList *list)
251 GList *filelist = NULL;
256 CollectInfo *info = work->data;
257 filelist = g_list_prepend(filelist, file_data_ref(info->fd));
261 filelist = g_list_reverse(filelist);
265 CollectWindow *collection_window_find(CollectionData *cd)
269 work = collection_window_list;
272 CollectWindow *cw = work->data;
273 if (cw->cd == cd) return cw;
280 CollectWindow *collection_window_find_by_path(const gchar *path)
284 if (!path) return NULL;
286 work = collection_window_list;
289 CollectWindow *cw = work->data;
290 if (cw->cd->path && strcmp(cw->cd->path, path) == 0) return cw;
298 *-------------------------------------------------------------------
299 * please use these to actually add/remove stuff
300 *-------------------------------------------------------------------
303 CollectionData *collection_new(const gchar *path)
306 static gint untitled_counter = 0;
308 cd = g_new0(CollectionData, 1);
310 cd->ref = 1; /* starts with a ref of 1 */
311 cd->sort_method = SORT_NONE;
312 cd->window_w = COLLECT_DEF_WIDTH;
313 cd->window_h = COLLECT_DEF_HEIGHT;
314 cd->existence = g_hash_table_new(NULL, NULL);
318 cd->path = g_strdup(path);
319 cd->name = g_strdup(filename_from_path(cd->path));
324 if (untitled_counter == 0)
326 cd->name = g_strdup(_("Untitled"));
330 cd->name = g_strdup_printf(_("Untitled (%d)"), untitled_counter + 1);
336 file_data_register_notify_func(collection_notify_cb, cd, NOTIFY_PRIORITY_MEDIUM);
339 collection_list = g_list_append(collection_list, cd);
344 void collection_free(CollectionData *cd)
348 DEBUG_1("collection \"%s\" freed", cd->name);
350 collection_load_stop(cd);
351 collection_list_free(cd->list);
353 file_data_unregister_notify_func(collection_notify_cb, cd);
355 collection_list = g_list_remove(collection_list, cd);
357 g_hash_table_destroy(cd->existence);
365 void collection_ref(CollectionData *cd)
369 DEBUG_1("collection \"%s\" ref count = %d", cd->name, cd->ref);
372 void collection_unref(CollectionData *cd)
376 DEBUG_1("collection \"%s\" ref count = %d", cd->name, cd->ref);
384 void collection_path_changed(CollectionData *cd)
386 collection_window_update_title(collection_window_find(cd));
389 gint collection_to_number(CollectionData *cd)
391 return g_list_index(collection_list, cd);
394 CollectionData *collection_from_number(gint n)
396 return g_list_nth_data(collection_list, n);
399 CollectionData *collection_from_dnd_data(const gchar *data, GList **list, GList **info_list)
402 gint collection_number;
405 if (list) *list = NULL;
406 if (info_list) *info_list = NULL;
408 if (strncmp(data, "COLLECTION:", 11) != 0) return NULL;
412 collection_number = atoi(ptr);
413 cd = collection_from_number(collection_number);
414 if (!cd) return NULL;
416 if (!list && !info_list) return cd;
418 while (*ptr != '\0' && *ptr != '\n' ) ptr++;
419 if (*ptr == '\0') return cd;
427 item_number = (guint) atoi(ptr);
428 while (*ptr != '\n' && *ptr != '\0') ptr++;
432 while (*ptr == '\n') ptr++;
434 info = g_list_nth_data(cd->list, item_number);
437 if (list) *list = g_list_append(*list, file_data_ref(info->fd));
438 if (info_list) *info_list = g_list_append(*info_list, info);
444 gchar *collection_info_list_to_dnd_data(CollectionData *cd, GList *list, gint *length)
451 gint collection_number;
454 if (!list) return NULL;
456 collection_number = collection_to_number(cd);
457 if (collection_number < 0) return NULL;
459 text = g_strdup_printf("COLLECTION:%d\n", collection_number);
460 *length += strlen(text);
461 temp = g_list_prepend(temp, text);
466 gint item_number = g_list_index(cd->list, work->data);
470 if (item_number < 0) continue;
472 text = g_strdup_printf("%d\n", item_number);
473 temp = g_list_prepend(temp, text);
474 *length += strlen(text);
477 *length += 1; /* ending nul char */
479 uri_text = g_malloc(*length);
482 work = g_list_last(temp);
486 gchar *text = work->data;
491 memcpy(ptr, text, len);
497 string_list_free(temp);
502 gint collection_info_valid(CollectionData *cd, CollectInfo *info)
504 if (collection_to_number(cd) < 0) return FALSE;
506 return (g_list_index(cd->list, info) != 0);
509 CollectInfo *collection_next_by_info(CollectionData *cd, CollectInfo *info)
513 work = g_list_find(cd->list, info);
515 if (!work) return NULL;
517 if (work) return work->data;
521 CollectInfo *collection_prev_by_info(CollectionData *cd, CollectInfo *info)
525 work = g_list_find(cd->list, info);
527 if (!work) return NULL;
529 if (work) return work->data;
533 CollectInfo *collection_get_first(CollectionData *cd)
535 if (cd->list) return cd->list->data;
540 CollectInfo *collection_get_last(CollectionData *cd)
544 list = g_list_last(cd->list);
546 if (list) return list->data;
551 void collection_set_sort_method(CollectionData *cd, SortType method)
555 if (cd->sort_method == method) return;
557 cd->sort_method = method;
558 cd->list = collection_list_sort(cd->list, cd->sort_method);
559 if (cd->list) cd->changed = TRUE;
561 collection_window_refresh(collection_window_find(cd));
564 void collection_randomize(CollectionData *cd)
568 cd->list = collection_list_randomize(cd->list);
569 cd->sort_method = SORT_NONE;
570 if (cd->list) cd->changed = TRUE;
572 collection_window_refresh(collection_window_find(cd));
575 void collection_set_update_info_func(CollectionData *cd,
576 void (*func)(CollectionData *, CollectInfo *, gpointer), gpointer data)
578 cd->info_updated_func = func;
579 cd->info_updated_data = data;
582 static CollectInfo *collection_info_new_if_not_exists(CollectionData *cd, struct stat *st, FileData *fd)
586 if (g_hash_table_lookup(cd->existence, fd->path)) return NULL;
588 ci = collection_info_new(fd, st, NULL);
589 if (ci) g_hash_table_insert(cd->existence, fd->path, "");
593 gboolean collection_add_check(CollectionData *cd, FileData *fd, gboolean sorted, gboolean must_exist)
600 valid = (stat_utf8(fd->path, &st) && !S_ISDIR(st.st_mode));
613 ci = collection_info_new_if_not_exists(cd, &st, fd);
614 if (!ci) return FALSE;
615 DEBUG_3("add to collection: %s", fd->path);
617 cd->list = collection_list_add(cd->list, ci, sorted ? cd->sort_method : SORT_NONE);
620 if (!sorted || cd->sort_method == SORT_NONE)
622 collection_window_add(collection_window_find(cd), ci);
626 collection_window_insert(collection_window_find(cd), ci);
633 gboolean collection_add(CollectionData *cd, FileData *fd, gboolean sorted)
635 return collection_add_check(cd, fd, sorted, TRUE);
638 gboolean collection_insert(CollectionData *cd, FileData *fd, CollectInfo *insert_ci, gboolean sorted)
642 if (!insert_ci) return collection_add(cd, fd, sorted);
644 if (stat_utf8(fd->path, &st) >= 0 && !S_ISDIR(st.st_mode))
648 ci = collection_info_new_if_not_exists(cd, &st, fd);
649 if (!ci) return FALSE;
651 DEBUG_3("insert in collection: %s", fd->path);
653 cd->list = collection_list_insert(cd->list, ci, insert_ci, sorted ? cd->sort_method : SORT_NONE);
656 collection_window_insert(collection_window_find(cd), ci);
664 gboolean collection_remove(CollectionData *cd, FileData *fd)
668 ci = collection_list_find_fd(cd->list, fd);
670 if (!ci) return FALSE;
672 g_hash_table_remove(cd->existence, fd->path);
674 cd->list = g_list_remove(cd->list, ci);
677 collection_window_remove(collection_window_find(cd), ci);
678 collection_info_free(ci);
683 static void collection_remove_by_info(CollectionData *cd, CollectInfo *info)
685 if (!info || !g_list_find(cd->list, info)) return;
687 cd->list = g_list_remove(cd->list, info);
688 cd->changed = (cd->list != NULL);
690 collection_window_remove(collection_window_find(cd), info);
691 collection_info_free(info);
694 void collection_remove_by_info_list(CollectionData *cd, GList *list)
702 /* more efficient (in collect-table) to remove a single item this way */
703 collection_remove_by_info(cd, (CollectInfo *)list->data);
710 cd->list = collection_list_remove(cd->list, work->data);
713 cd->changed = (cd->list != NULL);
715 collection_window_refresh(collection_window_find(cd));
718 gboolean collection_rename(CollectionData *cd, FileData *fd)
721 ci = collection_list_find_fd(cd->list, fd);
723 if (!ci) return FALSE;
727 collection_window_update(collection_window_find(cd), ci);
732 void collection_update_geometry(CollectionData *cd)
734 collection_window_get_geometry(collection_window_find(cd));
738 *-------------------------------------------------------------------
739 * simple maintenance for renaming, deleting
740 *-------------------------------------------------------------------
743 static void collection_notify_cb(FileData *fd, NotifyType type, gpointer data)
745 CollectionData *cd = data;
747 if (!(type & NOTIFY_CHANGE) || !fd->change) return;
749 DEBUG_1("Notify collection: %s %04x", fd->path, type);
751 switch (fd->change->type)
753 case FILEDATA_CHANGE_MOVE:
754 case FILEDATA_CHANGE_RENAME:
755 collection_rename(cd, fd);
757 case FILEDATA_CHANGE_COPY:
759 case FILEDATA_CHANGE_DELETE:
760 while (collection_remove(cd, fd));
762 case FILEDATA_CHANGE_UNSPECIFIED:
763 case FILEDATA_CHANGE_WRITE_METADATA:
771 *-------------------------------------------------------------------
773 *-------------------------------------------------------------------
776 static gboolean collection_window_keypress(GtkWidget *widget, GdkEventKey *event, gpointer data)
778 CollectWindow *cw = data;
779 gboolean stop_signal = FALSE;
782 if (event->state & GDK_CONTROL_MASK)
785 switch (event->keyval)
799 if (event->state & GDK_SHIFT_MASK)
801 collection_table_unselect_all(cw->table);
805 collection_table_select_all(cw->table);
809 list = layout_list(NULL);
812 collection_table_add_filelist(cw->table, list);
817 file_util_copy(NULL, collection_table_selection_get_list(cw->table), NULL, cw->window);
820 file_util_move(NULL, collection_table_selection_get_list(cw->table), NULL, cw->window);
823 file_util_rename(NULL, collection_table_selection_get_list(cw->table), cw->window);
826 file_util_delete(NULL, collection_table_selection_get_list(cw->table), cw->window);
829 collection_dialog_save_as(NULL, cw->cd);
832 collection_window_close(cw);
842 switch (event->keyval)
844 case GDK_KEY_Return: case GDK_KEY_KP_Enter:
845 layout_image_set_collection(NULL, cw->cd,
846 collection_table_get_focus_info(cw->table));
849 view_window_new_from_collection(cw->cd,
850 collection_table_get_focus_info(cw->table));
855 collection_dialog_save_as(NULL, cw->cd);
857 else if (!collection_save(cw->cd, cw->cd->path))
859 log_printf("failed saving to collection path: %s\n", cw->cd->path);
863 collection_dialog_append(NULL, cw->cd);
866 collection_set_sort_method(cw->cd, SORT_NAME);
868 #ifdef HAVE_STRVERSCMP
870 collection_set_sort_method(cw->cd, SORT_NUMBER);
874 collection_set_sort_method(cw->cd, SORT_TIME);
877 collection_set_sort_method(cw->cd, SORT_SIZE);
880 if (event->state & GDK_SHIFT_MASK)
884 info = collection_table_get_focus_info(cw->table);
886 print_window_new(info->fd, collection_table_selection_get_list(cw->table),
887 collection_list_to_filelist(cw->cd->list), cw->window);
891 collection_set_sort_method(cw->cd, SORT_PATH);
894 case GDK_KEY_Delete: case GDK_KEY_KP_Delete:
895 list = g_list_copy(cw->table->selection);
898 collection_remove_by_info_list(cw->cd, list);
903 collection_remove_by_info(cw->cd, collection_table_get_focus_info(cw->table));
915 *-------------------------------------------------------------------
917 *-------------------------------------------------------------------
919 static void collection_window_get_geometry(CollectWindow *cw)
927 window = gtk_widget_get_window(cw->window);
928 gdk_window_get_position(window, &cd->window_x, &cd->window_y);
929 cd->window_w = gdk_window_get_width(window);
930 cd->window_h = gdk_window_get_height(window);
931 cd->window_read = TRUE;
934 static void collection_window_refresh(CollectWindow *cw)
938 collection_table_refresh(cw->table);
941 static void collection_window_update_title(CollectWindow *cw)
943 gboolean free_name = FALSE;
949 if (file_extension_match(cw->cd->name, GQ_COLLECTION_EXT))
951 name = remove_extension_from_path(cw->cd->name);
959 buf = g_strdup_printf(_("%s - Collection - %s"), name, GQ_APPNAME);
960 if (free_name) g_free(name);
961 gtk_window_set_title(GTK_WINDOW(cw->window), buf);
965 static void collection_window_update_info(CollectionData *cd, CollectInfo *ci, gpointer data)
967 CollectWindow *cw = data;
969 collection_table_file_update(cw->table, ci);
972 static void collection_window_add(CollectWindow *cw, CollectInfo *ci)
976 if (!ci->pixbuf) collection_load_thumb_idle(cw->cd);
977 collection_table_file_add(cw->table, ci);
980 static void collection_window_insert(CollectWindow *cw, CollectInfo *ci)
984 if (!ci->pixbuf) collection_load_thumb_idle(cw->cd);
985 collection_table_file_insert(cw->table, ci);
989 static void collection_window_remove(CollectWindow *cw, CollectInfo *ci)
993 collection_table_file_remove(cw->table, ci);
996 static void collection_window_update(CollectWindow *cw, CollectInfo *ci)
1000 collection_table_file_update(cw->table, ci);
1001 collection_table_file_update(cw->table, NULL);
1004 static void collection_window_close_final(CollectWindow *cw)
1006 if (cw->close_dialog) return;
1008 collection_window_list = g_list_remove(collection_window_list, cw);
1009 collection_window_get_geometry(cw);
1011 gtk_widget_destroy(cw->window);
1013 collection_set_update_info_func(cw->cd, NULL, NULL);
1014 collection_unref(cw->cd);
1019 static void collection_close_save_cb(GenericDialog *gd, gpointer data)
1021 CollectWindow *cw = data;
1023 cw->close_dialog = NULL;
1024 generic_dialog_close(gd);
1028 collection_dialog_save_close(NULL, cw->cd);
1031 else if (!collection_save(cw->cd, cw->cd->path))
1034 buf = g_strdup_printf(_("Failed to save the collection:\n%s"), cw->cd->path);
1035 warning_dialog(_("Save Failed"), buf, GTK_STOCK_DIALOG_ERROR, cw->window);
1040 collection_window_close_final(cw);
1043 static void collection_close_close_cb(GenericDialog *gd, gpointer data)
1045 CollectWindow *cw = data;
1047 cw->close_dialog = NULL;
1048 generic_dialog_close(gd);
1050 collection_window_close_final(cw);
1053 static void collection_close_cancel_cb(GenericDialog *gd, gpointer data)
1055 CollectWindow *cw = data;
1057 cw->close_dialog = NULL;
1058 generic_dialog_close(gd);
1061 static void collection_close_dlg_show(CollectWindow *cw)
1065 if (cw->close_dialog)
1067 gtk_window_present(GTK_WINDOW(cw->close_dialog));
1071 gd = generic_dialog_new(_("Close collection"),
1072 "close_collection", cw->window, FALSE,
1073 collection_close_cancel_cb, cw);
1074 generic_dialog_add_message(gd, GTK_STOCK_DIALOG_QUESTION,
1075 _("Close collection"),
1076 _("Collection has been modified.\nSave first?"));
1078 generic_dialog_add_button(gd, GTK_STOCK_SAVE, NULL, collection_close_save_cb, TRUE);
1079 generic_dialog_add_button(gd, GTK_STOCK_DELETE, _("_Discard"), collection_close_close_cb, FALSE);
1081 cw->close_dialog = gd->dialog;
1083 gtk_widget_show(gd->dialog);
1086 static void collection_window_close(CollectWindow *cw)
1088 if (!cw->cd->changed && !cw->close_dialog)
1090 collection_window_close_final(cw);
1094 collection_close_dlg_show(cw);
1097 void collection_window_close_by_collection(CollectionData *cd)
1101 cw = collection_window_find(cd);
1102 if (cw) collection_window_close_final(cw);
1105 gboolean collection_window_modified_exists(void)
1109 work = collection_window_list;
1112 CollectWindow *cw = work->data;
1113 if (cw->cd->changed) return TRUE;
1120 static gboolean collection_window_delete(GtkWidget *widget, GdkEvent *event, gpointer data)
1122 CollectWindow *cw = data;
1123 collection_window_close(cw);
1128 CollectWindow *collection_window_new(const gchar *path)
1133 GtkWidget *status_label;
1134 GtkWidget *extra_label;
1135 GdkGeometry geometry;
1137 cw = g_new0(CollectWindow, 1);
1139 collection_window_list = g_list_append(collection_window_list, cw);
1141 cw->cd = collection_new(path);
1143 cw->window = window_new(GTK_WINDOW_TOPLEVEL, "collection", PIXBUF_INLINE_ICON_BOOK, NULL, NULL);
1145 geometry.min_width = DEFAULT_MINIMAL_WINDOW_SIZE;
1146 geometry.min_height = DEFAULT_MINIMAL_WINDOW_SIZE;
1147 geometry.base_width = COLLECT_DEF_WIDTH;
1148 geometry.base_height = COLLECT_DEF_HEIGHT;
1149 gtk_window_set_geometry_hints(GTK_WINDOW(cw->window), NULL, &geometry,
1150 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);
1153 if (options->save_window_positions && path && collection_load_only_geometry(cw->cd, path))
1155 /* FIXME: x, y is not implemented */
1156 gtk_window_set_default_size(GTK_WINDOW(cw->window), cw->cd->window_w, cw->cd->window_h);
1160 gtk_window_set_default_size(GTK_WINDOW(cw->window), COLLECT_DEF_WIDTH, COLLECT_DEF_HEIGHT);
1163 gtk_window_set_resizable(GTK_WINDOW(cw->window), TRUE);
1164 collection_window_update_title(cw);
1165 gtk_container_set_border_width(GTK_CONTAINER(cw->window), 0);
1167 g_signal_connect(G_OBJECT(cw->window), "delete_event",
1168 G_CALLBACK(collection_window_delete), cw);
1170 g_signal_connect(G_OBJECT(cw->window), "key_press_event",
1171 G_CALLBACK(collection_window_keypress), cw);
1173 vbox = gtk_vbox_new(FALSE, 0);
1174 gtk_container_add(GTK_CONTAINER(cw->window), vbox);
1175 gtk_widget_show(vbox);
1177 cw->table = collection_table_new(cw->cd);
1178 gtk_box_pack_start(GTK_BOX(vbox), cw->table->scrolled, TRUE, TRUE, 0);
1179 gtk_widget_show(cw->table->scrolled);
1181 cw->status_box = gtk_hbox_new(TRUE, 0);
1182 gtk_box_pack_start(GTK_BOX(vbox), cw->status_box, FALSE, FALSE, 0);
1183 gtk_widget_show(cw->status_box);
1185 frame = gtk_frame_new(NULL);
1186 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
1187 gtk_box_pack_start(GTK_BOX(cw->status_box), frame, TRUE, TRUE, 0);
1188 gtk_widget_show(frame);
1190 status_label = gtk_label_new("");
1191 gtk_container_add(GTK_CONTAINER(frame), status_label);
1192 gtk_widget_show(status_label);
1194 extra_label = gtk_progress_bar_new();
1195 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(extra_label), 0.0);
1196 gtk_box_pack_start(GTK_BOX(cw->status_box), extra_label, TRUE, TRUE, 0);
1197 gtk_widget_show(extra_label);
1199 collection_table_set_labels(cw->table, status_label, extra_label);
1201 gtk_widget_show(cw->window);
1202 gtk_widget_grab_focus(cw->table->listview);
1204 collection_set_update_info_func(cw->cd, collection_window_update_info, cw);
1206 if (path && *path == G_DIR_SEPARATOR) collection_load_begin(cw->cd, NULL, COLLECTION_LOAD_NONE);
1210 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */