Code

use g_timeout_add_seconds() where appropriate
[ncmpc.git] / src / screen_queue.c
index 7fd73aa7080c2e1531507b0debe3a2d86217d11e..d364c910a5c0ae8e0c91f8ff707e1414361e305d 100644 (file)
@@ -1,5 +1,5 @@
 /* ncmpc (Ncurses MPD Client)
- * (c) 2004-2010 The Music Player Daemon Project
+ * (c) 2004-2017 The Music Player Daemon Project
  * Project homepage: http://musicpd.org
  *
  * This program is free software; you can redistribute it and/or modify
@@ -415,7 +415,7 @@ handle_add_to_playlist(struct mpdclient *c)
 }
 
 static void
-screen_queue_init(WINDOW *w, int cols, int rows)
+screen_queue_init(WINDOW *w, unsigned cols, unsigned rows)
 {
        lw = list_window_init(w, cols, rows);
 
@@ -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();
@@ -479,7 +479,7 @@ screen_queue_close(void)
 }
 
 static void
-screen_queue_resize(int cols, int rows)
+screen_queue_resize(unsigned cols, unsigned rows)
 {
        list_window_resize(lw, cols, rows);
 }
@@ -548,7 +548,7 @@ screen_queue_update(struct mpdclient *c)
            c->events & MPD_IDLE_QUEUE)
                /* the queue or the current song has changed, we must
                   paint the new version */
-               screen_queue_repaint();
+               screen_queue_paint();
 }
 
 #ifdef HAVE_GETMOUSE
@@ -559,7 +559,7 @@ handle_mouse_event(struct mpdclient *c)
        int row;
        if (screen_get_mouse_event(c, &bstate, &row) ||
            list_window_mouse(lw, bstate, row)) {
-               screen_queue_repaint();
+               screen_queue_paint();
                return true;
        }
 
@@ -593,7 +593,7 @@ handle_mouse_event(struct mpdclient *c)
        }
 
        screen_queue_save_selection();
-       screen_queue_repaint();
+       screen_queue_paint();
 
        return true;
 }
@@ -613,26 +613,26 @@ 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)) {
                screen_queue_save_selection();
-               screen_queue_repaint();
+               screen_queue_paint();
                return true;
        }
 
        switch(cmd) {
        case CMD_SCREEN_UPDATE:
                center_playing_item(c->status, prev_cmd == CMD_SCREEN_UPDATE);
-               screen_queue_repaint();
+               screen_queue_paint();
                return false;
        case CMD_SELECT_PLAYING:
                list_window_set_cursor(lw, playlist_get_index(&c->playlist,
                                                              c->song));
                screen_queue_save_selection();
-               screen_queue_repaint();
+               screen_queue_paint();
                return true;
 
        case CMD_LIST_FIND:
@@ -641,12 +641,12 @@ screen_queue_cmd(struct mpdclient *c, command_t cmd)
        case CMD_LIST_RFIND_NEXT:
                screen_find(lw, cmd, screen_queue_lw_callback, NULL);
                screen_queue_save_selection();
-               screen_queue_repaint();
+               screen_queue_paint();
                return true;
        case CMD_LIST_JUMP:
-               screen_jump(lw, screen_queue_lw_callback, NULL, NULL);
+               screen_jump(lw, screen_queue_lw_callback, NULL, NULL, NULL);
                screen_queue_save_selection();
-               screen_queue_repaint();
+               screen_queue_paint();
                return true;
 
 #ifdef HAVE_GETMOUSE