diff options
author | Kalle Wallin <kaw@linux.se> | 2004-03-22 18:09:23 +0000 |
---|---|---|
committer | Kalle Wallin <kaw@linux.se> | 2004-03-22 18:09:23 +0000 |
commit | 3da656b83260ef257675a4ae4c681b3b99f83353 (patch) | |
tree | 539f4b2839afc54cca47a5dd3090d53f0d95044f | |
parent | 60edfc515dce2963f426450d3e66e51521645252 (diff) | |
download | mpd-3da656b83260ef257675a4ae4c681b3b99f83353.tar.gz mpd-3da656b83260ef257675a4ae4c681b3b99f83353.tar.xz mpd-3da656b83260ef257675a4ae4c681b3b99f83353.zip |
Added a find buffer and a function for formated status messages.
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@368 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | screen.c | 18 | ||||
-rw-r--r-- | screen.h | 3 |
2 files changed, 21 insertions, 0 deletions
@@ -5,6 +5,7 @@ #include <stdlib.h> #include <unistd.h> +#include <stdarg.h> #include <string.h> #include <time.h> #include <glib.h> @@ -20,6 +21,7 @@ #include "screen_search.h" #define STATUS_MESSAGE_TIMEOUT 3 +#define STATUS_LINE_MAX_SIZE 512 static screen_t *screen = NULL; @@ -203,6 +205,7 @@ screen_exit(void) screen->filelist = list_window_free(screen->filelist); screen->helplist = list_window_free(screen->helplist); free(screen->buf); + free(screen->findbuf); free(screen); screen = NULL; } @@ -235,6 +238,18 @@ screen_status_message(mpd_client_t *c, char *msg) screen->status_timestamp = time(NULL); } +void +screen_status_printf(mpd_client_t *c, char *format, ...) +{ + char buffer[STATUS_LINE_MAX_SIZE]; + va_list ap; + + va_start(ap,format); + vsnprintf(buffer,sizeof(buffer),format,ap); + va_end(ap); + screen_status_message(c, buffer); +} + int screen_init(void) { @@ -269,6 +284,7 @@ screen_init(void) screen->rows = LINES; screen->buf = malloc(screen->cols); screen->buf_size = screen->cols; + screen->findbuf = NULL; screen->painted = 0; /* create top window */ @@ -503,6 +519,8 @@ screen_cmd(mpd_client_t *c, command_t cmd) break; case CMD_QUIT: exit(EXIT_SUCCESS); + case CMD_LIST_FIND: + case CMD_LIST_FIND_NEXT: case CMD_NONE: case CMD_DELETE: case CMD_SELECT: @@ -53,6 +53,8 @@ typedef struct char *buf; size_t buf_size; + char *findbuf; + int painted; } screen_t; @@ -63,6 +65,7 @@ int screen_init(void); int screen_exit(void); void screen_resized(int sig); void screen_status_message(mpd_client_t *c, char *msg); +void screen_status_printf(mpd_client_t *c, char *format, ...); char *screen_error(void); void screen_paint(mpd_client_t *c); void screen_update(mpd_client_t *c); |