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 tab_completion_select_cancel_cb(FileDialog *fd, gpointer data) { TabCompData *td = data; td->fd = NULL; 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 void tab_completion_destroy(GtkWidget *widget, gpointer data) { TabCompData *td = data; tab_completion_free_list(td); g_free(td->history_key); if (td->fd) file_dialog_close(td->fd); g_free(td->fd_title); g_free(td->filter); g_free(td->filter_desc); g_free(td); }
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); }
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); }