void setup_default_options(ConfOptions *options) { gchar *path; gint i; bookmark_add_default(".", get_current_dir()); bookmark_add_default(_("Home"), homedir()); path = g_build_filename(homedir(), "Desktop", NULL); bookmark_add_default(_("Desktop"), path); g_free(path); bookmark_add_default(_("Collections"), get_collections_dir()); g_free(options->file_ops.safe_delete_path); options->file_ops.safe_delete_path = g_strdup(get_trash_dir()); for (i = 0; i < COLOR_PROFILE_INPUTS; i++) { options->color_profile.input_file[i] = NULL; options->color_profile.input_name[i] = NULL; } set_default_image_overlay_template_string(&options->image_overlay.template_string); options->sidecar.ext = g_strdup(".jpg;%raw;.ufraw;.xmp;%unknown"); options->shell.path = g_strdup(GQ_DEFAULT_SHELL_PATH); options->shell.options = g_strdup(GQ_DEFAULT_SHELL_OPTIONS); for (i = 0; i < FILEDATA_MARKS_SIZE; i++) { options->marks_tooltips[i] = g_strdup_printf("%s%d", _("Mark "), i + 1); } options->help_search_engine = g_strdup(HELP_SEARCH_ENGINE); }
static void collect_manager_refresh(void) { GList *list; GList *work; FileData *dir_fd; dir_fd = file_data_new_simple(get_collections_dir()); filelist_read(dir_fd, &list, NULL); file_data_unref(dir_fd); work = collection_manager_entry_list; while (work && list) { CollectManagerEntry *entry; GList *list_step; entry = work->data; work = work->next; list_step = list; while (list_step && entry) { FileData *fd; fd = list_step->data; list_step = list_step->next; if (strcmp(fd->path, entry->path) == 0) { list = g_list_remove(list, fd); file_data_unref(fd); entry = NULL; } else { collect_manager_entry_free(entry); } } } work = list; while (work) { FileData *fd; fd = work->data; work = work->next; collect_manager_entry_new(fd->path); } filelist_free(list); }
static void collection_save_or_load_dialog(const gchar *path, gint type, CollectionData *cd) { FileDialog *fd; GtkWidget *parent = NULL; CollectWindow *cw; const gchar *title; const gchar *btntext; gpointer btnfunc; const gchar *stock_id; if (type == DIALOG_SAVE || type == DIALOG_SAVE_CLOSE) { if (!cd) return; title = _("Save collection"); btntext = NULL; btnfunc = collection_save_cb; stock_id = GTK_STOCK_SAVE; } else if (type == DIALOG_LOAD) { title = _("Open collection"); btntext = NULL; btnfunc = collection_load_cb; stock_id = GTK_STOCK_OPEN; } else { if (!cd) return; title = _("Append collection"); btntext = _("_Append"); btnfunc = collection_append_cb; stock_id = GTK_STOCK_ADD; } if (cd) collection_ref(cd); cw = collection_window_find(cd); if (cw) parent = cw->window; fd = file_util_file_dlg(title, "dlg_collection", parent, collection_save_or_load_dialog_close_cb, cd); generic_dialog_add_message(GENERIC_DIALOG(fd), NULL, title, NULL); file_dialog_add_button(fd, stock_id, btntext, btnfunc, TRUE); file_dialog_add_path_widgets(fd, get_collections_dir(), path, "collection_load_save", GQ_COLLECTION_EXT, _("Collection Files")); fd->type = type; gtk_widget_show(GENERIC_DIALOG(fd)->dialog); }