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)
598 if (!fd) return FALSE;
600 g_assert(fd->magick == FD_MAGICK);
604 valid = (stat_utf8(fd->path, &st) && !S_ISDIR(st.st_mode));
617 ci = collection_info_new_if_not_exists(cd, &st, fd);
618 if (!ci) return FALSE;
619 DEBUG_3("add to collection: %s", fd->path);
621 cd->list = collection_list_add(cd->list, ci, sorted ? cd->sort_method : SORT_NONE);
624 if (!sorted || cd->sort_method == SORT_NONE)
626 collection_window_add(collection_window_find(cd), ci);
630 collection_window_insert(collection_window_find(cd), ci);
637 gboolean collection_add(CollectionData *cd, FileData *fd, gboolean sorted)
639 return collection_add_check(cd, fd, sorted, TRUE);
642 gboolean collection_insert(CollectionData *cd, FileData *fd, CollectInfo *insert_ci, gboolean sorted)
646 if (!insert_ci) return collection_add(cd, fd, sorted);
648 if (stat_utf8(fd->path, &st) >= 0 && !S_ISDIR(st.st_mode))
652 ci = collection_info_new_if_not_exists(cd, &st, fd);
653 if (!ci) return FALSE;
655 DEBUG_3("insert in collection: %s", fd->path);
657 cd->list = collection_list_insert(cd->list, ci, insert_ci, sorted ? cd->sort_method : SORT_NONE);
660 collection_window_insert(collection_window_find(cd), ci);
668 gboolean collection_remove(CollectionData *cd, FileData *fd)
672 ci = collection_list_find_fd(cd->list, fd);
674 if (!ci) return FALSE;
676 g_hash_table_remove(cd->existence, fd->path);
678 cd->list = g_list_remove(cd->list, ci);
681 collection_window_remove(collection_window_find(cd), ci);
682 collection_info_free(ci);
687 static void collection_remove_by_info(CollectionData *cd, CollectInfo *info)
689 if (!info || !g_list_find(cd->list, info)) return;
691 cd->list = g_list_remove(cd->list, info);
692 cd->changed = (cd->list != NULL);
694 collection_window_remove(collection_window_find(cd), info);
695 collection_info_free(info);
698 void collection_remove_by_info_list(CollectionData *cd, GList *list)
706 /* more efficient (in collect-table) to remove a single item this way */
707 collection_remove_by_info(cd, (CollectInfo *)list->data);
714 cd->list = collection_list_remove(cd->list, work->data);
717 cd->changed = (cd->list != NULL);
719 collection_window_refresh(collection_window_find(cd));
722 gboolean collection_rename(CollectionData *cd, FileData *fd)
725 ci = collection_list_find_fd(cd->list, fd);
727 if (!ci) return FALSE;
731 collection_window_update(collection_window_find(cd), ci);
736 void collection_update_geometry(CollectionData *cd)
738 collection_window_get_geometry(collection_window_find(cd));
742 *-------------------------------------------------------------------
743 * simple maintenance for renaming, deleting
744 *-------------------------------------------------------------------
747 static void collection_notify_cb(FileData *fd, NotifyType type, gpointer data)
749 CollectionData *cd = data;
751 if (!(type & NOTIFY_CHANGE) || !fd->change) return;
753 DEBUG_1("Notify collection: %s %04x", fd->path, type);
755 switch (fd->change->type)
757 case FILEDATA_CHANGE_MOVE:
758 case FILEDATA_CHANGE_RENAME:
759 collection_rename(cd, fd);
761 case FILEDATA_CHANGE_COPY:
763 case FILEDATA_CHANGE_DELETE:
764 while (collection_remove(cd, fd));
766 case FILEDATA_CHANGE_UNSPECIFIED:
767 case FILEDATA_CHANGE_WRITE_METADATA:
775 *-------------------------------------------------------------------
777 *-------------------------------------------------------------------
780 static gboolean collection_window_keypress(GtkWidget *widget, GdkEventKey *event, gpointer data)
782 CollectWindow *cw = data;
783 gboolean stop_signal = FALSE;
786 if (event->state & GDK_CONTROL_MASK)
789 switch (event->keyval)
803 if (event->state & GDK_SHIFT_MASK)
805 collection_table_unselect_all(cw->table);
809 collection_table_select_all(cw->table);
813 list = layout_list(NULL);
816 collection_table_add_filelist(cw->table, list);
821 file_util_copy(NULL, collection_table_selection_get_list(cw->table), NULL, cw->window);
824 file_util_move(NULL, collection_table_selection_get_list(cw->table), NULL, cw->window);
827 file_util_rename(NULL, collection_table_selection_get_list(cw->table), cw->window);
830 file_util_delete(NULL, collection_table_selection_get_list(cw->table), cw->window);
833 collection_dialog_save_as(NULL, cw->cd);
836 collection_window_close(cw);
846 switch (event->keyval)
848 case GDK_KEY_Return: case GDK_KEY_KP_Enter:
849 layout_image_set_collection(NULL, cw->cd,
850 collection_table_get_focus_info(cw->table));
853 view_window_new_from_collection(cw->cd,
854 collection_table_get_focus_info(cw->table));
859 collection_dialog_save_as(NULL, cw->cd);
861 else if (!collection_save(cw->cd, cw->cd->path))
863 log_printf("failed saving to collection path: %s\n", cw->cd->path);
867 collection_dialog_append(NULL, cw->cd);
870 collection_set_sort_method(cw->cd, SORT_NAME);
872 #ifdef HAVE_STRVERSCMP
874 collection_set_sort_method(cw->cd, SORT_NUMBER);
878 collection_set_sort_method(cw->cd, SORT_TIME);
881 collection_set_sort_method(cw->cd, SORT_SIZE);
884 if (event->state & GDK_SHIFT_MASK)
888 info = collection_table_get_focus_info(cw->table);
890 print_window_new(info->fd, collection_table_selection_get_list(cw->table),
891 collection_list_to_filelist(cw->cd->list), cw->window);
895 collection_set_sort_method(cw->cd, SORT_PATH);
898 case GDK_KEY_Delete: case GDK_KEY_KP_Delete:
899 list = g_list_copy(cw->table->selection);
902 collection_remove_by_info_list(cw->cd, list);
907 collection_remove_by_info(cw->cd, collection_table_get_focus_info(cw->table));
919 *-------------------------------------------------------------------
921 *-------------------------------------------------------------------
923 static void collection_window_get_geometry(CollectWindow *cw)
931 window = gtk_widget_get_window(cw->window);
932 gdk_window_get_position(window, &cd->window_x, &cd->window_y);
933 cd->window_w = gdk_window_get_width(window);
934 cd->window_h = gdk_window_get_height(window);
935 cd->window_read = TRUE;
938 static void collection_window_refresh(CollectWindow *cw)
942 collection_table_refresh(cw->table);
945 static void collection_window_update_title(CollectWindow *cw)
947 gboolean free_name = FALSE;
953 if (file_extension_match(cw->cd->name, GQ_COLLECTION_EXT))
955 name = remove_extension_from_path(cw->cd->name);
963 buf = g_strdup_printf(_("%s - Collection - %s"), name, GQ_APPNAME);
964 if (free_name) g_free(name);
965 gtk_window_set_title(GTK_WINDOW(cw->window), buf);
969 static void collection_window_update_info(CollectionData *cd, CollectInfo *ci, gpointer data)
971 CollectWindow *cw = data;
973 collection_table_file_update(cw->table, ci);
976 static void collection_window_add(CollectWindow *cw, CollectInfo *ci)
980 if (!ci->pixbuf) collection_load_thumb_idle(cw->cd);
981 collection_table_file_add(cw->table, ci);
984 static void collection_window_insert(CollectWindow *cw, CollectInfo *ci)
988 if (!ci->pixbuf) collection_load_thumb_idle(cw->cd);
989 collection_table_file_insert(cw->table, ci);
993 static void collection_window_remove(CollectWindow *cw, CollectInfo *ci)
997 collection_table_file_remove(cw->table, ci);
1000 static void collection_window_update(CollectWindow *cw, CollectInfo *ci)
1004 collection_table_file_update(cw->table, ci);
1005 collection_table_file_update(cw->table, NULL);
1008 static void collection_window_close_final(CollectWindow *cw)
1010 if (cw->close_dialog) return;
1012 collection_window_list = g_list_remove(collection_window_list, cw);
1013 collection_window_get_geometry(cw);
1015 gtk_widget_destroy(cw->window);
1017 collection_set_update_info_func(cw->cd, NULL, NULL);
1018 collection_unref(cw->cd);
1023 static void collection_close_save_cb(GenericDialog *gd, gpointer data)
1025 CollectWindow *cw = data;
1027 cw->close_dialog = NULL;
1028 generic_dialog_close(gd);
1032 collection_dialog_save_close(NULL, cw->cd);
1035 else if (!collection_save(cw->cd, cw->cd->path))
1038 buf = g_strdup_printf(_("Failed to save the collection:\n%s"), cw->cd->path);
1039 warning_dialog(_("Save Failed"), buf, GTK_STOCK_DIALOG_ERROR, cw->window);
1044 collection_window_close_final(cw);
1047 static void collection_close_close_cb(GenericDialog *gd, gpointer data)
1049 CollectWindow *cw = data;
1051 cw->close_dialog = NULL;
1052 generic_dialog_close(gd);
1054 collection_window_close_final(cw);
1057 static void collection_close_cancel_cb(GenericDialog *gd, gpointer data)
1059 CollectWindow *cw = data;
1061 cw->close_dialog = NULL;
1062 generic_dialog_close(gd);
1065 static void collection_close_dlg_show(CollectWindow *cw)
1069 if (cw->close_dialog)
1071 gtk_window_present(GTK_WINDOW(cw->close_dialog));
1075 gd = generic_dialog_new(_("Close collection"),
1076 "close_collection", cw->window, FALSE,
1077 collection_close_cancel_cb, cw);
1078 generic_dialog_add_message(gd, GTK_STOCK_DIALOG_QUESTION,
1079 _("Close collection"),
1080 _("Collection has been modified.\nSave first?"));
1082 generic_dialog_add_button(gd, GTK_STOCK_SAVE, NULL, collection_close_save_cb, TRUE);
1083 generic_dialog_add_button(gd, GTK_STOCK_DELETE, _("_Discard"), collection_close_close_cb, FALSE);
1085 cw->close_dialog = gd->dialog;
1087 gtk_widget_show(gd->dialog);
1090 static void collection_window_close(CollectWindow *cw)
1092 if (!cw->cd->changed && !cw->close_dialog)
1094 collection_window_close_final(cw);
1098 collection_close_dlg_show(cw);
1101 void collection_window_close_by_collection(CollectionData *cd)
1105 cw = collection_window_find(cd);
1106 if (cw) collection_window_close_final(cw);
1109 gboolean collection_window_modified_exists(void)
1113 work = collection_window_list;
1116 CollectWindow *cw = work->data;
1117 if (cw->cd->changed) return TRUE;
1124 static gboolean collection_window_delete(GtkWidget *widget, GdkEvent *event, gpointer data)
1126 CollectWindow *cw = data;
1127 collection_window_close(cw);
1132 CollectWindow *collection_window_new(const gchar *path)
1137 GtkWidget *status_label;
1138 GtkWidget *extra_label;
1139 GdkGeometry geometry;
1141 cw = g_new0(CollectWindow, 1);
1143 collection_window_list = g_list_append(collection_window_list, cw);
1145 cw->cd = collection_new(path);
1147 cw->window = window_new(GTK_WINDOW_TOPLEVEL, "collection", PIXBUF_INLINE_ICON_BOOK, NULL, NULL);
1149 geometry.min_width = DEFAULT_MINIMAL_WINDOW_SIZE;
1150 geometry.min_height = DEFAULT_MINIMAL_WINDOW_SIZE;
1151 geometry.base_width = COLLECT_DEF_WIDTH;
1152 geometry.base_height = COLLECT_DEF_HEIGHT;
1153 gtk_window_set_geometry_hints(GTK_WINDOW(cw->window), NULL, &geometry,
1154 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);
1157 if (options->save_window_positions && path && collection_load_only_geometry(cw->cd, path))
1159 /* FIXME: x, y is not implemented */
1160 gtk_window_set_default_size(GTK_WINDOW(cw->window), cw->cd->window_w, cw->cd->window_h);
1164 gtk_window_set_default_size(GTK_WINDOW(cw->window), COLLECT_DEF_WIDTH, COLLECT_DEF_HEIGHT);
1167 gtk_window_set_resizable(GTK_WINDOW(cw->window), TRUE);
1168 collection_window_update_title(cw);
1169 gtk_container_set_border_width(GTK_CONTAINER(cw->window), 0);
1171 g_signal_connect(G_OBJECT(cw->window), "delete_event",
1172 G_CALLBACK(collection_window_delete), cw);
1174 g_signal_connect(G_OBJECT(cw->window), "key_press_event",
1175 G_CALLBACK(collection_window_keypress), cw);
1177 vbox = gtk_vbox_new(FALSE, 0);
1178 gtk_container_add(GTK_CONTAINER(cw->window), vbox);
1179 gtk_widget_show(vbox);
1181 cw->table = collection_table_new(cw->cd);
1182 gtk_box_pack_start(GTK_BOX(vbox), cw->table->scrolled, TRUE, TRUE, 0);
1183 gtk_widget_show(cw->table->scrolled);
1185 cw->status_box = gtk_hbox_new(TRUE, 0);
1186 gtk_box_pack_start(GTK_BOX(vbox), cw->status_box, FALSE, FALSE, 0);
1187 gtk_widget_show(cw->status_box);
1189 frame = gtk_frame_new(NULL);
1190 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
1191 gtk_box_pack_start(GTK_BOX(cw->status_box), frame, TRUE, TRUE, 0);
1192 gtk_widget_show(frame);
1194 status_label = gtk_label_new("");
1195 gtk_container_add(GTK_CONTAINER(frame), status_label);
1196 gtk_widget_show(status_label);
1198 extra_label = gtk_progress_bar_new();
1199 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(extra_label), 0.0);
1200 gtk_box_pack_start(GTK_BOX(cw->status_box), extra_label, TRUE, TRUE, 0);
1201 gtk_widget_show(extra_label);
1203 collection_table_set_labels(cw->table, status_label, extra_label);
1205 gtk_widget_show(cw->window);
1206 gtk_widget_grab_focus(cw->table->listview);
1208 collection_set_update_info_func(cw->cd, collection_window_update_info, cw);
1210 if (path && *path == G_DIR_SEPARATOR) collection_load_begin(cw->cd, NULL, COLLECTION_LOAD_NONE);
1214 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */