Esempio n. 1
0
eabout_info *
eabout_load_info()
{
    struct sysinfo si;
    eabout_info *info=calloc(1, sizeof(eabout_info));
    info->version = eabout_load_text_file("/etc/openinkpot-version");
    char *eol = strchr(info->version, '\n');
    if(eol)
        *eol='\0';
    Efreet_Ini *ini = efreet_ini_new("/etc/eabout.conf");
    if(ini)
    {
        efreet_ini_section_set(ini, "overview");
        info->device_name = _ini_get(ini, "device_name");
        info->vendor_site = _ini_get(ini, "vendor_site");
        info->developers_site = _ini_get(ini, "developers_site");
        info->cpu = _ini_get(ini, "cpu");
        info->cpu_freq = _ini_get(ini, "cpu_freq");
        efreet_ini_free(ini);
    }
    eabout_get_freespace(info);
    sysinfo(&si);
    info->ram = si.totalram / 1024;
    return info;
}
Esempio n. 2
0
static void
_get_freespace(Efreet_Ini *ini, const char *section, int *total, int *avail)
{
    efreet_ini_section_set(ini, section);
    const char *path = efreet_ini_string_get(ini, "Path");
    struct statfs fs;
    statfs(path, &fs);
    *total = fs.f_blocks * fs.f_bsize / ( 1024 * 1024 );
    *avail = fs.f_bavail * fs.f_bsize / ( 1024 * 1024 );
}
Esempio n. 3
0
EAPI int
efreet_desktop_save(Efreet_Desktop *desktop)
{
    Efreet_Desktop_Type_Info *info;
    Efreet_Ini *ini;
    int ok = 1;

    EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, 0);

    ini = efreet_ini_new(NULL);
    if (!ini) return 0;
    efreet_ini_section_add(ini, "Desktop Entry");
    efreet_ini_section_set(ini, "Desktop Entry");

    info = eina_list_nth(efreet_desktop_types, desktop->type);
    if (info)
    {
        efreet_ini_string_set(ini, "Type", info->type);
        if (info->save_func) info->save_func(desktop, ini);
    }
    else
        ok = 0;

    if (ok)
    {
        char *val;

        if (desktop->only_show_in)
        {
            val = efreet_desktop_string_list_join(desktop->only_show_in);
            if (val)
            {
                efreet_ini_string_set(ini, "OnlyShowIn", val);
                FREE(val);
            }
        }
        if (desktop->not_show_in)
        {
            val = efreet_desktop_string_list_join(desktop->not_show_in);
            if (val)
            {
                efreet_ini_string_set(ini, "NotShowIn", val);
                FREE(val);
            }
        }
        efreet_desktop_generic_fields_save(desktop, ini);
        /* When we save the file, it should be updated to the
         * latest version that we support! */
        efreet_ini_string_set(ini, "Version", DESKTOP_VERSION);

        if (!efreet_ini_save(ini, desktop->orig_path)) ok = 0;
    }
    efreet_ini_free(ini);
    return ok;
}