Add cfg_getalignment() functions
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
7b1ce042de
commit
2a47aa7f0b
|
@ -119,6 +119,24 @@ cfg_value_free(void *value)
|
||||||
p_delete(&value);
|
p_delete(&value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Alignment
|
||||||
|
cfg_opt_getnalignment(cfg_opt_t *opt, unsigned int oindex)
|
||||||
|
{
|
||||||
|
return * (Alignment *) cfg_opt_getnptr(opt, oindex);
|
||||||
|
}
|
||||||
|
|
||||||
|
Alignment
|
||||||
|
cfg_getnalignment(cfg_t *cfg, const char *name, unsigned int oindex)
|
||||||
|
{
|
||||||
|
return cfg_opt_getnalignment(cfg_getopt(cfg, name), oindex);
|
||||||
|
}
|
||||||
|
|
||||||
|
Alignment
|
||||||
|
cfg_getalignment(cfg_t *cfg, const char *name)
|
||||||
|
{
|
||||||
|
return cfg_getnalignment(cfg, name, 0);
|
||||||
|
}
|
||||||
|
|
||||||
Position
|
Position
|
||||||
cfg_opt_getnposition(cfg_opt_t *opt, unsigned int oindex)
|
cfg_opt_getnposition(cfg_opt_t *opt, unsigned int oindex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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 *);
|
||||||
|
|
||||||
|
Alignment cfg_opt_getnalignment(cfg_opt_t *, unsigned int);
|
||||||
|
Alignment cfg_getnalignment(cfg_t *, const char *, unsigned int);
|
||||||
|
Alignment cfg_getalignment(cfg_t *, const char *);
|
||||||
|
|
||||||
Position cfg_opt_getnposition(cfg_opt_t *, unsigned int);
|
Position cfg_opt_getnposition(cfg_opt_t *, unsigned int);
|
||||||
Position cfg_getnposition(cfg_t *, const char *, unsigned int);
|
Position cfg_getnposition(cfg_t *, const char *, unsigned int);
|
||||||
Position cfg_getposition(cfg_t *, const char *);
|
Position cfg_getposition(cfg_t *, const char *);
|
||||||
|
|
2
config.c
2
config.c
|
@ -276,7 +276,7 @@ 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 = cfg_getposition(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 = cfg_getalignment(cfg_titlebar, "text_align");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
#include "rules.h"
|
#include "rules.h"
|
||||||
#include "ewmh.h"
|
#include "ewmh.h"
|
||||||
|
#include "common/configopts.h"
|
||||||
|
|
||||||
extern AwesomeConf globalconf;
|
extern AwesomeConf globalconf;
|
||||||
|
|
||||||
|
@ -100,7 +101,7 @@ focusicon_new(Statusbar *statusbar, cfg_t *config)
|
||||||
w = p_new(Widget, 1);
|
w = p_new(Widget, 1);
|
||||||
widget_common_new(w, statusbar, config);
|
widget_common_new(w, statusbar, config);
|
||||||
w->draw = focusicon_draw;
|
w->draw = focusicon_draw;
|
||||||
w->alignment = * (Alignment *) cfg_getptr(config, "align");
|
w->alignment = cfg_getalignment(config, "align");
|
||||||
|
|
||||||
/* Set cache property */
|
/* Set cache property */
|
||||||
w->cache.flags = WIDGET_CACHE_CLIENTS;
|
w->cache.flags = WIDGET_CACHE_CLIENTS;
|
||||||
|
|
|
@ -384,7 +384,7 @@ graph_new(Statusbar *statusbar, cfg_t *config)
|
||||||
|
|
||||||
w->draw = graph_draw;
|
w->draw = graph_draw;
|
||||||
w->tell = graph_tell;
|
w->tell = graph_tell;
|
||||||
w->alignment = * (Alignment *) cfg_getptr(config, "align");
|
w->alignment = cfg_getalignment(config, "align");
|
||||||
d = w->data = p_new(Data, 1);
|
d = w->data = p_new(Data, 1);
|
||||||
|
|
||||||
d->width = cfg_getint(config, "width");
|
d->width = cfg_getint(config, "width");
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
#include "common/configopts.h"
|
||||||
|
|
||||||
extern AwesomeConf globalconf;
|
extern AwesomeConf globalconf;
|
||||||
|
|
||||||
|
@ -99,7 +100,7 @@ iconbox_new(Statusbar *statusbar, cfg_t *config)
|
||||||
|
|
||||||
w = p_new(Widget, 1);
|
w = p_new(Widget, 1);
|
||||||
widget_common_new(w, statusbar, config);
|
widget_common_new(w, statusbar, config);
|
||||||
w->alignment = * (Alignment *) cfg_getptr(config, "align");
|
w->alignment = cfg_getalignment(config, "align");
|
||||||
w->draw = iconbox_draw;
|
w->draw = iconbox_draw;
|
||||||
w->tell = iconbox_tell;
|
w->tell = iconbox_tell;
|
||||||
w->data = d = p_new(Data, 1);
|
w->data = d = p_new(Data, 1);
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
#include "common/configopts.h"
|
||||||
|
|
||||||
extern AwesomeConf globalconf;
|
extern AwesomeConf globalconf;
|
||||||
|
|
||||||
|
@ -64,7 +65,7 @@ layoutinfo_new(Statusbar *statusbar, cfg_t* config)
|
||||||
w = p_new(Widget, 1);
|
w = p_new(Widget, 1);
|
||||||
widget_common_new(w, statusbar, config);
|
widget_common_new(w, statusbar, config);
|
||||||
w->draw = layoutinfo_draw;
|
w->draw = layoutinfo_draw;
|
||||||
w->alignment = * (Alignment *) cfg_getptr(config, "align");
|
w->alignment = cfg_getalignment(config, "align");
|
||||||
|
|
||||||
/* Set cache property */
|
/* Set cache property */
|
||||||
w->cache.flags = WIDGET_CACHE_LAYOUTS;
|
w->cache.flags = WIDGET_CACHE_LAYOUTS;
|
||||||
|
|
|
@ -21,8 +21,10 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
|
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
#include "common/configopts.h"
|
||||||
|
|
||||||
extern AwesomeConf globalconf;
|
extern AwesomeConf globalconf;
|
||||||
|
|
||||||
|
@ -430,7 +432,7 @@ progressbar_new(Statusbar *statusbar, cfg_t *config)
|
||||||
if(!(d->vertical = cfg_getbool(config, "vertical")))
|
if(!(d->vertical = cfg_getbool(config, "vertical")))
|
||||||
d->vertical = False;
|
d->vertical = False;
|
||||||
|
|
||||||
w->alignment = * (Alignment *) cfg_getptr(config, "align");
|
w->alignment = cfg_getalignment(config, "align");
|
||||||
|
|
||||||
if(!(d->data_items = cfg_size(config, "data")))
|
if(!(d->data_items = cfg_size(config, "data")))
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
#include "common/configopts.h"
|
||||||
|
|
||||||
extern AwesomeConf globalconf;
|
extern AwesomeConf globalconf;
|
||||||
|
|
||||||
|
@ -205,7 +206,7 @@ taglist_new(Statusbar *statusbar, cfg_t *config)
|
||||||
widget_common_new(w, statusbar, config);
|
widget_common_new(w, statusbar, config);
|
||||||
w->draw = taglist_draw;
|
w->draw = taglist_draw;
|
||||||
w->button_press = taglist_button_press;
|
w->button_press = taglist_button_press;
|
||||||
w->alignment = * (Alignment *) cfg_getptr(config, "align");
|
w->alignment = cfg_getalignment(config, "align");
|
||||||
|
|
||||||
/* Set cache property */
|
/* Set cache property */
|
||||||
w->cache.flags = WIDGET_CACHE_TAGS | WIDGET_CACHE_CLIENTS;
|
w->cache.flags = WIDGET_CACHE_TAGS | WIDGET_CACHE_CLIENTS;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "rules.h"
|
#include "rules.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
#include "common/configopts.h"
|
||||||
|
|
||||||
extern AwesomeConf globalconf;
|
extern AwesomeConf globalconf;
|
||||||
|
|
||||||
|
@ -297,7 +298,7 @@ tasklist_new(Statusbar *statusbar, cfg_t *config)
|
||||||
&d->styles.urgent,
|
&d->styles.urgent,
|
||||||
&globalconf.screens[statusbar->screen].styles.urgent);
|
&globalconf.screens[statusbar->screen].styles.urgent);
|
||||||
|
|
||||||
d->align = * (Alignment *) cfg_getptr(config, "text_align");
|
d->align = cfg_getalignment(config, "text_align");
|
||||||
d->show_icons = cfg_getbool(config, "show_icons");
|
d->show_icons = cfg_getbool(config, "show_icons");
|
||||||
|
|
||||||
buf = cfg_getstr(config, "show");
|
buf = cfg_getstr(config, "show");
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
#include "common/configopts.h"
|
||||||
|
|
||||||
extern AwesomeConf globalconf;
|
extern AwesomeConf globalconf;
|
||||||
|
|
||||||
|
@ -118,7 +119,7 @@ textbox_new(Statusbar *statusbar, cfg_t *config)
|
||||||
widget_common_new(w, statusbar, config);
|
widget_common_new(w, statusbar, config);
|
||||||
w->draw = textbox_draw;
|
w->draw = textbox_draw;
|
||||||
w->tell = textbox_tell;
|
w->tell = textbox_tell;
|
||||||
w->alignment = * (Alignment *) cfg_getptr(config, "align");
|
w->alignment = cfg_getalignment(config, "align");
|
||||||
|
|
||||||
w->data = d = p_new(Data, 1);
|
w->data = d = p_new(Data, 1);
|
||||||
|
|
||||||
|
@ -128,7 +129,7 @@ textbox_new(Statusbar *statusbar, cfg_t *config)
|
||||||
&globalconf.screens[statusbar->screen].styles.normal);
|
&globalconf.screens[statusbar->screen].styles.normal);
|
||||||
|
|
||||||
d->width = cfg_getint(config, "width");
|
d->width = cfg_getint(config, "width");
|
||||||
d->align = * (Alignment *) cfg_getptr(config, "text_align");
|
d->align = cfg_getalignment(config, "text_align");
|
||||||
|
|
||||||
d->text = a_strdup(cfg_getstr(config, "text"));
|
d->text = a_strdup(cfg_getstr(config, "text"));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue