aboutsummaryrefslogtreecommitdiff
path: root/src/format-selection.c
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-06-01 16:21:20 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-06-01 16:21:20 +0200
commit54f75db1b82cc5a81c98ed722b3a60c38645919d (patch)
tree993dfd37880816e663554bb7dac08c5b9e5af145 /src/format-selection.c
parent12541e8b3bd3f7296f6289cadd4e550832556a27 (diff)
downloadexperiment-player-54f75db1b82cc5a81c98ed722b3a60c38645919d.tar.gz
support for configuration files
* currently it saves the quick-open and format-selection directories
Diffstat (limited to 'src/format-selection.c')
-rw-r--r--src/format-selection.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/format-selection.c b/src/format-selection.c
index 2e14028..8fb04df 100644
--- a/src/format-selection.c
+++ b/src/format-selection.c
@@ -21,8 +21,6 @@ GtkWidget *transcript_wizard_combo,
*transcript_wizard_entry_check,
*transcript_proband_entry_check;
-static gchar *formats_directory;
-
enum {
COL_NAME,
COL_FILENAME,
@@ -42,19 +40,24 @@ formats_menu_choosedir_item_activate_cb(GtkWidget *widget,
gtk_combo_box_get_model(GTK_COMBO_BOX(transcript_wizard_combo));
GtkWidget *dialog;
+ gchar *formats_directory;
dialog = gtk_file_chooser_dialog_new("Choose Directory...", GTK_WINDOW(widget),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
NULL);
+
+ formats_directory = config_get_formats_directory();
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
formats_directory);
+ g_free(formats_directory);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
- g_free(formats_directory);
formats_directory =
gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
+ config_set_formats_directory(formats_directory);
+ g_free(formats_directory);
refresh_formats_store(GTK_LIST_STORE(model));
}
@@ -145,12 +148,13 @@ refresh_formats_store(GtkListStore *store)
gchar *wizard_filename = NULL;
gchar *proband_filename = NULL;
+ gchar *formats_directory;
GDir *dir;
const gchar *name;
GtkTreeIter iter;
if (pattern == NULL)
- pattern = g_pattern_spec_new(EXPERIMENT_FORMAT_FILTER);
+ pattern = g_pattern_spec_new(EXPERIMENT_FORMATS_FILTER);
if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(transcript_wizard_combo),
&iter))
@@ -165,6 +169,7 @@ refresh_formats_store(GtkListStore *store)
/* add null-entry */
gtk_list_store_append(store, &iter);
+ formats_directory = config_get_formats_directory();
dir = g_dir_open(formats_directory, 0, NULL);
while ((name = g_dir_read_name(dir)) != NULL) {
@@ -194,19 +199,18 @@ refresh_formats_store(GtkListStore *store)
}
g_dir_close(dir);
+ g_free(formats_directory);
g_free(proband_filename);
g_free(wizard_filename);
}
void
-format_selection_init(const gchar *dir)
+format_selection_init(void)
{
GtkListStore *formats_store;
GtkCellRenderer *renderer;
- formats_directory = g_strdup(dir);
-
formats_store = gtk_list_store_new(NUM_COLS,
G_TYPE_STRING, G_TYPE_STRING);
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(formats_store),