diff --git a/src/screen.c b/src/screen.c
index f4ced308c567dc80cf6d713729982c00e786ee9f..d952a1fe41b60a637f0572e4aa45122d3fad78ea 100644 (file)
--- a/src/screen.c
+++ b/src/screen.c
*
*/
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include <string.h>
-#include <time.h>
-#include <locale.h>
-#include <glib.h>
-#include <ncurses.h>
-
+#include "screen.h"
+#include "screen_utils.h"
#include "config.h"
#include "ncmpc.h"
#include "support.h"
#include "colors.h"
#include "strfsong.h"
#include "wreadln.h"
-#include "screen.h"
-#include "screen_utils.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <string.h>
+#include <time.h>
+#include <locale.h>
#define SCREEN_PLAYLIST_ID 0
#define SCREEN_BROWSE_ID 1
typedef struct
{
gint id;
- gchar *name;
+ const gchar *name;
screen_get_mode_functions_fn_t get_mode_functions;
} screen_mode_info_t;
static int seek_target_time = 0;
gint
-screen_get_id(char *name)
+screen_get_id(const char *name)
{
gint i=0;
return -1;
}
-gint get_cur_mode_id()
+gint get_cur_mode_id(void)
{
return screens[screen->mode].id;
}
}
static void
-paint_top_window2(char *header, mpdclient_t *c)
+paint_top_window2(const char *header, mpdclient_t *c)
{
char flags[5];
WINDOW *w = screen->top_window.w;
}
static void
-paint_top_window(char *header, mpdclient_t *c, int clear)
+paint_top_window(const char *header, mpdclient_t *c, int full_repaint)
{
static int prev_volume = -1;
static int prev_header_len = -1;
if (prev_header_len!=my_strlen(header)) {
prev_header_len = my_strlen(header);
- clear = 1;
+ full_repaint = 1;
}
- if (clear) {
+ if (full_repaint) {
wmove(w, 0, 0);
wclrtoeol(w);
}
- if (prev_volume!=c->status->volume || clear)
+ if (prev_volume!=c->status->volume || full_repaint)
paint_top_window2(header, c);
}
mpd_Status *status = c->status;
mpd_Song *song = c->song;
int elapsedTime = 0;
- char *str = NULL;
+ const char *str = NULL;
int x = 0;
if( time(NULL) - screen->status_timestamp <= SCREEN_STATUS_MESSAGE_TIME )
/* close and exit all screens (playlist,browse,help...) */
i=0;
while (screens[i].get_mode_functions) {
- screen_functions_t *mode_fn = screens[i].get_mode_functions();
+ screen_functions_t *sf = screens[i].get_mode_functions();
- if (mode_fn && mode_fn->close)
- mode_fn->close();
- if (mode_fn && mode_fn->exit)
- mode_fn->exit();
+ if (sf && sf->close)
+ sf->close();
+ if (sf && sf->exit)
+ sf->exit();
i++;
}
/* close and exit all screens (playlist,browse,help...) */
i=0;
while (screens[i].get_mode_functions) {
- screen_functions_t *mode_fn = screens[i].get_mode_functions();
+ screen_functions_t *sf = screens[i].get_mode_functions();
- if (mode_fn && mode_fn->resize)
- mode_fn->resize(screen->main_window.cols, screen->main_window.rows);
+ if (sf && sf->resize)
+ sf->resize(screen->main_window.cols, screen->main_window.rows);
i++;
}
}
void
-screen_status_message(char *msg)
+screen_status_message(const char *msg)
{
WINDOW *w = screen->status_window.w;
}
void
-screen_status_printf(char *format, ...)
+screen_status_printf(const char *format, ...)
{
char *msg;
va_list ap;
}
void
-ncurses_init()
+ncurses_init(void)
{
/* initialize the curses library */
}
}
+int
screen_init(mpdclient_t *c)
{
gint i;
void
screen_paint(mpdclient_t *c)
{
- char *title = NULL;
+ const char *title = NULL;
if (mode_fn && mode_fn->get_title)
title = mode_fn->get_title(screen->buf, screen->buf_size);
screen_update(mpdclient_t *c)
{
static int repeat = -1;
- static int random = -1;
+ static int random_enabled = -1;
static int crossfade = -1;
static int dbupdate = -1;
list_window_t *lw = NULL;
/* print a message if mpd status has changed */
if (repeat < 0) {
repeat = c->status->repeat;
- random = c->status->random;
+ random_enabled = c->status->random;
crossfade = c->status->crossfade;
dbupdate = c->status->updatingDb;
}
_("Repeat is on") :
_("Repeat is off"));
- if (random != c->status->random)
+ if (random_enabled != c->status->random)
screen_status_printf(c->status->random ?
_("Random is on") :
_("Random is off"));
}
repeat = c->status->repeat;
- random = c->status->random;
+ random_enabled = c->status->random;
crossfade = c->status->crossfade;
dbupdate = c->status->updatingDb;