static void panel_start(xconf *xc) { int i; xconf *pxc; ENTER; fbev = fb_ev_new(); //xconf_prn(stdout, xc, 0, FALSE); panel_parse_global(xconf_find(xc, "global", 0)); for (i = 0; (pxc = xconf_find(xc, "plugin", i)); i++) panel_parse_plugin(pxc); RET(); }
static void fetch_gravatar_done(GPid pid, gint status, gpointer data) { user_priv *c G_GNUC_UNUSED = data; plugin_instance *p G_GNUC_UNUSED = data; gchar *image = NULL, *icon = NULL; ENTER; DBG("status %d\n", status); g_spawn_close_pid(c->pid); c->pid = 0; c->sid = 0; if (status) RET(); DBG("rebuild menu\n"); XCG(p->xc, "icon", &icon, strdup); XCG(p->xc, "image", &image, strdup); XCS(p->xc, "image", image, value); xconf_del(xconf_find(p->xc, "icon", 0), FALSE); PLUGIN_CLASS(k)->destructor(p); PLUGIN_CLASS(k)->constructor(p); if (image) { XCS(p->xc, "image", image, value); g_free(image); } if (icon) { XCS(p->xc, "icon", icon, value); g_free(icon); } RET(); }
xconf * xconf_get(xconf *xc, gchar *name) { xconf *ret; if (!xc) return NULL; if ((ret = xconf_find(xc, name, 0))) return ret; ret = xconf_new(name, NULL); xconf_append(xc, ret); return ret; }
static void panel_parse_plugin(xconf *xc) { plugin_instance *plug = NULL; gchar *type = NULL; ENTER; xconf_get_str(xconf_find(xc, "type", 0), &type); if (!type || !(plug = plugin_load(type))) { ERR( "fbpanel: can't load %s plugin\n", type); return; } plug->panel = p; XCG(xc, "expand", &plug->expand, enum, bool_enum); XCG(xc, "padding", &plug->padding, int); XCG(xc, "border", &plug->border, int); plug->xc = xconf_find(xc, "config", 0); if (!plugin_start(plug)) { ERR( "fbpanel: can't start plugin %s\n", type); exit(1); } p->plugins = g_list_append(p->plugins, plug); }
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); }