static void collection_save_or_load_dialog_close_cb(FileDialog *fd, gpointer data) { CollectionData *cd = data; if (cd) collection_unref(cd); file_dialog_close(fd); }
static void collection_confirm_ok_cb(GenericDialog *gd, gpointer data) { FileDialog *fd = data; CollectionData *cd = GENERIC_DIALOG(fd)->data; if (!collection_save_confirmed(fd, TRUE, cd)) { collection_unref(cd); file_dialog_close(fd); } }
static gint collect_manager_process_entry(CollectManagerEntry *entry) { CollectionData *cd; gint success; GList *work; if (!entry->action_list) return FALSE; cd = collection_new(entry->path); success = collection_load_private(cd, entry->path, FALSE, FALSE); work = g_list_last(entry->action_list); while (work) { CollectManagerAction *action; action = work->data; work = work->prev; if (!action->oldpath) { /* add image */ if (collection_list_find(cd->list, action->newpath) == NULL) { collection_add_check(cd, action->newpath, FALSE, FALSE); } } else if (action->newpath) { /* rename image */ while (collection_rename(cd, action->oldpath, action->newpath)); } else { /* remove image */ while (collection_remove(cd, action->oldpath)); } collect_manager_action_unref(action); } if (success && cd->changed) { collection_save_private(cd, entry->path); if (debug) printf("collection manager updated: %s\n", entry->path); } collection_unref(cd); g_list_free(entry->action_list); entry->action_list = NULL; return TRUE; }
static gboolean collect_manager_process_entry(CollectManagerEntry *entry) { CollectionData *cd; if (entry->empty) return FALSE; cd = collection_new(entry->path); (void) collection_load_private(cd, entry->path, COLLECTION_LOAD_NONE); collection_unref(cd); return TRUE; }
static void collection_window_close_final(CollectWindow *cw) { if (cw->close_dialog) return; collection_window_list = g_list_remove(collection_window_list, cw); collection_window_get_geometry(cw); gtk_widget_destroy(cw->window); collection_set_update_info_func(cw->cd, NULL, NULL); collection_unref(cw->cd); g_free(cw); }
static gint collection_save_confirmed(FileDialog *fd, gint overwrite, CollectionData *cd) { gchar *buf; if (isdir(fd->dest_path)) { buf = g_strdup_printf(_("Specified path:\n%s\nis a folder, collections are files"), fd->dest_path); file_util_warning_dialog(_("Invalid filename"), buf, GTK_STOCK_DIALOG_INFO, GENERIC_DIALOG(fd)->dialog); g_free(buf); return FALSE; } if (!overwrite && isfile(fd->dest_path)) { GenericDialog *gd; gd = file_util_gen_dlg(_("Overwrite File"), "GQview", "dlg_confirm", GENERIC_DIALOG(fd)->dialog, TRUE, collection_confirm_cancel_cb, fd); generic_dialog_add_message(gd, GTK_STOCK_DIALOG_QUESTION, _("Overwrite existing file?"), fd->dest_path); generic_dialog_add_button(gd, GTK_STOCK_OK, _("_Overwrite"), collection_confirm_ok_cb, TRUE); gtk_widget_show(gd->dialog); return TRUE; } if (!collection_save(cd, fd->dest_path)) { buf = g_strdup_printf(_("Failed to save the collection:\n%s"), fd->dest_path); file_util_warning_dialog(_("Save Failed"), buf, GTK_STOCK_DIALOG_ERROR, GENERIC_DIALOG(fd)->dialog); g_free(buf); } collection_unref(cd); file_dialog_sync_history(fd, TRUE); if (fd->type == DIALOG_SAVE_CLOSE) collection_window_close_by_collection(cd); file_dialog_close(fd); return TRUE; }
static void real_collection_button_pressed(FileDialog *fd, gpointer data, gint append) { CollectionData *cd = data; gboolean err = FALSE; gchar *text = NULL; if (!isname(fd->dest_path)) { err = TRUE; text = g_strdup_printf(_("No such file '%s'."), fd->dest_path); } if (!err && isdir(fd->dest_path)) { err = TRUE; text = g_strdup_printf(_("'%s' is a directory, not a collection file."), fd->dest_path); } if (!err && !access_file(fd->dest_path, R_OK)) { err = TRUE; text = g_strdup_printf(_("You do not have read permissions on the file '%s'."), fd->dest_path); } if (err) { if (text) { file_util_warning_dialog(_("Can not open collection file"), text, GTK_STOCK_DIALOG_ERROR, NULL); g_free(text); } return; } if (append) { collection_load(cd, fd->dest_path, TRUE); collection_unref(cd); } else { collection_window_new(fd->dest_path); } file_dialog_sync_history(fd, TRUE); file_dialog_close(fd); }
void slideshow_free(SlideShowData *ss) { if (!ss) return; slideshow_timer_reset(ss, FALSE); if (ss->stop_func) ss->stop_func(ss, ss->stop_data); if (ss->path_list) path_list_free(ss->path_list); if (ss->cd) collection_unref(ss->cd); g_free(ss->layout_path); g_list_free(ss->list); g_list_free(ss->list_done); g_free(ss->slide_path); g_free(ss); }
static void real_collection_button_pressed(FileDialog *fd, gpointer data, gint append) { CollectionData *cd = data; if (!fd->dest_path || isdir(fd->dest_path)) return; if (append) { collection_load(cd, fd->dest_path, TRUE); collection_unref(cd); } else { collection_window_new(fd->dest_path); } file_dialog_sync_history(fd, TRUE); file_dialog_close(fd); }
void view_window_new(FileData *fd) { GList *list; if (file_extension_match(fd->path, GQ_COLLECTION_EXT)) { ViewWindow *vw; CollectionData *cd; CollectInfo *info; cd = collection_new(fd->path); if (collection_load(cd, fd->path, COLLECTION_LOAD_NONE)) { info = collection_get_first(cd); } else { collection_unref(cd); cd = NULL; info = NULL; } vw = real_view_window_new(NULL, NULL, cd, info); if (vw && cd) { g_signal_connect(G_OBJECT(vw->window), "destroy", G_CALLBACK(view_window_collection_unref_cb), cd); } } else if (isdir(fd->path) && filelist_read(fd, &list, NULL)) { list = filelist_sort_path(list); list = filelist_filter(list, FALSE); real_view_window_new(NULL, list, NULL, NULL); filelist_free(list); } else { real_view_window_new(fd, NULL, NULL, NULL); } }
static void view_window_collection_unref_cb(GtkWidget *widget, gpointer data) { CollectionData *cd = data; collection_unref(cd); }