diff options
author | John Stebbins <[email protected]> | 2017-12-23 10:09:24 -0800 |
---|---|---|
committer | John Stebbins <[email protected]> | 2017-12-23 10:09:50 -0800 |
commit | 41bc94d6481dfcb082b2e964765d287d6f2981a9 (patch) | |
tree | 3133bc66362824fb6852ffbfe7154b6417520b8c /gtk/src/presets.c | |
parent | ced960afd6cef99e9a543d1c122d9197a4ee5e0f (diff) |
LinGui: allow chaning description in preset rename
Diffstat (limited to 'gtk/src/presets.c')
-rw-r--r-- | gtk/src/presets.c | 15 |
1 files changed, 15 insertions, 0 deletions
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); |