Ejemplo n.º 1
0
Archivo: menu.c Proyecto: g7/fbpanel
/* Copies original config while replacing specific entries
 * with autogenerated configs */
static xconf *
menu_expand_xc(xconf *xc, menu_priv *m)
{
    xconf *nxc, *cxc, *smenu_xc;
    GSList *w;

    ENTER;
    if (!xc)
        RET(NULL);
    nxc = xconf_new(xc->name, xc->value);
    DBG("new node:%s\n", nxc->name);
    for (w = xc->sons; w; w = g_slist_next(w))
    {
        cxc = w->data;
        if (!strcmp(cxc->name, "systemmenu"))
        {
            smenu_xc = xconf_new_from_systemmenu();
            xconf_append_sons(nxc, smenu_xc);
            xconf_del(smenu_xc, FALSE);
            m->has_system_menu = TRUE;
            continue;
        }
        if (!strcmp(cxc->name, "include"))
        {
            smenu_xc = xconf_new_from_file(cxc->value, "include");
            xconf_append_sons(nxc, smenu_xc);
            xconf_del(smenu_xc, FALSE);
            continue;
        }
        xconf_append(nxc, menu_expand_xc(cxc, m));
    }
    return nxc;
}
Ejemplo n.º 2
0
Archivo: xconf.c Proyecto: g7/fbpanel
void xconf_set_value(xconf *x, gchar *value)
{
    xconf_del(x, TRUE);
    g_free(x->value);
    x->value = g_strdup(value);

}
Ejemplo n.º 3
0
Archivo: xconf.c Proyecto: g7/fbpanel
void xconf_set_value_ref(xconf *x, gchar *value)
{
    xconf_del(x, TRUE);
    g_free(x->value);
    x->value = value;

}
Ejemplo n.º 4
0
Archivo: user.c Proyecto: g7/fbpanel
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();
}
Ejemplo n.º 5
0
int
main(int argc, char *argv[])
{
    setlocale(LC_CTYPE, "");
    bindtextdomain(PROJECT_NAME, LOCALEDIR);
    textdomain(PROJECT_NAME);

    gtk_set_locale();
    gtk_init(&argc, &argv);
    XSetLocaleModifiers("");
    XSetErrorHandler((XErrorHandler) handle_error);
    fb_init();
    do_argv(argc, argv);
    profile_file = g_build_filename(g_get_user_config_dir(),
                                    "fbpanel", profile, NULL);
    ensure_profile();
    gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), IMGPREFIX);
    signal(SIGUSR1, sig_usr1);
    signal(SIGUSR2, sig_usr2);

    do {
        the_panel = p = g_new0(panel, 1);
        p->xc = xconf_new_from_file(profile_file, profile);
        if (!p->xc)
            exit(1);

        panel_start(p->xc);
        if (config)
            configure(p->xc);
        gtk_main();
        panel_stop(p);
        //xconf_save_to_profile(cprofile, xc);
        xconf_del(p->xc, FALSE);
        g_free(p);
        DBG("force_quit=%d\n", force_quit);
    } while (force_quit == 0);
    g_free(profile_file);
    fb_free();
    exit(0);
}
Ejemplo n.º 6
0
Archivo: xconf.c Proyecto: g7/fbpanel
/* Unlinks node and deletes it and its sub-tree */
void xconf_del(xconf *x, gboolean sons_only)
{
    GSList *s;
    xconf *x2;

    if (!x)
        return;
    DBG("%s %s\n", x->name, x->value);
    for (s = x->sons; s; s = g_slist_delete_link(s, s))
    {
        x2 = s->data;
        x2->parent = NULL;
        xconf_del(x2, FALSE);
    }
    x->sons = NULL;
    if (!sons_only)
    {
        g_free(x->name);
        g_free(x->value);
        xconf_unlink(x);
        g_free(x);
    }
}
Ejemplo n.º 7
0
Archivo: menu.c Proyecto: g7/fbpanel
static void
menu_destroy(menu_priv *m)
{
    ENTER;
    if (m->menu) {
        gtk_widget_destroy(m->menu);
        m->menu = NULL;
        m->has_system_menu = FALSE;
    }
    if (m->tout) {
        g_source_remove(m->tout);
        m->tout = 0;
    }
    if (m->rtout) {
        g_source_remove(m->rtout);
        m->rtout = 0;
    }
    if (m->xc) {
        xconf_del(m->xc, FALSE);
        m->xc = NULL;
    }
    RET();
}
Ejemplo n.º 8
0
Archivo: xconf.c Proyecto: g7/fbpanel
void xconf_set_int(xconf *x, int i)
{
    xconf_del(x, TRUE);
    g_free(x->value);
    x->value = g_strdup_printf("%d", i);
}