aboutsummaryrefslogtreecommitdiff
path: root/libsylph/utils.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-10-26 07:31:09 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-10-26 07:31:09 +0000
commit3a222b6d435f8720c2c0fa9932862c0e6434b0c2 (patch)
tree059b185d206a6f9b366266d36eb106c84f4abd32 /libsylph/utils.c
parent90752d79a7241e0be1798a0ccfacc3e3fa1db952 (diff)
use GLib functions to extract URIs if available.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@687 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/utils.c')
-rw-r--r--libsylph/utils.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/libsylph/utils.c b/libsylph/utils.c
index 80b6545c..95bc237f 100644
--- a/libsylph/utils.c
+++ b/libsylph/utils.c
@@ -1449,9 +1449,27 @@ gchar *trim_string_before(const gchar *str, gint len)
GList *uri_list_extract_filenames(const gchar *uri_list)
{
GList *result = NULL;
- const gchar *p, *q;
gchar *file;
+#if GLIB_CHECK_VERSION(2, 6, 0)
+ gchar **uris;
+ gint i;
+
+ uris = g_uri_list_extract_uris(uri_list);
+ g_return_val_if_fail(uris != NULL, NULL);
+
+ for (i = 0; uris[i] != NULL; i++) {
+ file = g_filename_from_uri(uris[i], NULL, NULL);
+ if (file)
+ result = g_list_append(result, file);
+ }
+
+ g_strfreev(uris);
+
+ return result;
+#else
+ const gchar *p, *q;
+
p = uri_list;
while (p) {
@@ -1471,7 +1489,7 @@ GList *uri_list_extract_filenames(const gchar *uri_list)
strncpy(file, p, q - p + 1);
file[q - p + 1] = '\0';
decode_uri(file, file);
- result = g_list_append(result,file);
+ result = g_list_append(result, file);
}
}
}
@@ -1480,6 +1498,7 @@ GList *uri_list_extract_filenames(const gchar *uri_list)
}
return result;
+#endif
}
#define HEX_TO_INT(val, hex) \