diff options
author | jstebbins <[email protected]> | 2008-09-09 23:14:28 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2008-09-09 23:14:28 +0000 |
commit | e57d4d0bf36c3b5d4691134d0fdb8171cb25f843 (patch) | |
tree | ad4dddfe057558ad5cd8fd5c02eb1d156079c709 /gtk/src/presets.c | |
parent | ebf4b4d663b9eeeed5d9632b5a2076355cff7145 (diff) |
LinGui: consolidate all resources into one stringified plist file that gets
compiled in. icons and everyting all rolled up into one ball-o-wax.
hehe, plists are cool
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1685 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/presets.c')
-rw-r--r-- | gtk/src/presets.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/gtk/src/presets.c b/gtk/src/presets.c index e2b0eb216..8f8a0cd65 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -18,19 +18,10 @@ #include <gtk/gtk.h> #include "settings.h" #include "plist.h" +#include "resources.h" #include "presets.h" #include "values.h" -// -// Internal defaults stored in character arrays and parsed -// the same as external settings files. -const gchar defaultSettings[] = -#include "internal_defaults.h" -; -const gchar standardPresets[] = -#include "standard_presets.h" -; - static GValue *presetsPlist = NULL; static GValue *internalPlist = NULL; static GValue *prefsPlist = NULL; @@ -383,15 +374,13 @@ load_plist(const gchar *name) { const gchar *dir; gchar *config; - FILE *file; GValue *plist = NULL; dir = g_get_user_config_dir(); config = g_strdup_printf ("%s/ghb/%s", dir, name); if (g_file_test(config, G_FILE_TEST_IS_REGULAR)) { - file = g_fopen(config, "r"); - plist = ghb_plist_parse_file(file); + plist = ghb_plist_parse_file(config); } g_free(config); return plist; @@ -555,7 +544,7 @@ ghb_settings_init(signal_user_data_t *ud) g_debug("ghb_settings_init"); prefs_initializing = TRUE; - internalPlist = ghb_plist_parse(defaultSettings, sizeof(defaultSettings)-1); + internalPlist = ghb_resource_get("internal-defaults"); // Setting a ui widget will cause the corresponding setting // to be set, but it also triggers a callback that can // have the side effect of using other settings values @@ -596,8 +585,8 @@ ghb_settings_init(signal_user_data_t *ud) void ghb_settings_close() { - if (internalPlist) - ghb_value_free(internalPlist); + //if (internalPlist) + //ghb_value_free(internalPlist); if (presetsPlist) ghb_value_free(presetsPlist); if (prefsPlist) @@ -650,7 +639,7 @@ ghb_presets_reload(signal_user_data_t *ud) GHashTableIter std_iter; g_debug("ghb_presets_reload()\n"); - std_dict = ghb_plist_parse(standardPresets, sizeof(standardPresets)-1); + std_dict = ghb_resource_get("standard-presets"); if (std_dict == NULL) return; // Merge the keyfile contents into our presets @@ -678,7 +667,6 @@ ghb_presets_reload(signal_user_data_t *ud) ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(value)); } } - ghb_value_free(std_dict); store_plist(presetsPlist, "presets"); } @@ -713,8 +701,7 @@ ghb_presets_load() presetsPlist = load_plist("presets"); if (presetsPlist == NULL) { - presetsPlist = ghb_plist_parse( - standardPresets, sizeof(standardPresets)-1); + presetsPlist = ghb_value_dup(ghb_resource_get("standard-presets")); presets_store(); } } |