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/ghb.m4 | 98 ++++++++++++++++++++++++++++++++++++++++++++++--------- gtk/src/presets.c | 15 +++++++++ 2 files changed, 97 insertions(+), 16 deletions(-) (limited to 'gtk/src') diff --git a/gtk/src/ghb.m4 b/gtk/src/ghb.m4 index 171186242..0baf542a8 100644 --- a/gtk/src/ghb.m4 +++ b/gtk/src/ghb.m4 @@ -8564,18 +8564,20 @@ Uncheck this if you want to allow changing each title's settings independently.< - - horizontal + + vertical True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - end - Preset Name: + start + 12 + True + <span size="x-large">Rename Preset</span> False @@ -8584,24 +8586,88 @@ Uncheck this if you want to allow changing each title's settings independently.< - + + horizontal True - True + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 40 - True - 30 - True - False - False - + True + 4 + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + end + Name: + + + False + True + 0 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 40 + True + 40 + True + False + False + True + + + + 1 + + - True - True 1 + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + etched-out + + + 6 + 4 + 12 + 4 + 60 + True + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + word + False + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + <b>Description</b> + True + + + + + 10 + 2 + + True 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