(label_set_textv): new WLabel API.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2013-08-07 10:24:30 +04:00
parent 9d4bafd889
commit c672ed9b21
2 changed files with 17 additions and 0 deletions

View File

@ -34,6 +34,7 @@
#include <config.h> #include <config.h>
#include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -188,3 +189,18 @@ label_set_text (WLabel * label, const char *text)
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
void
label_set_textv (WLabel * label, const char *format, ...)
{
va_list args;
char buf[BUF_1K]; /* FIXME: is it enough? */
va_start (args, format);
g_vsnprintf (buf, sizeof (buf), format, args);
va_end (args);
label_set_text (label, buf);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -28,6 +28,7 @@ typedef struct
WLabel *label_new (int y, int x, const char *text); WLabel *label_new (int y, int x, const char *text);
void label_set_text (WLabel * label, const char *text); void label_set_text (WLabel * label, const char *text);
void label_set_textv (WLabel * label, const char *format, ...);
/*** inline functions ****************************************************************************/ /*** inline functions ****************************************************************************/