3 * Copyright (C) 2008 - 2012 The Geeqie Team
5 * Authors: John Ellis, Vladimir Nadvornik, Laurent Monin
8 * This software is released under the GNU General Public License (GNU GPL).
9 * Please read the included file COPYING for more information.
10 * This software comes with no warranty of any kind, use at your own risk!
14 #include "uri_utils.h"
17 #include "ui_fileops.h"
19 gchar **uris_from_pathlist(GList *list)
23 guint num = g_list_length(list);
24 gchar **uris = g_new0(gchar *, num + 1);
29 const gchar *path = work->data;
30 gchar *local_path = path_from_utf8(path);
31 uris[i] = g_filename_to_uri(local_path, NULL, NULL);
42 gchar **uris_from_filelist(GList *list)
44 GList *path_list = filelist_to_path_list(list);
45 gchar **ret = uris_from_pathlist(path_list);
46 string_list_free(path_list);
50 gboolean uri_selection_data_set_uris_from_filelist(GtkSelectionData *selection_data, GList *list)
52 gchar **uris = uris_from_filelist(list);
53 gboolean ret = gtk_selection_data_set_uris(selection_data, uris);
56 char *str = g_strjoinv("\r\n", uris);
57 ret = gtk_selection_data_set_text(selection_data, str, -1);
65 GList *uri_pathlist_from_uris(gchar **uris)
72 gchar *local_path = g_filename_from_uri(uris[i], NULL, NULL);
73 gchar *path = path_to_utf8(local_path);
75 list = g_list_prepend(list, path);
79 return g_list_reverse(list);
84 GList *uri_filelist_from_uris(gchar **uris)
86 GList *path_list = uri_pathlist_from_uris(uris);
87 GList *filelist = filelist_from_path_list(path_list);
88 string_list_free(path_list);
92 GList *uri_filelist_from_gtk_selection_data(GtkSelectionData *selection_data)
94 gchar **uris = gtk_selection_data_get_uris(selection_data);
95 GList *ret = uri_filelist_from_uris(uris);
102 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */