diff options
author | jstebbins <[email protected]> | 2015-03-07 16:48:41 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2015-03-07 16:48:41 +0000 |
commit | 1c99a5be961b64a83a7a28ce99addd20c7ec1f96 (patch) | |
tree | 93376b9e8a3353cdc68413217969e1ba66f877d6 /gtk/src/presets.c | |
parent | 27a40c0299e0545d1b92ab12a5508c5f4ffb9b8b (diff) |
LinGui: clean settings better before writing to presets file
Some internal settings were getting written out to the presets file.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6972 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/presets.c')
-rw-r--r-- | gtk/src/presets.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/gtk/src/presets.c b/gtk/src/presets.c index acaf31dbb..520efbbd1 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -57,17 +57,44 @@ dict_clean(GhbValue *dict, GhbValue *template) GhbValue *tmp = ghb_value_dup(dict); GhbDictIter iter; const gchar *key; - GhbValue *value; + GhbValue *val; GhbValue *template_val; ghb_dict_iter_init(tmp, &iter); - while (ghb_dict_iter_next(tmp, &iter, &key, &value)) + while (ghb_dict_iter_next(tmp, &iter, &key, &val)) { template_val = ghb_dict_lookup(template, key); if (template_val == NULL) { ghb_dict_remove(dict, key); } + if (ghb_value_type(val) == GHB_DICT && + ghb_value_type(template_val) == GHB_DICT) + { + val = ghb_dict_lookup(dict, key); + dict_clean(val, template_val); + } + if (ghb_value_type(val) == GHB_ARRAY && + ghb_value_type(template_val) == GHB_ARRAY && + ghb_array_len(template_val) > 0) + { + template_val = ghb_array_get_nth(template_val, 0); + if (ghb_value_type(template_val) == GHB_DICT) + { + val = ghb_dict_lookup(dict, key); + int count = ghb_array_len(val); + int ii; + for (ii = 0; ii < count; ii++) + { + GhbValue *array_val; + array_val = ghb_array_get_nth(val, ii); + if (ghb_value_type(array_val) == GHB_DICT) + { + dict_clean(array_val, template_val); + } + } + } + } } ghb_value_free(tmp); } |