Add cfg_getposition() and cie to ease libconfuse compatibility
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
19656fc36d
commit
7b1ce042de
|
@ -119,6 +119,24 @@ cfg_value_free(void *value)
|
||||||
p_delete(&value);
|
p_delete(&value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Position
|
||||||
|
cfg_opt_getnposition(cfg_opt_t *opt, unsigned int oindex)
|
||||||
|
{
|
||||||
|
return * (Position *) cfg_opt_getnptr(opt, oindex);
|
||||||
|
}
|
||||||
|
|
||||||
|
Position
|
||||||
|
cfg_getnposition(cfg_t *cfg, const char *name, unsigned int oindex)
|
||||||
|
{
|
||||||
|
return cfg_opt_getnposition(cfg_getopt(cfg, name), oindex);
|
||||||
|
}
|
||||||
|
|
||||||
|
Position
|
||||||
|
cfg_getposition(cfg_t *cfg, const char *name)
|
||||||
|
{
|
||||||
|
return cfg_getnposition(cfg, name, 0);
|
||||||
|
}
|
||||||
|
|
||||||
cfg_opt_t titlebar_opts[] =
|
cfg_opt_t titlebar_opts[] =
|
||||||
{
|
{
|
||||||
CFG_POSITION((char *) "position", (char *) "auto", CFGF_NONE),
|
CFG_POSITION((char *) "position", (char *) "auto", CFGF_NONE),
|
||||||
|
|
|
@ -28,6 +28,10 @@ cfg_t * cfg_new(void);
|
||||||
char * config_file(void);
|
char * config_file(void);
|
||||||
int config_check(const char *);
|
int config_check(const char *);
|
||||||
|
|
||||||
|
Position cfg_opt_getnposition(cfg_opt_t *, unsigned int);
|
||||||
|
Position cfg_getnposition(cfg_t *, const char *, unsigned int);
|
||||||
|
Position cfg_getposition(cfg_t *, const char *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||||
|
|
4
config.c
4
config.c
|
@ -275,7 +275,7 @@ create_widgets(cfg_t* cfg_statusbar, Statusbar *statusbar)
|
||||||
static void
|
static void
|
||||||
config_section_titlebar_init(cfg_t *cfg_titlebar, Titlebar *tb)
|
config_section_titlebar_init(cfg_t *cfg_titlebar, Titlebar *tb)
|
||||||
{
|
{
|
||||||
tb->position = tb->dposition = *(Position *) cfg_getptr(cfg_titlebar, "position");
|
tb->position = tb->dposition = cfg_getposition(cfg_titlebar, "position");
|
||||||
tb->text_align = * (Alignment *) cfg_getptr(cfg_titlebar, "text_align");
|
tb->text_align = * (Alignment *) cfg_getptr(cfg_titlebar, "text_align");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ config_parse_screen(cfg_t *cfg, int screen)
|
||||||
statusbar = p_new(Statusbar, 1);
|
statusbar = p_new(Statusbar, 1);
|
||||||
cfgsectmp = cfg_getnsec(cfg_screen, "statusbar", i);
|
cfgsectmp = cfg_getnsec(cfg_screen, "statusbar", i);
|
||||||
statusbar->position = statusbar->dposition =
|
statusbar->position = statusbar->dposition =
|
||||||
* (Position *) cfg_getptr(cfgsectmp, "position");
|
cfg_getposition(cfgsectmp, "position");
|
||||||
statusbar->height = cfg_getint(cfgsectmp, "height");
|
statusbar->height = cfg_getint(cfgsectmp, "height");
|
||||||
statusbar->width = cfg_getint(cfgsectmp, "width");
|
statusbar->width = cfg_getint(cfgsectmp, "width");
|
||||||
statusbar->name = a_strdup(cfg_title(cfgsectmp));
|
statusbar->name = a_strdup(cfg_title(cfgsectmp));
|
||||||
|
|
|
@ -20,10 +20,11 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "common/draw.h"
|
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
#include "common/draw.h"
|
||||||
|
#include "common/configopts.h"
|
||||||
|
|
||||||
extern AwesomeConf globalconf;
|
extern AwesomeConf globalconf;
|
||||||
|
|
||||||
|
@ -403,7 +404,7 @@ graph_new(Statusbar *statusbar, cfg_t *config)
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
d->grow = *(Position *) cfg_getptr(config, "grow");
|
d->grow = cfg_getposition(config, "grow");
|
||||||
if(d->grow != Left && d->grow != Right)
|
if(d->grow != Left && d->grow != Right)
|
||||||
{
|
{
|
||||||
warn("graph widget: 'grow' argument must be 'left' or 'right'\n");
|
warn("graph widget: 'grow' argument must be 'left' or 'right'\n");
|
||||||
|
|
Loading…
Reference in New Issue