summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ae8123c)
raw | patch | inline | side by side (parent: ae8123c)
author | Max Kellermann <max@duempel.org> | |
Sat, 3 Oct 2009 21:22:57 +0000 (23:22 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Sat, 3 Oct 2009 21:22:57 +0000 (23:22 +0200) |
Keep track of the current source id, and unregister it on exit.
src/main.c | patch | blob | history |
diff --git a/src/main.c b/src/main.c
index 8d9152b27cb8e64e3e90d252bc2465755dbde10d..a8643a393d7c01d3d9c0f9a6b362e30c970bc6a2 100644 (file)
--- a/src/main.c
+++ b/src/main.c
assert(!mpdclient_is_connected(mpd));
+ reconnect_source_id = 0;
+
screen_status_printf(_("Connecting to %s... [Press %s to abort]"),
options.host, get_key_names(CMD_QUIT,0) );
doupdate();
options.password);
if (!success) {
/* try again in 5 seconds */
- g_timeout_add(5000, timer_reconnect, NULL);
+ reconnect_source_id = g_timeout_add(5000,
+ timer_reconnect, NULL);
return FALSE;
}
doupdate();
/* try again after 30 seconds */
- g_timeout_add(30000, timer_reconnect, NULL);
+ reconnect_source_id = g_timeout_add(30000,
+ timer_reconnect, NULL);
return FALSE;
}
#endif
/* update immediately */
g_timeout_add(1, timer_mpd_update, GINT_TO_POINTER(FALSE));
- reconnect_source_id = 0;
return FALSE;
-
}
static gboolean
disable_update_timer();
+ if (reconnect_source_id != 0)
+ g_source_remove(reconnect_source_id);
+
#ifndef NCMPC_MINI
if (check_key_bindings_source_id != 0)
g_source_remove(check_key_bindings_source_id);