Index: panel-util.c
===================================================================
--- panel-util.c	(revision 10778)
+++ panel-util.c	(working copy)
@@ -27,9 +27,7 @@
 #include <libgnomeui/gnome-icon-lookup.h>
 #include <libgnomeui/gnome-help.h>
 
-#include <libgnomevfs/gnome-vfs-utils.h>
-#include <libgnomevfs/gnome-vfs-uri.h>
-#include <libgnomevfs/gnome-vfs-ops.h>
+#include <gio/gio.h>
 
 #include "applet.h"
 #include "nothing.h"
@@ -524,14 +522,14 @@ panel_ensure_dir (const char *dirname)
 static gboolean
 internal_panel_is_uri_writable (const char *uri, gboolean recurse)
 {
-	GnomeVFSFileInfo *info = gnome_vfs_file_info_new ();
+	GFileInfo *info = g_file_info_new ();
 
-	if (gnome_vfs_get_file_info
+	/*if (gnome_vfs_get_file_info
 	    (uri, info, GNOME_VFS_FILE_INFO_DEFAULT) != GNOME_VFS_OK) {
 		char *dir;
 		gboolean ret;
 
-		gnome_vfs_file_info_unref (info);
+		g_object_unref (info);
 
 		if ( ! recurse)
 			return FALSE;
@@ -541,64 +539,14 @@ internal_panel_is_uri_writable (const ch
 		g_free (dir);
 
 		return ret;
-	}
-
-	if ( ! (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS)) {
-		gnome_vfs_file_info_unref (info);
-		/* assume writable, if no permissions */
-		return TRUE;
-	} 
+	}*/
 
-	if (info->permissions & GNOME_VFS_PERM_OTHER_WRITE) {
-		gnome_vfs_file_info_unref (info);
+	if (!g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE)) {
+		g_object_unref (info);
 		return TRUE;
 	}
-
-	if (info->gid == getgid () &&
-	    info->permissions & GNOME_VFS_PERM_GROUP_WRITE) {
-		gnome_vfs_file_info_unref (info);
-		return TRUE;
-	}
-
-	if (info->uid == getuid () &&
-	    info->permissions & GNOME_VFS_PERM_USER_WRITE) {
-		gnome_vfs_file_info_unref (info);
-		return TRUE;
-	}
-
-	if (info->gid == getgid () &&
-	    info->permissions & GNOME_VFS_PERM_GROUP_WRITE) {
-		gnome_vfs_file_info_unref (info);
-		return TRUE;
-	}
-
-	if (info->permissions & GNOME_VFS_PERM_GROUP_WRITE) {
-		gid_t *groups;
-		int i, n;
-
-		/* get size */
-		n = getgroups (0, NULL);
-
-		if (n == 0) {
-			/* no more groups */
-			gnome_vfs_file_info_unref (info);
-			return FALSE;
-		}
-
-		groups = g_new0 (gid_t, n);
-
-		n = getgroups (n, groups);
-		for (i = 0; i < n; i++) {
-			if (info->gid == groups[i]) {
-				/* ok */
-				gnome_vfs_file_info_unref (info);
-				return TRUE;
-			}
-		}
-	}
-
-	/* no more perimission stuff to try */
-	gnome_vfs_file_info_unref (info);
+	
+	g_object_unref (info);
 	return FALSE;
 }
 
@@ -613,20 +561,20 @@ panel_is_uri_writable (const char *uri)
 gboolean
 panel_uri_exists (const char *uri)
 {
-	GnomeVFSURI *suri;
+	GFile *suri;
 	gboolean ret;
 
 	g_return_val_if_fail (uri != NULL, FALSE);
 
-	suri = gnome_vfs_uri_new (uri);
+	suri = g_file_new_for_uri (uri);
 
 	if (!suri) {
 		return FALSE;
 	}
 
-	ret = gnome_vfs_uri_exists (suri);
+	ret = g_file_query_exists (suri, NULL);
 
-	gnome_vfs_uri_unref (suri);
+	g_object_unref (suri);
 
 	return ret;
 }
