diff --git a/gui/collection_tab.cpp b/gui/collection_tab.cpp
index 6aa08916..5c46c5d9 100644
--- a/gui/collection_tab.cpp
+++ b/gui/collection_tab.cpp
@@ -72,28 +72,14 @@ static void collection_removed(struct queue *queue, unsigned int pos)
gui_queue_removed(queue, pos);
}
-static void collection_cleared(struct queue *queue, unsigned int n)
-{
- if (collection_tab)
- collection_tab->on_tracks_cleared(n);
- gui_queue_cleared(queue, n);
-}
-
-static void collection_updated(struct queue *queue, unsigned int pos)
-{
- if (collection_tab)
- collection_tab->on_track_updated(pos);
- gui_queue_updated(queue, pos);
-}
-
struct queue_ops collection_ops = {
collection_init,
gui_queue_free,
collection_added,
collection_removed,
- collection_cleared,
+ gui_queue_cleared,
collection_save,
- collection_updated,
+ gui_queue_updated,
};
void init_collection_tab()
diff --git a/gui/history.cpp b/gui/history.cpp
index babff81a..36d045e7 100644
--- a/gui/history.cpp
+++ b/gui/history.cpp
@@ -56,26 +56,14 @@ static void history_removed(struct queue *queue, unsigned int pos)
gui_queue_removed(queue, pos);
}
-static void history_cleared(struct queue *queue, unsigned int n)
-{
- history_tab->on_tracks_cleared(n);
- gui_queue_cleared(queue, n);
-}
-
-static void history_updated(struct queue *queue, unsigned int pos)
-{
- history_tab->on_track_updated(pos);
- gui_queue_updated(queue, pos);
-}
-
struct queue_ops history_ops = {
history_init,
gui_queue_free,
history_added,
history_removed,
- history_cleared,
+ gui_queue_cleared,
NULL,
- history_updated,
+ gui_queue_updated,
};
void init_history_tab()
diff --git a/gui/playlist_tab.cpp b/gui/playlist_tab.cpp
index 86e7a467..20da15ce 100644
--- a/gui/playlist_tab.cpp
+++ b/gui/playlist_tab.cpp
@@ -101,26 +101,14 @@ static void playlist_removed(struct queue *queue, unsigned int pos)
gui_queue_removed(queue, pos);
}
-static void playlist_cleared(struct queue *queue, unsigned int n)
-{
- p_tab->on_tracks_cleared(n);
- gui_queue_cleared(queue, n);
-}
-
-static void playlist_updated(struct queue *queue, unsigned int pos)
-{
- p_tab->on_track_updated(pos);
- gui_queue_updated(queue, pos);
-}
-
struct queue_ops playlist_ops = {
playlist_init,
gui_queue_free,
playlist_added,
playlist_removed,
- playlist_cleared,
+ gui_queue_cleared,
NULL,
- playlist_updated,
+ gui_queue_updated,
};
void plist :: init()
diff --git a/gui/queue.c b/gui/queue.c
index 19b1fbc4..17624336 100644
--- a/gui/queue.c
+++ b/gui/queue.c
@@ -10,6 +10,18 @@
static struct gui_queue *gq_queue = NULL;
+static void __queue_set_runtime(struct gui_queue *queue)
+{
+ gchar *len;
+
+ if (queue != gq_queue)
+ return;
+
+ len = string_sec2str_long(queue->gq_queue->q_length);
+ gtk_label_set_text(GTK_LABEL(gui_builder_widget("o_runtime")), len);
+ g_free(len);
+}
+
static void __queue_toggle_flag(bool active, GtkWidget *widget,
enum queue_flags flag)
{
@@ -114,6 +126,7 @@ void gui_queue_show(struct gui_queue *queue)
GtkButton *repeat = GTK_BUTTON(gui_builder_widget("o_repeat"));
GtkSwitch *enabled = GTK_SWITCH(gui_builder_widget("o_enable"));
GtkEntry *search = GTK_ENTRY(gui_builder_widget("o_search"));
+ GtkLabel *runtime = GTK_LABEL(gui_builder_widget("o_runtime"));
bool has_random = false, has_repeat = false, is_enabled = false;;
gq_queue = queue;
@@ -127,7 +140,9 @@ void gui_queue_show(struct gui_queue *queue)
has_repeat = queue_has_flag(queue->gq_queue, Q_REPEAT);
is_enabled = queue_has_flag(queue->gq_queue, Q_ENABLED);
gui_view_set_model(GTK_TREE_MODEL_FILTER(queue->gq_filter));
- }
+ __queue_set_runtime(queue);
+ } else
+ gtk_label_set_text(runtime, "");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(random), has_random);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(repeat), has_repeat);
@@ -148,19 +163,23 @@ void gui_queue_show(struct gui_queue *queue)
void gui_queue_added(struct queue *queue, unsigned int row)
{
gui_queue_model_add(gui_queue(queue)->gq_model, row);
+ __queue_set_runtime(gui_queue(queue));
}
void gui_queue_removed(struct queue *queue, unsigned int row)
{
gui_queue_model_remove(gui_queue(queue)->gq_model, row);
+ __queue_set_runtime(gui_queue(queue));
}
void gui_queue_cleared(struct queue *queue, unsigned int n)
{
gui_queue_model_clear(gui_queue(queue)->gq_model, n);
+ __queue_set_runtime(gui_queue(queue));
}
void gui_queue_updated(struct queue *queue, unsigned int row)
{
gui_queue_model_update(gui_queue(queue)->gq_model, row);
+ __queue_set_runtime(gui_queue(queue));
}
diff --git a/gui/tabs.cpp b/gui/tabs.cpp
index 9b086f54..da351c62 100644
--- a/gui/tabs.cpp
+++ b/gui/tabs.cpp
@@ -47,26 +47,14 @@ static void tempq_removed(struct queue *queue, unsigned int pos)
gui_queue_removed(queue, pos);
}
-static void tempq_cleared(struct queue *queue, unsigned int n)
-{
- find_tab(queue)->on_tracks_cleared(n);
- gui_queue_cleared(queue, n);
-}
-
-static void tempq_updated(struct queue *queue, unsigned int pos)
-{
- find_tab(queue)->on_track_updated(pos);
- gui_queue_updated(queue, pos);
-}
-
struct queue_ops tempq_ops = {
tempq_init,
gui_queue_free,
tempq_added,
tempq_removed,
- tempq_cleared,
+ gui_queue_cleared,
tempq_save,
- tempq_updated,
+ gui_queue_updated,
};
@@ -100,8 +88,6 @@ Tab :: Tab(queue *pq)
tab_vbox.set_margin_end(1);
tab_vbox.set_homogeneous(false);
tab_vbox.show();
-
- tab_runtime_changed();
}
Tab :: ~Tab() {}
@@ -116,26 +102,11 @@ Tab :: ~Tab() {}
void Tab :: on_track_added(unsigned int row)
{
tab_label->set_size();
- tab_runtime_changed();
}
void Tab :: on_track_removed(unsigned int row)
{
tab_label->set_size();
- tab_runtime_changed();
-}
-
-void Tab :: on_tracks_cleared(unsigned int n)
-{
- if (n > 0) {
- tab_label->set_size();
- tab_runtime_changed();
- }
-}
-
-void Tab :: on_track_updated(unsigned int row)
-{
- tab_runtime_changed();
}
@@ -157,14 +128,6 @@ bool Tab :: tab_is_cur()
return notebook->page_num(tab_vbox) == notebook->get_current_page();
}
-void Tab :: tab_runtime_changed()
-{
- gchar *len = string_sec2str_long(tab_pq->q_length);
- if (tab_is_cur())
- Glib :: wrap(GTK_LABEL(gui_builder_widget("o_queue_time")), false)->set_text(len);
- g_free(len);
-}
-
void Tab :: tab_display_sorting()
{
std::string text = "";
@@ -393,7 +356,6 @@ static void on_switch_page(Gtk::Widget *page, int num)
{
Tab *tab = find_tab(num);
if (tab) {
- tab->tab_runtime_changed();
tab->tab_display_sorting();
} else
Glib :: wrap(GTK_LABEL(gui_builder_widget("o_queue_time")), false)->set_text("");
diff --git a/share/ocarina/ocarina6.glade b/share/ocarina/ocarina6.glade
index 565eb8b3..d1e4cc8c 100644
--- a/share/ocarina/ocarina6.glade
+++ b/share/ocarina/ocarina6.glade
@@ -323,8 +323,8 @@
media-skip-backward
-
+
False
@@ -358,8 +358,8 @@
5
-
+
False
@@ -392,8 +392,8 @@
5
-
+
False
@@ -426,8 +426,8 @@
media-skip-forward
-
+
False
@@ -1395,7 +1395,7 @@
-