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 <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
4a4ec3fa36
commit
0cb44aaf3a
15
gui/queue.c
15
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,
|
static gboolean __queue_visible_func(GtkTreeModel *model, GtkTreeIter *iter,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
|
@ -163,33 +156,27 @@ void gui_queue_free(struct queue *queue)
|
||||||
void gui_queue_show(struct gui_queue *queue)
|
void gui_queue_show(struct gui_queue *queue)
|
||||||
{
|
{
|
||||||
GtkButton *random = GTK_BUTTON(gui_builder_widget("o_random"));
|
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"));
|
GtkEntry *search = GTK_ENTRY(gui_builder_widget("o_search"));
|
||||||
bool has_random = false, has_repeat = false;
|
bool has_random = false;
|
||||||
gchar *text;
|
gchar *text;
|
||||||
|
|
||||||
gq_queue = queue;
|
gq_queue = queue;
|
||||||
|
|
||||||
gtk_widget_set_sensitive(GTK_WIDGET(random), gui_queue_can_random(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) {
|
if (queue) {
|
||||||
has_random = queue_has_flag(queue->gq_queue, Q_RANDOM);
|
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);
|
gui_view_set_queue(queue->gq_queue);
|
||||||
} else
|
} else
|
||||||
gui_view_set_queue(NULL);
|
gui_view_set_queue(NULL);
|
||||||
|
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(random), has_random);
|
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,
|
* Some GTK themes have trouble with toggle buttons,
|
||||||
* so let's help users know what the current state is.
|
* 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(random), has_random);
|
||||||
gtk_widget_set_sensitive(gtk_button_get_image(repeat), has_repeat);
|
|
||||||
|
|
||||||
gtk_widget_set_sensitive(GTK_WIDGET(search), queue != NULL);
|
gtk_widget_set_sensitive(GTK_WIDGET(search), queue != NULL);
|
||||||
|
|
||||||
if (queue && queue->gq_search) {
|
if (queue && queue->gq_search) {
|
||||||
|
|
|
@ -13,13 +13,6 @@
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="icon_name">text-x-generic</property>
|
<property name="icon_name">text-x-generic</property>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkImage" id="image10">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="margin_left">10</property>
|
|
||||||
<property name="margin_right">10</property>
|
|
||||||
<property name="icon_name">media-playlist-repeat</property>
|
|
||||||
</object>
|
|
||||||
<object class="GtkImage" id="image19">
|
<object class="GtkImage" id="image19">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
@ -427,7 +420,7 @@
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="valign">start</property>
|
<property name="valign">start</property>
|
||||||
<property name="margin_right">5</property>
|
<property name="margin_right">9</property>
|
||||||
<property name="margin_top">10</property>
|
<property name="margin_top">10</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToggleButton" id="o_random">
|
<object class="GtkToggleButton" id="o_random">
|
||||||
|
@ -435,7 +428,7 @@
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="tooltip_text" translatable="yes">Randomly pick tracks</property>
|
<property name="tooltip_text" translatable="yes">Randomly pick tracks</property>
|
||||||
<property name="halign">center</property>
|
<property name="halign">start</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="image">image9</property>
|
<property name="image">image9</property>
|
||||||
<signal name="toggled" handler="__queue_random" swapped="no"/>
|
<signal name="toggled" handler="__queue_random" swapped="no"/>
|
||||||
|
@ -447,31 +440,13 @@
|
||||||
<property name="non_homogeneous">True</property>
|
<property name="non_homogeneous">True</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkToggleButton" id="o_repeat">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">True</property>
|
|
||||||
<property name="tooltip_text" translatable="yes">Repeat tracks</property>
|
|
||||||
<property name="halign">center</property>
|
|
||||||
<property name="valign">center</property>
|
|
||||||
<property name="image">image10</property>
|
|
||||||
<signal name="toggled" handler="__queue_repeat" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
<property name="non_homogeneous">True</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkVolumeButton" id="o_volume">
|
<object class="GtkVolumeButton" id="o_volume">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="focus_on_click">False</property>
|
<property name="focus_on_click">False</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="halign">center</property>
|
<property name="halign">end</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<property name="size">button</property>
|
<property name="size">button</property>
|
||||||
|
@ -1234,6 +1209,12 @@ audio-volume-medium</property>
|
||||||
<widget name="filter_how"/>
|
<widget name="filter_how"/>
|
||||||
</widgets>
|
</widgets>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="GtkSizeGroup">
|
||||||
|
<widgets>
|
||||||
|
<widget name="o_random"/>
|
||||||
|
<widget name="o_volume"/>
|
||||||
|
</widgets>
|
||||||
|
</object>
|
||||||
<object class="GtkSizeGroup" id="sizegroup1">
|
<object class="GtkSizeGroup" id="sizegroup1">
|
||||||
<property name="ignore_hidden">True</property>
|
<property name="ignore_hidden">True</property>
|
||||||
<widgets>
|
<widgets>
|
||||||
|
|
|
@ -33,17 +33,15 @@ struct core_init_data init_data = {
|
||||||
|
|
||||||
static void test_queue()
|
static void test_queue()
|
||||||
{
|
{
|
||||||
GtkToggleButton *random, *repeat;
|
GtkToggleButton *random;
|
||||||
GtkWidget *random_img, *repeat_img;
|
GtkWidget *random_img;
|
||||||
struct gui_queue *gq;
|
struct gui_queue *gq;
|
||||||
GtkEntry *search;
|
GtkEntry *search;
|
||||||
struct queue q;
|
struct queue q;
|
||||||
|
|
||||||
search = GTK_ENTRY(gui_builder_widget("o_search"));
|
search = GTK_ENTRY(gui_builder_widget("o_search"));
|
||||||
random = GTK_TOGGLE_BUTTON(gui_builder_widget("o_random"));
|
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));
|
random_img = gtk_button_get_image(GTK_BUTTON(random));
|
||||||
repeat_img = gtk_button_get_image(GTK_BUTTON(repeat));
|
|
||||||
|
|
||||||
/* Test initialization */
|
/* Test initialization */
|
||||||
queue_init(&q, Q_ENABLED, &test_ops, NULL);
|
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 */
|
/* Show a queue where random and repeat are disabled */
|
||||||
gui_queue_show(gq);
|
gui_queue_show(gq);
|
||||||
g_assert_false(gtk_widget_get_sensitive(GTK_WIDGET(random)));
|
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(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(random_img));
|
||||||
g_assert_false(gtk_widget_get_sensitive(repeat_img));
|
|
||||||
g_assert_cmpstr(gtk_entry_get_text(search), ==, "");
|
g_assert_cmpstr(gtk_entry_get_text(search), ==, "");
|
||||||
|
|
||||||
/* Test clicking random button. */
|
/* Test clicking random button. */
|
||||||
|
@ -79,35 +74,20 @@ static void test_queue()
|
||||||
g_assert_false(gtk_widget_get_sensitive(random_img));
|
g_assert_false(gtk_widget_get_sensitive(random_img));
|
||||||
g_assert_false(queue_has_flag(&q, Q_RANDOM));
|
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 */
|
/* Show a queue where random and repeat are enabled */
|
||||||
gq->gq_flags = GQ_CAN_RANDOM | GQ_CAN_REPEAT | GQ_CAN_DISABLE;
|
gq->gq_flags = GQ_CAN_RANDOM | GQ_CAN_REPEAT | GQ_CAN_DISABLE;
|
||||||
q.q_flags = Q_RANDOM | Q_REPEAT | Q_ENABLED;
|
q.q_flags = Q_RANDOM | Q_REPEAT | Q_ENABLED;
|
||||||
gui_queue_show(gq);
|
gui_queue_show(gq);
|
||||||
g_assert_true(gtk_widget_get_sensitive(GTK_WIDGET(random)));
|
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(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(random_img));
|
||||||
g_assert_true(gtk_widget_get_sensitive(repeat_img));
|
|
||||||
|
|
||||||
/* Attempt to show a NULL pointer */
|
/* Attempt to show a NULL pointer */
|
||||||
gui_queue_show(NULL);
|
gui_queue_show(NULL);
|
||||||
g_assert_false(gtk_widget_get_sensitive(GTK_WIDGET(search)));
|
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(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(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(random_img));
|
||||||
g_assert_false(gtk_widget_get_sensitive(repeat_img));
|
|
||||||
|
|
||||||
queue_deinit(&q);
|
queue_deinit(&q);
|
||||||
g_assert_null(gui_queue(&q));
|
g_assert_null(gui_queue(&q));
|
||||||
|
|
Loading…
Reference in New Issue