summaryrefslogtreecommitdiffstats
path: root/gtk/src/presets.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2009-04-04 21:13:29 +0000
committerjstebbins <[email protected]>2009-04-04 21:13:29 +0000
commit0e8146cb77a2891a228d61fc5cfbca9d715e69fb (patch)
tree6e1b601c6d51d13cdda4aa7b291bd42e267144b2 /gtk/src/presets.c
parentc836a955f7248d35808c0f5e00a72e40d86c1f46 (diff)
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
Diffstat (limited to 'gtk/src/presets.c')
-rw-r--r--gtk/src/presets.c43
1 files changed, 41 insertions, 2 deletions
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;
}
}