diff options
author | jstebbins <[email protected]> | 2014-05-21 17:03:24 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2014-05-21 17:03:24 +0000 |
commit | c8cef65489e56e5387aae849e11fb732761632cc (patch) | |
tree | 52f37ff745792e30e8ef641c8faf6d1cb6cca7e6 /gtk/src/callbacks.c | |
parent | 2f11d9d7920a7e3c54c38c28c0478a67f313aeb2 (diff) |
LinGui: Improve auto destination file name behavior
Don't change the destination file name when a setting changes that is
not in the auto-name template. I.e. if quality changes and "{quality}" is
not in the template, leave the destination file name alone.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6200 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/callbacks.c')
-rw-r--r-- | gtk/src/callbacks.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 359a68ae7..9b765958d 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -562,6 +562,20 @@ get_extension(signal_user_data_t *ud, GValue *settings) return mux->default_extension; } +static gboolean +check_name_template(signal_user_data_t *ud, const char *str) +{ + if (ghb_settings_get_boolean(ud->prefs, "auto_name")) + { + gchar *template; + + template = ghb_settings_get_string(ud->prefs, "auto_name_template"); + if (strstr(template, str) != NULL) + return TRUE; + } + return FALSE; +} + static void set_destination_settings(signal_user_data_t *ud, GValue *settings) { @@ -2095,7 +2109,9 @@ vquality_type_changed_cb(GtkWidget *widget, signal_user_data_t *ud) ghb_check_dependency(ud, widget, NULL); ghb_clear_presets_selection(ud); ghb_live_reset(ud); - set_destination(ud); + if (check_name_template(ud, "{quality}") || + check_name_template(ud, "{bitrate}")) + set_destination(ud); } G_MODULE_EXPORT void @@ -2105,7 +2121,8 @@ vbitrate_changed_cb(GtkWidget *widget, signal_user_data_t *ud) ghb_check_dependency(ud, widget, NULL); ghb_clear_presets_selection(ud); ghb_live_reset(ud); - set_destination(ud); + if (check_name_template(ud, "{bitrate}")) + set_destination(ud); } G_MODULE_EXPORT void @@ -2136,7 +2153,8 @@ vquality_changed_cb(GtkWidget *widget, signal_user_data_t *ud) gdouble val = gtk_range_get_value(GTK_RANGE(widget)); val = ((int)((val + step / 2) / step)) * step; gtk_range_set_value(GTK_RANGE(widget), val); - set_destination(ud); + if (check_name_template(ud, "{quality}")) + set_destination(ud); } G_MODULE_EXPORT void @@ -2230,7 +2248,8 @@ start_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud) if (start > end) ghb_ui_update(ud, "end_point", ghb_int_value(start)); ghb_check_dependency(ud, widget, NULL); - set_destination(ud); + if (check_name_template(ud, "{chapters}")) + set_destination(ud); widget = GHB_WIDGET (ud->builder, "ChapterMarkers"); // End may have been changed above, get it again end = ghb_settings_get_int(ud->settings, "end_point"); @@ -2270,7 +2289,8 @@ end_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud) if (start > end) ghb_ui_update(ud, "start_point", ghb_int_value(end)); ghb_check_dependency(ud, widget, NULL); - set_destination(ud); + if (check_name_template(ud, "{chapters}")) + set_destination(ud); widget = GHB_WIDGET (ud->builder, "ChapterMarkers"); // Start may have been changed above, get it again start = ghb_settings_get_int(ud->settings, "start_point"); |