Index: panel-menu-items.c
===================================================================
--- panel-menu-items.c	(revision 10778)
+++ panel-menu-items.c	(working copy)
@@ -38,7 +38,7 @@
 #include <string.h>
 #include <glib/gi18n.h>
 
-#include <libgnomevfs/gnome-vfs.h>
+#include <gio/gio.h>
 #include <libgnome/gnome-url.h>
 #include <libgnomeui/gnome-url.h>
 
@@ -71,7 +71,7 @@ struct _PanelPlaceMenuItemPrivate {
 
 	GtkRecentManager *recent_manager;
 
-	GnomeVFSMonitorHandle *bookmarks_monitor;
+	GFileMonitor *bookmarks_monitor;
 
 	gulong       volume_mounted_id;
 	gulong       volume_unmounted_id;
@@ -87,21 +87,36 @@ struct _PanelDesktopMenuItemPrivate {
 	guint        append_lock_logout : 1;
 };
 
-static GnomeVFSVolumeMonitor *volume_monitor = NULL;
+static GVolumeMonitor *volume_monitor = NULL;
 
 static void
 activate_uri (GtkWidget  *menuitem,
 	      const char *path)
 {
 	GError    *error = NULL;
+	GFile     *file;
 	GdkScreen *screen;
-	char      *url;
 	char      *escaped;
+	char      *scheme;
+	char      *url;
 
 	screen = menuitem_to_screen (menuitem);
-
-	url = gnome_vfs_make_uri_from_input_with_dirs (path,
-						       GNOME_VFS_MAKE_URI_DIR_HOMEDIR);
+	
+	scheme = g_uri_get_scheme (path);
+	
+	if (scheme)
+	{
+		url = g_strdup (path);
+	}
+	else
+	{
+		file = g_file_new_for_path (path);
+		url = g_file_get_uri (file);
+		g_object_unref (file);
+	}
+	g_debug ("path: %s;", path);
+	g_debug ("url: %s;", url);
+	
 	if (g_str_has_prefix (url, "x-nautilus-search:")) {
 		//FIXME: this is ugly...
 		char *command;
@@ -157,6 +172,7 @@ panel_menu_items_append_from_desktop (Gt
 	char      *icon;
 	char      *name;
 	char      *comment;
+	GFile     *file;
 
 	path_freeme = NULL;
 
@@ -218,7 +234,10 @@ panel_menu_items_append_from_desktop (Gt
 	g_signal_connect (G_OBJECT (item), "button_press_event",
 			  G_CALLBACK (menu_dummy_button_press_event), NULL);
 
-	uri = gnome_vfs_get_uri_from_local_path (full_path);
+	//uri = g_file_get_uri (g_file_new_for_path (full_path));
+	file = g_file_new_for_path (full_path);
+	uri = g_file_get_uri (file);
+	g_object_unref (file);
 	setup_uri_drag (item, uri, icon);
 	g_free (uri);
 
@@ -342,7 +361,7 @@ panel_place_menu_item_append_gtk_bookmar
 
 	for (i = 0; lines[i]; i++) {
 		if (lines[i][0] && !g_hash_table_lookup (table, lines[i])) {
-			GnomeVFSURI *uri;
+			GFile       *file;
 			char        *space;
 			char        *label;
 			gboolean     keep;
@@ -358,21 +377,20 @@ panel_place_menu_item_append_gtk_bookmar
 			}
 
 			keep = FALSE;
-			uri = NULL;
 
 			if (g_str_has_prefix (lines[i], "x-nautilus-search:") ||
 			    g_str_has_prefix (lines[i], "trash:"))
 				keep = TRUE;
 
 			if (!keep) {
-				uri = gnome_vfs_uri_new (lines[i]);
-				if (uri) {
-					const char *scheme;
+				file = g_file_new_for_uri (lines[i]);
+				if (file) {
+					char *scheme;
 
-					scheme = gnome_vfs_uri_get_scheme (uri);
+					scheme = g_file_get_uri_scheme (file);
 					keep = strcmp (scheme, "file") != 0 ||
-					       gnome_vfs_uri_exists (uri);
-					gnome_vfs_uri_unref (uri);
+					       g_file_query_exists (file, NULL);
+					g_object_unref (file);
 				}
 			}
 
@@ -412,17 +430,20 @@ panel_place_menu_item_append_gtk_bookmar
 	}
 
 	for (l = add_bookmarks; l; l = l->next) {
-		char *display_uri;
+		char *display_name;
 		char *tooltip;
 		char *label;
 		char *icon;
+		GFile *file;
 
 		bookmark = l->data;
-
-		display_uri = gnome_vfs_format_uri_for_display (bookmark->full_uri);
+		
+		file = g_file_new_for_uri (bookmark->full_uri);
+		display_name = g_file_get_parse_name (file);
+		g_object_unref (file);
 		/* Translators: %s is a URI */
-		tooltip = g_strdup_printf (_("Open '%s'"), display_uri);
-		g_free (display_uri);
+		tooltip = g_strdup_printf (_("Open '%s'"), display_name);
+		g_free (display_name);
 
 		label = NULL;
 		if (bookmark->label) {
@@ -475,37 +496,34 @@ panel_place_menu_item_append_volumes (Gt
 				      gboolean   connected_volumes)
 {
 	GtkWidget *add_menu;
-	GList     *volumes, *l;
-	GSList    *add_volumes, *sl;
-
-	volumes = gnome_vfs_volume_monitor_get_mounted_volumes (volume_monitor);
-	add_volumes = NULL;
+	GList     *mounts, *l;
+	GSList    *add_mounts, *sl;
 
-	for (l = volumes; l; l = l->next) {
-		GnomeVFSVolume *volume = l->data;
+    
+	mounts = g_volume_monitor_get_mounts (volume_monitor);
+	add_mounts = NULL;
 
-		if (!gnome_vfs_volume_is_user_visible (volume) ||
-		    !gnome_vfs_volume_is_mounted (volume))
-			continue;
+	/*for (l = mounts; l; l = l->next) {
+		GMount *mount = l->data;
 
 		switch (gnome_vfs_volume_get_volume_type (volume)) {
 		case GNOME_VFS_VOLUME_TYPE_CONNECTED_SERVER:
 			if (connected_volumes)
-				add_volumes = g_slist_prepend (add_volumes,
+				add_mounts = g_slist_prepend (add_mounts,
 							       volume);
 			break;
 		default:
 			if (!connected_volumes)
-				add_volumes = g_slist_prepend (add_volumes,
+				add_mounts = g_slist_prepend (add_mounts,
 							       volume);
 			break;
 		}
-	}
+	}*/
 
-	add_volumes = g_slist_sort (add_volumes,
-				    (GCompareFunc) gnome_vfs_volume_compare);
+	//add_volumes = g_slist_sort (add_volumes,
+	//			    (GCompareFunc) gnome_vfs_volume_compare);
 
-	if (g_slist_length (add_volumes) <= MAX_ITEMS_OR_SUBMENU) {
+	if (g_slist_length (add_mounts) <= MAX_ITEMS_OR_SUBMENU) {
 		add_menu = menu;
 	} else {
 		GtkWidget  *item;
@@ -531,15 +549,17 @@ panel_place_menu_item_append_volumes (Gt
 		gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), add_menu);
 	}
 
-	for (sl = add_volumes; sl; sl = sl->next) {
-		GnomeVFSVolume *volume = sl->data;
+	for (sl = add_mounts; sl; sl = sl->next) {
+		GMount *mount = sl->data;
 		char           *icon;
 		char           *display_name;
 		char           *activation_uri;
 
-		icon           = gnome_vfs_volume_get_icon (volume);
-		display_name   = gnome_vfs_volume_get_display_name (volume);
-		activation_uri = gnome_vfs_volume_get_activation_uri (volume);
+		//icon           = gnome_vfs_volume_get_icon (volume);
+		//icon           = g_mount_get_icon (mount);
+		icon           = PANEL_ICON_REMOVABLE_MEDIA;
+		display_name   = g_mount_get_name (mount);
+		activation_uri = g_file_get_uri (g_mount_get_root (mount));
 
 		panel_menu_items_append_place_item (icon,
 						    display_name,
@@ -553,10 +573,8 @@ panel_place_menu_item_append_volumes (Gt
 		g_free (activation_uri);
 	}
 
-	g_slist_free (add_volumes);
-
-	g_list_foreach (volumes, (GFunc) gnome_vfs_volume_unref, NULL);
-	g_list_free (volumes);
+	g_slist_free (add_mounts);
+	g_list_free (mounts);
 }
 
 
@@ -567,6 +585,7 @@ panel_place_menu_item_create_menu (Panel
 	GtkWidget *item;
 	char      *gconf_name;
 	char      *uri;
+	GFile     *file;
 
 	places_menu = panel_create_menu ();
 
@@ -574,7 +593,10 @@ panel_place_menu_item_create_menu (Panel
 					      HOME_NAME_KEY,
 					      NULL);
 
-	uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
+	file = g_file_new_for_path (g_get_home_dir ());
+	uri = g_file_get_uri (file);
+	g_object_unref (file);
+	
 	panel_menu_items_append_place_item (PANEL_ICON_HOME,
 					    string_empty (gconf_name) ?
 						_("Home Folder") : gconf_name,
@@ -590,7 +612,10 @@ panel_place_menu_item_create_menu (Panel
 	if (!gconf_client_get_bool (panel_gconf_get_client (),
 				    DESKTOP_IS_HOME_DIR_KEY,
 				    NULL)) {
-		uri = gnome_vfs_get_uri_from_local_path (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
+		file = g_file_new_for_path (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
+		uri = g_file_get_uri (file);
+		g_object_unref (file);
+		
 		panel_menu_items_append_place_item (
 				PANEL_ICON_DESKTOP,
 				/* Translators: Desktop is used here as in
@@ -677,18 +702,18 @@ panel_place_menu_item_key_changed (GConf
 }
 
 static void
-panel_place_menu_item_gtk_bookmarks_changed (GnomeVFSMonitorHandle *handle,
-					     const gchar *monitor_uri,
-					     const gchar *info_uri,
-					     GnomeVFSMonitorEventType event_type,
+panel_place_menu_item_gtk_bookmarks_changed (GFileMonitor *handle,
+					     GFile *file,
+					     GFile *other_file,
+					     GFileMonitorEvent event,
 					     gpointer user_data)
 {
 	panel_place_menu_item_recreate_menu (GTK_WIDGET (user_data));
 }
 
 static void
-panel_place_menu_item_volume_changed (GnomeVFSVolumeMonitor *monitor,
-				      GnomeVFSVolume        *volume,
+panel_place_menu_item_volume_changed (GVolumeMonitor *monitor,
+				      GVolume        *volume,
 				      GtkWidget             *place_menu)
 {
 	panel_place_menu_item_recreate_menu (place_menu);
@@ -768,7 +793,7 @@ panel_place_menu_item_finalize (GObject 
 				 NULL);
 
 	if (menuitem->priv->bookmarks_monitor != NULL)
-		gnome_vfs_monitor_cancel (menuitem->priv->bookmarks_monitor);
+		g_file_monitor_cancel (menuitem->priv->bookmarks_monitor);
 	menuitem->priv->bookmarks_monitor = NULL;
 
 	if (menuitem->priv->volume_mounted_id)
@@ -826,24 +851,32 @@ panel_place_menu_item_init (PanelPlaceMe
 
 	bookmarks_filename = g_build_filename (g_get_home_dir (),
 					       BOOKMARKS_FILENAME, NULL);
-	bookmarks_uri = gnome_vfs_get_uri_from_local_path (bookmarks_filename);
+	GFile *bookmark;
+	bookmark = g_file_new_for_path (bookmarks_filename);
+	bookmarks_uri = g_file_get_uri (bookmark);
 
 	if (bookmarks_uri) {
-		GnomeVFSResult result;
+		GError *error = NULL;
+		menuitem->priv->bookmarks_monitor = g_file_monitor_file 
+        						(bookmark,
+        						G_FILE_MONITOR_NONE,
+        						NULL,
+        						&error);
+
+		g_signal_connect (G_OBJECT (menuitem->priv->bookmarks_monitor), 
+				"changed", 
+				(GCallback)panel_place_menu_item_gtk_bookmarks_changed,
+				menuitem);
 
-		result = gnome_vfs_monitor_add (&menuitem->priv->bookmarks_monitor,
-						bookmarks_uri,
-						GNOME_VFS_MONITOR_FILE,
-						panel_place_menu_item_gtk_bookmarks_changed,
-						menuitem);
-
-		if (result == GNOME_VFS_ERROR_NOT_SUPPORTED)
-			g_message ("File monitoring not supported in the compiled version of gnome-vfs: bookmarks won't be monitored.");
-		else if (result != GNOME_VFS_OK)
+		if (error != NULL)
+		{
 			g_warning ("Failed to add file monitor for %s: %s\n",
 				   bookmarks_uri,
-				   gnome_vfs_result_to_string (result));
-
+				   error->message);
+			g_error_free (error);
+		}
+		
+		g_object_unref (bookmark);
 		g_free (bookmarks_uri);
 	} else {
 		g_warning ("Could not make URI of ~/"BOOKMARKS_FILENAME);
@@ -852,14 +885,14 @@ panel_place_menu_item_init (PanelPlaceMe
 	g_free (bookmarks_filename);
 
 	if (!volume_monitor)
-		volume_monitor = gnome_vfs_get_volume_monitor ();
+		volume_monitor = g_volume_monitor_get ();
 
 	menuitem->priv->volume_mounted_id = g_signal_connect (volume_monitor,
-							      "volume_mounted",
+							      "volume_added",
 							      G_CALLBACK (panel_place_menu_item_volume_changed),
 							      menuitem);
 	menuitem->priv->volume_unmounted_id = g_signal_connect (volume_monitor,
-							        "volume_unmounted",
+							        "volume_removed",
 							        G_CALLBACK (panel_place_menu_item_volume_changed),
 							        menuitem);
 
