1
/* vi:set et ai sw=2 sts=2 ts=2: */
3
* Copyright (c) 2009 Jannis Pohlmann <jannis@xfce.org>
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Library General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU Library General Public License for more details.
15
* You should have received a copy of the GNU Library General
16
* Public License along with this library; if not, write to the
17
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
* Boston, MA 02110-1301, USA.
28
#include <tumbler/tumbler-util.h>
33
tumbler_util_get_supported_uri_schemes (void)
35
const gchar *const *vfs_schemes;
37
gboolean file_scheme_found = FALSE;
42
/* determine the URI schemes supported by GIO */
43
vfs = g_vfs_get_default ();
44
vfs_schemes = g_vfs_get_supported_uri_schemes (vfs);
46
/* search for the "file" scheme */
47
for (n = 0; !file_scheme_found && vfs_schemes[n] != NULL; ++n)
48
if (g_strcmp0 (vfs_schemes[n], "file") == 0)
49
file_scheme_found = TRUE;
51
/* check if the "file" scheme is included */
52
if (file_scheme_found)
54
/* it is, so simply copy the array */
55
uri_schemes = g_strdupv ((GStrv) vfs_schemes);
59
/* it is not, so we need to copy the array and add "file" */
60
length = g_strv_length ((GStrv) vfs_schemes);
61
uri_schemes = g_new0 (gchar *, length + 2);
62
uri_schemes[0] = g_strdup ("file");
63
for (n = 1; n <= length; ++n)
64
uri_schemes[n] = g_strdup (vfs_schemes[n-1]);
65
uri_schemes[n] = NULL;