From fd68cdf70a0bae8afcad274f3308e99f75234d62 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Thu, 8 Feb 2018 08:23:14 -0500 Subject: [PATCH] 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 --- include/gui/audio.h | 17 ++++++++- share/ocarina/ocarina.ui | 75 ++++++++++++++++++++++++++++++++++++++-- tests/gui/audio.c | 3 ++ 3 files changed, 92 insertions(+), 3 deletions(-) diff --git a/include/gui/audio.h b/include/gui/audio.h index c7fc2e91..1eb3991f 100644 --- a/include/gui/audio.h +++ b/include/gui/audio.h @@ -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) { diff --git a/share/ocarina/ocarina.ui b/share/ocarina/ocarina.ui index 15a9eb8d..90b1b591 100644 --- a/share/ocarina/ocarina.ui +++ b/share/ocarina/ocarina.ui @@ -607,7 +607,6 @@ audio-volume-medium 3 1 - 2 @@ -725,7 +724,79 @@ audio-volume-medium 4 1 - 2 + + + + + True + False + end + center + + + True + True + Paused + + + False + True + 0 + + + + + True + False + False + True + + + True + False + list-remove-symbolic + + + + + + False + True + 1 + + + + + True + False + True + + + True + False + list-add-symbolic + + + + + + False + True + 2 + + + + + + 3 + 2 + 2 diff --git a/tests/gui/audio.c b/tests/gui/audio.c index 9c6e3856..f0ecf1b3 100644 --- a/tests/gui/audio.c +++ b/tests/gui/audio.c @@ -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())));