From 692ceb95e184f15a91f67bae4dbde565b1287f36 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Wed, 11 Nov 2009 22:10:55 +0100 Subject: finished moving gtk-related code to plugin --- Makefile.am | 2 - deadbeef.h | 21 +++-- main.c | 100 ++++------------------- playlist.c | 2 + plugins.c | 89 +++++++++++---------- plugins.h | 14 +++- plugins/gtkui/Makefile.am | 2 + plugins/gtkui/gtkplaylist.c | 10 ++- plugins/gtkui/gtkui.c | 141 +++++++++++++++++++++++++-------- plugins/gtkui/progress.c | 83 +++++++++++++++++++ plugins/gtkui/progress.h | 40 ++++++++++ plugins/gtkui/search.c | 189 ++++++++++++++++++++++++++++++++++++++++++++ plugins/gtkui/search.h | 31 ++++++++ plugins/lastfm/lastfm.c | 24 +++--- plugins/vorbis/vorbis.c | 4 +- progress.c | 83 ------------------- progress.h | 40 ---------- search.c | 189 -------------------------------------------- search.h | 31 -------- streamer.c | 4 +- 20 files changed, 569 insertions(+), 530 deletions(-) create mode 100644 plugins/gtkui/progress.c create mode 100644 plugins/gtkui/progress.h create mode 100644 plugins/gtkui/search.c create mode 100644 plugins/gtkui/search.h delete mode 100644 progress.c delete mode 100644 progress.h delete mode 100644 search.c delete mode 100644 search.h diff --git a/Makefile.am b/Makefile.am index b1e67241..3cded06c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,11 +30,9 @@ deadbeef_SOURCES =\ plugins.c plugins.h moduleconf.h\ playlist.c playlist.h \ streamer.c streamer.h\ - progress.c progress.h\ codec.c codec.h\ messagepump.c messagepump.h\ conf.c conf.h\ - search.c search.h\ cgme.c cdumb.c csid.cpp\ palsa.c palsa.h playback.h\ threading_pthread.c threading.h\ diff --git a/deadbeef.h b/deadbeef.h index 355f9e48..dfdcb9cf 100644 --- a/deadbeef.h +++ b/deadbeef.h @@ -97,19 +97,25 @@ enum { typedef struct { int event; - double time; + time_t time; } DB_event_t; typedef struct { DB_event_t ev; - DB_playItem_t *song; -} DB_event_song_t; + int index; + DB_playItem_t *track; +} DB_event_track_t; typedef struct { DB_event_t ev; int from; int to; -} DB_event_songchange_t; +} DB_event_trackchange_t; + +typedef struct { + DB_event_t ev; + int state; +} DB_event_state_t; typedef struct DB_conf_item_s { char *key; @@ -129,6 +135,10 @@ enum { DB_EV_TRACKDELETED = 4, // triggers when track is to be deleted from playlist DB_EV_CONFIGCHANGED = 5, // configuration option changed DB_EV_ACTIVATE = 6, // will be fired every time player is activated + DB_EV_TRACKINFOCHANGED = 7, // notify plugins that trackinfo was changed + DB_EV_PAUSED = 8, // player was paused or unpaused + DB_EV_PLAYLISTCHANGED = 9, // playlist contents were changed + DB_EV_VOLUMECHANGED = 10, // volume was changed DB_EV_MAX }; @@ -262,9 +272,6 @@ typedef struct { int (*conf_get_int) (const char *key, int def); void (*conf_set_str) (const char *key, const char *val); DB_conf_item_t * (*conf_find) (const char *group, DB_conf_item_t *prev); - // gui locking - void (*gui_lock) (void); - void (*gui_unlock) (void); // exporting plugin conf options for gui // all exported options are grouped by plugin, and will be available to user // from gui diff --git a/main.c b/main.c index c2c608d5..99b67d89 100644 --- a/main.c +++ b/main.c @@ -227,7 +227,6 @@ player_thread (uintptr_t ctx) { messagepump_push (M_TERMINATE, 0, 0, 0); } } - plug_trigger_event (DB_EV_FRAMEUPDATE, 0); uint32_t msg; uintptr_t ctx; uint32_t p1; @@ -259,22 +258,17 @@ player_thread (uintptr_t ctx) { #endif return; case M_SONGCHANGED: - plug_trigger_event_songchanged (p1, p2); + plug_trigger_event_trackchange (p1, p2); break; case M_PLAYSONG: - // - // start a track - guiplug_start_current_track (); + streamer_play_current_track (); break; case M_TRACKCHANGED: - // - // notify gui that track information was changed - guiplug_track_changed (p1); + plug_trigger_event_trackinfochanged (p1); break; case M_PLAYSONGNUM: - // - // start track by number in p1 - guiplug_start_track (p1); + p_stop (); + streamer_set_nextsong (p1, 1); break; case M_STOPSONG: streamer_set_nextsong (-2, 0); @@ -290,54 +284,48 @@ player_thread (uintptr_t ctx) { case M_PAUSESONG: if (p_ispaused ()) { p_unpause (); + plug_trigger_event_paused (0); } else { p_pause (); - } - // - // notify that current track was paused - if (playlist_current_ptr) { - guiplug_track_paused (pl_get_idx_of (playlist_current_ptr)); + plug_trigger_event_paused (1); } break; case M_PLAYRANDOM: - // - // play random song - guiplug_start_random (); + p_stop (); + pl_randomsong (); break; case M_ADDDIR: // // * let guiplug know that addition is in progress // * call it back on every file // * let guiplug know that addition is done - guiplug_add_dir ((char *)ctx); + // guiplug_add_dir ((char *)ctx); break; case M_ADDDIRS: // // same as above, but for many folders - guiplug_add_dirs ((GSList *)ctx); + // guiplug_add_dirs ((GSList *)ctx); break; case M_ADDFILES: // // same as above but for many files - guiplug_add_files ((GSList *)ctx); + // guiplug_add_files ((GSList *)ctx); break; case M_OPENFILES: p_stop (); // // open many files and start 1st of them - guiplug_open_files ((GSList *)ctx); + // guiplug_open_files ((GSList *)ctx); break; case M_FMDRAGDROP: // // handle drag-n-drop from filemanager // that should be handled internally in ui plugin - guiplug_add_fm_dropped_files ((char *)ctx, p1, p2) + // guiplug_add_fm_dropped_files ((char *)ctx, p1, p2) break; case M_PLAYLISTREFRESH: - // - // refresh all playlist windows - guiplug_refresh_playlist (); + plug_trigger_event_playlistchanged (); break; case M_CONFIGCHANGED: palsa_configchanged (); @@ -347,7 +335,7 @@ player_thread (uintptr_t ctx) { } } usleep(50000); - guiplug_frameupdate (); + plug_trigger_event (DB_EV_FRAMEUPDATE, 0); } } @@ -474,58 +462,7 @@ main (int argc, char *argv[]) { // p_init (); thread_start (player_thread, 0); - g_thread_init (NULL); - add_pixmap_directory (PREFIX "/share/deadbeef/pixmaps"); - gdk_threads_init (); - gdk_threads_enter (); - gtk_set_locale (); - gtk_init (&argc, &argv); - - // system tray icon - traymenu = create_traymenu (); - GdkPixbuf *trayicon_pixbuf = create_pixbuf ("play_24.png"); - trayicon = gtk_status_icon_new_from_pixbuf (trayicon_pixbuf); - set_tray_tooltip ("DeaDBeeF"); - //gtk_status_icon_set_title (GTK_STATUS_ICON (trayicon), "DeaDBeeF"); -#if GTK_MINOR_VERSION <= 14 - g_signal_connect ((gpointer)trayicon, "activate", G_CALLBACK (on_trayicon_activate), NULL); -#else - g_signal_connect ((gpointer)trayicon, "scroll_event", G_CALLBACK (on_trayicon_scroll_event), NULL); - g_signal_connect ((gpointer)trayicon, "button_press_event", G_CALLBACK (on_trayicon_button_press_event), NULL); -#endif - g_signal_connect ((gpointer)trayicon, "popup_menu", G_CALLBACK (on_trayicon_popup_menu), NULL); - - gtkpl_init (); - - mainwin = create_mainwin (); - GdkPixbuf *mainwin_icon_pixbuf; - mainwin_icon_pixbuf = create_pixbuf ("play_24.png"); - if (mainwin_icon_pixbuf) - { - gtk_window_set_icon (GTK_WINDOW (mainwin), mainwin_icon_pixbuf); - gdk_pixbuf_unref (mainwin_icon_pixbuf); - } - session_restore_window_attrs ((uintptr_t)mainwin); volume_set_db (conf_get_float ("playback.volume", 0)); - // order and looping - const char *orderwidgets[3] = { "order_linear", "order_shuffle", "order_random" }; - const char *loopingwidgets[3] = { "loop_all", "loop_disable", "loop_single" }; - const char *w; - w = orderwidgets[conf_get_int ("playback.order", 0)]; - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, w)), TRUE); - w = loopingwidgets[conf_get_int ("playback.loop", 0)]; - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, w)), TRUE); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, "scroll_follows_playback")), conf_get_int ("playlist.scroll.followplayback", 0) ? TRUE : FALSE); - - searchwin = create_searchwin (); - gtk_window_set_transient_for (GTK_WINDOW (searchwin), GTK_WINDOW (mainwin)); - extern void main_playlist_init (GtkWidget *widget); - main_playlist_init (lookup_widget (mainwin, "playlist")); - extern void search_playlist_init (GtkWidget *widget); - search_playlist_init (lookup_widget (searchwin, "searchlist")); - - progress_init (); - if (argc > 1) { int res = exec_command_line (cmdline, size, 0); if (res == -1) { @@ -537,17 +474,12 @@ main (int argc, char *argv[]) { } } - gtk_widget_show (mainwin); - gtk_main (); // save config pl_save (defpl); conf_save (); // stop receiving messages from outside server_close (); // at this point we can simply do exit(0), but let's clean up for debugging - gtkpl_free (&main_playlist); - gtkpl_free (&search_playlist); - gdk_threads_leave (); messagepump_free (); p_free (); streamer_free (); diff --git a/playlist.c b/playlist.c index fbc85a53..5e90f422 100644 --- a/playlist.c +++ b/playlist.c @@ -50,6 +50,8 @@ playItem_t *playlist_head[PL_MAX_ITERATORS]; playItem_t *playlist_tail[PL_MAX_ITERATORS]; +int playlist_current_row[PL_MAX_ITERATORS]; + playItem_t *playlist_current_ptr; int pl_count = 0; float pl_totaltime = 0; diff --git a/plugins.c b/plugins.c index c568fa15..4630abfb 100644 --- a/plugins.c +++ b/plugins.c @@ -22,7 +22,6 @@ #include #include #include -#include #ifdef HAVE_CONFIG_H # include #endif @@ -30,7 +29,6 @@ #include "md5/md5.h" #include "messagepump.h" #include "threading.h" -#include "progress.h" #include "playlist.h" #include "volume.h" #include "streamer.h" @@ -122,8 +120,6 @@ static DB_functions_t deadbeef_api = { .conf_get_int = conf_get_int, .conf_set_str = conf_set_str, .conf_find = conf_find, - .gui_lock = plug_gui_lock, - .gui_unlock = plug_gui_unlock, }; DB_functions_t *deadbeef = &deadbeef_api; @@ -133,19 +129,16 @@ plug_get_config_dir (void) { return dbconfdir; } -void -volumebar_notify_changed (void); - void plug_volume_set_db (float db) { volume_set_db (db); - volumebar_notify_changed (); + plug_trigger_event_volumechanged (); } void plug_volume_set_amp (float amp) { volume_set_amp (amp); - volumebar_notify_changed (); + plug_trigger_event_volumechanged (); } #define MAX_PLUGINS 100 @@ -157,16 +150,6 @@ DB_decoder_t *g_decoder_plugins[MAX_DECODER_PLUGINS+1]; #define MAX_VFS_PLUGINS 10 DB_vfs_t *g_vfs_plugins[MAX_VFS_PLUGINS+1]; -void -plug_gui_lock (void) { - gdk_threads_enter (); -} - -void -plug_gui_unlock (void) { - gdk_threads_leave (); -} - void plug_md5 (uint8_t sig[16], const char *in, int len) { md5_buffer (in, len, sig); @@ -277,66 +260,90 @@ plug_playback_set_pos (float pos) { void plug_quit (void) { - progress_abort (); + // FIXME progress_abort (); messagepump_push (M_TERMINATE, 0, 0, 0); } /////// non-api functions (plugin support) void plug_event_call (DB_event_t *ev) { + ev->time = time (NULL); + mutex_lock (mutex); for (int i = 0; i < MAX_HANDLERS; i++) { - if (handlers[ev->event][i].plugin && !handlers[ev][i].plugin->inactive) { - handlers[ev->event][i].callback (event, handlers[ev->event][i].data); + if (handlers[ev->event][i].plugin && !handlers[ev->event][i].plugin->inactive) { + handlers[ev->event][i].callback (ev, handlers[ev->event][i].data); } } + mutex_unlock (mutex); } void plug_trigger_event (int ev, uintptr_t param) { - mutex_lock (mutex); DB_event_t *event; switch (ev) { case DB_EV_SONGSTARTED: case DB_EV_SONGFINISHED: { - DB_event_song_t *pev = _alloca (sizeof (DB_event_song_t)); - pev->song = DB_PLAYITEM (&str_playing_song); + DB_event_track_t *pev = alloca (sizeof (DB_event_track_t)); + pev->index = -1; + pev->track = DB_PLAYITEM (&str_playing_song); event = DB_EVENT (pev); } break; case DB_EV_TRACKDELETED: { - DB_event_song_t *pev = _alloca (sizeof (DB_event_song_t)); - pev->song = DB_PLAYITEM (param); + DB_event_track_t *pev = alloca (sizeof (DB_event_track_t)); + pev->index = -1; // FIXME + pev->track = DB_PLAYITEM (param); event = DB_EVENT (pev); } break; default: - event = _alloca (sizeof (DB_event_t)); + event = alloca (sizeof (DB_event_t)); } event->event = ev; - event->time = (double)clock () / CLOCKS_PER_SEC; plug_event_call (event); - mutex_unlock (mutex); } void -plug_trigger_event_songchanged (int from, int to) { - mutex_lock (mutex); - DB_event_songchange_t event; +plug_trigger_event_trackchange (int from, int to) { + DB_event_trackchange_t event; event.ev.event = DB_EV_SONGCHANGED; - event.ev.time = (double)clock () / CLOCKS_PER_SEC; event.from = from; event.to = to; + plug_event_call (DB_EVENT (&event)); +} +void +plug_trigger_event_trackinfochanged (int trk) { + DB_event_track_t event; + event.ev.event = DB_EV_SONGCHANGED; + event.index = trk; + event.track = DB_PLAYITEM (pl_get_for_idx (trk)); + plug_event_call (DB_EVENT (&event)); +} - for (int i = 0; i < MAX_HANDLERS; i++) { - if (handlers[ev][i].plugin && !handlers[ev][i].plugin->inactive) { - handlers[ev][i].callback (event.ev.event, handlers[ev][i].data); - } - } - free (event); - mutex_unlock (mutex); +void +plug_trigger_event_paused (int paused) { + DB_event_state_t event; + event.ev.event = DB_EV_PAUSED; + event.state = paused; + plug_event_call (DB_EVENT (&event)); } + +void +plug_trigger_event_playlistchanged (void) { + DB_event_t event; + event.event = DB_EV_PLAYLISTCHANGED; + plug_event_call (DB_EVENT (&event)); +} + +void +plug_trigger_event_volumechanged (void) { + DB_event_t event; + event.event = DB_EV_VOLUMECHANGED; + plug_event_call (DB_EVENT (&event)); +} + int plug_init_plugin (DB_plugin_t* (*loadfunc)(DB_functions_t *), void *handle) { DB_plugin_t *plugin_api = loadfunc (&deadbeef_api); diff --git a/plugins.h b/plugins.h index 533058c6..4955eb25 100644 --- a/plugins.h +++ b/plugins.h @@ -38,7 +38,19 @@ void plug_trigger_event (int ev, uintptr_t param); void -plug_trigger_event_songchanged (int from, int to); +plug_trigger_event_trackchange (int from, int to); + +void +plug_trigger_event_trackinfochanged (int trk); + +void +plug_trigger_event_paused (int paused); + +void +plug_trigger_event_playlistchanged (void); + +void +plug_trigger_event_volumechanged (void); void plug_md5 (uint8_t sig[16], const char *in, int len); diff --git a/plugins/gtkui/Makefile.am b/plugins/gtkui/Makefile.am index 13ace983..9eba3da8 100644 --- a/plugins/gtkui/Makefile.am +++ b/plugins/gtkui/Makefile.am @@ -5,6 +5,8 @@ # callbacks.c interface.c support.c callbacks.h interface.h support.h\ # gtkplaylist.c gtkplaylist.h\ # drawing.h gdkdrawing.c\ +# progress.c progress.h\ +# search.c search.h\ # gtksession.c # # diff --git a/plugins/gtkui/gtkplaylist.c b/plugins/gtkui/gtkplaylist.c index 65334248..62cfe610 100644 --- a/plugins/gtkui/gtkplaylist.c +++ b/plugins/gtkui/gtkplaylist.c @@ -932,14 +932,16 @@ gtkpl_hscroll (gtkplaylist_t *ps, int newscroll) { void gtkpl_randomsong (void) { - p_stop (); - pl_randomsong (); +// +// p_stop (); +// pl_randomsong (); } void gtkpl_playsongnum (int idx) { - p_stop (); - streamer_set_nextsong (idx, 1); +// +// p_stop (); +// streamer_set_nextsong (idx, 1); } void diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index 32c58e95..ab849882 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -235,18 +235,6 @@ guiplug_start_current_track (void) { GDK_THREADS_LEAVE(); } } -void -guiplug_track_changed (int idx) { - playItem_t *it = pl_get_for_idx (idx); - if (it) { - GDK_THREADS_ENTER(); - gtkpl_redraw_pl_row (&main_playlist, idx, it); - if (it == playlist_current_ptr) { - gtkpl_current_track_changed (it); - } - GDK_THREADS_LEAVE(); - } -} void guiplug_start_track (int idx) { @@ -255,18 +243,10 @@ guiplug_start_track (int idx) { GDK_THREADS_LEAVE(); } -void -guiplug_track_paused (int idx) { - GDK_THREADS_ENTER(); - gtkpl_redraw_pl_row (&main_playlist, idx, pl_get_for_idx (idx)); - GDK_THREADS_LEAVE(); -} - void guiplug_start_random (void) { - GDK_THREADS_ENTER(); - gtkpl_randomsong (); - GDK_THREADS_LEAVE(); + // + assert (0); } void @@ -300,10 +280,8 @@ guiplug_open_files (GSList *files) { void guiplug_refresh_playlist (void) { - GDK_THREADS_ENTER(); - playlist_refresh (); - search_refresh (); - GDK_THREADS_LEAVE(); + // + assert (0); } void @@ -311,11 +289,6 @@ guiplug_add_fm_dropped_files (char *files, int p1, int p2) { gtkpl_add_fm_dropped_files (&main_playlist, (char *)ctx, p1, p2); } -void -guiplug_frameupdate (void) { - update_songinfo (); -} - static int gtkui_on_activate (DB_event_t *ev, uintptr_t data) { GDK_THREADS_ENTER(); @@ -325,14 +298,110 @@ gtkui_on_activate (DB_event_t *ev, uintptr_t data) { } static int -gtkui_on_songchanged (DB_event_song_t *ev, uintptr_t data) { +gtkui_on_songchanged (DB_event_songchange_t *ev, uintptr_t data) { gtkpl_songchanged_wrapper (from, to); } +static int +gtkui_on_trackinfochanged (DB_event_track_t *ev, uintptr_t data) { + GDK_THREADS_ENTER(); + gtkpl_redraw_pl_row (&main_playlist, ev->index, ev->track); + if (ev->track == playlist_current_ptr) { + gtkpl_current_track_changed (ev->track); + } + GDK_THREADS_LEAVE(); +} + +static int +gtkui_on_paused (DB_event_state_t *ev, uintptr_t data) { + GDK_THREADS_ENTER(); + gtkpl_redraw_pl_row (&main_playlist, pl_get_idx_of (playlist_current_ptr), playlist_current_ptr); + GDK_THREADS_LEAVE(); +} + +static int +gtkui_on_playlistchanged (DB_event_t *ev, uintptr_t data) { + GDK_THREADS_ENTER(); + playlist_refresh (); + search_refresh (); + GDK_THREADS_LEAVE(); +} + +static int +gtkui_on_frameupdate (DB_event_t *ev, uintptr_t data) { + update_songinfo (); +} + +static int +gtkui_on_volumechanged (DB_event_t *ev, uintptr_t data) { + void volumebar_notify_changed (void); // FIXME: do it properly + volumebar_notify_changed (); +} + static int gtkui_start (void) { + // let's start some gtk + g_thread_init (NULL); + add_pixmap_directory (PREFIX "/share/deadbeef/pixmaps"); + gdk_threads_init (); + gdk_threads_enter (); + gtk_set_locale (); + gtk_init (&argc, &argv); + + // system tray icon + traymenu = create_traymenu (); + GdkPixbuf *trayicon_pixbuf = create_pixbuf ("play_24.png"); + trayicon = gtk_status_icon_new_from_pixbuf (trayicon_pixbuf); + set_tray_tooltip ("DeaDBeeF"); + //gtk_status_icon_set_title (GTK_STATUS_ICON (trayicon), "DeaDBeeF"); +#if GTK_MINOR_VERSION <= 14 + g_signal_connect ((gpointer)trayicon, "activate", G_CALLBACK (on_trayicon_activate), NULL); +#else + g_signal_connect ((gpointer)trayicon, "scroll_event", G_CALLBACK (on_trayicon_scroll_event), NULL); + g_signal_connect ((gpointer)trayicon, "button_press_event", G_CALLBACK (on_trayicon_button_press_event), NULL); +#endif + g_signal_connect ((gpointer)trayicon, "popup_menu", G_CALLBACK (on_trayicon_popup_menu), NULL); + + gtkpl_init (); + + mainwin = create_mainwin (); + GdkPixbuf *mainwin_icon_pixbuf; + mainwin_icon_pixbuf = create_pixbuf ("play_24.png"); + if (mainwin_icon_pixbuf) + { + gtk_window_set_icon (GTK_WINDOW (mainwin), mainwin_icon_pixbuf); + gdk_pixbuf_unref (mainwin_icon_pixbuf); + } + session_restore_window_attrs ((uintptr_t)mainwin); + // order and looping + const char *orderwidgets[3] = { "order_linear", "order_shuffle", "order_random" }; + const char *loopingwidgets[3] = { "loop_all", "loop_disable", "loop_single" }; + const char *w; + w = orderwidgets[conf_get_int ("playback.order", 0)]; + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, w)), TRUE); + w = loopingwidgets[conf_get_int ("playback.loop", 0)]; + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, w)), TRUE); + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, "scroll_follows_playback")), conf_get_int ("playlist.scroll.followplayback", 0) ? TRUE : FALSE); + + searchwin = create_searchwin (); + gtk_window_set_transient_for (GTK_WINDOW (searchwin), GTK_WINDOW (mainwin)); + extern void main_playlist_init (GtkWidget *widget); + main_playlist_init (lookup_widget (mainwin, "playlist")); + extern void search_playlist_init (GtkWidget *widget); + search_playlist_init (lookup_widget (searchwin, "searchlist")); + + progress_init (); + gtk_widget_show (mainwin); + 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); + deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_TRACKINFOCHANGED, DB_CALLBACK (gtkui_on_trackinfochanged), 0); + deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_PAUSED, DB_CALLBACK (gtkui_on_paused), 0); + deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_PLAYLISTCHANGED, DB_CALLBACK (gtkui_on_playlistchanged), 0); + deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_FRAMEUPDATE, DB_CALLBACK (gtkui_on_frameupdate), 0); + deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_VOLUMECHANGED, DB_CALLBACK (gtkui_on_volumechanged), 0); + gtk_main (); + return 0; } @@ -340,6 +409,14 @@ 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); + deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_TRACKINFOCHANGED, DB_CALLBACK (gtkui_on_trackinfochanged), 0); + deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_PAUSED, DB_CALLBACK (gtkui_on_paused), 0); + deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_PLAYLISTCHANGED, DB_CALLBACK (gtkui_on_playlistchanged), 0); + deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_FRAMEUPDATE, DB_CALLBACK (gtkui_on_frameupdate), 0); + deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_VOLUMECHANGED, DB_CALLBACK (gtkui_on_volumechanged), 0); + gtkpl_free (&main_playlist); + gtkpl_free (&search_playlist); + gdk_threads_leave (); return 0; } diff --git a/plugins/gtkui/progress.c b/plugins/gtkui/progress.c new file mode 100644 index 00000000..4c413dfc --- /dev/null +++ b/plugins/gtkui/progress.c @@ -0,0 +1,83 @@ +/* + DeaDBeeF - ultimate music player for GNU/Linux systems with X11 + Copyright (C) 2009 Alexey Yakovenko + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +#include +#include +#include +#include +#include +#include "interface.h" +#include "callbacks.h" +#include "support.h" +#include "progress.h" + +static GtkWidget *progressdlg; +static GtkWidget *progressitem; +static int progress_aborted; + +void +progress_init (void) { + extern GtkWidget *mainwin; + progressdlg = create_addprogress (); + gtk_window_set_transient_for (GTK_WINDOW (progressdlg), GTK_WINDOW (mainwin)); + progressitem = lookup_widget (progressdlg, "progresstitle"); +} + +void +progress_show (void) { + progress_aborted = 0; + progress_settext ("Initializing..."); + gtk_widget_show_all (progressdlg); + gtk_window_present (GTK_WINDOW (progressdlg)); +} + +void +progress_hide (void) { + gtk_widget_hide (progressdlg); +} + +void +progress_settext (const char *text) { + gtk_entry_set_text (GTK_ENTRY (progressitem), text); +} + +void +progress_abort (void) { + progress_aborted = 1; +} + +void +on_progress_abort (GtkButton *button, + gpointer user_data) +{ + progress_aborted = 1; +} + +int +progress_is_aborted (void) { + return progress_aborted; +} + + +gboolean +on_addprogress_delete_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data) +{ + progress_aborted = 1; + return gtk_widget_hide_on_delete (widget); +} diff --git a/plugins/gtkui/progress.h b/plugins/gtkui/progress.h new file mode 100644 index 00000000..e4de0e8e --- /dev/null +++ b/plugins/gtkui/progress.h @@ -0,0 +1,40 @@ +/* + DeaDBeeF - ultimate music player for GNU/Linux systems with X11 + Copyright (C) 2009 Alexey Yakovenko + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef __PROGRESS_H +#define __PROGRESS_H + +void +progress_init (void); + +void +progress_show (void); + +void +progress_hide (void); + +void +progress_settext (const char *text); + +int +progress_is_aborted (void); + +void +progress_abort (void); + +#endif // __PROGRESS_H diff --git a/plugins/gtkui/search.c b/plugins/gtkui/search.c new file mode 100644 index 00000000..1ce99edd --- /dev/null +++ b/plugins/gtkui/search.c @@ -0,0 +1,189 @@ +/* + DeaDBeeF - ultimate music player for GNU/Linux systems with X11 + Copyright (C) 2009 Alexey Yakovenko + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include "callbacks.h" +#include "interface.h" +#include "support.h" + +#include "common.h" +#include "search.h" +#include "gtkplaylist.h" +#include "messagepump.h" +#include "utf8.h" +#include "deadbeef.h" + +extern GtkWidget *searchwin; +struct playItem_s *search_current = NULL; +int search_count = 0; + +void +search_start (void) { + gtk_entry_set_text (GTK_ENTRY (lookup_widget (searchwin, "searchentry")), ""); + gtk_widget_show (searchwin); + gtk_window_present (GTK_WINDOW (searchwin)); +} + +void +on_searchentry_changed (GtkEditable *editable, + gpointer user_data) +{ + // final implementation must work in separate thread, and catch up when + // value was changed + // but for alpha, let's do it in GTK thread + + // walk playlist starting with playlist_head, and populate list starting + // with search_head + + const gchar *text = gtk_entry_get_text (GTK_ENTRY (editable)); + + playlist_head[PL_SEARCH] = NULL; + playlist_tail[PL_SEARCH] = NULL; + search_count = 0; + if (*text) { + for (playItem_t *it = playlist_head[PL_MAIN]; it; it = it->next[PL_MAIN]) { + for (metaInfo_t *m = it->meta; m; m = m->next) { +// if (strcasestr (m->value, text)) { + if (utfcasestr (m->value, text)) { + // add to list + it->next[PL_SEARCH] = NULL; + if (playlist_tail[PL_SEARCH]) { + playlist_tail[PL_SEARCH]->next[PL_SEARCH] = it; + playlist_tail[PL_SEARCH] = it; + } + else { + playlist_head[PL_SEARCH] = playlist_tail[PL_SEARCH] = it; + } + search_count++; + break; + } + } + } + } + + extern gtkplaylist_t search_playlist; + gtkplaylist_t *ps = &search_playlist; + gtkpl_setup_scrollbar (ps); + //memset (ps->fmtcache, 0, sizeof (int16_t) * 3 * pl_ncolumns * ps->nvisiblerows); + gtkpl_draw_playlist (ps, 0, 0, ps->playlist->allocation.width, ps->playlist->allocation.height); + gtkpl_expose (ps, 0, 0, ps->playlist->allocation.width, ps->playlist->allocation.height); +} + +void +search_refresh (void) { + if (searchwin) { + on_searchentry_changed (GTK_EDITABLE (lookup_widget (searchwin, "searchentry")), NULL); + } +} + +///////// searchwin header handlers + +gboolean +on_searchheader_button_press_event (GtkWidget *widget, + GdkEventButton *event, + gpointer user_data) +{ + + return FALSE; +} + + +gboolean +on_searchheader_button_release_event (GtkWidget *widget, + GdkEventButton *event, + gpointer user_data) +{ + + return FALSE; +} + + +gboolean +on_searchheader_configure_event (GtkWidget *widget, + GdkEventConfigure *event, + gpointer user_data) +{ + return FALSE; +} + + +gboolean +on_searchheader_expose_event (GtkWidget *widget, + GdkEventExpose *event, + gpointer user_data) +{ + + return FALSE; +} + + +gboolean +on_searchheader_motion_notify_event (GtkWidget *widget, + GdkEventMotion *event, + gpointer user_data) +{ + + return FALSE; +} + + +///////// searchwin playlist navigation and rendering + +gboolean +on_searchwin_key_press_event (GtkWidget *widget, + GdkEventKey *event, + gpointer user_data) +{ + // that's for when user attempts to navigate list while entry has focus + if (event->keyval == GDK_Escape) { + gtk_widget_hide (widget); + } + else if (event->keyval == GDK_Return) { + extern gtkplaylist_t search_playlist; + gtkplaylist_t *ps = &search_playlist; + if (search_count > 0) { + playItem_t *it = gtkpl_get_for_idx (ps, max (ps->row, 0)); + if (it) { + messagepump_push (M_PLAYSONGNUM, 0, pl_get_idx_of (it), 0); + } + } + } + return FALSE; +} + + + +gboolean +on_searchlist_configure_event (GtkWidget *widget, + GdkEventConfigure *event, + gpointer user_data) +{ + GTKPL_PROLOGUE; + gtkpl_configure (ps); + return FALSE; +} + + diff --git a/plugins/gtkui/search.h b/plugins/gtkui/search.h new file mode 100644 index 00000000..32d45e07 --- /dev/null +++ b/plugins/gtkui/search.h @@ -0,0 +1,31 @@ +/* + DeaDBeeF - ultimate music player for GNU/Linux systems with X11 + Copyright (C) 2009 Alexey Yakovenko + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +#ifndef __SEARCH_H +#define __SEARCH_H + +extern struct playItem_s *search_current; +extern int search_count; + +void +search_start (void); + +// should be called whenever playlist was changed +void +search_refresh (void); + +#endif // __SEARCH_H diff --git a/plugins/lastfm/lastfm.c b/plugins/lastfm/lastfm.c index 776e2bbe..773a8fa3 100644 --- a/plugins/lastfm/lastfm.c +++ b/plugins/lastfm/lastfm.c @@ -445,9 +445,9 @@ lfm_format_uri (int subm, DB_playItem_t *song, char *out, int outl) { } static int -lastfm_songstarted (DB_event_song_t *ev, uintptr_t data) { +lastfm_songstarted (DB_event_track_t *ev, uintptr_t data) { deadbeef->mutex_lock (lfm_mutex); - if (lfm_format_uri (-1, ev->song, lfm_nowplaying, sizeof (lfm_nowplaying)) < 0) { + if (lfm_format_uri (-1, ev->track, lfm_nowplaying, sizeof (lfm_nowplaying)) < 0) { lfm_nowplaying[0] = 0; } // trace ("%s\n", lfm_nowplaying); @@ -460,28 +460,28 @@ lastfm_songstarted (DB_event_song_t *ev, uintptr_t data) { } static int -lastfm_songfinished (DB_event_song_t *ev, uintptr_t data) { +lastfm_songfinished (DB_event_track_t *ev, uintptr_t data) { trace ("lfm songfinished\n"); #if !LFM_IGNORE_RULES // check submission rules // duration must be >= 30 sec - if (deadbeef->pl_get_item_duration (ev->song) < 30) { - trace ("song duration is %f seconds. not eligible for submission\n", ev->song->duration); + if (deadbeef->pl_get_item_duration (ev->track) < 30) { + trace ("track duration is %f seconds. not eligible for submission\n", ev->song->duration); return 0; } // must be played for >=240sec of half the total time - if (ev->song->playtime < 240 && ev->song->playtime < deadbeef->pl_get_item_duration (ev->song)/2) { - trace ("song playtime=%f seconds. not eligible for submission\n", ev->song->playtime); + if (ev->track->playtime < 240 && ev->track->playtime < deadbeef->pl_get_item_duration (ev->track)/2) { + trace ("track playtime=%f seconds. not eligible for submission\n", ev->track->playtime); return 0; } #endif - if (!deadbeef->pl_find_meta (ev->song, "artist") - || !deadbeef->pl_find_meta (ev->song, "title") -// || !deadbeef->pl_find_meta (ev->song, "album") + if (!deadbeef->pl_find_meta (ev->track, "artist") + || !deadbeef->pl_find_meta (ev->track, "title") +// || !deadbeef->pl_find_meta (ev->track, "album") ) { - trace ("lfm: not enough metadata for submission, artist=%s, title=%s, album=%s\n", deadbeef->pl_find_meta (ev->song, "artist"), deadbeef->pl_find_meta (ev->song, "title"), deadbeef->pl_find_meta (ev->song, "album")); + trace ("lfm: not enough metadata for submission, artist=%s, title=%s, album=%s\n", deadbeef->pl_find_meta (ev->track, "artist"), deadbeef->pl_find_meta (ev->track, "title"), deadbeef->pl_find_meta (ev->track, "album")); return 0; } deadbeef->mutex_lock (lfm_mutex); @@ -490,7 +490,7 @@ lastfm_songfinished (DB_event_song_t *ev, uintptr_t data) { if (!lfm_subm_queue[i]) { trace ("lfm: song is now in queue for submission\n"); lfm_subm_queue[i] = deadbeef->pl_item_alloc (); - deadbeef->pl_item_copy (lfm_subm_queue[i], ev->song); + deadbeef->pl_item_copy (lfm_subm_queue[i], ev->track); break; } } diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c index 31e252eb..2a10322c 100644 --- a/plugins/vorbis/vorbis.c +++ b/plugins/vorbis/vorbis.c @@ -354,8 +354,8 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) { } static int -vorbis_trackdeleted (DB_event_song_t *ev, uintptr_t data) { - if (ev->song == ptrack) { +vorbis_trackdeleted (DB_event_track_t *ev, uintptr_t data) { + if (ev->track == ptrack) { ptrack = NULL; } return 0; diff --git a/progress.c b/progress.c deleted file mode 100644 index 4c413dfc..00000000 --- a/progress.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - DeaDBeeF - ultimate music player for GNU/Linux systems with X11 - Copyright (C) 2009 Alexey Yakovenko - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ -#include -#include -#include -#include -#include -#include "interface.h" -#include "callbacks.h" -#include "support.h" -#include "progress.h" - -static GtkWidget *progressdlg; -static GtkWidget *progressitem; -static int progress_aborted; - -void -progress_init (void) { - extern GtkWidget *mainwin; - progressdlg = create_addprogress (); - gtk_window_set_transient_for (GTK_WINDOW (progressdlg), GTK_WINDOW (mainwin)); - progressitem = lookup_widget (progressdlg, "progresstitle"); -} - -void -progress_show (void) { - progress_aborted = 0; - progress_settext ("Initializing..."); - gtk_widget_show_all (progressdlg); - gtk_window_present (GTK_WINDOW (progressdlg)); -} - -void -progress_hide (void) { - gtk_widget_hide (progressdlg); -} - -void -progress_settext (const char *text) { - gtk_entry_set_text (GTK_ENTRY (progressitem), text); -} - -void -progress_abort (void) { - progress_aborted = 1; -} - -void -on_progress_abort (GtkButton *button, - gpointer user_data) -{ - progress_aborted = 1; -} - -int -progress_is_aborted (void) { - return progress_aborted; -} - - -gboolean -on_addprogress_delete_event (GtkWidget *widget, - GdkEvent *event, - gpointer user_data) -{ - progress_aborted = 1; - return gtk_widget_hide_on_delete (widget); -} diff --git a/progress.h b/progress.h deleted file mode 100644 index e4de0e8e..00000000 --- a/progress.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - DeaDBeeF - ultimate music player for GNU/Linux systems with X11 - Copyright (C) 2009 Alexey Yakovenko - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef __PROGRESS_H -#define __PROGRESS_H - -void -progress_init (void); - -void -progress_show (void); - -void -progress_hide (void); - -void -progress_settext (const char *text); - -int -progress_is_aborted (void); - -void -progress_abort (void); - -#endif // __PROGRESS_H diff --git a/search.c b/search.c deleted file mode 100644 index 1ce99edd..00000000 --- a/search.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - DeaDBeeF - ultimate music player for GNU/Linux systems with X11 - Copyright (C) 2009 Alexey Yakovenko - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include - -#include "callbacks.h" -#include "interface.h" -#include "support.h" - -#include "common.h" -#include "search.h" -#include "gtkplaylist.h" -#include "messagepump.h" -#include "utf8.h" -#include "deadbeef.h" - -extern GtkWidget *searchwin; -struct playItem_s *search_current = NULL; -int search_count = 0; - -void -search_start (void) { - gtk_entry_set_text (GTK_ENTRY (lookup_widget (searchwin, "searchentry")), ""); - gtk_widget_show (searchwin); - gtk_window_present (GTK_WINDOW (searchwin)); -} - -void -on_searchentry_changed (GtkEditable *editable, - gpointer user_data) -{ - // final implementation must work in separate thread, and catch up when - // value was changed - // but for alpha, let's do it in GTK thread - - // walk playlist starting with playlist_head, and populate list starting - // with search_head - - const gchar *text = gtk_entry_get_text (GTK_ENTRY (editable)); - - playlist_head[PL_SEARCH] = NULL; - playlist_tail[PL_SEARCH] = NULL; - search_count = 0; - if (*text) { - for (playItem_t *it = playlist_head[PL_MAIN]; it; it = it->next[PL_MAIN]) { - for (metaInfo_t *m = it->meta; m; m = m->next) { -// if (strcasestr (m->value, text)) { - if (utfcasestr (m->value, text)) { - // add to list - it->next[PL_SEARCH] = NULL; - if (playlist_tail[PL_SEARCH]) { - playlist_tail[PL_SEARCH]->next[PL_SEARCH] = it; - playlist_tail[PL_SEARCH] = it; - } - else { - playlist_head[PL_SEARCH] = playlist_tail[PL_SEARCH] = it; - } - search_count++; - break; - } - } - } - } - - extern gtkplaylist_t search_playlist; - gtkplaylist_t *ps = &search_playlist; - gtkpl_setup_scrollbar (ps); - //memset (ps->fmtcache, 0, sizeof (int16_t) * 3 * pl_ncolumns * ps->nvisiblerows); - gtkpl_draw_playlist (ps, 0, 0, ps->playlist->allocation.width, ps->playlist->allocation.height); - gtkpl_expose (ps, 0, 0, ps->playlist->allocation.width, ps->playlist->allocation.height); -} - -void -search_refresh (void) { - if (searchwin) { - on_searchentry_changed (GTK_EDITABLE (lookup_widget (searchwin, "searchentry")), NULL); - } -} - -///////// searchwin header handlers - -gboolean -on_searchheader_button_press_event (GtkWidget *widget, - GdkEventButton *event, - gpointer user_data) -{ - - return FALSE; -} - - -gboolean -on_searchheader_button_release_event (GtkWidget *widget, - GdkEventButton *event, - gpointer user_data) -{ - - return FALSE; -} - - -gboolean -on_searchheader_configure_event (GtkWidget *widget, - GdkEventConfigure *event, - gpointer user_data) -{ - return FALSE; -} - - -gboolean -on_searchheader_expose_event (GtkWidget *widget, - GdkEventExpose *event, - gpointer user_data) -{ - - return FALSE; -} - - -gboolean -on_searchheader_motion_notify_event (GtkWidget *widget, - GdkEventMotion *event, - gpointer user_data) -{ - - return FALSE; -} - - -///////// searchwin playlist navigation and rendering - -gboolean -on_searchwin_key_press_event (GtkWidget *widget, - GdkEventKey *event, - gpointer user_data) -{ - // that's for when user attempts to navigate list while entry has focus - if (event->keyval == GDK_Escape) { - gtk_widget_hide (widget); - } - else if (event->keyval == GDK_Return) { - extern gtkplaylist_t search_playlist; - gtkplaylist_t *ps = &search_playlist; - if (search_count > 0) { - playItem_t *it = gtkpl_get_for_idx (ps, max (ps->row, 0)); - if (it) { - messagepump_push (M_PLAYSONGNUM, 0, pl_get_idx_of (it), 0); - } - } - } - return FALSE; -} - - - -gboolean -on_searchlist_configure_event (GtkWidget *widget, - GdkEventConfigure *event, - gpointer user_data) -{ - GTKPL_PROLOGUE; - gtkpl_configure (ps); - return FALSE; -} - - diff --git a/search.h b/search.h deleted file mode 100644 index 32d45e07..00000000 --- a/search.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - DeaDBeeF - ultimate music player for GNU/Linux systems with X11 - Copyright (C) 2009 Alexey Yakovenko - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ -#ifndef __SEARCH_H -#define __SEARCH_H - -extern struct playItem_s *search_current; -extern int search_count; - -void -search_start (void); - -// should be called whenever playlist was changed -void -search_refresh (void); - -#endif // __SEARCH_H diff --git a/streamer.c b/streamer.c index 6717ca18..e5ff4289 100644 --- a/streamer.c +++ b/streamer.c @@ -890,9 +890,9 @@ streamer_play_current_track (void) { if (p_ispaused ()) { p_unpause (); } - else if (ps->row != -1) { + else if (playlist_current_row[PL_MAIN] != -1) { p_stop (); - streamer_set_nextsong (ps->row, 1); + streamer_set_nextsong (playlist_current_row[PL_MAIN], 1); } else { p_stop (); -- cgit v1.2.3