Ejemplo n.º 1
0
EAPI Efreet_Desktop *
efreet_desktop_uncached_new(const char *file)
{
    Efreet_Desktop *desktop = NULL;
    char *tmp;

    EINA_SAFETY_ON_NULL_RETURN_VAL(file, NULL);
    if (!ecore_file_exists(file)) return NULL;

    tmp = eina_file_path_sanitize(file);
    if (!tmp) return NULL;

    desktop = NEW(Efreet_Desktop, 1);
    if (!desktop)
    {
        free(tmp);
        return NULL;
    }
    desktop->orig_path = tmp;
    desktop->ref = 1;
    if (!efreet_desktop_read(desktop))
    {
        efreet_desktop_free(desktop);
        return NULL;
    }

    return desktop;
}
Ejemplo n.º 2
0
/**
 * @param file: The file to create the Efreet_Desktop from
 * @return Returns a new Efreet_Desktop on success, NULL on failure
 * @brief Creates a new Efreet_Desktop structure initialized from the
 * contents of @a file or NULL on failure
 *
 * By using efreet_desktop_uncached_new the Efreet_Desktop structure will be
 * read from disk, and not from any cache.
 */
EAPI Efreet_Desktop *
efreet_desktop_uncached_new(const char *file)
{
    Efreet_Desktop *desktop = NULL;
    char rp[PATH_MAX];

    if (!file) return NULL;
    if (!realpath(file, rp)) return NULL;
    if (!ecore_file_exists(rp)) return NULL;

    desktop = NEW(Efreet_Desktop, 1);
    if (!desktop) return NULL;
    desktop->orig_path = strdup(rp);
    desktop->ref = 1;
    if (!efreet_desktop_read(desktop))
    {
        efreet_desktop_free(desktop);
        return NULL;
    }

    return desktop;
}