diff options
author | John Stebbins <[email protected]> | 2017-12-23 12:29:23 -0800 |
---|---|---|
committer | John Stebbins <[email protected]> | 2017-12-23 12:30:00 -0800 |
commit | cbd96d9ae28fc3f8763ffbeb8ff80ae9905b1902 (patch) | |
tree | 2ad11d44286b39021e9093af0ab35edf2165aad7 /gtk/src/presets.c | |
parent | 12bd125b49882aebc321a1ca1f01ce0c2ef839cc (diff) |
LinGui: add option to make new preset default in "Save As"
Diffstat (limited to 'gtk/src/presets.c')
-rw-r--r-- | gtk/src/presets.c | 18 |
1 files changed, 15 insertions, 3 deletions
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); } } |