コード例 #1
0
ファイル: menu.c プロジェクト: 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;
}
コード例 #2
0
ファイル: panel.c プロジェクト: bbidulock/fbpanel
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);
}