ocarina: Make a generic chooser function

I want a function that can be used to select either a file or a
directory.
This commit is contained in:
Bryan Schumaker 2011-09-10 10:41:47 -04:00
parent 9df15e944c
commit 13244b880c
1 changed files with 6 additions and 4 deletions

View File

@ -2,12 +2,10 @@
#include <ocarina/gtk.h>
#include <ocarina/chooser.h>
string ocarina_choose_file()
static string ocarina_generic_chooser(GtkFileChooserAction action)
{
GtkWidget *chooser = gtk_file_chooser_dialog_new(
"Open File",
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
"Open File", NULL, action,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
@ -24,3 +22,7 @@ string ocarina_choose_file()
return filename;
}
string ocarina_choose_file()
{
return ocarina_generic_chooser(GTK_FILE_CHOOSER_ACTION_OPEN);
}