summaryrefslogtreecommitdiffstats
path: root/gtk/src/settings.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2014-02-18 16:02:14 +0000
committerjstebbins <[email protected]>2014-02-18 16:02:14 +0000
commitb3e905dde9dacd4129c05440cedbe5a1366d0243 (patch)
tree420015a42c464390a90c3f9c94c268a3d0ea5bd3 /gtk/src/settings.c
parent52036382899171921343e10053fa3adaedcb19d2 (diff)
LinGui: Audio and subtitle UI rework.
Adds new tabs for audio and subtitle defaults (presets). "Audio" and "Subtitle" tabs renamed to "Audio List" and "Subtitle List" New Preset Keys: AudioLanguageList - array of strings List of languages that will be used to generate the output audio tracks for a job. Values: preset - UI display iso639_2 codes - native_name if not NULL, else eng_name SubtitleLanguageList - array of strings List of languages that will be used to generate the output subtitle tracks for a job. Values: preset - UI display iso639_2 codes - native_name if not NULL, else eng_name AudioTrackSelectionBehavior - string Defines how source tracks will be selected when generating the audio list for a job. Values: preset - UI display none - None first - First Matching Selected Languages all - All Matching Selected Languages SubtitleTrackSelectionBehavior - string Defines how source tracks will be selected when generating the subtitle list for a job. Values: preset - UI display none - None first - First Matching Selected Languages all - All Matching Selected Languages SubtitleAddCC - boolean Add Closed Caption track to subtitle list if available SubtitleAddForeignAudioSearch - boolean Add Foreign audio search pass to job if a default subtitle language is set (i.e. SubtitleLanguageList is not empty and first entry is not "Any") and default audio track language matches subtitle preferred language. SubtitleAddForeignAudioSubtitle - boolean Add preferred language subtitle track if the default subtitle language is set (i.e. SubtitleLanguageList is not empty and first entry is not "Any") and default audio track language does not match the preferred subtitle language. Removed Preset Keys: AudioTrack SubtitleList - I think only the LinGui had this key. Note that the remaining keys in the pre-existing AudioList are reused and map to the "Audio Encoder Settings" on the "Audio Defaults" tab. They used to map to the entries in the list on the old "Audio" tab. The old "Audio" tab is now the "Audio List" tab. Nothing in the "Audio List" tab map to preset values in the new design. The contents of this tab is strictly for use in the encode job. Ditto for "Subtitle Defaults" and "Subtitle List". git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6040 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/settings.c')
-rw-r--r--gtk/src/settings.c47
1 files changed, 11 insertions, 36 deletions
diff --git a/gtk/src/settings.c b/gtk/src/settings.c
index ee68f74f6..5acee1ece 100644
--- a/gtk/src/settings.c
+++ b/gtk/src/settings.c
@@ -190,6 +190,10 @@ ghb_get_setting_key(GtkWidget *widget)
if (name == NULL)
{
+ name = gtk_widget_get_name(widget);
+ }
+ if (name == NULL)
+ {
// Bad widget pointer? Should never happen.
g_debug("Bad widget\n");
return NULL;
@@ -415,26 +419,6 @@ ghb_widget_boolean(GtkWidget *widget)
return bval;
}
-static void check_radio_consistency(GValue *settings, GtkWidget *widget)
-{
- const gchar *key = NULL;
- GValue *value;
-
- if (widget == NULL) return;
- if (G_OBJECT_TYPE(widget) == GTK_TYPE_RADIO_BUTTON)
- {
- // Find corresponding setting
- key = ghb_get_setting_key(widget);
- if (key == NULL) return;
- value = ghb_widget_value(widget);
- if (value == NULL) return;
- if (ghb_value_boolean(value) == ghb_settings_get_boolean(settings, key))
- {
- gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(widget), FALSE);
- }
- }
-}
-
void
ghb_widget_to_setting(GValue *settings, GtkWidget *widget)
{
@@ -449,7 +433,6 @@ ghb_widget_to_setting(GValue *settings, GtkWidget *widget)
value = ghb_widget_value(widget);
if (value != NULL)
{
- check_radio_consistency(settings, widget);
ghb_settings_take_value(settings, key, value);
}
else
@@ -458,15 +441,15 @@ ghb_widget_to_setting(GValue *settings, GtkWidget *widget)
}
}
-static void
-update_widget(GtkWidget *widget, const GValue *value)
+void
+ghb_update_widget(GtkWidget *widget, const GValue *value)
{
GType type;
gchar *str;
gint ival;
gdouble dval;
- g_debug("update_widget");
+ g_debug("ghb_update_widget");
type = G_VALUE_TYPE(value);
if (type == ghb_array_get_type() || type == ghb_dict_get_type())
return;
@@ -475,6 +458,7 @@ update_widget(GtkWidget *widget, const GValue *value)
ival = ghb_value_int(value);
dval = ghb_value_double(value);
type = G_OBJECT_TYPE(widget);
+
if (type == GTK_TYPE_ENTRY)
{
g_debug("entry");
@@ -483,16 +467,7 @@ update_widget(GtkWidget *widget, const GValue *value)
else if (type == GTK_TYPE_RADIO_BUTTON)
{
g_debug("radio button");
- int cur_val = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
- if (cur_val && !ival)
- {
- gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(widget), TRUE);
- }
- else
- {
- gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(widget), FALSE);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), ival);
- }
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), !!ival);
}
else if (type == GTK_TYPE_CHECK_BUTTON)
{
@@ -666,7 +641,7 @@ ghb_ui_update_from_settings(GtkBuilder *builder, const gchar *name, const GValue
g_debug("Failed to find widget for key: %s\n", name);
return -1;
}
- update_widget((GtkWidget*)object, value);
+ ghb_update_widget((GtkWidget*)object, value);
return 0;
}
@@ -684,7 +659,7 @@ ghb_ui_update(signal_user_data_t *ud, const gchar *name, const GValue *value)
g_debug("Failed to find widget for key: %s\n", name);
return -1;
}
- update_widget((GtkWidget*)object, value);
+ ghb_update_widget((GtkWidget*)object, value);
// Its possible the value hasn't changed. Since settings are only
// updated when the value changes, I'm initializing settings here as well.
ghb_widget_to_setting(ud->settings, (GtkWidget*)object);