summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2009-07-13 14:38:41 +0000
committerjstebbins <[email protected]>2009-07-13 14:38:41 +0000
commit59e07f6e61c2f924ef491f1bbb52ef3a064a98e3 (patch)
treea8678754a45152a9146b062b0f48c5cf090ad287
parente611f88e3e0088ac43f9f729f0e9c78b0eef9601 (diff)
LinGui: when renaming a preset, prevent duplicates names from being used
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2689 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--gtk/src/presets.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/gtk/src/presets.c b/gtk/src/presets.c
index 5bd8786dd..c11b9994a 100644
--- a/gtk/src/presets.c
+++ b/gtk/src/presets.c
@@ -4040,12 +4040,28 @@ preset_edited_cb(
GtkTreeStore *store;
GtkTreeView *treeview;
GtkTreeIter iter;
- gint *indices, len;
+ gint *indices, len, count;
GValue *dict;
+ GValue *preset, *dest;
g_debug("preset_edited_cb ()");
g_debug("path (%s)", path);
g_debug("text (%s)", text);
+
+ preset = ghb_settings_get_value (ud->settings, "preset_selection");
+ dest = ghb_array_value_new(MAX_NESTED_PRESET);
+ count = ghb_array_len(preset);
+ ghb_array_copy(dest, preset, count-1);
+ ghb_array_append(dest, ghb_string_value_new(text));
+ indices = ghb_preset_indices_from_path(presetsPlist, dest, &len);
+ ghb_value_free(dest);
+ if (indices != NULL)
+ {
+ // Already exists
+ g_free(indices);
+ return;
+ }
+
treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list"));
store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
treepath = gtk_tree_path_new_from_string (path);