summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 196c22c)
raw | patch | inline | side by side (parent: 196c22c)
author | Max Kellermann <max@duempel.org> | |
Fri, 12 Dec 2008 18:59:40 +0000 (19:59 +0100) | ||
committer | Max Kellermann <max@duempel.org> | |
Fri, 12 Dec 2008 18:59:40 +0000 (19:59 +0100) |
Eliminated the lyrics_loader struct. Instead of lyrics_free(),
callers should use plugin_stop().
callers should use plugin_stop().
src/lyrics.c | patch | blob | history | |
src/lyrics.h | patch | blob | history | |
src/screen_lyrics.c | patch | blob | history |
diff --git a/src/lyrics.c b/src/lyrics.c
index 052af4e8ac656c29bcd4925b5ea24c738bd98b39..1b33542d4a05942c93b67f8706610deb0b10fca7 100644 (file)
--- a/src/lyrics.c
+++ b/src/lyrics.c
static struct plugin_list plugins;
-struct lyrics_loader {
- struct plugin_cycle *plugin;
-};
-
void lyrics_init(void)
{
plugin_list_init(&plugins);
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 d8bbe734dbe5ec0f574d284687d1f10b34657c6e..ca831982e88111902ce709510e6baf5acea802e9 100644 (file)
--- a/src/lyrics.h
+++ b/src/lyrics.h
#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 e5635bd3282425f1ab888e7f48d895292c6fa843..b59f6bdfbb1e52372c900bd7e9503768143c9e22 100644 (file)
--- a/src/screen_lyrics.c
+++ b/src/screen_lyrics.c
char *artist, *title;
- struct lyrics_loader *loader;
+ struct plugin_cycle *loader;
GPtrArray *lines;
} current;
screen_lyrics_abort(void)
{
if (current.loader != NULL) {
- lyrics_free(current.loader);
+ plugin_stop(current.loader);
current.loader = NULL;
}
else
screen_status_message (_("No lyrics"));
- lyrics_free(current.loader);
+ plugin_stop(current.loader);
current.loader = NULL;
}