gui/audio: Remove old pause after configuration code
And rearrange UI widgets a bit Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
bf73685098
commit
b59b2a2daf
19
gui/audio.c
19
gui/audio.c
|
@ -50,29 +50,10 @@ static void __audio_change_state(GstState state)
|
|||
|
||||
static void __audio_config_pause(int n)
|
||||
{
|
||||
GtkToggleButton *enabled = GTK_TOGGLE_BUTTON(gui_builder_widget("o_pause_enabled"));
|
||||
GtkComboBox *combo = GTK_COMBO_BOX(gui_builder_widget("o_pause_after"));
|
||||
|
||||
if (n >= 0)
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(gui_builder_widget("o_pause_count")), n);
|
||||
gtk_toggle_button_set_active(enabled, n >= 0);
|
||||
gtk_combo_box_set_active(combo, n + 1);
|
||||
}
|
||||
|
||||
void __audio_pause_count(GtkSpinButton *count)
|
||||
{
|
||||
audio_pause_after(gtk_spin_button_get_value(count));
|
||||
}
|
||||
|
||||
void __audio_pause_enabled(GtkToggleButton *enabled, GtkSpinButton *count)
|
||||
{
|
||||
int val = -1;
|
||||
|
||||
if (gtk_toggle_button_get_active(enabled))
|
||||
val = gtk_spin_button_get_value(count);
|
||||
audio_pause_after(val);
|
||||
}
|
||||
|
||||
void __audio_pause_changed(GtkComboBox *combo, gpointer data)
|
||||
{
|
||||
int val = gtk_combo_box_get_active(combo) - 1;
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
#ifdef TEST_NEED_AUDIO
|
||||
void __audio_can_accel() {}
|
||||
void __audio_pause_changed() {}
|
||||
void __audio_pause_count() {}
|
||||
void __audio_pause_enabled() {}
|
||||
void __audio_seek() {}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -286,12 +286,6 @@
|
|||
<property name="default_height">615</property>
|
||||
<signal name="configure-event" handler="__window_configure" swapped="no"/>
|
||||
<signal name="window-state-event" handler="__window_state" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkBox" id="box2">
|
||||
<property name="name">=</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
|
@ -799,13 +793,6 @@
|
|||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkPaned" id="o_sidebar">
|
||||
<property name="visible">True</property>
|
||||
|
@ -1204,51 +1191,42 @@
|
|||
<object class="GtkBox" id="box3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_top">2</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<object class="GtkProgressBar" id="o_idle_progress">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="label" translatable="yes"> songs</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="o_pause_count">
|
||||
<object class="GtkLabel" id="o_sorting_indicator">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="caps_lock_warning">False</property>
|
||||
<property name="adjustment">adjustment1</property>
|
||||
<property name="numeric">True</property>
|
||||
<signal name="changed" handler="__audio_pause_count" swapped="no"/>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="o_pause_enabled">
|
||||
<property name="label" translatable="yes">Pause after </property>
|
||||
<object class="GtkLabel" id="o_queue_time">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="__audio_pause_enabled" object="o_pause_count" swapped="no"/>
|
||||
<property name="halign">end</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
@ -1267,74 +1245,9 @@
|
|||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator" id="separator1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">2</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box12">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkProgressBar" id="o_idle_progress">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="o_queue_time">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="o_sorting_indicator">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">1</property>
|
||||
<property name="position">4</property>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -1342,10 +1255,9 @@
|
|||
<accelerator key="Escape" signal="grab-focus"/>
|
||||
</object>
|
||||
<object class="GtkSizeGroup" id="sizegroup1">
|
||||
<property name="mode">vertical</property>
|
||||
<widgets>
|
||||
<widget name="buttonbox2"/>
|
||||
<widget name="box10"/>
|
||||
<widget name="buttonbox1"/>
|
||||
<widget name="o_idle_progress"/>
|
||||
</widgets>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
@ -26,9 +26,15 @@ static inline bool test_get_toggle_state(const gchar *name)
|
|||
return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gui_builder_widget(name)));
|
||||
}
|
||||
|
||||
static inline int test_spin_button_value(const gchar *name)
|
||||
static inline gchar *test_get_pause_text()
|
||||
{
|
||||
return gtk_spin_button_get_value(GTK_SPIN_BUTTON(gui_builder_widget(name)));
|
||||
return gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(gui_builder_widget("o_pause_after")));
|
||||
}
|
||||
|
||||
static inline void test_set_pause_after(unsigned int n)
|
||||
{
|
||||
GtkComboBox *combo = GTK_COMBO_BOX(gui_builder_widget("o_pause_after"));
|
||||
gtk_combo_box_set_active(combo, n + 1);
|
||||
}
|
||||
|
||||
static inline void test_click_button(const gchar *name)
|
||||
|
@ -58,8 +64,7 @@ static void test_audio()
|
|||
|
||||
test_equal(gtk_widget_is_visible(gui_builder_widget("o_play")), true);
|
||||
test_equal(gtk_widget_is_visible(gui_builder_widget("o_pause")), false);
|
||||
test_equal(test_get_toggle_state("o_pause_enabled"), (bool)false);
|
||||
test_equal(test_spin_button_value("o_pause_count"), 0);
|
||||
test_str_equal(test_get_pause_text(), "(disabled)");
|
||||
test_equal(test_get_toggle_state("o_favorite"), (bool)false);
|
||||
test_equal(test_get_toggle_state("o_hide"), (bool)false);
|
||||
|
||||
|
@ -90,30 +95,26 @@ static void test_audio()
|
|||
test_equal(gtk_widget_is_visible(gui_builder_widget("o_play")), true);
|
||||
test_equal(gtk_widget_is_visible(gui_builder_widget("o_pause")), false);
|
||||
|
||||
test_click_button("o_pause_enabled");
|
||||
test_equal(test_get_toggle_state("o_pause_enabled"), (bool)true);
|
||||
test_set_pause_after(0);
|
||||
audio_eos();
|
||||
test_equal(audio_cur_track()->tr_track, 1);
|
||||
test_equal(test_get_toggle_state("o_pause_enabled"), (bool)false);
|
||||
test_str_equal(test_get_pause_text(), "(disabled)");
|
||||
|
||||
test_click_button("o_next");
|
||||
test_equal(audio_cur_track()->tr_track, 2);
|
||||
test_equal(test_get_toggle_state("o_favorite"), (bool)false);
|
||||
test_equal(test_get_toggle_state("o_hide"), (bool)false);
|
||||
|
||||
gtk_spin_button_set_value(
|
||||
GTK_SPIN_BUTTON(gui_builder_widget("o_pause_count")), 1);
|
||||
test_equal(test_get_toggle_state("o_pause_enabled"), (bool)true);
|
||||
test_equal(test_spin_button_value("o_pause_count"), 1);
|
||||
test_set_pause_after(1);
|
||||
test_str_equal(test_get_pause_text(), "next track");
|
||||
|
||||
audio_eos();
|
||||
test_equal(audio_cur_track()->tr_track, 3);
|
||||
test_equal(test_get_toggle_state("o_pause_enabled"), (bool)true);
|
||||
test_equal(test_spin_button_value("o_pause_count"), 0);
|
||||
test_str_equal(test_get_pause_text(), "current track");
|
||||
|
||||
audio_eos();
|
||||
test_equal(audio_cur_track()->tr_track, 4);
|
||||
test_equal(test_get_toggle_state("o_pause_enabled"), (bool)false);
|
||||
test_str_equal(test_get_pause_text(), "(disabled)");
|
||||
|
||||
test_click_button("o_prev");
|
||||
test_equal(audio_cur_track()->tr_track, 3);
|
||||
|
|
Loading…
Reference in New Issue