diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c
index ec723e9e2ee98e5820c9c6adaf3ccf907e5261d3..0819f91424b9d6917cbefff5ed78e29ff996165e 100644 (file)
--- a/src/screen_lyrics.c
+++ b/src/screen_lyrics.c
char *artist, *title, *plugin_name;
struct plugin_cycle *loader;
+
+ guint loader_timeout;
} current;
static void
current.loader = NULL;
}
+ if (current.loader_timeout != 0) {
+ g_source_remove(current.loader_timeout);
+ current.loader_timeout = 0;
+ }
+
if (current.plugin_name != NULL) {
g_free(current.plugin_name);
current.plugin_name = NULL;
screen_status_message (_("No lyrics"));
}
+ if (current.loader_timeout != 0) {
+ g_source_remove(current.loader_timeout);
+ current.loader_timeout = 0;
+ }
+
+ plugin_stop(current.loader);
+ current.loader = NULL;
+}
+
+static gboolean
+screen_lyrics_timeout_callback(gpointer G_GNUC_UNUSED data)
+{
plugin_stop(current.loader);
current.loader = NULL;
+
+ screen_status_printf(_("Lyrics timeout occurred after %d seconds"),
+ options.lyrics_timeout);
+
+ current.loader_timeout = 0;
+ return FALSE;
}
static void
current.loader = lyrics_load(current.artist, current.title,
screen_lyrics_callback, NULL);
+
+ if (options.lyrics_timeout != 0) {
+ current.loader_timeout =
+ g_timeout_add_seconds(options.lyrics_timeout,
+ screen_lyrics_timeout_callback,
+ NULL);
+ }
}
static void