gtk+ r22154 - in trunk: . gtk
- From: federico svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r22154 - in trunk: . gtk
- Date: Wed, 21 Jan 2009 03:16:13 +0000 (UTC)
Author: federico
Date: Wed Jan 21 03:16:13 2009
New Revision: 22154
URL: http://svn.gnome.org/viewvc/gtk+?rev=22154&view=rev
Log:
bgo545980 - parse URIs in GtkFileChooserEntry
2009-01-15 Federico Mena Quintero <federico novell com>
http://bugzilla.gnome.org/show_bug.cgi?id=545980 -
GtkFileChooserEntry should handle URIs
* gtk/gtkfilesystem.c (_gtk_file_system_parse): Detect URI schemes
and parse the full URI.
(has_uri_scheme): New function, stolen from the old
gtkfilesystemgnomevfs.c.
Signed-off-by: Federico Mena Quintero <federico novell com>
Modified:
trunk/ChangeLog
trunk/gtk/gtkfilesystem.c
Modified: trunk/gtk/gtkfilesystem.c
==============================================================================
--- trunk/gtk/gtkfilesystem.c (original)
+++ trunk/gtk/gtkfilesystem.c Wed Jan 21 03:16:13 2009
@@ -637,6 +637,29 @@
return g_slist_reverse (files);
}
+static gboolean
+is_valid_scheme_character (char c)
+{
+ return g_ascii_isalnum (c) || c == '+' || c == '-' || c == '.';
+}
+
+static gboolean
+has_uri_scheme (const char *str)
+{
+ const char *p;
+
+ p = str;
+
+ if (!is_valid_scheme_character (*p))
+ return FALSE;
+
+ do
+ p++;
+ while (is_valid_scheme_character (*p));
+
+ return (strncmp (p, "://", 3) == 0);
+}
+
gboolean
_gtk_file_system_parse (GtkFileSystem *file_system,
GFile *base_file,
@@ -657,7 +680,7 @@
last_slash = strrchr (str, G_DIR_SEPARATOR);
- if (str[0] == '~')
+ if (str[0] == '~' || g_path_is_absolute (str) || has_uri_scheme (str))
file = g_file_parse_name (str);
else
file = g_file_resolve_relative_path (base_file, str);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]