Esempio n. 1
0
static int
icons_constructor(plugin *p)
{
    icons *ics;
    line s;

    ENTER;
    ics = g_new0(icons, 1);
    ics->plug = p;
    p->priv = ics;

    ics->wmpixno           = 0;
    ics->task_list         = g_hash_table_new(g_int_hash, g_int_equal);
    s.len = 256;
    while (get_line(p->fp, &s) != LINE_BLOCK_END) {
        if (s.type == LINE_NONE) {
            ERR( "icons: illegal token %s\n", s.str);
            goto error;
        }
        if (s.type == LINE_VAR) {
            if (!g_ascii_strcasecmp(s.t[0], "DefaultIcon")) {
                if (!read_dicon(ics, s.t[1])) {
                    goto error;
                }
            } else {
                ERR( "icons: unknown var %s\n", s.t[0]);
                goto error;
            }
        } else if (s.type == LINE_BLOCK_START) {
            if (!g_ascii_strcasecmp(s.t[0], "application")) {
                if (!read_application(p)) {
                    goto error;
                }
            } else {
                ERR( "icons: unknown var %s\n", s.t[0]);
                goto error;
            }
        } else {
            ERR( "icons: illegal in this context %s\n", s.str);
            goto error;
        }
    }

    icons_build_gui(p);
    do_net_client_list(NULL, ics);
    RET(1);

error:
    icons_destructor(p);
    RET(0);
}
Esempio n. 2
0
File: icons.c Progetto: g7/fbpanel
static int
ics_parse_config(icons_priv *ics)
{
    gchar *def_icon;
    plugin_instance *p = (plugin_instance *) ics;
    int i;
    xconf *pxc;
    
    ENTER;
    def_icon = NULL;
    XCG(p->xc, "defaulticon", &def_icon, str);
    if (def_icon && !read_dicon(ics, def_icon)) 
        goto error;

    for (i = 0; (pxc = xconf_find(p->xc, "application", i)); i++)
        if (!read_application(ics, pxc))
            goto error;
    RET(1);
    
error:
    RET(0);
}