diff options
-rw-r--r-- | src/lyrics.c | 19 | ||||
-rw-r--r-- | src/lyrics.h | 7 | ||||
-rw-r--r-- | src/screen_lyrics.c | 6 |
3 files changed, 6 insertions, 26 deletions
diff --git a/src/lyrics.c b/src/lyrics.c index 052af4e8a..1b33542d4 100644 --- a/src/lyrics.c +++ b/src/lyrics.c @@ -23,10 +23,6 @@ static struct plugin_list plugins; -struct lyrics_loader { - struct plugin_cycle *plugin; -}; - void lyrics_init(void) { plugin_list_init(&plugins); @@ -38,25 +34,14 @@ void lyrics_deinit(void) plugin_list_deinit(&plugins); } -struct lyrics_loader * +struct plugin_cycle * lyrics_load(const char *artist, const char *title, plugin_callback_t callback, void *data) { - struct lyrics_loader *loader = g_new(struct lyrics_loader, 1); const char *args[3] = { artist, title, NULL }; assert(artist != NULL); assert(title != NULL); - loader->plugin = plugin_run(&plugins, args, - callback, data); - - return loader; -} - -void -lyrics_free(struct lyrics_loader *loader) -{ - plugin_stop(loader->plugin); - g_free(loader); + return plugin_run(&plugins, args, callback, data); } diff --git a/src/lyrics.h b/src/lyrics.h index d8bbe734d..ca831982e 100644 --- a/src/lyrics.h +++ b/src/lyrics.h @@ -21,17 +21,12 @@ #include "plugin.h" -struct lyrics_loader; - void lyrics_init(void); void lyrics_deinit(void); -struct lyrics_loader * +struct plugin_cycle * lyrics_load(const char *artist, const char *title, plugin_callback_t callback, void *callback_data); -void -lyrics_free(struct lyrics_loader *loader); - #endif diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index e5635bd32..b59f6bdfb 100644 --- a/src/screen_lyrics.c +++ b/src/screen_lyrics.c @@ -44,7 +44,7 @@ static struct { char *artist, *title; - struct lyrics_loader *loader; + struct plugin_cycle *loader; GPtrArray *lines; } current; @@ -53,7 +53,7 @@ static void screen_lyrics_abort(void) { if (current.loader != NULL) { - lyrics_free(current.loader); + plugin_stop(current.loader); current.loader = NULL; } @@ -165,7 +165,7 @@ screen_lyrics_callback(const GString *result, G_GNUC_UNUSED void *data) else screen_status_message (_("No lyrics")); - lyrics_free(current.loader); + plugin_stop(current.loader); current.loader = NULL; } |