Exemplo n.º 1
0
static gchar *
get_path (NemoAction *action, NemoFile *file)
{
    gchar *ret;

    if (action->escape_space) {
        gchar *path = nemo_file_get_path (file);
        ret = eel_str_escape_spaces (path);
        g_free (path);
    } else {
        ret = nemo_file_get_path (file);
    }

    return ret;
}
Exemplo n.º 2
0
static gchar *
get_insertion_string (TokenType token_type, GList *selection, NemoFile *parent)
{
    GList *l;

    GString *str = g_string_new("");
    gboolean first = TRUE;

    switch (token_type) {
        case TOKEN_PATH_LIST:
            for (l = selection; l != NULL; l = l->next) {
                if (!first)
                    str = g_string_append (str, " ");
                gchar *path = nemo_file_get_path (NEMO_FILE (l->data));
                str = g_string_append (str, path);
                g_free (path);
                first = FALSE;
            }
            break;
        case TOKEN_URI_LIST:
            for (l = selection; l != NULL; l = l->next) {
                if (!first)
                    str = g_string_append (str, " ");
                gchar *uri = nemo_file_get_uri (NEMO_FILE (l->data));
                str = g_string_append (str, uri);
                g_free (uri);
                first = FALSE;
            }
            break;
        case TOKEN_PARENT:
            ;
            gchar *path = nemo_file_get_path (parent);
            str = g_string_append (str, path);
            g_free (path);
            break;
    }

    gchar *ret = str->str;

    g_string_free (str, FALSE);

    return ret;
}