Mercurial > geeqie
changeset 170:9a56e3d13e67
basic sidecar files configuration via preferences dialog
author | nadvornik |
---|---|
date | Sun, 23 Dec 2007 21:24:48 +0000 |
parents | 501010403a04 |
children | 6b4918c2bb0d |
files | src/filelist.c src/filelist.h src/preferences.c src/rcfile.c |
diffstat | 4 files changed, 31 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/filelist.c Sun Dec 23 20:28:50 2007 +0000 +++ b/src/filelist.c Sun Dec 23 21:24:48 2007 +0000 @@ -416,7 +416,7 @@ return sidecar_ext_list; } -void sidecar_ext_parse(const gchar *text) +void sidecar_ext_parse(const gchar *text, gint quoted) { GList *work; gchar *value; @@ -431,7 +431,10 @@ g_list_free(sidecar_ext_list); sidecar_ext_list = NULL; - value = quoted_value(text); + if (quoted) + value = quoted_value(text); + else + value = g_strdup(text); if (value == NULL) return; @@ -443,22 +446,28 @@ void sidecar_ext_write(FILE *f) { GList *work; - fprintf(f, "\nsidecar_ext: \""); - + fprintf(f, "\nsidecar_ext: \"%s\"\n", sidecar_ext_to_string()); +} + +char *sidecar_ext_to_string() +{ + GList *work; + GString *str = g_string_new(""); + work = sidecar_ext_list; while (work) { gchar *ext = work->data; work = work->next; - fprintf(f, "%s%s", ext, work ? ";" : ""); + g_string_append(str, ext); + if (work) g_string_append(str, ";"); } - fprintf(f, "\"\n"); - + return g_string_free(str, FALSE); } void sidecar_ext_add_defaults() { - sidecar_ext_parse("\".jpg;.cr2;.nef;.crw\""); + sidecar_ext_parse(".jpg;.cr2;.nef;.crw", FALSE); } /*
--- a/src/filelist.h Sun Dec 23 20:28:50 2007 +0000 +++ b/src/filelist.h Sun Dec 23 21:24:48 2007 +0000 @@ -38,8 +38,9 @@ void filter_write_list(FILE *f); void filter_parse(const gchar *text); -void sidecar_ext_parse(const gchar *text); +void sidecar_ext_parse(const gchar *text, gint quoted); void sidecar_ext_write(FILE *f); +char *sidecar_ext_to_string(); void sidecar_ext_add_defaults(); gint ishidden(const gchar *name);
--- a/src/preferences.c Sun Dec 23 20:28:50 2007 +0000 +++ b/src/preferences.c Sun Dec 23 21:24:48 2007 +0000 @@ -142,7 +142,7 @@ static GtkWidget *color_profile_input_name_entry[COLOR_PROFILE_INPUTS]; static GtkWidget *color_profile_screen_file_entry; - +static GtkWidget *sidecar_ext_entry; /* *----------------------------------------------------------------------------- * option widget callbacks (private) @@ -256,6 +256,8 @@ file_sort_case_sensitive = file_sort_case_sensitive_c; file_filter_disable = file_filter_disable_c; + sidecar_ext_parse(gtk_entry_get_text(GTK_ENTRY(sidecar_ext_entry)), FALSE); + slideshow_random = slideshow_random_c; slideshow_repeat = slideshow_repeat_c; slideshow_delay = slideshow_delay_c; @@ -1022,6 +1024,14 @@ ct_button = pref_checkbox_new_int(group, _("Disable File Filtering"), file_filter_disable, &file_filter_disable_c); + + group = pref_group_new(vbox, FALSE, _("Grouping sidecar extensions"), GTK_ORIENTATION_VERTICAL); + + sidecar_ext_entry = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(sidecar_ext_entry), sidecar_ext_to_string()); + gtk_box_pack_start(GTK_BOX(group), sidecar_ext_entry, FALSE, FALSE, 0); + gtk_widget_show(sidecar_ext_entry); + group = pref_group_new(vbox, TRUE, _("File types"), GTK_ORIENTATION_VERTICAL); frame = pref_group_parent(group);