From: Max Kellermann Date: Mon, 20 Mar 2017 19:26:42 +0000 (+0100) Subject: use g_timeout_add_seconds() where appropriate X-Git-Tag: v0.27~31 X-Git-Url: https://git.tokkee.org/?p=ncmpc.git;a=commitdiff_plain;h=26efd1aa493c9c25cfbd167f225d48203ec8620b use g_timeout_add_seconds() where appropriate --- diff --git a/src/main.c b/src/main.c index a8fb3b3..88660de 100644 --- a/src/main.c +++ b/src/main.c @@ -218,8 +218,8 @@ mpdclient_connected_callback(void) doupdate(); /* try again after 30 seconds */ - reconnect_source_id = g_timeout_add(30000, - timer_reconnect, NULL); + reconnect_source_id = + g_timeout_add_seconds(30, timer_reconnect, NULL); return; } #endif @@ -241,8 +241,7 @@ mpdclient_failed_callback(void) assert(reconnect_source_id == 0); /* try again in 5 seconds */ - reconnect_source_id = g_timeout_add(5000, - timer_reconnect, NULL); + reconnect_source_id = g_timeout_add_seconds(5, timer_reconnect, NULL); } void @@ -252,7 +251,7 @@ mpdclient_lost_callback(void) screen_update(mpd); - reconnect_source_id = g_timeout_add(1000, timer_reconnect, NULL); + reconnect_source_id = g_timeout_add_seconds(1, timer_reconnect, NULL); } /** @@ -427,7 +426,8 @@ main(int argc, const char *argv[]) auto_update_timer(); #ifndef NCMPC_MINI - check_key_bindings_source_id = g_timeout_add(10000, timer_check_key_bindings, NULL); + check_key_bindings_source_id = + g_timeout_add_seconds(10, timer_check_key_bindings, NULL); #endif screen_paint(mpd); diff --git a/src/screen.c b/src/screen.c index 0a056a8..781b68f 100644 --- a/src/screen.c +++ b/src/screen.c @@ -277,8 +277,8 @@ screen_init(struct mpdclient *c) #ifndef NCMPC_MINI if (options.welcome_screen_list) screen.welcome_source_id = - g_timeout_add(SCREEN_WELCOME_TIME * 1000, - welcome_timer_callback, c); + g_timeout_add_seconds(SCREEN_WELCOME_TIME, + welcome_timer_callback, c); #endif /* create top window */ diff --git a/src/screen_queue.c b/src/screen_queue.c index de6b2a0..d364c91 100644 --- a/src/screen_queue.c +++ b/src/screen_queue.c @@ -442,8 +442,8 @@ timer_hide_cursor(gpointer data) lw->hide_cursor = true; screen_queue_repaint(); } else - timer_hide_cursor_id = g_timeout_add(options.hide_cursor * 1000, - timer_hide_cursor, c); + timer_hide_cursor_id = g_timeout_add_seconds(options.hide_cursor, + timer_hide_cursor, c); return FALSE; } @@ -456,8 +456,8 @@ screen_queue_open(struct mpdclient *c) assert(timer_hide_cursor_id == 0); if (options.hide_cursor > 0) { lw->hide_cursor = false; - timer_hide_cursor_id = g_timeout_add(options.hide_cursor * 1000, - timer_hide_cursor, c); + timer_hide_cursor_id = g_timeout_add_seconds(options.hide_cursor, + timer_hide_cursor, c); } screen_queue_restore_selection(); @@ -613,8 +613,8 @@ screen_queue_cmd(struct mpdclient *c, command_t cmd) if (options.hide_cursor > 0) { if (timer_hide_cursor_id != 0) g_source_remove(timer_hide_cursor_id); - timer_hide_cursor_id = g_timeout_add(options.hide_cursor * 1000, - timer_hide_cursor, c); + timer_hide_cursor_id = g_timeout_add_seconds(options.hide_cursor, + timer_hide_cursor, c); } if (list_window_cmd(lw, cmd)) { diff --git a/src/status_bar.c b/src/status_bar.c index 74f91de..bdf3bcd 100644 --- a/src/status_bar.c +++ b/src/status_bar.c @@ -261,6 +261,6 @@ status_bar_message(struct status_bar *p, const char *msg) if (p->message_source_id != 0) g_source_remove(p->message_source_id); - p->message_source_id = g_timeout_add(options.status_message_time * 1000, - status_bar_clear_message_cb, p); + p->message_source_id = g_timeout_add_seconds(options.status_message_time, + status_bar_clear_message_cb, p); }