Ejemplo n.º 1
0
gchar * find_file_case_uri (const gchar * folder, const gchar * basename)
{
    gchar * found, * uri;

    if ((found = find_file_case_path (folder, basename)) == NULL)
        return NULL;

    uri = g_filename_to_uri (found, NULL, NULL);
    g_free (found);
    return uri;
}
Ejemplo n.º 2
0
VFSFile * open_local_file_nocase (const char * folder, const char * basename)
{
    char * path = find_file_case_path (folder, basename);
    if (! path)
        return NULL;

    char * uri = filename_to_uri (path);
    g_free (path);

    if (! uri)
        return NULL;

    VFSFile * file = vfs_fopen (uri, "r");
    str_unref (uri);
    return file;
}
Ejemplo n.º 3
0
static GdkPixbuf *
skin_get_preview(const gchar * path)
{
    GdkPixbuf *preview = NULL;
    gchar *dec_path, *preview_path;
    gboolean is_archive = FALSE;
    gint i = 0;
    gchar buf[60];			/* gives us lots of room */

    if (file_is_archive(path))
    {
        if (!(dec_path = archive_decompress(path)))
            return NULL;

        is_archive = TRUE;
    }
    else
    {
        dec_path = g_strdup(path);
    }

    for (i = 0; i < EXTENSION_TARGETS; i++)
    {
        sprintf(buf, "main.%s", ext_targets[i]);

        if ((preview_path = find_file_case_path (dec_path, buf)) != NULL)
            break;
    }

    if (preview_path)
    {
        preview = gdk_pixbuf_new_from_file(preview_path, NULL);
        g_free(preview_path);
    }

    if (is_archive)
        del_directory(dec_path);

    g_free(dec_path);

    return preview;
}