Code

use g_timeout_add_seconds() where appropriate
authorMax Kellermann <max.kellermann@gmail.com>
Mon, 20 Mar 2017 19:26:42 +0000 (20:26 +0100)
committerMax Kellermann <max.kellermann@gmail.com>
Mon, 20 Mar 2017 19:26:42 +0000 (20:26 +0100)
src/main.c
src/screen.c
src/screen_queue.c
src/status_bar.c

index a8fb3b36f654a93e4157c46baa594108dbf03153..88660de05842e12fc4258c58da3a45f13547bb70 100644 (file)
@@ -218,8 +218,8 @@ mpdclient_connected_callback(void)
                doupdate();
 
                /* try again after 30 seconds */
                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
                return;
        }
 #endif
@@ -241,8 +241,7 @@ mpdclient_failed_callback(void)
        assert(reconnect_source_id == 0);
 
        /* try again in 5 seconds */
        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
 }
 
 void
@@ -252,7 +251,7 @@ mpdclient_lost_callback(void)
 
        screen_update(mpd);
 
 
        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
        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);
 #endif
 
        screen_paint(mpd);
index 0a056a866ec29ba266711eea5bc4c7044ac44885..781b68f22eb9e99c2d06b2590dce1990548041a6 100644 (file)
@@ -277,8 +277,8 @@ screen_init(struct mpdclient *c)
 #ifndef NCMPC_MINI
        if (options.welcome_screen_list)
                screen.welcome_source_id =
 #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 */
 #endif
 
        /* create top window */
index de6b2a09627f19d7781b5cece0cc225283f396b3..d364c910a5c0ae8e0c91f8ff707e1414361e305d 100644 (file)
@@ -442,8 +442,8 @@ timer_hide_cursor(gpointer data)
                lw->hide_cursor = true;
                screen_queue_repaint();
        } else
                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;
 }
 
        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;
        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();
        }
 
        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);
        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)) {
        }
 
        if (list_window_cmd(lw, cmd)) {
index 74f91de3a67a75baa121960e8f928484c9934714..bdf3bcd6200cb324898ba63e675be63677f9733a 100644 (file)
@@ -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);
 
        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);
 }
 }