summaryrefslogtreecommitdiffstats
path: root/gtk/src
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2017-08-04 16:57:23 -0700
committerJohn Stebbins <[email protected]>2017-08-04 17:00:13 -0700
commit9d98250279e5337d3083bd8d33e38d1f88669c9a (patch)
tree1cdba54fd5c6889874da6b0532aacce54d9fce8f /gtk/src
parenteb1d99a074e06b336aa1ac0dcad0fa192ac4240e (diff)
LinGui: rework audio/subtitle tabs gtk < 3.16
Add support for older gtk versions
Diffstat (limited to 'gtk/src')
-rw-r--r--gtk/src/Makefile.am4
-rw-r--r--gtk/src/audiohandler.c28
-rw-r--r--gtk/src/ghb.m4144
-rw-r--r--gtk/src/subtitlehandler.c27
4 files changed, 200 insertions, 3 deletions
diff --git a/gtk/src/Makefile.am b/gtk/src/Makefile.am
index f376996b7..6378b90ce 100644
--- a/gtk/src/Makefile.am
+++ b/gtk/src/Makefile.am
@@ -114,6 +114,9 @@ data_res.h : data_res.gresource.xml $(srcdir)/internal_defaults.json widget.deps
cp $(srcdir)/internal_defaults.json .
glib-compile-resources --generate --target=$@ --c-name ghb_data --manual-register $<
+if GHB_GTK_3_16
+UI=316
+else
if GHB_GTK_3_14
UI=314
else
@@ -123,6 +126,7 @@ else
UI=300
endif
endif
+endif
ui_res.c : ui_res.gresource.xml ui_res.h $(srcdir)/ghb.m4
glib-compile-resources --generate --target=$@ --c-name ghb_ui --manual-register $<
diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c
index 87fe10c13..0a3a01833 100644
--- a/gtk/src/audiohandler.c
+++ b/gtk/src/audiohandler.c
@@ -2446,3 +2446,31 @@ void ghb_init_audio_defaults_ui(signal_user_data_t *ud)
list_box = GTK_LIST_BOX(GHB_WIDGET(ud->builder, "audio_avail_lang"));
ghb_init_lang_list_box(list_box);
}
+
+G_MODULE_EXPORT void
+audio_list_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
+{
+ gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ GtkToggleButton * selection = GTK_TOGGLE_BUTTON(GHB_WIDGET(ud->builder,
+ "audio_selection_toggle"));
+ gtk_toggle_button_set_active(selection, !active);
+
+ GtkStack * stack;
+ GtkWidget * tab;
+
+ stack = GTK_STACK(GHB_WIDGET(ud->builder, "AudioStack"));
+ if (active)
+ tab = GHB_WIDGET(ud->builder, "audio_list_tab");
+ else
+ tab = GHB_WIDGET(ud->builder, "audio_selection_tab");
+ gtk_stack_set_visible_child(stack, tab);
+}
+
+G_MODULE_EXPORT void
+audio_selection_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
+{
+ gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ GtkToggleButton * list = GTK_TOGGLE_BUTTON(GHB_WIDGET(ud->builder,
+ "audio_list_toggle"));
+ gtk_toggle_button_set_active(list, !active);
+}
diff --git a/gtk/src/ghb.m4 b/gtk/src/ghb.m4
index 627af176d..75ca74e44 100644
--- a/gtk/src/ghb.m4
+++ b/gtk/src/ghb.m4
@@ -4201,6 +4201,73 @@ Colon separated list of encoder options.</property>
<property name="margin_bottom">0</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
+])dnl
+ifelse(eval(gtk_version < 316), 1, filter_output([
+ <child>
+ <object class="GtkBox" id="audio_toggle_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">horizontal</property>
+ <property name="hexpand">False</property>
+ <property name="vexpand">True</property>
+ <child>
+ <object class="GtkBox" id="audio_toggle_vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="hexpand">False</property>
+ <property name="vexpand">True</property>
+ <child>
+ <object class="GtkToggleButton" id="audio_list_toggle">
+ <property name="label" translatable="yes">Track List</property>
+ <property name="active">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Show Output Audio Track List</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="halign">fill</property>
+ <signal name="toggled" handler="audio_list_toggled_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="audio_selection_toggle">
+ <property name="label" translatable="yes">Track Selection</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Show Source Track Selection Options</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="halign">fill</property>
+ <signal name="toggled" handler="audio_selection_toggled_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSeparator" id="audio_separator">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+]), filter_output([
<child>
<object class="GtkStackSidebar" id="AudioStackSidebar">
<property name="visible">True</property>
@@ -4216,6 +4283,8 @@ Colon separated list of encoder options.</property>
<property name="position">0</property>
</packing>
</child>
+]))dnl
+filter_output([
<child>
<object class="GtkStack" id="AudioStack">
<property name="homogeneous">True</property>
@@ -4956,6 +5025,73 @@ Colon separated list of encoder options.</property>
<property name="margin_bottom">0</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
+])dnl
+ifelse(eval(gtk_version < 316), 1, filter_output([
+ <child>
+ <object class="GtkBox" id="subtitle_toggle_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">horizontal</property>
+ <property name="hexpand">False</property>
+ <property name="vexpand">True</property>
+ <child>
+ <object class="GtkBox" id="subtitle_toggle_vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="hexpand">False</property>
+ <property name="vexpand">True</property>
+ <child>
+ <object class="GtkToggleButton" id="subtitle_list_toggle">
+ <property name="label" translatable="yes">Track List</property>
+ <property name="active">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Show Output Subtitle Track List</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="halign">fill</property>
+ <signal name="toggled" handler="subtitle_list_toggled_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="subtitle_selection_toggle">
+ <property name="label" translatable="yes">Track Selection</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Show Source Track Selection Options</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="halign">fill</property>
+ <signal name="toggled" handler="subtitle_selection_toggled_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSeparator" id="subtitle_separator">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+]), filter_output([
<child>
<object class="GtkStackSidebar" id="SubtitleStackSidebar">
<property name="visible">True</property>
@@ -4971,6 +5107,8 @@ Colon separated list of encoder options.</property>
<property name="position">0</property>
</packing>
</child>
+]))dnl
+filter_output([
<child>
<object class="GtkStack" id="SubtitleStack">
<property name="homogeneous">True</property>
@@ -5116,7 +5254,7 @@ Colon separated list of encoder options.</property>
</packing>
</child>
<child>
- <object class="GtkBox" id="subtitle_defaults_tab">
+ <object class="GtkBox" id="subtitle_selection_tab">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
@@ -5126,13 +5264,13 @@ Colon separated list of encoder options.</property>
<property name="margin_bottom">12</property>
<property name="hexpand">True</property>
<child>
- <object class="GtkBox" id="subtitle_defaults_box1">
+ <object class="GtkBox" id="subtitle_selection_box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">horizontal</property>
<property name="spacing">6</property>
<child>
- <object class="GtkBox" id="subtitle_defaults_box2">
+ <object class="GtkBox" id="subtitle_selection_box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
diff --git a/gtk/src/subtitlehandler.c b/gtk/src/subtitlehandler.c
index 3de46103a..580562fce 100644
--- a/gtk/src/subtitlehandler.c
+++ b/gtk/src/subtitlehandler.c
@@ -1609,3 +1609,30 @@ subtitle_remove_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *u
gtk_tree_path_free(tp);
}
+G_MODULE_EXPORT void
+subtitle_list_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
+{
+ gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ GtkToggleButton * selection = GTK_TOGGLE_BUTTON(GHB_WIDGET(ud->builder,
+ "subtitle_selection_toggle"));
+ gtk_toggle_button_set_active(selection, !active);
+
+ GtkStack * stack;
+ GtkWidget * tab;
+
+ stack = GTK_STACK(GHB_WIDGET(ud->builder, "SubtitleStack"));
+ if (active)
+ tab = GHB_WIDGET(ud->builder, "subtitle_list_tab");
+ else
+ tab = GHB_WIDGET(ud->builder, "subtitle_selection_tab");
+ gtk_stack_set_visible_child(stack, tab);
+}
+
+G_MODULE_EXPORT void
+subtitle_selection_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
+{
+ gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ GtkToggleButton * list = GTK_TOGGLE_BUTTON(GHB_WIDGET(ud->builder,
+ "subtitle_list_toggle"));
+ gtk_toggle_button_set_active(list, !active);
+}