From 0e8146cb77a2891a228d61fc5cfbca9d715e69fb Mon Sep 17 00:00:00 2001 From: jstebbins Date: Sat, 4 Apr 2009 21:13:29 +0000 Subject: LinGui: preview and picture window changes - split picture settings into it's own window - create overlay for preview window (like the mac ui, but not a pretty) - save window positions and preview display status between sessions git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2297 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- gtk/src/presets.c | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'gtk/src/presets.c') diff --git a/gtk/src/presets.c b/gtk/src/presets.c index cbe539345..aafff05d1 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -38,6 +38,7 @@ enum static GValue *presetsPlist = NULL; static GValue *internalPlist = NULL; static GValue *prefsPlist = NULL; +static gboolean prefs_modified = FALSE; static const GValue* preset_dict_get_value(GValue *dict, const gchar *key); static void store_plist(GValue *plist, const gchar *name); @@ -1196,12 +1197,35 @@ ghb_prefs_save(GValue *settings) } } store_plist(prefsPlist, "preferences"); + prefs_modified = FALSE; +} + +void +ghb_pref_set(GValue *settings, const gchar *key) +{ + const GValue *value, *value2; + + if (prefs_initializing) return; + value = ghb_settings_get_value(settings, key); + if (value != NULL) + { + GValue *dict; + dict = plist_get_dict(prefsPlist, "Preferences"); + if (dict == NULL) return; + value2 = ghb_dict_lookup(dict, key); + if (ghb_value_cmp(value, value2) != 0) + { + ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(value)); + store_plist(prefsPlist, "preferences"); + prefs_modified = TRUE; + } + } } void ghb_pref_save(GValue *settings, const gchar *key) { - const GValue *value; + const GValue *value, *value2; if (prefs_initializing) return; value = ghb_settings_get_value(settings, key); @@ -1210,8 +1234,23 @@ ghb_pref_save(GValue *settings, const gchar *key) GValue *dict; dict = plist_get_dict(prefsPlist, "Preferences"); if (dict == NULL) return; - ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(value)); + value2 = ghb_dict_lookup(dict, key); + if (ghb_value_cmp(value, value2) != 0) + { + ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(value)); + store_plist(prefsPlist, "preferences"); + prefs_modified = FALSE; + } + } +} + +void +ghb_prefs_store(void) +{ + if (prefs_modified) + { store_plist(prefsPlist, "preferences"); + prefs_modified = FALSE; } } -- cgit v1.2.3