# HG changeset patch # User zas_ # Date 1211502056 0 # Node ID 77ff94c0490a6b5b255f286d55fb23bf97d292c6 # Parent a336b5545af6b989ec4fbc7dd0f197b8de37fc07 Try to load a system-wide rc file if any, before per-user rc file. For now, system-wide rc file path is set to /etc/geeqie/geeqierc (defined by GQ_SYSTEM_WIDE_DIR in main.h). filter_parse() was modified to replace entries having the same key, needed since it may be called more than once. Please test heavily. diff -r a336b5545af6 -r 77ff94c0490a src/filefilter.c --- a/src/filefilter.c Thu May 22 23:22:12 2008 +0000 +++ b/src/filefilter.c Fri May 23 00:20:56 2008 +0000 @@ -79,11 +79,11 @@ filter_entry_free(fe); } -static gint filter_key_exists(const gchar *key) +static FilterEntry *filter_get_by_key(const gchar *key) { GList *work; - if (!key) return FALSE; + if (!key) return NULL; work = filter_list; while (work) @@ -91,10 +91,15 @@ FilterEntry *fe = work->data; work = work->next; - if (strcmp(fe->key, key) == 0) return TRUE; + if (strcmp(fe->key, key) == 0) return fe; } - return FALSE; + return NULL; +} + +static gint filter_key_exists(const gchar *key) +{ + return (filter_get_by_key(key) == NULL ? FALSE : TRUE); } void filter_add(const gchar *key, const gchar *description, const gchar *extensions, FileFormatClass file_class, gint enabled) @@ -419,7 +424,13 @@ enabled = FALSE; } - if (key && strlen(key) > 0 && ext) filter_add(key, desc, ext, file_class, enabled); + if (key && strlen(key) > 0 && ext) + { + FilterEntry *fe = filter_get_by_key(key); + + if (fe != NULL) filter_remove_entry(fe); + filter_add(key, desc, ext, file_class, enabled); + } g_free(key); g_free(ext); diff -r a336b5545af6 -r 77ff94c0490a src/main.h --- a/src/main.h Thu May 22 23:22:12 2008 +0000 +++ b/src/main.h Fri May 23 00:20:56 2008 +0000 @@ -76,6 +76,8 @@ #define GQ_RC_DIR_COLLECTIONS GQ_RC_DIR G_DIR_SEPARATOR_S "collections" #define GQ_RC_DIR_TRASH GQ_RC_DIR G_DIR_SEPARATOR_S "trash" +#define GQ_SYSTEM_WIDE_DIR "/etc/" GQ_APPNAME_LC + #define RC_FILE_NAME GQ_APPNAME_LC "rc" #define ZOOM_RESET_ORIGINAL 0 diff -r a336b5545af6 -r 77ff94c0490a src/rcfile.c --- a/src/rcfile.c Thu May 22 23:22:12 2008 +0000 +++ b/src/rcfile.c Fri May 23 00:20:56 2008 +0000 @@ -924,9 +924,19 @@ void load_options(ConfOptions *options) { + gboolean success; gchar *rc_path; + if (isdir(GQ_SYSTEM_WIDE_DIR)) + { + rc_path = g_build_filename(GQ_SYSTEM_WIDE_DIR, RC_FILE_NAME, NULL); + success = load_options_from(rc_path, options); + DEBUG_1("Loading options from %s ... %s", rc_path, success ? "done" : "failed"); + g_free(rc_path); + } + rc_path = g_build_filename(homedir(), GQ_RC_DIR, RC_FILE_NAME, NULL); - load_options_from(rc_path, options); + success = load_options_from(rc_path, options); + DEBUG_1("Loading options from %s ... %s", rc_path, success ? "done" : "failed"); g_free(rc_path); }