From 0cb44aaf3a770e582c1eef0fadafbf3f27dadd53 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Thu, 18 Aug 2016 10:00:41 -0400 Subject: [PATCH] gui/queue: Remove Repeat button Most playlists don't allow changing this, and now that we have user playlists it doesn't make sense to support repeating queued tracks. Signed-off-by: Anna Schumaker --- gui/queue.c | 15 +-------------- share/ocarina/ocarina6.glade | 37 +++++++++--------------------------- tests/gui/queue.c | 24 ++--------------------- 3 files changed, 12 insertions(+), 64 deletions(-) diff --git a/gui/queue.c b/gui/queue.c index 1c438d73..0370289f 100644 --- a/gui/queue.c +++ b/gui/queue.c @@ -49,13 +49,6 @@ void __queue_random(GtkToggleButton *button, gpointer data) } } -void __queue_repeat(GtkToggleButton *button, gpointer data) -{ - __queue_toggle_flag(gtk_toggle_button_get_active(button), - gtk_button_get_image(GTK_BUTTON(button)), - Q_REPEAT); -} - static gboolean __queue_visible_func(GtkTreeModel *model, GtkTreeIter *iter, gpointer data) { @@ -163,33 +156,27 @@ void gui_queue_free(struct queue *queue) void gui_queue_show(struct gui_queue *queue) { GtkButton *random = GTK_BUTTON(gui_builder_widget("o_random")); - GtkButton *repeat = GTK_BUTTON(gui_builder_widget("o_repeat")); GtkEntry *search = GTK_ENTRY(gui_builder_widget("o_search")); - bool has_random = false, has_repeat = false; + bool has_random = false; gchar *text; gq_queue = queue; gtk_widget_set_sensitive(GTK_WIDGET(random), gui_queue_can_random(queue)); - gtk_widget_set_sensitive(GTK_WIDGET(repeat), gui_queue_can_repeat(queue)); if (queue) { has_random = queue_has_flag(queue->gq_queue, Q_RANDOM); - has_repeat = queue_has_flag(queue->gq_queue, Q_REPEAT); gui_view_set_queue(queue->gq_queue); } else gui_view_set_queue(NULL); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(random), has_random); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(repeat), has_repeat); /* * Some GTK themes have trouble with toggle buttons, * so let's help users know what the current state is. */ gtk_widget_set_sensitive(gtk_button_get_image(random), has_random); - gtk_widget_set_sensitive(gtk_button_get_image(repeat), has_repeat); - gtk_widget_set_sensitive(GTK_WIDGET(search), queue != NULL); if (queue && queue->gq_search) { diff --git a/share/ocarina/ocarina6.glade b/share/ocarina/ocarina6.glade index f815f04c..3bc7b44d 100644 --- a/share/ocarina/ocarina6.glade +++ b/share/ocarina/ocarina6.glade @@ -13,13 +13,6 @@ False text-x-generic - - True - False - 10 - 10 - media-playlist-repeat - True False @@ -427,7 +420,7 @@ False end start - 5 + 9 10 @@ -435,7 +428,7 @@ True True Randomly pick tracks - center + start center image9 @@ -447,31 +440,13 @@ True - - - True - True - True - Repeat tracks - center - center - image10 - - - - False - False - 1 - True - - True True False True - center + end center vertical button @@ -1234,6 +1209,12 @@ audio-volume-medium + + + + + + True diff --git a/tests/gui/queue.c b/tests/gui/queue.c index 99441b45..85246c83 100644 --- a/tests/gui/queue.c +++ b/tests/gui/queue.c @@ -33,17 +33,15 @@ struct core_init_data init_data = { static void test_queue() { - GtkToggleButton *random, *repeat; - GtkWidget *random_img, *repeat_img; + GtkToggleButton *random; + GtkWidget *random_img; struct gui_queue *gq; GtkEntry *search; struct queue q; search = GTK_ENTRY(gui_builder_widget("o_search")); random = GTK_TOGGLE_BUTTON(gui_builder_widget("o_random")); - repeat = GTK_TOGGLE_BUTTON(gui_builder_widget("o_repeat")); random_img = gtk_button_get_image(GTK_BUTTON(random)); - repeat_img = gtk_button_get_image(GTK_BUTTON(repeat)); /* Test initialization */ queue_init(&q, Q_ENABLED, &test_ops, NULL); @@ -63,11 +61,8 @@ static void test_queue() /* Show a queue where random and repeat are disabled */ gui_queue_show(gq); g_assert_false(gtk_widget_get_sensitive(GTK_WIDGET(random))); - g_assert_false(gtk_widget_get_sensitive(GTK_WIDGET(repeat))); g_assert_false(gtk_toggle_button_get_active(random)); - g_assert_false(gtk_toggle_button_get_active(repeat)); g_assert_false(gtk_widget_get_sensitive(random_img)); - g_assert_false(gtk_widget_get_sensitive(repeat_img)); g_assert_cmpstr(gtk_entry_get_text(search), ==, ""); /* Test clicking random button. */ @@ -79,35 +74,20 @@ static void test_queue() g_assert_false(gtk_widget_get_sensitive(random_img)); g_assert_false(queue_has_flag(&q, Q_RANDOM)); - /* Test clicking repeat button. */ - gtk_toggle_button_set_active(repeat, true); - g_assert_true(gtk_widget_get_sensitive(repeat_img)); - g_assert_true(queue_has_flag(&q, Q_REPEAT)); - - gtk_toggle_button_set_active(repeat, false); - g_assert_false(gtk_widget_get_sensitive(repeat_img)); - g_assert_false(queue_has_flag(&q, Q_REPEAT)); - /* Show a queue where random and repeat are enabled */ gq->gq_flags = GQ_CAN_RANDOM | GQ_CAN_REPEAT | GQ_CAN_DISABLE; q.q_flags = Q_RANDOM | Q_REPEAT | Q_ENABLED; gui_queue_show(gq); g_assert_true(gtk_widget_get_sensitive(GTK_WIDGET(random))); - g_assert_true(gtk_widget_get_sensitive(GTK_WIDGET(repeat))); g_assert_true(gtk_toggle_button_get_active(random)); - g_assert_true(gtk_toggle_button_get_active(repeat)); g_assert_true(gtk_widget_get_sensitive(random_img)); - g_assert_true(gtk_widget_get_sensitive(repeat_img)); /* Attempt to show a NULL pointer */ gui_queue_show(NULL); g_assert_false(gtk_widget_get_sensitive(GTK_WIDGET(search))); g_assert_false(gtk_widget_get_sensitive(GTK_WIDGET(random))); - g_assert_false(gtk_widget_get_sensitive(GTK_WIDGET(repeat))); g_assert_false(gtk_toggle_button_get_active(random)); - g_assert_false(gtk_toggle_button_get_active(repeat)); g_assert_false(gtk_widget_get_sensitive(random_img)); - g_assert_false(gtk_widget_get_sensitive(repeat_img)); queue_deinit(&q); g_assert_null(gui_queue(&q));