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; void *btnfunc; gchar *base; 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, "GQview", "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); base = g_strconcat(homedir(), "/", GQVIEW_RC_DIR_COLLECTIONS, NULL); file_dialog_add_path_widgets(fd, base, path, "collection_load_save", ".gqv", _("Collection Files")); g_free(base); fd->type = type; gtk_widget_show(GENERIC_DIALOG(fd)->dialog); }
static void tab_completion_select_show(TabCompData *td) { const gchar *title; const gchar *path; gchar *filter = NULL; gchar *filter_desc = NULL; if (td->fd) { gtk_window_present(GTK_WINDOW(GENERIC_DIALOG(td->fd)->dialog)); return; } title = (td->fd_title) ? td->fd_title : _("Select path"); td->fd = file_dialog_new(title, "select_path", td->entry, tab_completion_select_cancel_cb, td); file_dialog_add_button(td->fd, GTK_STOCK_OK, NULL, tab_completion_select_ok_cb, TRUE); generic_dialog_add_message(GENERIC_DIALOG(td->fd), NULL, title, NULL, FALSE); if (td->filter) { filter = td->filter; } else { filter = "*"; } if (td->filter_desc) { filter_desc = td->filter_desc; } else { filter_desc = _("All files"); } path = gtk_entry_get_text(GTK_ENTRY(td->entry)); if (strlen(path) == 0) path = NULL; if (td->fd_folders_only) { file_dialog_add_path_widgets(td->fd, NULL, path, td->history_key, NULL, NULL); } else { file_dialog_add_path_widgets(td->fd, NULL, path, td->history_key, filter, filter_desc); } gtk_widget_show(GENERIC_DIALOG(td->fd)->dialog); }