summaryrefslogtreecommitdiffstats
path: root/gtk/src
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2017-12-23 12:29:23 -0800
committerJohn Stebbins <[email protected]>2017-12-23 12:30:00 -0800
commitcbd96d9ae28fc3f8763ffbeb8ff80ae9905b1902 (patch)
tree2ad11d44286b39021e9093af0ab35edf2165aad7 /gtk/src
parent12bd125b49882aebc321a1ca1f01ce0c2ef839cc (diff)
LinGui: add option to make new preset default in "Save As"
Diffstat (limited to 'gtk/src')
-rw-r--r--gtk/src/ghb.m421
-rw-r--r--gtk/src/presets.c18
2 files changed, 34 insertions, 5 deletions
diff --git a/gtk/src/ghb.m4 b/gtk/src/ghb.m4
index 0baf542a8..3b1e64816 100644
--- a/gtk/src/ghb.m4
+++ b/gtk/src/ghb.m4
@@ -8864,6 +8864,23 @@ Uncheck this if you want to allow changing each title's settings independently.<
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="PresetSetDefault">
+ <property name="label" translatable="yes">Default Preset</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">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="tooltip_text" translatable="yes">Make this the default Preset when HandBrake starts</property>
+ <property name="halign">start</property>
+ <property name="margin-bottom">12</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="preset_widget_changed_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkGrid" id="PicturePresetBox">
<property name="visible">True</property>
<property name="row-spacing">2</property>
@@ -8989,7 +9006,7 @@ Setting this to 0 means there is no maximum height.</property>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -9027,7 +9044,7 @@ Setting this to 0 means there is no maximum height.</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="padding">10</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
diff --git a/gtk/src/presets.c b/gtk/src/presets.c
index 7d7a3f67d..0f0315c3a 100644
--- a/gtk/src/presets.c
+++ b/gtk/src/presets.c
@@ -1833,7 +1833,7 @@ ghb_presets_load(signal_user_data_t *ud)
static void
settings_save(signal_user_data_t *ud, const char * category,
- const char *name, const char * desc)
+ const char *name, const char * desc, gboolean set_def)
{
GhbValue * preset, * new_preset;
gboolean def = FALSE;
@@ -1885,6 +1885,14 @@ settings_save(signal_user_data_t *ud, const char * category,
}
else
{
+ // Check if the new preset is also the new default preset
+ if (set_def)
+ {
+ ghb_dict_set_bool(new_preset, "Default", set_def);
+ ghb_presets_list_clear_default(ud);
+ hb_presets_clear_default();
+ }
+
// Adding a new preset
// Append to the folder
int index = hb_preset_append(folder_path, new_preset);
@@ -2167,7 +2175,7 @@ static void preset_save_action(signal_user_data_t *ud, gboolean as)
height = ghb_dict_get_int(ud->settings, "PictureHeight");
autoscale = ghb_dict_get_bool(ud->settings, "autoscale");
-
+ ghb_ui_update(ud, "PresetSetDefault", ghb_boolean_value(FALSE));
ghb_ui_update(ud, "PictureWidthEnable", ghb_boolean_value(!autoscale));
ghb_ui_update(ud, "PictureHeightEnable", ghb_boolean_value(!autoscale));
@@ -2232,6 +2240,8 @@ static void preset_save_action(signal_user_data_t *ud, gboolean as)
gtk_widget_set_sensitive(widget, as);
widget = GHB_WIDGET(ud->builder, "PresetCategory");
gtk_widget_set_sensitive(widget, as);
+ widget = GHB_WIDGET(ud->builder, "PresetSetDefault");
+ gtk_widget_set_visible(widget, as);
response = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_hide(dialog);
@@ -2240,6 +2250,7 @@ static void preset_save_action(signal_user_data_t *ud, gboolean as)
GtkTextBuffer * buffer;
GtkTextIter start, end;
char * desc;
+ gboolean def;
// save the preset
name = gtk_entry_get_text(entry);
@@ -2257,7 +2268,8 @@ static void preset_save_action(signal_user_data_t *ud, gboolean as)
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);
- settings_save(ud, category, name, desc);
+ def = ghb_dict_get_bool(ud->settings, "PresetSetDefault");
+ settings_save(ud, category, name, desc, def);
free(desc);
}
}