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"
27 #include "pixbuf_util.h"
29 #include "ui_fileops.h"
30 #include "ui_tree_edit.h"
34 #include <gdk/gdkkeysyms.h> /* for keyboard values */
37 #define COLLECT_DEF_WIDTH 440
38 #define COLLECT_DEF_HEIGHT 450
40 static GList *collection_list = NULL;
41 static GList *collection_window_list = NULL;
43 static void collection_window_get_geometry(CollectWindow *cw);
44 static void collection_window_refresh(CollectWindow *cw);
45 static void collection_window_update_title(CollectWindow *cw);
46 static void collection_window_add(CollectWindow *cw, CollectInfo *ci);
47 static void collection_window_insert(CollectWindow *cw, CollectInfo *ci);
48 static void collection_window_remove(CollectWindow *cw, CollectInfo *ci);
49 static void collection_window_update(CollectWindow *cw, CollectInfo *ci);
51 static void collection_window_close(CollectWindow *cw);
53 static void collection_notify_cb(FileData *fd, NotifyType type, gpointer data);
56 *-------------------------------------------------------------------
58 *-------------------------------------------------------------------
61 CollectInfo *collection_info_new(FileData *fd, struct stat *st, GdkPixbuf *pixbuf)
67 ci = g_new0(CollectInfo, 1);
68 ci->fd = file_data_ref(fd);
71 if (ci->pixbuf) g_object_ref(ci->pixbuf);
76 void collection_info_free_thumb(CollectInfo *ci)
78 if (ci->pixbuf) g_object_unref(ci->pixbuf);
82 void collection_info_free(CollectInfo *ci)
86 file_data_unref(ci->fd);
87 collection_info_free_thumb(ci);
91 void collection_info_set_thumb(CollectInfo *ci, GdkPixbuf *pixbuf)
93 if (pixbuf) g_object_ref(pixbuf);
94 collection_info_free_thumb(ci);
98 gint collection_info_load_thumb(CollectInfo *ci)
100 if (!ci) return FALSE;
102 collection_info_free_thumb(ci);
104 log_printf("collection_info_load_thumb not implemented!\n(because an instant thumb loader not implemented)");
107 if (create_thumbnail(ci->fd->path, &ci->pixmap, &ci->mask) < 0) return FALSE;
109 if (ci->pixmap) gdk_pixmap_ref(ci->pixmap);
110 if (ci->mask) gdk_bitmap_ref(ci->mask);
116 void collection_list_free(GList *list)
122 collection_info_free((CollectInfo *)work->data);
128 /* an ugly static var, well what ya gonna do ? */
129 static SortType collection_list_sort_method = SORT_NAME;
131 static gint collection_list_sort_cb(gconstpointer a, gconstpointer b)
133 const CollectInfo *cia = a;
134 const CollectInfo *cib = b;
136 switch(collection_list_sort_method)
144 if (cia->fd->size < cib->fd->size) return -1;
145 if (cia->fd->size > cib->fd->size) return 1;
149 if (cia->fd->date < cib->fd->date) return -1;
150 if (cia->fd->date > cib->fd->date) return 1;
154 return utf8_compare(cia->fd->path, cib->fd->path, options->file_sort.case_sensitive);
156 #ifdef HAVE_STRVERSCMP
158 return strverscmp(cia->fd->name, cib->fd->name);
165 if (options->file_sort.case_sensitive)
166 return strcmp(cia->fd->collate_key_name, cib->fd->collate_key_name);
168 return strcmp(cia->fd->collate_key_name_nocase, cib->fd->collate_key_name_nocase);
171 GList *collection_list_sort(GList *list, SortType method)
173 if (method == SORT_NONE) return list;
175 collection_list_sort_method = method;
177 return g_list_sort(list, collection_list_sort_cb);
180 GList *collection_list_add(GList *list, CollectInfo *ci, SortType method)
182 if (method != SORT_NONE)
184 collection_list_sort_method = method;
185 list = g_list_insert_sorted(list, ci, collection_list_sort_cb);
189 list = g_list_append(list, ci);
195 GList *collection_list_insert(GList *list, CollectInfo *ci, CollectInfo *insert_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);
206 point = g_list_find(list, insert_ci);
207 list = uig_list_insert_link(list, point, ci);
213 GList *collection_list_remove(GList *list, CollectInfo *ci)
215 list = g_list_remove(list, ci);
216 collection_info_free(ci);
220 CollectInfo *collection_list_find_fd(GList *list, FileData *fd)
226 CollectInfo *ci = work->data;
227 if (ci->fd == fd) return ci;
235 static GList *collection_list_find_link(GList *list, gchar *path)
241 CollectInfo *ci = work->data;
242 if (strcmp(ci->fd->path, path) == 0) return work;
249 static gint collection_list_find_index(GList *list, gchar *path)
256 CollectInfo *ci = work->data;
257 if (strcmp(ci->fd->path, path) == 0) return c;
266 GList *collection_list_to_filelist(GList *list)
268 GList *filelist = NULL;
273 CollectInfo *info = work->data;
274 filelist = g_list_prepend(filelist, file_data_ref(info->fd));
278 filelist = g_list_reverse(filelist);
282 CollectWindow *collection_window_find(CollectionData *cd)
286 work = collection_window_list;
289 CollectWindow *cw = work->data;
290 if (cw->cd == cd) return cw;
297 CollectWindow *collection_window_find_by_path(const gchar *path)
301 if (!path) return NULL;
303 work = collection_window_list;
306 CollectWindow *cw = work->data;
307 if (cw->cd->path && strcmp(cw->cd->path, path) == 0) return cw;
315 *-------------------------------------------------------------------
316 * please use these to actually add/remove stuff
317 *-------------------------------------------------------------------
320 CollectionData *collection_new(const gchar *path)
323 static gint untitled_counter = 0;
325 cd = g_new0(CollectionData, 1);
327 collection_list = g_list_append(collection_list, cd);
329 cd->ref = 1; /* starts with a ref of 1 */
332 cd->sort_method = SORT_NONE;
333 cd->thumb_loader = NULL;
334 cd->info_updated_func = NULL;
336 cd->window_read = FALSE;
339 cd->window_w = COLLECT_DEF_WIDTH;
340 cd->window_h = COLLECT_DEF_HEIGHT;
344 cd->existence = g_hash_table_new(NULL, NULL);
348 cd->path = g_strdup(path);
349 cd->name = g_strdup(filename_from_path(cd->path));
356 if (untitled_counter == 0)
358 cd->name = g_strdup(_("Untitled"));
362 cd->name = g_strdup_printf(_("Untitled (%d)"), untitled_counter + 1);
368 file_data_register_notify_func(collection_notify_cb, cd, NOTIFY_PRIORITY_MEDIUM);
373 void collection_free(CollectionData *cd)
377 DEBUG_1("collection \"%s\" freed", cd->name);
379 collection_load_stop(cd);
380 collection_list_free(cd->list);
382 file_data_unregister_notify_func(collection_notify_cb, cd);
384 collection_list = g_list_remove(collection_list, cd);
386 g_hash_table_destroy(cd->existence);
394 void collection_ref(CollectionData *cd)
398 DEBUG_1("collection \"%s\" ref count = %d", cd->name, cd->ref);
401 void collection_unref(CollectionData *cd)
405 DEBUG_1("collection \"%s\" ref count = %d", cd->name, cd->ref);
413 void collection_path_changed(CollectionData *cd)
415 collection_window_update_title(collection_window_find(cd));
418 gint collection_to_number(CollectionData *cd)
420 return g_list_index(collection_list, cd);
423 CollectionData *collection_from_number(gint n)
425 return g_list_nth_data(collection_list, n);
428 CollectionData *collection_from_dnd_data(const gchar *data, GList **list, GList **info_list)
431 gint collection_number;
434 if (list) *list = NULL;
435 if (info_list) *info_list = NULL;
437 if (strncmp(data, "COLLECTION:", 11) != 0) return NULL;
441 collection_number = atoi(ptr);
442 cd = collection_from_number(collection_number);
443 if (!cd) return NULL;
445 if (!list && !info_list) return cd;
447 while (*ptr != '\0' && *ptr != '\n' ) ptr++;
448 if (*ptr == '\0') return cd;
456 item_number = (guint) atoi(ptr);
457 while (*ptr != '\n' && *ptr != '\0') ptr++;
461 while (*ptr == '\n') ptr++;
463 info = g_list_nth_data(cd->list, item_number);
466 if (list) *list = g_list_append(*list, file_data_ref(info->fd));
467 if (info_list) *info_list = g_list_append(*info_list, info);
473 gchar *collection_info_list_to_dnd_data(CollectionData *cd, GList *list, gint *length)
480 gint collection_number;
483 if (!list) return NULL;
485 collection_number = collection_to_number(cd);
486 if (collection_number < 0) return NULL;
488 text = g_strdup_printf("COLLECTION:%d\n", collection_number);
489 *length += strlen(text);
490 temp = g_list_prepend(temp, text);
495 gint item_number = g_list_index(cd->list, work->data);
499 if (item_number < 0) continue;
501 text = g_strdup_printf("%d\n", item_number);
502 temp = g_list_prepend(temp, text);
503 *length += strlen(text);
506 *length += 1; /* ending nul char */
508 uri_text = g_malloc(*length);
511 work = g_list_last(temp);
515 gchar *text = work->data;
520 memcpy(ptr, text, len);
526 string_list_free(temp);
531 gint collection_info_valid(CollectionData *cd, CollectInfo *info)
533 if (collection_to_number(cd) < 0) return FALSE;
535 return (g_list_index(cd->list, info) != 0);
538 CollectInfo *collection_next_by_info(CollectionData *cd, CollectInfo *info)
542 work = g_list_find(cd->list, info);
544 if (!work) return NULL;
546 if (work) return work->data;
550 CollectInfo *collection_prev_by_info(CollectionData *cd, CollectInfo *info)
554 work = g_list_find(cd->list, info);
556 if (!work) return NULL;
558 if (work) return work->data;
562 CollectInfo *collection_get_first(CollectionData *cd)
564 if (cd->list) return cd->list->data;
569 CollectInfo *collection_get_last(CollectionData *cd)
573 list = g_list_last(cd->list);
575 if (list) return list->data;
580 void collection_set_sort_method(CollectionData *cd, SortType method)
584 if (cd->sort_method == method) return;
586 cd->sort_method = method;
587 cd->list = collection_list_sort(cd->list, cd->sort_method);
588 if (cd->list) cd->changed = TRUE;
590 collection_window_refresh(collection_window_find(cd));
593 void collection_set_update_info_func(CollectionData *cd,
594 void (*func)(CollectionData *, CollectInfo *, gpointer), gpointer data)
596 cd->info_updated_func = func;
597 cd->info_updated_data = data;
600 static CollectInfo *collection_info_new_if_not_exists(CollectionData *cd, struct stat *st, FileData *fd)
604 if (g_hash_table_lookup(cd->existence, fd->path)) return NULL;
606 ci = collection_info_new(fd, st, NULL);
607 if (ci) g_hash_table_insert(cd->existence, fd->path, "");
611 gint collection_add_check(CollectionData *cd, FileData *fd, gint sorted, gint must_exist)
618 valid = (stat_utf8(fd->path, &st) && !S_ISDIR(st.st_mode));
631 ci = collection_info_new_if_not_exists(cd, &st, fd);
632 if (!ci) return FALSE;
633 DEBUG_3("add to collection: %s", fd->path);
635 cd->list = collection_list_add(cd->list, ci, sorted ? cd->sort_method : SORT_NONE);
638 if (!sorted || cd->sort_method == SORT_NONE)
640 collection_window_add(collection_window_find(cd), ci);
644 collection_window_insert(collection_window_find(cd), ci);
651 gint collection_add(CollectionData *cd, FileData *fd, gint sorted)
653 return collection_add_check(cd, fd, sorted, TRUE);
656 gint collection_insert(CollectionData *cd, FileData *fd, CollectInfo *insert_ci, gint sorted)
660 if (!insert_ci) return collection_add(cd, fd, sorted);
662 if (stat_utf8(fd->path, &st) >= 0 && !S_ISDIR(st.st_mode))
666 ci = collection_info_new_if_not_exists(cd, &st, fd);
667 if (!ci) return FALSE;
669 DEBUG_3("insert in collection: %s", fd->path);
671 cd->list = collection_list_insert(cd->list, ci, insert_ci, sorted ? cd->sort_method : SORT_NONE);
674 collection_window_insert(collection_window_find(cd), ci);
682 gint collection_remove(CollectionData *cd, FileData *fd)
686 ci = collection_list_find_fd(cd->list, fd);
688 if (!ci) return FALSE;
690 g_hash_table_remove(cd->existence, fd->path);
692 cd->list = g_list_remove(cd->list, ci);
695 collection_window_remove(collection_window_find(cd), ci);
696 collection_info_free(ci);
701 static void collection_remove_by_info(CollectionData *cd, CollectInfo *info)
703 if (!info || !g_list_find(cd->list, info)) return;
705 cd->list = g_list_remove(cd->list, info);
706 cd->changed = (cd->list != NULL);
708 collection_window_remove(collection_window_find(cd), info);
709 collection_info_free(info);
712 void collection_remove_by_info_list(CollectionData *cd, GList *list)
720 /* more efficient (in collect-table) to remove a single item this way */
721 collection_remove_by_info(cd, (CollectInfo *)list->data);
728 cd->list = collection_list_remove(cd->list, work->data);
731 cd->changed = (cd->list != NULL);
733 collection_window_refresh(collection_window_find(cd));
736 gint collection_rename(CollectionData *cd, FileData *fd)
739 ci = collection_list_find_fd(cd->list, fd);
741 if (!ci) return FALSE;
745 collection_window_update(collection_window_find(cd), ci);
750 void collection_update_geometry(CollectionData *cd)
752 collection_window_get_geometry(collection_window_find(cd));
756 *-------------------------------------------------------------------
757 * simple maintenance for renaming, deleting
758 *-------------------------------------------------------------------
761 static void collection_notify_cb(FileData *fd, NotifyType type, gpointer data)
763 CollectionData *cd = data;
765 if (type != NOTIFY_TYPE_CHANGE || !fd->change) return;
767 switch(fd->change->type)
769 case FILEDATA_CHANGE_MOVE:
770 case FILEDATA_CHANGE_RENAME:
771 collection_rename(cd, fd);
773 case FILEDATA_CHANGE_COPY:
775 case FILEDATA_CHANGE_DELETE:
776 while (collection_remove(cd, fd));
778 case FILEDATA_CHANGE_UNSPECIFIED:
786 *-------------------------------------------------------------------
788 *-------------------------------------------------------------------
791 static gint collection_window_keypress(GtkWidget *widget, GdkEventKey *event, gpointer data)
793 CollectWindow *cw = data;
794 gint stop_signal = FALSE;
798 if (event->state & GDK_CONTROL_MASK)
801 switch (event->keyval)
834 if (event->state & GDK_SHIFT_MASK)
836 collection_table_unselect_all(cw->table);
840 collection_table_select_all(cw->table);
844 list = layout_list(NULL);
847 collection_table_add_filelist(cw->table, list);
852 file_util_copy(NULL, collection_table_selection_get_list(cw->table), NULL, cw->window);
855 file_util_move(NULL, collection_table_selection_get_list(cw->table), NULL, cw->window);
858 file_util_rename(NULL, collection_table_selection_get_list(cw->table), cw->window);
861 file_util_delete(NULL, collection_table_selection_get_list(cw->table), cw->window);
864 info_window_new(NULL, collection_table_selection_get_list(cw->table), NULL);
867 collection_dialog_save_as(NULL, cw->cd);
870 collection_window_close(cw);
880 switch (event->keyval)
882 case GDK_Return: case GDK_KP_Enter:
883 layout_image_set_collection(NULL, cw->cd,
884 collection_table_get_focus_info(cw->table));
887 view_window_new_from_collection(cw->cd,
888 collection_table_get_focus_info(cw->table));
893 collection_dialog_save_as(NULL, cw->cd);
895 else if (!collection_save(cw->cd, cw->cd->path))
897 log_printf("failed saving to collection path: %s\n", cw->cd->path);
901 collection_dialog_append(NULL, cw->cd);
904 collection_set_sort_method(cw->cd, SORT_NAME);
906 #ifdef HAVE_STRVERSCMP
908 collection_set_sort_method(cw->cd, SORT_NUMBER);
912 collection_set_sort_method(cw->cd, SORT_TIME);
915 collection_set_sort_method(cw->cd, SORT_SIZE);
918 if (event->state & GDK_SHIFT_MASK)
922 info = collection_table_get_focus_info(cw->table);
924 print_window_new(info->fd, collection_table_selection_get_list(cw->table),
925 collection_list_to_filelist(cw->cd->list), cw->window);
929 collection_set_sort_method(cw->cd, SORT_PATH);
932 case GDK_Delete: case GDK_KP_Delete:
933 list = g_list_copy(cw->table->selection);
936 collection_remove_by_info_list(cw->cd, list);
941 collection_remove_by_info(cw->cd, collection_table_get_focus_info(cw->table));
952 list = collection_table_selection_get_list(cw->table);
953 file_util_start_editor_from_filelist(edit_val, list, cw->window);
961 *-------------------------------------------------------------------
963 *-------------------------------------------------------------------
965 static void collection_window_get_geometry(CollectWindow *cw)
972 gdk_window_get_position(cw->window->window, &cd->window_x, &cd->window_y);
973 gdk_drawable_get_size(cw->window->window, &cd->window_w, &cd->window_h);
974 cd->window_read = TRUE;
977 static void collection_window_refresh(CollectWindow *cw)
981 collection_table_refresh(cw->table);
984 static void collection_window_update_title(CollectWindow *cw)
990 buf = g_strdup_printf(_("%s - Collection - %s"), cw->cd->name, GQ_APPNAME);
991 gtk_window_set_title(GTK_WINDOW(cw->window), buf);
995 static void collection_window_update_info(CollectionData *cd, CollectInfo *ci, gpointer data)
997 CollectWindow *cw = data;
999 collection_table_file_update(cw->table, ci);
1002 static void collection_window_add(CollectWindow *cw, CollectInfo *ci)
1006 if (!ci->pixbuf) collection_load_thumb_idle(cw->cd);
1007 collection_table_file_add(cw->table, ci);
1010 static void collection_window_insert(CollectWindow *cw, CollectInfo *ci)
1014 if (!ci->pixbuf) collection_load_thumb_idle(cw->cd);
1015 collection_table_file_insert(cw->table, ci);
1020 static void collection_window_move(CollectWindow *cw, CollectInfo *ci)
1026 static void collection_window_remove(CollectWindow *cw, CollectInfo *ci)
1030 collection_table_file_remove(cw->table, ci);
1033 static void collection_window_update(CollectWindow *cw, CollectInfo *ci)
1037 collection_table_file_update(cw->table, ci);
1038 collection_table_file_update(cw->table, NULL);
1041 static void collection_window_close_final(CollectWindow *cw)
1043 if (cw->close_dialog) return;
1045 collection_window_list = g_list_remove(collection_window_list, cw);
1046 collection_window_get_geometry(cw);
1048 gtk_widget_destroy(cw->window);
1050 collection_set_update_info_func(cw->cd, NULL, NULL);
1051 collection_unref(cw->cd);
1056 static void collection_close_save_cb(GenericDialog *gd, gpointer data)
1058 CollectWindow *cw = data;
1060 cw->close_dialog = NULL;
1061 generic_dialog_close(gd);
1065 collection_dialog_save_close(NULL, cw->cd);
1068 else if (!collection_save(cw->cd, cw->cd->path))
1071 buf = g_strdup_printf(_("Failed to save the collection:\n%s"), cw->cd->path);
1072 warning_dialog(_("Save Failed"), buf, GTK_STOCK_DIALOG_ERROR, cw->window);
1077 collection_window_close_final(cw);
1080 static void collection_close_close_cb(GenericDialog *gd, gpointer data)
1082 CollectWindow *cw = data;
1084 cw->close_dialog = NULL;
1085 generic_dialog_close(gd);
1087 collection_window_close_final(cw);
1090 static void collection_close_cancel_cb(GenericDialog *gd, gpointer data)
1092 CollectWindow *cw = data;
1094 cw->close_dialog = NULL;
1095 generic_dialog_close(gd);
1098 static void collection_close_dlg_show(CollectWindow *cw)
1102 if (cw->close_dialog)
1104 gtk_window_present(GTK_WINDOW(cw->close_dialog));
1108 gd = generic_dialog_new(_("Close collection"),
1109 GQ_WMCLASS, "close_collection", cw->window, FALSE,
1110 collection_close_cancel_cb, cw);
1111 generic_dialog_add_message(gd, GTK_STOCK_DIALOG_QUESTION,
1112 _("Close collection"),
1113 _("Collection has been modified.\nSave first?"));
1115 generic_dialog_add_button(gd, GTK_STOCK_SAVE, NULL, collection_close_save_cb, TRUE);
1116 generic_dialog_add_button(gd, GTK_STOCK_DELETE, _("_Discard"), collection_close_close_cb, FALSE);
1118 cw->close_dialog = gd->dialog;
1120 gtk_widget_show(gd->dialog);
1123 static void collection_window_close(CollectWindow *cw)
1125 if (!cw->cd->changed && !cw->close_dialog)
1127 collection_window_close_final(cw);
1131 collection_close_dlg_show(cw);
1134 void collection_window_close_by_collection(CollectionData *cd)
1138 cw = collection_window_find(cd);
1139 if (cw) collection_window_close_final(cw);
1142 gint collection_window_modified_exists(void)
1146 work = collection_window_list;
1149 CollectWindow *cw = work->data;
1150 if (cw->cd->changed) return TRUE;
1157 static gint collection_window_delete(GtkWidget *widget, GdkEvent *event, gpointer data)
1159 CollectWindow *cw = data;
1160 collection_window_close(cw);
1165 CollectWindow *collection_window_new(const gchar *path)
1170 GtkWidget *status_label;
1171 GtkWidget *extra_label;
1172 GdkGeometry geometry;
1174 cw = g_new0(CollectWindow, 1);
1176 cw->close_dialog = NULL;
1178 collection_window_list = g_list_append(collection_window_list, cw);
1180 cw->cd = collection_new(path);
1182 cw->window = window_new(GTK_WINDOW_TOPLEVEL, "collection", PIXBUF_INLINE_ICON_BOOK, NULL, NULL);
1184 geometry.min_width = DEFAULT_MINIMAL_WINDOW_SIZE;
1185 geometry.min_height = DEFAULT_MINIMAL_WINDOW_SIZE;
1186 geometry.base_width = COLLECT_DEF_WIDTH;
1187 geometry.base_height = COLLECT_DEF_HEIGHT;
1188 gtk_window_set_geometry_hints(GTK_WINDOW(cw->window), NULL, &geometry,
1189 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);
1192 if (options->layout.save_window_positions && path && collection_load_only_geometry(cw->cd, path))
1194 /* FIXME: x, y is not implemented */
1195 gtk_window_set_default_size(GTK_WINDOW(cw->window), cw->cd->window_w, cw->cd->window_h);
1199 gtk_window_set_default_size(GTK_WINDOW(cw->window), COLLECT_DEF_WIDTH, COLLECT_DEF_HEIGHT);
1202 gtk_window_set_resizable(GTK_WINDOW(cw->window), TRUE);
1203 collection_window_update_title(cw);
1204 gtk_container_set_border_width(GTK_CONTAINER(cw->window), 0);
1206 g_signal_connect(G_OBJECT(cw->window), "delete_event",
1207 G_CALLBACK(collection_window_delete), cw);
1209 g_signal_connect(G_OBJECT(cw->window), "key_press_event",
1210 G_CALLBACK(collection_window_keypress), cw);
1212 vbox = gtk_vbox_new(FALSE, 0);
1213 gtk_container_add(GTK_CONTAINER(cw->window), vbox);
1214 gtk_widget_show(vbox);
1216 cw->table = collection_table_new(cw->cd);
1217 gtk_box_pack_start(GTK_BOX(vbox), cw->table->scrolled, TRUE, TRUE, 0);
1218 gtk_widget_show(cw->table->scrolled);
1220 cw->status_box = gtk_hbox_new(TRUE, 0);
1221 gtk_box_pack_start(GTK_BOX(vbox), cw->status_box, FALSE, FALSE, 0);
1222 gtk_widget_show(cw->status_box);
1224 frame = gtk_frame_new(NULL);
1225 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
1226 gtk_box_pack_start(GTK_BOX(cw->status_box), frame, TRUE, TRUE, 0);
1227 gtk_widget_show(frame);
1229 status_label = gtk_label_new("");
1230 gtk_container_add(GTK_CONTAINER(frame), status_label);
1231 gtk_widget_show(status_label);
1233 extra_label = gtk_progress_bar_new();
1234 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(extra_label), 0.0);
1235 gtk_box_pack_start(GTK_BOX(cw->status_box), extra_label, TRUE, TRUE, 0);
1236 gtk_widget_show(extra_label);
1238 collection_table_set_labels(cw->table, status_label, extra_label);
1240 gtk_widget_show(cw->window);
1241 gtk_widget_grab_focus(cw->table->listview);
1243 collection_set_update_info_func(cw->cd, collection_window_update_info, cw);
1245 if (path && *path == G_DIR_SEPARATOR) collection_load_begin(cw->cd, NULL, COLLECTION_LOAD_NONE);
1249 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */