gui/audio: Add basic spin-button-like widgets

I set the "linked" property on the hbox to make everything look like a
single widget.  I'm doing this on my own to cut out the GtkAdjustment
and to just use the counter in the audio layer in its place.
Additionally, this will give me the ability to use "+" and "-" keyboard
shortcuts to activate the widgets.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2018-02-08 08:23:14 -05:00
parent 8a2c631a9b
commit fd68cdf70a
3 changed files with 92 additions and 3 deletions

View File

@ -72,12 +72,27 @@ static inline GtkButton *gui_next_button(void)
return GTK_BUTTON(gui_builder_widget("next_button"));
}
/* Called to get the pause-fater combobox. */
/* Called to get the pause-after widgets. */
static inline GtkComboBoxText *gui_pause_after(void)
{
return GTK_COMBO_BOX_TEXT(gui_builder_widget("pause_after"));
}
static inline GtkEntry *gui_pause_entry(void)
{
return GTK_ENTRY(gui_builder_widget("pause_entry"));
}
static inline GtkButton *gui_pause_down(void)
{
return GTK_BUTTON(gui_builder_widget("pause_down"));
}
static inline GtkButton *gui_pause_up(void)
{
return GTK_BUTTON(gui_builder_widget("pause_up"));
}
/* Called to get the seeking GtkAdjustment. */
static inline GtkAdjustment *gui_seek(void)
{

View File

@ -607,7 +607,6 @@ audio-volume-medium</property>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">1</property>
<property name="height">2</property>
</packing>
</child>
<child>
@ -725,7 +724,79 @@ audio-volume-medium</property>
<packing>
<property name="left_attach">4</property>
<property name="top_attach">1</property>
<property name="height">2</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">center</property>
<child>
<object class="GtkEntry" id="pause_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text" translatable="yes">Paused</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pause_down">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="receives_default">True</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">list-remove-symbolic</property>
</object>
</child>
<style>
<class name="down"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pause_up">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">True</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">list-add-symbolic</property>
</object>
</child>
<style>
<class name="up"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<style>
<class name="linked"/>
</style>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child>

View File

@ -25,6 +25,9 @@ static void test_audio_init()
==, "(disabled)");
g_assert_cmpuint(gtk_combo_box_get_active(
GTK_COMBO_BOX(gui_pause_after())), ==, 0);
g_assert_cmpstr(gtk_entry_get_text(gui_pause_entry()), ==, "Paused");
g_assert_true(gtk_widget_get_sensitive(GTK_WIDGET(gui_pause_up())));
g_assert_false(gtk_widget_get_sensitive(GTK_WIDGET(gui_pause_down())));
g_assert_cmpfloat(gtk_scale_button_get_value(gui_volume_button()),
==, 100);
g_assert_true( gtk_widget_is_visible(GTK_WIDGET(gui_play_button())));