summaryrefslogtreecommitdiffstats
path: root/gtk/src
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2017-12-23 10:09:24 -0800
committerJohn Stebbins <[email protected]>2017-12-23 10:09:50 -0800
commit41bc94d6481dfcb082b2e964765d287d6f2981a9 (patch)
tree3133bc66362824fb6852ffbfe7154b6417520b8c /gtk/src
parentced960afd6cef99e9a543d1c122d9197a4ee5e0f (diff)
LinGui: allow chaning description in preset rename
Diffstat (limited to 'gtk/src')
-rw-r--r--gtk/src/ghb.m498
-rw-r--r--gtk/src/presets.c15
2 files changed, 97 insertions, 16 deletions
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.<
</packing>
</child>
<child>
- <object class="GtkBox" id="preset_rename_hbox">
- <property name="orientation">horizontal</property>
+ <object class="GtkBox" id="preset_rename_vbox">
+ <property name="orientation">vertical</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
- <object class="GtkLabel" id="preset_rename_label">
+ <object class="GtkLabel" id="preset_dialog_rename_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="halign">end</property>
- <property name="label" translatable="yes">Preset Name:</property>
+ <property name="halign">start</property>
+ <property name="margin-bottom">12</property>
+ <property name="use_markup">True</property>
+ <property name="label" translatable="yes">&lt;span size="x-large"&gt;Rename Preset&lt;/span&gt;</property>
</object>
<packing>
<property name="expand">False</property>
@@ -8584,24 +8586,88 @@ Uncheck this if you want to allow changing each title's settings independently.<
</packing>
</child>
<child>
- <object class="GtkEntry" id="PresetReName">
+ <object class="GtkBox" id="preset_rename_hbox">
+ <property name="orientation">horizontal</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="max_length">40</property>
- <property name="activates_default">True</property>
- <property name="width-chars">30</property>
- <property name="truncate_multiline">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- <signal name="changed" handler="preset_name_changed_cb" swapped="no"/>
+ <property name="hexpand">True</property>
+ <property name="spacing">4</property>
+ <child>
+ <object class="GtkLabel" id="preset_rename_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="halign">end</property>
+ <property name="label" translatable="yes">Name:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="PresetReName">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="max_length">40</property>
+ <property name="activates_default">True</property>
+ <property name="width-chars">40</property>
+ <property name="truncate_multiline">True</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="hexpand">True</property>
+ <signal name="changed" handler="preset_name_changed_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkFrame" id="preset_rename_desc_frame">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">etched-out</property>
+ <child>
+ <object class="GtkTextView" id="PresetReDescription">
+ <property name="margin-top">6</property>
+ <property name="margin-bottom">4</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">4</property>
+ <property name="height_request">60</property>
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="wrap_mode">word</property>
+ <property name="accepts_tab">False</property>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="preset_rename_desc_frame_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">&lt;b&gt;Description&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">10</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">True</property>
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);