@@ -940,7 +888,7 @@ panel_make_unique_desktop_uri (const cha
 	path = panel_make_unique_desktop_path_from_name (dir, name);
 	g_free (name);
 
-	uri = gnome_vfs_get_uri_from_local_path (path);
+	uri = g_filename_to_uri (path, NULL, NULL);
 	g_free (path);
 
 	return uri;
@@ -1170,7 +1118,7 @@ panel_util_key_file_load_from_uri (GKeyF
 	g_return_val_if_fail (uri != NULL, FALSE);
 	g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-	scheme = gnome_vfs_get_uri_scheme (uri);
+	scheme = g_uri_get_scheme (uri);
 	is_local = (scheme == NULL) || !g_ascii_strcasecmp (scheme, "file");
 	g_free (scheme);
 
@@ -1185,17 +1133,24 @@ panel_util_key_file_load_from_uri (GKeyF
 						    flags, error);
 		g_free (path);
 	} else {
-		GnomeVFSResult  vfs_result;
-		int             size;
-		char           *contents;
+		GFile   *file;
+		char	*contents;
+		char    *etag;
+		gsize    size;
+		gboolean ret;
 
-		vfs_result = gnome_vfs_read_entire_file (uri, &size, &contents);
-		if (vfs_result != GNOME_VFS_OK)
+		file = g_file_new_for_uri (uri);
+		ret = g_file_load_contents (file, NULL, &contents, &size,
+					&etag, NULL);
+		g_object_unref (file);
+		g_free (etag);
+		
+		if (!ret)
 			return FALSE;
 
 		result = g_key_file_load_from_data (keyfile, contents, size,
 						    flags, error);
-
+		
 		g_free (contents);
 	}
 
@@ -1417,9 +1372,13 @@ panel_util_get_icon_for_uri_known_folder
 	const char *icon;
 	char       *path;
 	int         len;
+	GFile      *file;
 
 	icon = NULL;
-	path = gnome_vfs_get_local_path_from_uri (uri);
+	
+	file = g_file_new_for_uri (uri);
+	path = g_file_get_path (file);
+	g_object_unref (file);
 
 	len = strlen (path);
 	if (path[len] == '/')
@@ -1441,8 +1400,8 @@ panel_util_get_icon_for_uri_known_folder
 char *
 panel_util_get_label_for_uri (const char *text_uri)
 {
-	GnomeVFSURI *uri;
-	const char  *hostname;
+	GFile       *file;
+	char        *hostname;
 	const char  *method;
 	char        *displayname;
 	char        *label;
@@ -1460,7 +1419,10 @@ panel_util_get_label_for_uri (const char
 		return g_strdup (_("Trash"));
 
 	if (g_str_has_prefix (text_uri, "file:")) {
-		buffer = gnome_vfs_get_local_path_from_uri (text_uri);
+		file = g_file_new_for_uri (text_uri);
+		buffer = g_file_get_path (file);
+		g_object_unref (file);
+		
 		if (!buffer)
 			return NULL;
 
@@ -1470,30 +1432,27 @@ panel_util_get_label_for_uri (const char
 		return label;
 	}
 
-	uri = gnome_vfs_uri_new (text_uri);
-	if (uri) {
+	file = g_file_new_for_uri (text_uri);
+	if (file) {
 		char *short_name;
 
-		hostname = gnome_vfs_uri_get_host_name (uri);
-
-		buffer = gnome_vfs_uri_extract_short_path_name (uri);
-		short_name = gnome_vfs_unescape_string_for_display (buffer);
-		g_free (buffer);
+		g_filename_from_uri (text_uri, &hostname, NULL);
+		short_name = g_file_get_basename (file);
 
-		if (strcmp (short_name, GNOME_VFS_URI_PATH_STR) != 0) {
+		if (strcmp (short_name, G_DIR_SEPARATOR_S) != 0) {
 			displayname = short_name;
 		} else {
 			g_free (short_name);
-			method = panel_util_get_vfs_method_display_name (uri->method_string);
+			method = panel_util_get_vfs_method_display_name (g_file_get_uri_scheme (file));
 			if (method == NULL)
-				method = uri->method_string;
+				method = g_file_get_uri_scheme (file);
 
-			buffer = gnome_vfs_uri_extract_short_name (uri);
-			short_name = gnome_vfs_unescape_string_for_display (buffer);
+			buffer = g_file_get_basename (file);
+			short_name = g_file_get_parse_name (file);
 			g_free (buffer);
 
 			if (short_name == NULL ||
-			    strcmp (short_name, GNOME_VFS_URI_PATH_STR) == 0) {
+			    strcmp (short_name, G_DIR_SEPARATOR_S) == 0) {
 				displayname = g_strdup (method);
 			} else {
 				displayname = g_strdup_printf ("%s: %s",
@@ -1503,7 +1462,7 @@ panel_util_get_label_for_uri (const char
 			g_free (short_name);
 		}
 	} else {
-		displayname = gnome_vfs_format_uri_for_display (text_uri);
+		displayname = g_file_get_parse_name (file);
 	}
 
 	if (hostname) {
@@ -1516,9 +1475,11 @@ panel_util_get_label_for_uri (const char
 		label = displayname;
 	}
 
-	if (uri)
-		gnome_vfs_uri_unref (uri);
+	if (file)
+		g_object_unref (file);
 
+	g_free (hostname);
+	
 	return label;
 }
 
