From 76b5d753192aba0ed20e8eaff81a3c22a7f7025f Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Wed, 11 Nov 2009 21:28:02 +0100 Subject: moved playcursor control to playlist module improved plugin event triggering moved some playback control from gui to streamer --- plugins/gtkui/gtkplaylist.c | 15 --------------- plugins/gtkui/gtkplaylist.h | 1 - plugins/gtkui/gtkui.c | 34 +++++++++++++++++++++++++--------- 3 files changed, 25 insertions(+), 25 deletions(-) (limited to 'plugins/gtkui') diff --git a/plugins/gtkui/gtkplaylist.c b/plugins/gtkui/gtkplaylist.c index cef45ea4..65334248 100644 --- a/plugins/gtkui/gtkplaylist.c +++ b/plugins/gtkui/gtkplaylist.c @@ -1740,21 +1740,6 @@ gtkpl_add_files (gtkplaylist_t *ps, GSList *lst) { GDK_THREADS_LEAVE(); } -void -gtkpl_playsong (gtkplaylist_t *ps) { - if (p_ispaused ()) { - p_unpause (); - } - else if (ps->row != -1) { - p_stop (); - streamer_set_nextsong (ps->row, 1); - } - else { - p_stop (); - streamer_set_nextsong (0, 1); - } -} - int gtkpl_get_idx_of (gtkplaylist_t *ps, playItem_t *it) { playItem_t *c = playlist_head[ps->iterator]; diff --git a/plugins/gtkui/gtkplaylist.h b/plugins/gtkui/gtkplaylist.h index 2e827839..477afa60 100644 --- a/plugins/gtkui/gtkplaylist.h +++ b/plugins/gtkui/gtkplaylist.h @@ -81,7 +81,6 @@ typedef struct { // current state int scrollpos; int hscrollpos; - int row; double clicktime; // for doubleclick detection int nvisiblerows; int nvisiblefullrows; diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index c5a87056..32c58e95 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -226,11 +226,6 @@ guiplug_shutdown (void) { GDK_THREADS_LEAVE(); } -void -guiplug_songchanged (int from, int to) { - gtkpl_songchanged_wrapper (from, to); -} - void guiplug_start_current_track (void) { gtkpl_playsong (&main_playlist); @@ -321,10 +316,31 @@ guiplug_frameupdate (void) { update_songinfo (); } -void -guiplug_reset_selection (void) { - search_playlist.row = -1; - main_playlist.row = -1; +static int +gtkui_on_activate (DB_event_t *ev, uintptr_t data) { + GDK_THREADS_ENTER(); + gtk_widget_show (mainwin); + gtk_window_present (GTK_WINDOW (mainwin)); + GDK_THREADS_LEAVE(); +} + +static int +gtkui_on_songchanged (DB_event_song_t *ev, uintptr_t data) { + gtkpl_songchanged_wrapper (from, to); +} + +static int +gtkui_start (void) { + deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_ACTIVATE, DB_CALLBACK (gtkui_on_activate), 0); + deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_SONGCHANGED, DB_CALLBACK (gtkui_on_songchanged), 0); + return 0; +} + +static int +gtkui_stop (void) { + deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_ACTIVATE, DB_CALLBACK (gtkui_on_activate), 0); + deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_SONGCHANGED, DB_CALLBACK (gtkui_on_songchanged), 0); + return 0; } // define plugin interface -- cgit v1.2.3