+static void select_collection_dialog_close_cb(FileDialog *fdlg, gpointer data)
+{
+ file_dialog_close(fdlg);
+}
+
+static void select_collection_dialog_ok_cb(FileDialog *fdlg, gpointer data)
+{
+ SearchData *sd = data;
+ gchar *path;
+ gchar *path_noext;
+ gchar *collection;
+
+ path = g_strdup(gtk_entry_get_text(GTK_ENTRY(fdlg->entry)));
+ path_noext = remove_extension_from_path(path);
+ collection = g_path_get_basename(path_noext);
+
+ gtk_entry_set_text(GTK_ENTRY(sd->collection_entry), collection);
+ file_dialog_close(fdlg);
+
+ g_free(path);
+ g_free(path_noext);
+ g_free(collection);
+}
+
+static gboolean select_collection_clicked_cb(GtkWidget *widget, gpointer data)
+{
+ SearchData *sd = data;
+ FileDialog *fdlg;
+ const gchar *title;
+ const gchar *btntext;
+ gpointer btnfunc;
+ const gchar *stock_id;
+
+ title = _("Select collection");
+ btntext = NULL;
+ btnfunc = select_collection_dialog_ok_cb;
+ stock_id = GTK_STOCK_OK;
+
+ fdlg = file_util_file_dlg(title, "dlg_collection", sd->window, select_collection_dialog_close_cb, sd);
+
+ generic_dialog_add_message(GENERIC_DIALOG(fdlg), NULL, title, NULL, FALSE);
+ file_dialog_add_button(fdlg, stock_id, btntext, btnfunc, TRUE);
+
+ file_dialog_add_path_widgets(fdlg, get_collections_dir(), NULL, "search_collection", GQ_COLLECTION_EXT, _("Collection Files"));
+
+ gtk_widget_show(GENERIC_DIALOG(fdlg)->dialog);
+}
+