From 41bc94d6481dfcb082b2e964765d287d6f2981a9 Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Sat, 23 Dec 2017 10:09:24 -0800 Subject: LinGui: allow chaning description in preset rename --- gtk/src/presets.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gtk/src/presets.c') diff --git a/gtk/src/presets.c b/gtk/src/presets.c index 8da10ce5d..7d7a3f67d 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -2089,6 +2089,7 @@ preset_rename_action_cb(GSimpleAction *action, GVariant *param, hb_preset_index_t * path; GtkWidget * dialog; GtkEntry * entry; + GtkTextView * tv; GhbValue * dict; GtkResponseType response; @@ -2103,6 +2104,10 @@ preset_rename_action_cb(GSimpleAction *action, GVariant *param, } path = hb_preset_search_index(fullname, 0, type); + ghb_ui_update(ud, "PresetReDescription", + ghb_dict_get_value(ud->settings, "PresetDescription")); + tv = GTK_TEXT_VIEW(GHB_WIDGET(ud->builder, "PresetReDescription")); + dialog = GHB_WIDGET(ud->builder, "preset_rename_dialog"); entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "PresetReName")); gtk_entry_set_text(entry, name); @@ -2111,6 +2116,10 @@ preset_rename_action_cb(GSimpleAction *action, GVariant *param, gtk_widget_hide(dialog); if (response == GTK_RESPONSE_OK) { + GtkTextBuffer * buffer; + GtkTextIter start, end; + char * desc; + // save the new name name = gtk_entry_get_text(entry); dict = hb_preset_get(path); @@ -2120,6 +2129,12 @@ preset_rename_action_cb(GSimpleAction *action, GVariant *param, store_presets(); } + buffer = gtk_text_view_get_buffer(tv); + gtk_text_buffer_get_bounds(buffer, &start, &end); + desc = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); + ghb_dict_set_string(ud->settings, "PresetDescription", desc); + free(desc); + char * full = preset_get_fullname(path, "/"); ghb_dict_set_string(ud->settings, "PresetFullName", full); ghb_dict_set_string(ud->settings, "PresetName", name); -- cgit v1.2.3