use list functions for statusbar

This commit is contained in:
Julien Danjou 2008-01-12 21:39:41 +01:00
parent 6bd8c670e5
commit 56d7e1654a
2 changed files with 14 additions and 15 deletions

View File

@ -292,6 +292,7 @@ config_parse_screen(cfg_t *cfg, int screen)
*cfg_layouts, *cfg_padding, *cfgsectmp; *cfg_layouts, *cfg_padding, *cfgsectmp;
VirtScreen *virtscreen = &globalconf.screens[screen]; VirtScreen *virtscreen = &globalconf.screens[screen];
unsigned int i; unsigned int i;
int j;
int phys_screen = get_phys_screen(screen); int phys_screen = get_phys_screen(screen);
snprintf(buf, sizeof(buf), "%d", screen); snprintf(buf, sizeof(buf), "%d", screen);
@ -350,22 +351,18 @@ config_parse_screen(cfg_t *cfg, int screen)
/* Statusbar */ /* Statusbar */
if(cfg_size(cfg_screen, "statusbar")) statusbar_list_init(&virtscreen->statusbar);
for(j = cfg_size(cfg_screen, "statusbar") - 1; j >= 0; j--)
{ {
virtscreen->statusbar = statusbar = p_new(Statusbar, 1); statusbar = p_new(Statusbar, 1);
for(i = 0; i < cfg_size(cfg_screen, "statusbar"); i++) cfgsectmp = cfg_getnsec(cfg_screen, "statusbar", j);
{
cfgsectmp = cfg_getnsec(cfg_screen, "statusbar", i);
statusbar->position = statusbar->dposition = statusbar->position = statusbar->dposition =
statusbar_get_position_from_str(cfg_getstr(cfgsectmp, "position")); statusbar_get_position_from_str(cfg_getstr(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));
create_widgets(cfgsectmp, statusbar); create_widgets(cfgsectmp, statusbar);
statusbar_list_append(&virtscreen->statusbar, statusbar);
if(i < cfg_size(cfg_screen, "statusbar") - 1)
statusbar = statusbar->next = p_new(Statusbar, 1);
}
} }
/* Layouts */ /* Layouts */

View File

@ -161,6 +161,8 @@ struct Statusbar
Statusbar *next; Statusbar *next;
}; };
DO_SLIST(Statusbar, statusbar, p_delete);
typedef struct Client Client; typedef struct Client Client;
struct Client struct Client
{ {