diff src/scrobbler/plugin.c @ 2318:d7c321957be8

apply username/password changes 10 seconds after last keystroke in config editboxes
author Tomasz Mon <desowin@gmail.com>
date Tue, 15 Jan 2008 20:26:27 +0100
parents 3f684f1b1840
children 224727e6c73d
line wrap: on
line diff
--- a/src/scrobbler/plugin.c	Tue Jan 15 19:54:19 2008 +0100
+++ b/src/scrobbler/plugin.c	Tue Jan 15 20:26:27 2008 +0100
@@ -100,17 +100,13 @@
     }
 }
 
-static void init(void)
-{
+void start(void) {
 	char *username = NULL, *password = NULL;
 	char *ge_username = NULL, *ge_password = NULL;
 	ConfigDb *cfgfile;
 	sc_going = 1;
 	ge_going = 1;
 	GError **moo = NULL;
-	cfgdlg = create_cfgdlg();
-
-        aud_prefswin_page_new(cfgdlg, "Scrobbler", DATA_DIR "/images/audioscrobbler.png");
 
 	if ((cfgfile = aud_cfg_db_open()) != NULL) {
 		aud_cfg_db_get_string(cfgfile, "audioscrobbler", "username",
@@ -180,10 +176,7 @@
 	pdebug("plugin started", DEBUG);
 }
 
-static void cleanup(void)
-{
-        aud_prefswin_page_destroy(cfgdlg);
-
+void stop(void) {
 	if (!sc_going && !ge_going)
 		return;
 	pdebug("about to lock mutex", DEBUG);
@@ -219,6 +212,19 @@
 	aud_hook_dissociate("playback end", aud_hook_playback_end);
 }
 
+static void init(void)
+{
+    start();
+    cfgdlg = create_cfgdlg();
+    aud_prefswin_page_new(cfgdlg, "Scrobbler", DATA_DIR "/images/audioscrobbler.png");
+}
+
+static void cleanup(void)
+{
+    stop();
+    aud_prefswin_page_destroy(cfgdlg);
+}
+
 static void *xs_thread(void *data __attribute__((unused)))
 {
 	int run = 1;