summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--deadbeef.h3
-rw-r--r--playlist.c5
-rw-r--r--plugins/gtkui/Makefile.am2
-rw-r--r--plugins/gtkui/gtkplaylist.c3
-rw-r--r--plugins/gtkui/gtkui.c15
-rw-r--r--plugins/gtkui/tabs.c2
-rw-r--r--streamer.c2
7 files changed, 26 insertions, 6 deletions
diff --git a/deadbeef.h b/deadbeef.h
index 77efba6b..c67e34f4 100644
--- a/deadbeef.h
+++ b/deadbeef.h
@@ -48,7 +48,7 @@ extern "C" {
// ............
// }
// this is required for versioning
-// if you don't do it -- no version checking will be done (usefull for
+// if you don't do it -- no version checking will be done (useful for
// debugging/development)
// DON'T release plugins without DB_PLUGIN_SET_API_VERSION
@@ -173,6 +173,7 @@ enum {
DB_EV_VOLUMECHANGED = 10, // volume was changed
DB_EV_OUTPUTCHANGED = 11, // sound output plugin changed
DB_EV_ABORTREAD = 12, // tells plugins to stop reading operations, e.g. long-time http requests
+ DB_EV_PLAYLISTSWITCH = 13, // playlist switch occured
DB_EV_MAX
};
diff --git a/playlist.c b/playlist.c
index b9c57e8b..b5086b19 100644
--- a/playlist.c
+++ b/playlist.c
@@ -149,7 +149,10 @@ plt_set_curr (int plt) {
trace ("plt_set_curr %d failed\n", plt);
return;
}
- playlist = p;
+ if (p != playlist) {
+ playlist = p;
+ plug_trigger_event (DB_EV_PLAYLISTSWITCH, 0);
+ }
}
int
diff --git a/plugins/gtkui/Makefile.am b/plugins/gtkui/Makefile.am
index 3ef740f5..235d8cfa 100644
--- a/plugins/gtkui/Makefile.am
+++ b/plugins/gtkui/Makefile.am
@@ -10,7 +10,7 @@ gtkui_la_SOURCES = gtkui.c gtkui.h\
fileman.c\
pluginconf.c\
parser.c parser.h\
- tabs.c
+ tabs.c tabs.h
gtkui_la_LDFLAGS = -module
diff --git a/plugins/gtkui/gtkplaylist.c b/plugins/gtkui/gtkplaylist.c
index 868e26a2..2c423e11 100644
--- a/plugins/gtkui/gtkplaylist.c
+++ b/plugins/gtkui/gtkplaylist.c
@@ -444,6 +444,9 @@ gtkpl_draw_playlist (gtkplaylist_t *ps, int x, int y, int w, int h) {
it = it_copy;
int idx = 0;
for (row = row1; row < row2; row++, idx++) {
+ if (!it) {
+ break;
+ }
gtkpl_draw_pl_row (ps, row, it);
it = PL_NEXT (it, ps->iterator);
}
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index 8b1d3b1b..28bc8c9f 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -320,6 +320,19 @@ gtkui_on_playlistchanged (DB_event_t *ev, uintptr_t data) {
g_idle_add (playlistchanged_cb, NULL);
}
+static gboolean
+playlistswitch_cb (gpointer none) {
+ playlist_refresh ();
+ search_refresh ();
+ tabbar_draw (lookup_widget (mainwin, "tabbar"));
+ return FALSE;
+}
+
+static int
+gtkui_on_playlistswitch (DB_event_t *ev, uintptr_t data) {
+ g_idle_add (playlistswitch_cb, NULL);
+}
+
static int
gtkui_on_frameupdate (DB_event_t *ev, uintptr_t data) {
g_idle_add (update_songinfo, NULL);
@@ -479,6 +492,7 @@ gtkui_start (void) {
deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_VOLUMECHANGED, DB_CALLBACK (gtkui_on_volumechanged), 0);
deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_CONFIGCHANGED, DB_CALLBACK (gtkui_on_configchanged), 0);
deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_OUTPUTCHANGED, DB_CALLBACK (gtkui_on_outputchanged), 0);
+ deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_PLAYLISTSWITCH, DB_CALLBACK (gtkui_on_playlistswitch), 0);
// gtk must be running in separate thread
gtk_tid = deadbeef->thread_start (gtkui_thread, NULL);
@@ -503,6 +517,7 @@ gtkui_stop (void) {
deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_VOLUMECHANGED, DB_CALLBACK (gtkui_on_volumechanged), 0);
deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_CONFIGCHANGED, DB_CALLBACK (gtkui_on_configchanged), 0);
deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_OUTPUTCHANGED, DB_CALLBACK (gtkui_on_outputchanged), 0);
+ deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_PLAYLISTSWITCH, DB_CALLBACK (gtkui_on_playlistswitch), 0);
trace ("quitting gtk\n");
g_idle_add (quit_gtk_cb, NULL);
trace ("waiting for gtk thread to finish\n");
diff --git a/plugins/gtkui/tabs.c b/plugins/gtkui/tabs.c
index be6e703c..d302d582 100644
--- a/plugins/gtkui/tabs.c
+++ b/plugins/gtkui/tabs.c
@@ -151,7 +151,7 @@ on_tabbar_button_press_event (GtkWidget *widget,
fw += w;
if (fw > event->x) {
deadbeef->plt_set_curr (idx);
- tabbar_draw (widget);
+// tabbar_draw (widget);
break;
}
}
diff --git a/streamer.c b/streamer.c
index 3cc7ffab..692b8b84 100644
--- a/streamer.c
+++ b/streamer.c
@@ -37,8 +37,6 @@
#include "volume.h"
#include "vfs.h"
-#pragma GCC optimize("O0")
-
#define trace(...) { fprintf(stderr, __VA_ARGS__); }
//#define trace(fmt,...)