gnome-main-menu r489 - in trunk: . libslab main-menu/src



Author: cosimoc
Date: Fri Aug 22 09:48:27 2008
New Revision: 489
URL: http://svn.gnome.org/viewvc/gnome-main-menu?rev=489&view=rev

Log:
2008-08-22  Cosimo Cecchi  <cosimoc gnome org>

	* configure.in:
	* main-menu/src/main-menu-ui.c: (main_menu_ui_new),
	(main_menu_ui_finalize), (create_rct_docs_section),
	(recently_used_store_monitor_changed_cb),
	(setup_recently_used_store_monitor), (item_to_recent_doc_tile),
	(doc_uri_to_item), (update_recently_used_sections),
	(volume_monitor_mount_cb):
	Port to GIO and drop gnome-vfs dependency (#527903).


Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/libslab/ChangeLog
   trunk/libslab/Makefile.am
   trunk/libslab/app-shell.c
   trunk/libslab/bookmark-agent.c
   trunk/libslab/directory-tile.c
   trunk/libslab/document-tile.c
   trunk/libslab/recent-files.c
   trunk/libslab/slab-gnome-util.c
   trunk/main-menu/src/main-menu-ui.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Fri Aug 22 09:48:27 2008
@@ -42,7 +42,10 @@
 dnl ==============================================
 AM_PATH_GLIB_2_0(2.8.0,,,gobject)
 
-COMMON_MODULES="glib-2.0 gobject-2.0 gtk+-2.0 gdk-2.0"
+COMMON_MODULES="glib-2.0 >= 2.12.0 \
+		gobject-2.0 \
+		gtk+-2.0 >= 2.13.3 \
+		gdk-2.0 gio-2.0"
 
 PKG_CHECK_MODULES(GLADE, libglade-2.0)
 AC_SUBST(GLADE_CFLAGS)
@@ -152,9 +155,8 @@
 if test "x$ENABLE_NAUTILUS_EXTENSION" = "x1"
 then
 	NAUTILUS_REQUIRED=2.6.0
-	GNOME_VFS_REQUIRED=2.12.0
 
-	PKG_CHECK_MODULES(NAUTILUS, [libnautilus-extension >= $NAUTILUS_REQUIRED glib-2.0 gobject-2.0 gconf-2.0 gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED])
+	PKG_CHECK_MODULES(NAUTILUS, [libnautilus-extension >= $NAUTILUS_REQUIRED glib-2.0 gobject-2.0 gconf-2.0])
 
 	AC_SUBST(NAUTILUS_CFLAGS)
 	AC_SUBST(NAUTILUS_LIBS)

Modified: trunk/libslab/Makefile.am
==============================================================================
--- trunk/libslab/Makefile.am	(original)
+++ trunk/libslab/Makefile.am	Fri Aug 22 09:48:27 2008
@@ -37,18 +37,11 @@
 	app-shell-startup.c			\
 	application-tile.c			\
 	bookmark-agent.h			\
-	bookmark-agent-libslab.h		\
 	bookmark-agent.c			\
 	directory-tile.c			\
 	document-tile.c				\
 	double-click-detector.c			\
 	double-click-detector.h			\
-	libslab-bookmarkfile.c			\
-	libslab-bookmarkfile.h			\
-	egg-recent-item.c			\
-	egg-recent-item.h			\
-	egg-recent-model.c			\
-	egg-recent-model.h			\
 	gnome-utils.c				\
 	libslab-utils.c				\
 	libslab-utils.h				\

Modified: trunk/libslab/app-shell.c
==============================================================================
--- trunk/libslab/app-shell.c	(original)
+++ trunk/libslab/app-shell.c	Fri Aug 22 09:48:27 2008
@@ -24,7 +24,7 @@
 
 #include <libgnome/gnome-desktop-item.h>
 #include <libgnomeui/libgnomeui.h>
-#include <libgnomevfs/gnome-vfs-ops.h>
+#include <gio/gio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -1137,7 +1137,8 @@
 			const gchar *uri = gnome_desktop_item_get_location (item);
 			if (!g_hash_table_lookup (all_apps_cache, uri))
 			{
-				GnomeVFSFileInfo *info;
+				GFile *file;
+				GFileInfo *info;
 				long filetime;
 
 				if (g_hash_table_lookup (new_apps_dups, uri))
@@ -1163,17 +1164,21 @@
 					got_new_apps = TRUE;
 				}
 
-				info = gnome_vfs_file_info_new ();
-				if (gnome_vfs_get_file_info (uri, info,
-						GNOME_VFS_FILE_INFO_DEFAULT) != GNOME_VFS_OK
-					|| !(info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MTIME))
+				file = g_file_new_for_uri (uri);
+				info = g_file_query_info (file,
+							  G_FILE_ATTRIBUTE_TIME_MODIFIED,
+							  0, NULL, NULL);
+
+				if (!info)
 				{
-					gnome_vfs_file_info_unref (info);
+					g_object_unref (file);
 					g_warning ("Cant get vfs info for %s\n", uri);
 					return;
 				}
-				filetime = info->mtime;
-				gnome_vfs_file_info_unref (info);
+				filetime = (long) g_file_info_get_attribute_uint64 (info,
+										    G_FILE_ATTRIBUTE_TIME_MODIFIED);
+				g_object_unref (info);
+				g_object_unref (file);
 
 				for (x = 0; x < app_data->new_apps->max_items; x++)
 				{

Modified: trunk/libslab/bookmark-agent.c
==============================================================================
--- trunk/libslab/bookmark-agent.c	(original)
+++ trunk/libslab/bookmark-agent.c	Fri Aug 22 09:48:27 2008
@@ -26,24 +26,13 @@
 #	define PACKAGE "gnome-main-menu"
 #endif
 
-#if ! GLIB_CHECK_VERSION (2, 12, 0)
-#	include "bookmark-agent-libslab.h"
-#endif
-
-#include <gtk/gtkversion.h>
-#if GTK_CHECK_VERSION (2, 10, 0)
-#	define USE_GTK_RECENT_MANAGER
-#	include <gtk/gtkrecentmanager.h>
-#else
-#	define EGG_ENABLE_RECENT_FILES
-#	include "egg-recent-model.h"
-#endif
+#include <gtk/gtk.h>
 
 #include <string.h>
 #include <stdlib.h>
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
-#include <libgnomevfs/gnome-vfs.h>
+#include <gio/gio.h>
 
 #include "libslab-utils.h"
 
@@ -80,8 +69,8 @@
 	const gchar             *store_filename;
 	const gchar             *lockdown_key;
 
-	GnomeVFSMonitorHandle   *store_monitor;
-	GnomeVFSMonitorHandle   *user_store_monitor;
+	GFileMonitor            *store_monitor;
+	GFileMonitor            *user_store_monitor;
 	guint                    gconf_monitor;
 
 	void                  (* update_path) (BookmarkAgent *);
@@ -90,7 +79,7 @@
 	void                  (* create_item) (BookmarkAgent *, const gchar *);
 
 	gchar                   *gtk_store_path;
-	GnomeVFSMonitorHandle   *gtk_store_monitor;
+	GFileMonitor            *gtk_store_monitor;
 } BookmarkAgentPrivate;
 
 #define PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BOOKMARK_AGENT_TYPE, BookmarkAgentPrivate))
@@ -128,14 +117,12 @@
 static void create_doc_item          (BookmarkAgent *, const gchar *);
 static void create_dir_item          (BookmarkAgent *, const gchar *);
 
-static void store_monitor_cb (GnomeVFSMonitorHandle *, const gchar *, const gchar *,
-                              GnomeVFSMonitorEventType, gpointer);
+static void store_monitor_cb (GFileMonitor *, GFile *, GFile *,
+                              GFileMonitorEvent, gpointer);
 static void gconf_notify_cb  (GConfClient *, guint, GConfEntry *, gpointer);
 static void weak_destroy_cb  (gpointer, GObject *);
 
-#ifdef USE_GTK_RECENT_MANAGER
 static gint recent_item_mru_comp_func (gconstpointer a, gconstpointer b);
-#endif
 
 static gchar *find_package_data_file (const gchar *filename);
 
@@ -218,17 +205,11 @@
 {
 	BookmarkAgentPrivate *priv = PRIVATE (this);
 
-#ifdef USE_GTK_RECENT_MANAGER
 	GError *error = NULL;
-#else
-	EggRecentModel *model;
-#endif
-
 
 	if (! TYPE_IS_RECENT (priv->type))
 		return;
 
-#ifdef USE_GTK_RECENT_MANAGER
 	gtk_recent_manager_move_item (
 		gtk_recent_manager_get_default (), uri, uri_new, & error);
 
@@ -236,14 +217,6 @@
 		libslab_handle_g_error (
 			& error, "%s: unable to update %s with renamed file, [%s] -> [%s].",
 			G_STRFUNC, priv->store_path, uri, uri_new);
-#else
-	model = egg_recent_model_new (EGG_RECENT_MODEL_SORT_NONE);
-
-	egg_recent_model_delete (model, uri);
-	egg_recent_model_add    (model, uri_new);
-
-	g_object_unref (model);
-#endif
 }
 
 void
@@ -253,11 +226,7 @@
 
 	gint rank;
 
-#ifdef USE_GTK_RECENT_MANAGER
 	GError *error = NULL;
-#else
-	EggRecentModel *model;
-#endif
 
 	gchar **uris = NULL;
 	gint    rank_i;
@@ -270,7 +239,6 @@
 		return;
 
 	if (TYPE_IS_RECENT (priv->type)) {
-#ifdef USE_GTK_RECENT_MANAGER
 		gtk_recent_manager_remove_item (
 			gtk_recent_manager_get_default (), uri, & error);
 
@@ -278,11 +246,6 @@
 			libslab_handle_g_error (
 				& error, "%s: unable to remove [%s] from %s.",
 				G_STRFUNC, priv->store_path, uri);
-#else
-		model = egg_recent_model_new (EGG_RECENT_MODEL_SORT_NONE);
-		egg_recent_model_delete (model, uri);
-		g_object_unref (model);
-#endif
 	}
 	else {
 		rank = get_rank (this, uri);
@@ -495,6 +458,7 @@
 {
 	BookmarkAgent        *this;
 	BookmarkAgentPrivate *priv;
+	GFile *gtk_store_file;
 
 	this = g_object_new (BOOKMARK_AGENT_TYPE, NULL);
 	priv = PRIVATE (this);
@@ -528,9 +492,15 @@
 			priv->load_store = load_places_store;
 
 			priv->gtk_store_path = g_build_filename (g_get_home_dir (), GTK_BOOKMARKS_FILE, NULL);
-			gnome_vfs_monitor_add (
-				& priv->gtk_store_monitor, priv->gtk_store_path,
-				GNOME_VFS_MONITOR_FILE, store_monitor_cb, this);
+			gtk_store_file = g_file_new_for_path (priv->gtk_store_path);
+			priv->gtk_store_monitor = g_file_monitor_file (gtk_store_file,
+								       0, NULL, NULL);
+			if (priv->gtk_store_monitor) {
+				g_signal_connect (priv->gtk_store_monitor, "changed",
+						  G_CALLBACK (store_monitor_cb), this);
+			}
+
+			g_object_unref (gtk_store_file);
 
 			break;
 
@@ -539,11 +509,7 @@
 			priv->user_modifiable = TRUE;
 			priv->reorderable     = FALSE;
 
-#ifdef USE_GTK_RECENT_MANAGER
 			priv->store_path = g_build_filename (g_get_home_dir (), ".recently-used.xbel", NULL);
-#else
-			priv->store_path = g_build_filename (g_get_home_dir (), ".recently-used", NULL);
-#endif
 
 			break;
 
@@ -611,6 +577,7 @@
 static void
 finalize (GObject *g_obj)
 {
+	BookmarkAgent *this = BOOKMARK_AGENT (g_obj);
 	BookmarkAgentPrivate *priv = PRIVATE (g_obj);
 
 	gint i;
@@ -624,14 +591,23 @@
 	g_free (priv->user_store_path);
 	g_free (priv->gtk_store_path);
 
-	if (priv->store_monitor)
-		gnome_vfs_monitor_cancel (priv->store_monitor);
-
-	if (priv->user_store_monitor)
-		gnome_vfs_monitor_cancel (priv->user_store_monitor);
-
-	if (priv->gtk_store_monitor)
-		gnome_vfs_monitor_cancel (priv->gtk_store_monitor);
+	if (priv->store_monitor) {
+		g_signal_handlers_disconnect_by_func (priv->store_monitor, store_monitor_cb, this);
+		g_file_monitor_cancel (priv->store_monitor);
+		g_object_unref (priv->store_monitor);
+	}
+
+	if (priv->user_store_monitor) {
+		g_signal_handlers_disconnect_by_func (priv->user_store_monitor, store_monitor_cb, this);
+		g_file_monitor_cancel (priv->user_store_monitor);
+		g_object_unref (priv->user_store_monitor);
+	}
+
+	if (priv->gtk_store_monitor) {
+		g_signal_handlers_disconnect_by_func (priv->gtk_store_monitor, store_monitor_cb, this);
+		g_file_monitor_cancel (priv->gtk_store_monitor);
+		g_object_unref (priv->gtk_store_monitor);
+	}
 
 	libslab_gconf_notify_remove (priv->gconf_monitor);
 
@@ -995,27 +971,48 @@
 		g_object_notify (G_OBJECT (this), BOOKMARK_AGENT_STORE_STATUS_PROP);
 
 		if (priv->user_store_monitor) {
-			gnome_vfs_monitor_cancel (priv->user_store_monitor);
+			g_file_monitor_cancel (priv->user_store_monitor);
+			g_object_unref (priv->user_store_monitor);
 			priv->user_store_monitor = NULL;
 		}
 
-		if (priv->status == BOOKMARK_STORE_DEFAULT)
-			gnome_vfs_monitor_add (
-				& priv->user_store_monitor, priv->user_store_path,
-				GNOME_VFS_MONITOR_FILE, store_monitor_cb, this);
+		if (priv->status == BOOKMARK_STORE_DEFAULT) {
+			GFile *user_store_file;
+
+			user_store_file = g_file_new_for_path (priv->user_store_path);
+			priv->user_store_monitor = g_file_monitor_file (user_store_file,
+									0, NULL, NULL);
+			if (priv->user_store_monitor) {
+				g_signal_connect (priv->user_store_monitor, "changed",
+						  G_CALLBACK (store_monitor_cb), this);
+			}
+
+			g_object_unref (user_store_file);
+		}
 	}
 
 	if (libslab_strcmp (priv->store_path, path)) {
 		g_free (priv->store_path);
 		priv->store_path = path;
 
-		if (priv->store_monitor)
-			gnome_vfs_monitor_cancel (priv->store_monitor);
+		if (priv->store_monitor) {
+			g_file_monitor_cancel (priv->store_monitor);
+			g_object_unref (priv->store_monitor);
+		}
+
+		if (priv->store_path) {
+			GFile *store_file;
+
+			store_file = g_file_new_for_path (priv->store_path);
+			priv->store_monitor = g_file_monitor_file (store_file,
+								   0, NULL, NULL);
+			if (priv->store_monitor) {
+				g_signal_connect (priv->store_monitor, "changed",
+						  G_CALLBACK (store_monitor_cb), this);
+			}
 
-		if (priv->store_path)
-			gnome_vfs_monitor_add (
-				& priv->store_monitor, priv->store_path,
-				GNOME_VFS_MONITOR_FILE, store_monitor_cb, this);
+			g_object_unref (store_file);
+		}
 	}
 	else
 		g_free (path);
@@ -1210,8 +1207,8 @@
 }
 
 static void
-store_monitor_cb (GnomeVFSMonitorHandle *handle, const gchar *monitor_uri,
-                  const gchar *info_uri, GnomeVFSMonitorEventType type, gpointer user_data)
+store_monitor_cb (GFileMonitor *mon, GFile *f1, GFile *f2,
+                  GFileMonitorEvent event_type, gpointer user_data)
 {
 	update_agent (BOOKMARK_AGENT (user_data));
 }
@@ -1240,10 +1237,8 @@
 	instances [GPOINTER_TO_INT (data)] = NULL;
 }
 
-#ifdef USE_GTK_RECENT_MANAGER
 static gint
 recent_item_mru_comp_func (gconstpointer a, gconstpointer b)
 {
 	return ((BookmarkItem *) b)->mtime - ((BookmarkItem *) a)->mtime;
 }
-#endif

Modified: trunk/libslab/directory-tile.c
==============================================================================
--- trunk/libslab/directory-tile.c	(original)
+++ trunk/libslab/directory-tile.c	Fri Aug 22 09:48:27 2008
@@ -23,8 +23,8 @@
 #include <glib/gi18n.h>
 #include <string.h>
 #include <libgnomeui/gnome-icon-lookup.h>
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-#include <libgnomevfs/gnome-vfs.h>
+#include <gio/gio.h>
+#include <gdk/gdk.h>
 #include <unistd.h>
 
 #include "slab-gnome-util.h"
@@ -67,7 +67,7 @@
 	gchar *icon_name;
 	
 	GtkBin *header_bin;
-	GnomeVFSMimeApplication *default_app;
+	GAppInfo *default_app;
 	
 	gboolean image_is_broken;
 	
@@ -121,7 +121,7 @@
 
 	if (! title) {
 		markup = g_path_get_basename (uri);
-		basename = gnome_vfs_unescape_string (markup, NULL);
+		basename = g_uri_unescape_string (markup, NULL);
 		g_free (markup);
 	}
 	else
@@ -262,7 +262,7 @@
 	GConfClient *client;
 
 	if (priv->mime_type)
-		priv->default_app = gnome_vfs_mime_get_default_application (priv->mime_type);
+		priv->default_app = g_app_info_get_default_for_type (priv->mime_type, TRUE);
 	else
 		priv->default_app = NULL;
 
@@ -304,7 +304,7 @@
 	g_free (priv->icon_name);
 	g_free (priv->mime_type);
 
-	gnome_vfs_mime_application_free (priv->default_app);
+	g_object_unref (priv->default_app);
     
 	client = gconf_client_get_default ();
 
@@ -368,41 +368,48 @@
 	DirectoryTile *tile = DIRECTORY_TILE (user_data);
 	DirectoryTilePrivate *priv = DIRECTORY_TILE_GET_PRIVATE (tile);
 
-	GnomeVFSURI *src_uri;
-	GnomeVFSURI *dst_uri;
+	GFile *src_file;
+	GFile *dst_file;
 
 	gchar *dirname;
-	gchar *dst_path;
-	gchar *dst_uri_str;
+	gchar *dst_uri;
+	gchar *src_path;
 
 	GtkWidget *child;
 	GtkWidget *header;
 
-	GnomeVFSResult retval;
-
+	gboolean res;
+	GError *error = NULL;
 
 	if (strlen (gtk_entry_get_text (entry)) < 1)
 		return;
 
-	src_uri = gnome_vfs_uri_new (TILE (tile)->uri);
-
-	dirname = gnome_vfs_uri_extract_dirname (src_uri);
+	src_file = g_file_new_for_uri (TILE (tile)->uri);
 
-	dst_path = g_build_filename (dirname, gtk_entry_get_text (entry), NULL);
+	src_path = g_filename_from_uri (TILE (tile)->uri, NULL, NULL);
+	dirname = g_path_get_dirname (src_path);
+	dst_uri = g_build_filename (dirname, gtk_entry_get_text (entry), NULL);
+	dst_file = g_file_new_for_uri (dst_uri);
 
-	dst_uri = gnome_vfs_uri_new (dst_path);
-
-	retval = gnome_vfs_xfer_uri (src_uri, dst_uri, GNOME_VFS_XFER_REMOVESOURCE,
-		GNOME_VFS_XFER_ERROR_MODE_ABORT, GNOME_VFS_XFER_OVERWRITE_MODE_SKIP, NULL, NULL);
+	g_free (dirname);
+	g_free (src_path);
 
-	dst_uri_str = gnome_vfs_uri_to_string (dst_uri, GNOME_VFS_URI_HIDE_NONE);
+	res = g_file_move (src_file, dst_file,
+			   G_FILE_COPY_NONE, NULL, NULL, NULL, &error);
 
-	if (retval == GNOME_VFS_OK) {
+	if (res) {
 		g_free (priv->basename);
 		priv->basename = g_strdup (gtk_entry_get_text (entry));
 	}
-	else
-		g_warning ("unable to move [%s] to [%s]\n", TILE (tile)->uri, dst_uri_str);
+	else {
+		g_warning ("unable to move [%s] to [%s]: %s\n", TILE (tile)->uri, dst_uri,
+			   error->message);
+		g_error_free (error);
+	}
+
+	g_free (dst_uri);
+	g_object_unref (src_file);
+	g_object_unref (dst_file);
 
 	header = gtk_label_new (priv->basename);
 	gtk_misc_set_alignment (GTK_MISC (header), 0.0, 0.5);
@@ -415,13 +422,6 @@
 	gtk_container_add (GTK_CONTAINER (priv->header_bin), header);
 
 	gtk_widget_show (header);
-
-	gnome_vfs_uri_unref (src_uri);
-	gnome_vfs_uri_unref (dst_uri);
-
-	g_free (dirname);
-	g_free (dst_path);
-	g_free (dst_uri_str);
 }
 
 static gboolean
@@ -501,53 +501,20 @@
 static void
 move_to_trash_trigger (Tile *tile, TileEvent *event, TileAction *action)
 {
-	GnomeVFSURI *src_uri;
-	GnomeVFSURI *trash_uri;
-
-	gchar *file_name;
-	gchar *trash_uri_str;
-
-	GnomeVFSResult retval;
-
-
-	src_uri = gnome_vfs_uri_new (TILE (tile)->uri);
-
-	gnome_vfs_find_directory (src_uri, GNOME_VFS_DIRECTORY_KIND_TRASH, &trash_uri,
-		FALSE, FALSE, 0777);
-
-	if (!trash_uri) {
-		g_warning ("unable to find trash location\n");
-
-		return;
-	}
-
-	file_name = gnome_vfs_uri_extract_short_name (src_uri);
-
-	if (!file_name) {
-		g_warning ("unable to extract short name from [%s]\n",
-			gnome_vfs_uri_to_string (src_uri, GNOME_VFS_URI_HIDE_NONE));
-
-		return;
-	}
-
-	trash_uri = gnome_vfs_uri_append_file_name (trash_uri, file_name);
-
-	retval = gnome_vfs_xfer_uri (src_uri, trash_uri, GNOME_VFS_XFER_REMOVESOURCE,
-		GNOME_VFS_XFER_ERROR_MODE_ABORT, GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE, NULL, NULL);
-
-	if (retval != GNOME_VFS_OK) {
-		trash_uri_str = gnome_vfs_uri_to_string (trash_uri, GNOME_VFS_URI_HIDE_NONE);
+	GFile *src_file;
+	gboolean res;
+	GError *error = NULL;
 
-		g_warning ("unable to move [%s] to the trash [%s]\n", TILE (tile)->uri,
-			trash_uri_str);
+	src_file = g_file_new_for_uri (TILE (tile)->uri);
 
-		g_free (trash_uri_str);
+	res = g_file_trash (src_file, NULL, &error);
+	if (!res) {
+		g_warning ("unable to move [%s] to the trash: %s\n", TILE (tile)->uri,
+			   error->message);
+		g_error_free (error);
 	}
 
-	gnome_vfs_uri_unref (src_uri);
-	gnome_vfs_uri_unref (trash_uri);
-
-	g_free (file_name);
+	g_object_unref (src_file);
 }
 
 static void
@@ -556,11 +523,9 @@
 	GtkDialog *confirm_dialog;
 	gint       result;
 
-	GnomeVFSURI *src_uri;
-	GList *list = NULL;
-
-	GnomeVFSResult retval;
-
+	GFile *src_file;
+	gboolean res;
+	GError *error = NULL;
 
 	if (GPOINTER_TO_INT (libslab_get_gconf_value (GCONF_CONFIRM_DELETE_KEY))) {
 		confirm_dialog = GTK_DIALOG(gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_WARNING, 
@@ -579,18 +544,17 @@
 			return;
 	}
 
-	src_uri = gnome_vfs_uri_new (TILE (tile)->uri);
+	src_file = g_file_new_for_uri (TILE (tile)->uri);
 
-	list = g_list_append (list, src_uri);
+	res = g_file_delete (src_file, NULL, &error);
 
-	retval = gnome_vfs_xfer_delete_list (list, GNOME_VFS_XFER_ERROR_MODE_ABORT,
-		GNOME_VFS_XFER_REMOVESOURCE, NULL, NULL);
-
-	if (retval != GNOME_VFS_OK)
-		g_warning ("unable to delete [%s]\n", TILE (tile)->uri);
+	if (!res) {
+		g_warning ("unable to delete [%s]: %s\n", TILE (tile)->uri,
+			   error->message);
+		g_error_free (error);
+	}
 
-	gnome_vfs_uri_unref (src_uri);
-	g_list_free (list);
+	g_object_unref (src_file);
 }
 
 static void
@@ -667,20 +631,33 @@
 {
 	DirectoryTilePrivate *priv = DIRECTORY_TILE_GET_PRIVATE (tile);
 	GList *uris = NULL;
-	GnomeVFSResult retval;
+	gboolean res;
+	GdkAppLaunchContext *launch_context;
+	GError *error = NULL;
 
 	if (priv->default_app)
 	{
 		uris = g_list_append (uris, TILE (tile)->uri);
+		
+		launch_context = gdk_app_launch_context_new ();
+		gdk_app_launch_context_set_screen (launch_context,
+						   gtk_widget_get_screen (GTK_WIDGET (tile)));
+		gdk_app_launch_context_set_timestamp (launch_context,
+						      event->time);
+
+		res = g_app_info_launch_uris (priv->default_app, uris,
+					      G_APP_LAUNCH_CONTEXT (launch_context),
+					      &error);
 
-		retval = gnome_vfs_mime_application_launch (priv->default_app, uris);
-
-		if (retval != GNOME_VFS_OK)
+		if (!res) {
 			g_warning
-				("error: could not launch application with [%s].  GnomeVFSResult = %d\n",
-				TILE (tile)->uri, retval);
+				("error: could not launch application with [%s]: %s\n",
+				 TILE (tile)->uri, error->message);
+			g_error_free (error);
+		}
 
 		g_list_free (uris);
+		g_object_unref (launch_context);
 	} else {
 		gchar *cmd;
 		cmd = string_replace_once (

Modified: trunk/libslab/document-tile.c
==============================================================================
--- trunk/libslab/document-tile.c	(original)
+++ trunk/libslab/document-tile.c	Fri Aug 22 09:48:27 2008
@@ -23,12 +23,7 @@
 #include <glib/gi18n.h>
 #include <string.h>
 #include <libgnomeui/gnome-icon-lookup.h>
-#include <libgnomevfs/gnome-vfs-ops.h>
-#include <libgnomevfs/gnome-vfs-uri.h>
-#include <libgnomevfs/gnome-vfs-xfer.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-#include <libgnomevfs/gnome-vfs-find-directory.h>
+#include <gio/gio.h>
 
 #include "slab-gnome-util.h"
 #include "gnome-utils.h"
@@ -77,7 +72,7 @@
 	gchar *mime_type;
 	time_t modified;
 
-	GnomeVFSMimeApplication *default_app;
+	GAppInfo *default_app;
 
 	GtkBin *header_bin;
 
@@ -155,7 +150,7 @@
 	image = gtk_image_new ();
 
 	markup = g_path_get_basename (uri);
-	basename = gnome_vfs_unescape_string (markup, NULL);
+	basename = g_uri_unescape_string (markup, NULL);
 	g_free (markup);
 
 	header = create_header (basename);
@@ -199,7 +194,7 @@
 
 	if (priv->default_app) {
 		markup = g_markup_printf_escaped (_("<b>Open with \"%s\"</b>"),
-			priv->default_app->name);
+						    g_app_info_get_name (priv->default_app));
 		action = tile_action_new (TILE (this), open_with_default_trigger, markup,
 			TILE_ACTION_OPENS_NEW_WINDOW);
 		g_free (markup);
@@ -324,23 +319,16 @@
 {
 	DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (this);
 
-	GnomeVFSResult result;
-	GnomeVFSFileInfo *info;
+	GFile *file;
+	GAppInfo *app;
 
 	GConfClient *client;
 
+	file = g_file_new_for_uri (TILE (this)->uri);
+	app = g_file_query_default_handler (file, NULL, NULL);
+	priv->default_app = app;
 
-	info = gnome_vfs_file_info_new ();
-
-	result = gnome_vfs_get_file_info (TILE (this)->uri, info,
-		GNOME_VFS_FILE_INFO_GET_MIME_TYPE | GNOME_VFS_FILE_INFO_FORCE_FAST_MIME_TYPE);
-
-	if (result == GNOME_VFS_OK)
-		priv->default_app = gnome_vfs_mime_get_default_application (priv->mime_type);
-	else
-		priv->default_app = NULL;
-
-	gnome_vfs_file_info_unref (info);
+	g_object_unref (file);
 
 	priv->delete_enabled =
 		(gboolean) GPOINTER_TO_INT (get_gconf_value (GCONF_ENABLE_DELETE_KEY));
@@ -395,7 +383,7 @@
 	g_free (priv->mime_type);
 	g_free (priv->force_icon_name);
 
-	gnome_vfs_mime_application_free (priv->default_app);
+	g_object_unref (priv->default_app);
 
 	if (priv->notify_signal_id)
 		g_signal_handler_disconnect (priv->agent, priv->notify_signal_id);
@@ -750,43 +738,46 @@
 	DocumentTile *tile = DOCUMENT_TILE (user_data);
 	DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
 
-	GnomeVFSURI *src_uri;
-	GnomeVFSURI *dst_uri;
+	GFile *src_file;
+	GFile *dst_file;
 
-	gchar *dirname;
-	gchar *dst_path;
-	gchar *dst_uri_str;
+	char *src_path;
+	char *dirname;
+	char *dst_path;
+
+	gboolean res;
+	GError *error = NULL;
 
 	GtkWidget *child;
 	GtkWidget *header;
 
-	GnomeVFSResult retval;
-
-
 	if (strlen (gtk_entry_get_text (entry)) < 1)
 		return;
 
-	src_uri = gnome_vfs_uri_new (TILE (tile)->uri);
-
-	dirname = gnome_vfs_uri_extract_dirname (src_uri);
+	src_file = g_file_new_for_uri (TILE (tile)->uri);
 
+	src_path = g_filename_from_uri (TILE (tile)->uri, NULL, NULL);
+	dirname = g_path_get_dirname (src_path);
 	dst_path = g_build_filename (dirname, gtk_entry_get_text (entry), NULL);
+	dst_file = g_file_new_for_path (dst_path);
 
-	dst_uri = gnome_vfs_uri_new (dst_path);
-
-	retval = gnome_vfs_xfer_uri (src_uri, dst_uri, GNOME_VFS_XFER_REMOVESOURCE,
-		GNOME_VFS_XFER_ERROR_MODE_ABORT, GNOME_VFS_XFER_OVERWRITE_MODE_SKIP, NULL, NULL);
-
-	dst_uri_str = gnome_vfs_uri_to_string (dst_uri, GNOME_VFS_URI_HIDE_NONE);
+	res = g_file_move (src_file, dst_file, 0, NULL, NULL, NULL, &error);
+	
+	if (res) {
+		char *dst_uri;
 
-	if (retval == GNOME_VFS_OK) {
-		bookmark_agent_move_item (priv->agent, TILE (tile)->uri, dst_uri_str);
+		dst_uri = g_file_get_uri (dst_file);
+		bookmark_agent_move_item (priv->agent, TILE (tile)->uri, dst_uri);
+		g_free (dst_uri);
 
 		g_free (priv->basename);
 		priv->basename = g_strdup (gtk_entry_get_text (entry));
 	}
-	else
-		g_warning ("unable to move [%s] to [%s]\n", TILE (tile)->uri, dst_uri_str);
+	else {
+		g_warning ("unable to move [%s] to [%s]: %s\n", TILE (tile)->uri,
+			   dst_path, error->message);
+		g_error_free (error);
+	}
 
 	header = gtk_label_new (priv->basename);
 	gtk_misc_set_alignment (GTK_MISC (header), 0.0, 0.5);
@@ -800,12 +791,12 @@
 
 	gtk_widget_show (header);
 
-	gnome_vfs_uri_unref (src_uri);
-	gnome_vfs_uri_unref (dst_uri);
+	g_object_unref (src_file);
+	g_object_unref (dst_file);
 
 	g_free (dirname);
 	g_free (dst_path);
-	g_free (dst_uri_str);
+	g_free (src_path);
 }
 
 static gboolean
@@ -859,21 +850,31 @@
 	DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
 
 	GList *uris = NULL;
-
-	GnomeVFSResult retval;
+	gboolean res;
+	GdkAppLaunchContext *launch_context;
+	GError *error = NULL;
 
 	if (priv->default_app)
 	{
 		uris = g_list_append (uris, TILE (tile)->uri);
+		launch_context = gdk_app_launch_context_new ();
+		gdk_app_launch_context_set_screen (launch_context,
+						   gtk_widget_get_screen (GTK_WIDGET (tile)));
+		gdk_app_launch_context_set_timestamp (launch_context,
+						      event->time);
 
-		retval = gnome_vfs_mime_application_launch (priv->default_app, uris);
+		res = g_app_info_launch_uris (priv->default_app, uris,
+					      G_APP_LAUNCH_CONTEXT (launch_context), &error);
 
-		if (retval != GNOME_VFS_OK)
+		if (!res) {
 			g_warning
-				("error: could not launch application with [%s].  GnomeVFSResult = %d\n",
-				TILE (tile)->uri, retval);
+				("error: could not launch application with [%s]: %s\n",
+				TILE (tile)->uri, error->message);
+			g_error_free (error);
+		}
 
 		g_list_free (uris);
+		g_object_unref (launch_context);
 	}
 }
 
@@ -941,55 +942,24 @@
 {
 	DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
 
-	GnomeVFSURI *src_uri;
-	GnomeVFSURI *trash_uri;
-
-	gchar *file_name;
-	gchar *trash_uri_str;
-
-	GnomeVFSResult retval;
-
-	src_uri = gnome_vfs_uri_new (TILE (tile)->uri);
-
-	gnome_vfs_find_directory (src_uri, GNOME_VFS_DIRECTORY_KIND_TRASH, &trash_uri,
-		FALSE, FALSE, 0777);
-
-	if (!trash_uri) {
-		g_warning ("unable to find trash location\n");
-
-		return;
-	}
-
-	file_name = gnome_vfs_uri_extract_short_name (src_uri);
-
-	if (!file_name)
-	{
-		g_warning ("unable to extract short name from [%s]\n",
-			gnome_vfs_uri_to_string (src_uri, GNOME_VFS_URI_HIDE_NONE));
-
-		return;
-	}
+	GFile *src_file;
+	gboolean res;
+	GError *error = NULL;
 
-	trash_uri = gnome_vfs_uri_append_file_name (trash_uri, file_name);
+	src_file = g_file_new_for_uri (TILE (tile)->uri);
 
-	retval = gnome_vfs_xfer_uri (src_uri, trash_uri, GNOME_VFS_XFER_REMOVESOURCE,
-		GNOME_VFS_XFER_ERROR_MODE_ABORT, GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE, NULL, NULL);
+	res = g_file_trash (src_file, NULL, &error);
 
-	if (retval == GNOME_VFS_OK)
+	if (res)
 		bookmark_agent_remove_item (priv->agent, TILE (tile)->uri);
 	else {
-		trash_uri_str = gnome_vfs_uri_to_string (trash_uri, GNOME_VFS_URI_HIDE_NONE);
-
-		g_warning ("unable to move [%s] to the trash [%s]\n", TILE (tile)->uri,
-			trash_uri_str);
+		g_warning ("unable to move [%s] to the trash: %s\n", TILE (tile)->uri,
+			   error->message);
 
-		g_free (trash_uri_str);
+		g_error_free (error);
 	}
 
-	gnome_vfs_uri_unref (src_uri);
-	gnome_vfs_uri_unref (trash_uri);
-
-	g_free (file_name);
+	g_object_unref (src_file);
 }
 
 static void
@@ -1000,10 +970,9 @@
 	GtkDialog *confirm_dialog;
 	gint       result;
 
-	GnomeVFSURI *src_uri;
-	GList *list = NULL;
-
-	GnomeVFSResult retval;
+	GFile *src_file;
+	gboolean res;
+	GError *error = NULL;
 
 
 	if (GPOINTER_TO_INT (libslab_get_gconf_value (GCONF_CONFIRM_DELETE_KEY))) {
@@ -1023,20 +992,19 @@
 			return;
 	}
 
-	src_uri = gnome_vfs_uri_new (TILE (tile)->uri);
-
-	list = g_list_append (list, src_uri);
+	src_file = g_file_new_for_uri (TILE (tile)->uri);
 
-	retval = gnome_vfs_xfer_delete_list (list, GNOME_VFS_XFER_ERROR_MODE_ABORT,
-		GNOME_VFS_XFER_REMOVESOURCE, NULL, NULL);
+	res = g_file_delete (src_file, NULL, &error);
 
-	if (retval == GNOME_VFS_OK)
+	if (res)
 		bookmark_agent_remove_item (priv->agent, TILE (tile)->uri);
-	else
-		g_warning ("unable to delete [%s]\n", TILE (tile)->uri);
+	else {
+		g_warning ("unable to delete [%s]: %s\n", TILE (tile)->uri,
+			   error->message);
+		g_error_free (error);
+	}
 
-	gnome_vfs_uri_unref (src_uri);
-	g_list_free (list);
+	g_object_unref (src_file);
 }
 
 static void
@@ -1055,8 +1023,8 @@
 		item->uri       = tile->uri;
 		item->mime_type = priv->mime_type;
 		item->mtime     = priv->modified;
-		item->app_name  = (gchar *) gnome_vfs_mime_application_get_name (priv->default_app);
-		item->app_exec  = (gchar *) gnome_vfs_mime_application_get_exec (priv->default_app);
+		item->app_name  = (gchar *) g_app_info_get_name (priv->default_app);
+		item->app_exec  = (gchar *) g_app_info_get_executable (priv->default_app);
 
 		bookmark_agent_add_item (priv->agent, item);
 		g_free (item);

Modified: trunk/libslab/recent-files.c
==============================================================================
--- trunk/libslab/recent-files.c	(original)
+++ trunk/libslab/recent-files.c	Fri Aug 22 09:48:27 2008
@@ -20,18 +20,8 @@
 
 #include "recent-files.h"
 
-#include <gtk/gtkversion.h>
-#if GTK_CHECK_VERSION (2, 10, 0)
-#	define USE_GTK_RECENT_MANAGER
-
-#	include <gtk/gtkrecentmanager.h>
-#	include <libgnomevfs/gnome-vfs-ops.h>
-#	include <libgnomevfs/gnome-vfs-utils.h>
-#	include <libgnomevfs/gnome-vfs-monitor.h>
-#else
-#	define EGG_ENABLE_RECENT_FILES
-#	include "egg-recent-model.h"
-#endif
+#include <gtk/gtk.h>
+#include <gio/gio.h>
 
 G_DEFINE_TYPE (MainMenuRecentMonitor, main_menu_recent_monitor, G_TYPE_OBJECT)
 G_DEFINE_TYPE (MainMenuRecentFile,    main_menu_recent_file,    G_TYPE_OBJECT)
@@ -40,24 +30,13 @@
 #define MAIN_MENU_RECENT_FILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MAIN_MENU_RECENT_FILE_TYPE, MainMenuRecentFilePrivate))
 
 typedef struct {
-#ifdef USE_GTK_RECENT_MANAGER
-	GnomeVFSMonitorHandle *monitor_handle;
-#else
-	EggRecentModel *model;
-#endif
+	GFileMonitor *monitor;
 
 	gulong changed_handler_id;
 } MainMenuRecentMonitorPrivate;
 
 typedef struct {
-#ifdef USE_GTK_RECENT_MANAGER
 	GtkRecentInfo *item_obj;
-#else
-	EggRecentItem *item_obj;
-
-	gchar  *uri;
-	gchar  *mime_type;
-#endif
 } MainMenuRecentFilePrivate;
 
 enum {
@@ -72,15 +51,11 @@
 
 static GList *get_files (MainMenuRecentMonitor *, gboolean);
 
-#ifdef USE_GTK_RECENT_MANAGER
-static void recent_file_store_monitor_cb (
-	GnomeVFSMonitorHandle *, const gchar *,
-	const gchar *, GnomeVFSMonitorEventType, gpointer);
+static void
+recent_file_store_monitor_cb (GFileMonitor *, GFile *,
+                              GFile *, GFileMonitorEvent, gpointer);
 
 static gint recent_item_mru_comp_func (gconstpointer, gconstpointer);
-#else
-static void recent_file_store_changed_cb (EggRecentModel *, GList *, gpointer);
-#endif
 
 static void
 main_menu_recent_monitor_class_init (MainMenuRecentMonitorClass *this_class)
@@ -111,9 +86,7 @@
 {
 	MainMenuRecentMonitorPrivate *priv = MAIN_MENU_RECENT_MONITOR_GET_PRIVATE (this);
 
-#ifndef USE_GTK_RECENT_MANAGER
 	priv->model = NULL;
-#endif
 
 	priv->changed_handler_id = 0;
 }
@@ -125,10 +98,8 @@
 
 	priv->item_obj = NULL;
 
-#ifndef USE_GTK_RECENT_MANAGER
 	priv->uri       = NULL;
 	priv->mime_type = NULL;
-#endif
 }
 
 static void
@@ -136,13 +107,8 @@
 {
 	MainMenuRecentMonitorPrivate *priv = MAIN_MENU_RECENT_MONITOR_GET_PRIVATE (g_object);
 
-#ifdef USE_GTK_RECENT_MANAGER
-	gnome_vfs_monitor_cancel (priv->monitor_handle);
-#else
-	g_signal_handler_disconnect (priv->model, priv->changed_handler_id);
-
-	g_object_unref (priv->model);
-#endif
+	g_file_monitor_cancel (priv->monitor);
+	g_object_unref (priv->monitor);
 
 	(* G_OBJECT_CLASS (main_menu_recent_monitor_parent_class)->finalize) (g_object);
 }
@@ -152,16 +118,8 @@
 {
 	MainMenuRecentFilePrivate *priv = MAIN_MENU_RECENT_FILE_GET_PRIVATE (g_object);
 
-#ifdef USE_GTK_RECENT_MANAGER
 	if (priv->item_obj)
 		gtk_recent_info_unref (priv->item_obj);
-#else
-	if (priv->item_obj)
-		egg_recent_item_unref (priv->item_obj);
-
-	g_free (priv->uri);
-	g_free (priv->mime_type);
-#endif
 
 	(* G_OBJECT_CLASS (main_menu_recent_file_parent_class)->finalize) (g_object);
 }
@@ -172,29 +130,25 @@
 	MainMenuRecentMonitor *this = g_object_new (MAIN_MENU_RECENT_MONITOR_TYPE, NULL);
 	MainMenuRecentMonitorPrivate *priv = MAIN_MENU_RECENT_MONITOR_GET_PRIVATE (this);
 
-#ifdef USE_GTK_RECENT_MANAGER
 	GtkRecentManager *manager;
 	gchar *store_path;
-	gchar *store_uri;
+	GFile *store_file;
 
 
 	manager = gtk_recent_manager_get_default ();
 	g_object_get (G_OBJECT (manager), "filename", & store_path, NULL);
-	store_uri = gnome_vfs_get_uri_from_local_path (store_path);
+	store_file = g_file_new_for_path (store_path);
 
-	gnome_vfs_monitor_add (
-		& priv->monitor_handle, store_uri, GNOME_VFS_MONITOR_FILE,
-		recent_file_store_monitor_cb, this);
+	priv->monitor = g_file_monitor_file (store_file,
+					     0, NULL, NULL);
+	if (priv->monitor) {
+		g_signal_connect (priv->monitor, "changed",
+				  G_CALLBACK (recent_file_store_monitor_cb),
+				  this);
+	}
 
 	g_free (store_path);
-	g_free (store_uri);
-
-#else
-	priv->model = egg_recent_model_new (EGG_RECENT_MODEL_SORT_NONE);
-
-	priv->changed_handler_id = g_signal_connect (
-		priv->model, "changed", G_CALLBACK (recent_file_store_changed_cb), this);
-#endif
+	g_object_unref (store_file);
 
 	return this;
 }
@@ -205,15 +159,11 @@
 	GList *list;
 	GList *items;
 
-#ifdef USE_GTK_RECENT_MANAGER
 	GtkRecentManager *manager = gtk_recent_manager_get_default ();
 
 	GtkRecentInfo *info;
 
 	gboolean include;
-#else
-	MainMenuRecentMonitorPrivate *priv = MAIN_MENU_RECENT_MONITOR_GET_PRIVATE (this);
-#endif
 
 	MainMenuRecentFile *item;
 	MainMenuRecentFilePrivate *item_priv;
@@ -221,18 +171,7 @@
 	GList *node;
 
 
-#ifdef USE_GTK_RECENT_MANAGER
 	list = gtk_recent_manager_get_items (manager);
-#else
-	egg_recent_model_set_sort (priv->model, EGG_RECENT_MODEL_SORT_MRU);
-
-	if (apps)
-		egg_recent_model_set_filter_groups (priv->model, "recently-used-apps", NULL);
-	else
-		egg_recent_model_set_filter_groups (priv->model, NULL);
-
-	list = egg_recent_model_get_list (priv->model);
-#endif
 
 	items = NULL;
 
@@ -240,7 +179,6 @@
 		item = g_object_new (MAIN_MENU_RECENT_FILE_TYPE, NULL);
 		item_priv = MAIN_MENU_RECENT_FILE_GET_PRIVATE (item);
 
-#ifdef USE_GTK_RECENT_MANAGER
 		info = (GtkRecentInfo *) node->data;
 
 		include = (apps && gtk_recent_info_has_group (info, "recently-used-apps")) ||
@@ -253,12 +191,6 @@
 		}
 		else
 			g_object_unref (item);
-
-#else
-		item_priv->item_obj = (EggRecentItem *) node->data;
-
-		items = g_list_append (items, item);
-#endif
 	}
 
 	g_list_free (list);
@@ -284,14 +216,7 @@
 {
 	MainMenuRecentFilePrivate *priv = MAIN_MENU_RECENT_FILE_GET_PRIVATE (this);
 
-#ifdef USE_GTK_RECENT_MANAGER
 	return gtk_recent_info_get_uri (priv->item_obj);
-#else
-	if (! priv->uri)
-		priv->uri = egg_recent_item_get_uri (priv->item_obj);
-
-	return priv->uri;
-#endif
 }
 
 const gchar *
@@ -299,14 +224,7 @@
 {
 	MainMenuRecentFilePrivate *priv = MAIN_MENU_RECENT_FILE_GET_PRIVATE (this);
 
-#ifdef USE_GTK_RECENT_MANAGER
 	return gtk_recent_info_get_mime_type (priv->item_obj);
-#else
-	if (! priv->mime_type)
-		priv->mime_type = egg_recent_item_get_mime_type (priv->item_obj);
-
-	return priv->mime_type;
-#endif
 }
 
 time_t
@@ -314,17 +232,12 @@
 {
 	MainMenuRecentFilePrivate *priv = MAIN_MENU_RECENT_FILE_GET_PRIVATE (this);
 
-#ifdef USE_GTK_RECENT_MANAGER
 	return gtk_recent_info_get_modified (priv->item_obj);
-#else
-	return egg_recent_item_get_timestamp (priv->item_obj);
-#endif
 }
 
 void
 main_menu_rename_recent_file (MainMenuRecentMonitor *this, const gchar *uri_0, const gchar *uri_1)
 {
-#ifdef USE_GTK_RECENT_MANAGER
 	GtkRecentManager *manager;
 
 	GError *error = NULL;
@@ -339,18 +252,11 @@
 
 		g_error_free (error);
 	}
-#else
-	MainMenuRecentMonitorPrivate *priv = MAIN_MENU_RECENT_MONITOR_GET_PRIVATE (this);
-
-	egg_recent_model_delete (priv->model, uri_0);
-	egg_recent_model_add    (priv->model, uri_1);
-#endif
 }
 
 void
 main_menu_remove_recent_file (MainMenuRecentMonitor *this, const gchar *uri)
 {
-#ifdef USE_GTK_RECENT_MANAGER
 	GtkRecentManager *manager;
 
 	GError *error = NULL;
@@ -365,32 +271,16 @@
 
 		g_error_free (error);
 	}
-#else
-	MainMenuRecentMonitorPrivate *priv = MAIN_MENU_RECENT_MONITOR_GET_PRIVATE (this);
-
-	egg_recent_model_delete (priv->model, uri);
-#endif
 }
 
-#ifdef USE_GTK_RECENT_MANAGER
 static void
 recent_file_store_monitor_cb (
-	GnomeVFSMonitorHandle *handle, const gchar *monitor_uri,
-	const gchar *info_uri, GnomeVFSMonitorEventType type, gpointer user_data)
+	GFileMonitor *mon, GFile *f1,
+	GFile *f2, GFileMonitorEvent event_type, gpointer user_data)
 {
 	g_signal_emit ((MainMenuRecentMonitor *) user_data, monitor_signals [STORE_CHANGED], 0);
 }
-#else
-
-static void
-recent_file_store_changed_cb (EggRecentModel *model, GList *list, gpointer user_data)
-{
-	g_signal_emit ((MainMenuRecentMonitor *) user_data, monitor_signals [STORE_CHANGED], 0);
-}
-
-#endif
 
-#ifdef USE_GTK_RECENT_MANAGER
 static gint
 recent_item_mru_comp_func (gconstpointer a, gconstpointer b)
 {
@@ -402,4 +292,3 @@
 
 	return modified_b - modified_a;
 }
-#endif

Modified: trunk/libslab/slab-gnome-util.c
==============================================================================
--- trunk/libslab/slab-gnome-util.c	(original)
+++ trunk/libslab/slab-gnome-util.c	Fri Aug 22 09:48:27 2008
@@ -22,9 +22,7 @@
 
 #include <gconf/gconf-client.h>
 #include <libgnome/gnome-url.h>
-#include <libgnomevfs/gnome-vfs-result.h>
-#include <libgnomevfs/gnome-vfs-uri.h>
-#include <libgnomevfs/gnome-vfs-xfer.h>
+#include <gio/gio.h>
 #include <string.h>
 
 gboolean
@@ -453,20 +451,24 @@
 void
 copy_file (const gchar * src_uri, const gchar * dst_uri)
 {
-	GnomeVFSURI *src;
-	GnomeVFSURI *dst;
-
-	GnomeVFSResult retval;
+	GFile *src;
+	GFile *dst;
+	GError *error = NULL;
+	gboolean res;
 
-	src = gnome_vfs_uri_new (src_uri);
-	dst = gnome_vfs_uri_new (dst_uri);
+	src = g_file_new_for_uri (src_uri);
+	dst = g_file_new_for_uri (dst_uri);
 
-	retval = gnome_vfs_xfer_uri (src, dst, GNOME_VFS_XFER_DEFAULT,
-		GNOME_VFS_XFER_ERROR_MODE_ABORT, GNOME_VFS_XFER_OVERWRITE_MODE_SKIP, NULL, NULL);
+	res = g_file_copy (src, dst,
+			   G_FILE_COPY_NONE,
+			   NULL, NULL, NULL, &error);
 
-	if (retval != GNOME_VFS_OK)
-		g_warning ("error copying [%s] to [%s].", src_uri, dst_uri);
+	if (!res)
+	{
+		g_warning ("error copying [%s] to [%s]: %s.", src_uri, dst_uri, error->message);
+		g_error_free (error);
+	}
 
-	gnome_vfs_uri_unref (src);
-	gnome_vfs_uri_unref (dst);
+	g_object_unref (src);
+	g_object_unref (dst);
 }

Modified: trunk/main-menu/src/main-menu-ui.c
==============================================================================
--- trunk/main-menu/src/main-menu-ui.c	(original)
+++ trunk/main-menu/src/main-menu-ui.c	Fri Aug 22 09:48:27 2008
@@ -33,8 +33,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <X11/Xlib.h>
 #include <gdk/gdkx.h>
-#include <libgnomevfs/gnome-vfs.h>
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
+#include <gio/gio.h>
 
 #include <gtk/gtkversion.h>
 #if GTK_CHECK_VERSION (2, 10, 0)
@@ -122,11 +121,10 @@
 
 	BookmarkAgent *bm_agents [BOOKMARK_STORE_N_TYPES];
 
-	GnomeVFSVolumeMonitor *volume_mon;
+	GVolumeMonitor        *volume_mon;
 	GList                 *mounts;
 
-	guint recently_used_throttle_timeout_id;
-	GnomeVFSMonitorHandle *recently_used_store_monitor;
+	GFileMonitor *recently_used_store_monitor;
 
 	guint search_cmd_gconf_mntr_id;
 	guint current_page_gconf_mntr_id;
@@ -168,7 +166,7 @@
 static void setup_file_tables        (MainMenuUI *);
 static void setup_bookmark_agents    (MainMenuUI *);
 static void setup_lock_down          (MainMenuUI *);
-static void setup_recently_used_store_monitor (MainMenuUI *this, gboolean is_startup);
+static void setup_recently_used_store_monitor (MainMenuUI *this);
 static void update_recently_used_sections (MainMenuUI *this);
 
 static void       select_page                (MainMenuUI *);
@@ -224,7 +222,7 @@
 static gboolean grabbing_window_event_cb          (GtkWidget *, GdkEvent *, gpointer);
 static void     user_app_agent_notify_cb          (GObject *, GParamSpec *, gpointer);
 static void     user_doc_agent_notify_cb          (GObject *, GParamSpec *, gpointer);
-static void     volume_monitor_mount_cb           (GnomeVFSVolumeMonitor *, GnomeVFSVolume *, gpointer);
+static void     volume_monitor_mount_cb           (GVolumeMonitor *, GMount *, gpointer);
 
 static GdkFilterReturn slab_gdk_message_filter (GdkXEvent *, GdkEvent *, gpointer);
 
@@ -291,7 +289,7 @@
 	g_free (glade_xml_path);
 
 	libslab_checkpoint ("main_menu_ui_new(): setup_recently_used_store_monitor");
-	setup_recently_used_store_monitor (this, TRUE);
+	setup_recently_used_store_monitor (this);
 	libslab_checkpoint ("main_menu_ui_new(): setup_bookmark_agents");
 	setup_bookmark_agents    (this);
 	libslab_checkpoint ("main_menu_ui_new(): create_panel_button");
@@ -438,10 +436,7 @@
 	gint i;
 
 	if (priv->recently_used_store_monitor)
-		gnome_vfs_monitor_cancel (priv->recently_used_store_monitor);
-
-	if (priv->recently_used_throttle_timeout_id)
-		g_source_remove (priv->recently_used_throttle_timeout_id);
+		g_file_monitor_cancel (priv->recently_used_store_monitor);
 
 	for (i = 0; i < 4; ++i) {
 		g_object_unref (G_OBJECT (g_object_get_data (
@@ -475,9 +470,9 @@
 	for (i = 0; i < BOOKMARK_STORE_N_TYPES; ++i)
 		g_object_unref (priv->bm_agents [i]);
 
-	g_list_foreach (priv->mounts, (GFunc) gnome_vfs_volume_unref, NULL);
+	g_list_foreach (priv->mounts, (GFunc) g_object_unref, NULL);
 	g_list_free (priv->mounts);
-	gnome_vfs_volume_monitor_unref (priv->volume_mon);
+	g_object_unref (priv->volume_mon);
 
 	G_OBJECT_CLASS (main_menu_ui_parent_class)->finalize (g_obj);
 }
@@ -818,11 +813,11 @@
 
 	gtk_container_add (ctnr, GTK_WIDGET (priv->file_tables [RCNT_DOCS_TABLE]));
 
-	priv->volume_mon = gnome_vfs_get_volume_monitor ();
-	priv->mounts = gnome_vfs_volume_monitor_get_mounted_volumes (priv->volume_mon);
+	priv->volume_mon = g_volume_monitor_get ();
+	priv->mounts = g_volume_monitor_get_mounts (priv->volume_mon);
 
-	g_signal_connect (priv->volume_mon, "volume_mounted", G_CALLBACK (volume_monitor_mount_cb), this);
-	g_signal_connect (priv->volume_mon, "volume_unmounted", G_CALLBACK (volume_monitor_mount_cb), this);
+	g_signal_connect (priv->volume_mon, "mount-added", G_CALLBACK (volume_monitor_mount_cb), this);
+	g_signal_connect (priv->volume_mon, "mount-removed", G_CALLBACK (volume_monitor_mount_cb), this);
 }
 
 static void
@@ -973,88 +968,47 @@
 	return g_build_filename (g_get_home_dir (), basename, NULL);
 }
 
-static gboolean
-recently_used_throttle_timeout_cb (gpointer data)
-{
-	MainMenuUI *this = MAIN_MENU_UI (data);
-	MainMenuUIPrivate *priv = PRIVATE (this);
-
-	update_recently_used_sections (this);
-
-	priv->recently_used_throttle_timeout_id = 0;
+#define RECENTLY_USED_STORE_THROTTLE_MILLISECONDS 2000
 
-	return FALSE;
-}
-
-#define RECENTLY_USED_STORE_THROTTLE_SECONDS 2
-
-static void
-setup_recently_used_throttle_timeout (MainMenuUI *this, gboolean is_startup)
-{
-	MainMenuUIPrivate *priv = PRIVATE (this);
-
-	if (priv->recently_used_throttle_timeout_id != 0)
-		g_source_remove (priv->recently_used_throttle_timeout_id);
-
-	/* Some apps do many updates to the recently-used store quickly, like
-	 * when Nautilus or EOG are asked to open a bunch of files at the same
-	 * time.  So, we throttle our updates to the recently-used store to
-	 * avoid re-reading the store more times than needed.
-	 *
-	 * Additionally, we do this in an idle during startup, not a timeout,
-	 * so that the Computer menu will be up to date as soon as possible.
-	 */
-	if (is_startup)
-		priv->recently_used_throttle_timeout_id = g_idle_add (recently_used_throttle_timeout_cb, this);
-	else
-		priv->recently_used_throttle_timeout_id = g_timeout_add_seconds (RECENTLY_USED_STORE_THROTTLE_SECONDS,
-										 recently_used_throttle_timeout_cb,
-										 this);
-}
-
-/* Called from GnomeVFSMonitor when the recently-used store changes.  We'll note
- * this in a flag, and we'll check that flag later, when it is necessary to have
- * an up-to-date view of the recently-used store.
- */
-static void recently_used_store_monitor_changed_cb (GnomeVFSMonitorHandle *handle,
-						    const gchar *monitor_uri,
-						    const gchar *info_uri,
-						    GnomeVFSMonitorEventType event_type,
+static void recently_used_store_monitor_changed_cb (GFileMonitor *monitor,
+						    GFile *f1, GFile *f2,
+						    GFileMonitorEvent event_type,
 						    gpointer data)
 {
 	MainMenuUI *this = MAIN_MENU_UI (data);
 	MainMenuUIPrivate *priv = PRIVATE (this);
 
 	priv->recently_used_store_has_changed = TRUE;
-	setup_recently_used_throttle_timeout (this, FALSE);
+	update_recently_used_sections (this);
 }
 
-/* Creates a GnomeVFSMonitor for the recently-used store, so we can be informed
+/* Creates a GFileMonitor for the recently-used store, so we can be informed
  * when the store changes.
  */
 static void
-setup_recently_used_store_monitor (MainMenuUI *this, gboolean is_startup)
+setup_recently_used_store_monitor (MainMenuUI *this)
 {
 	MainMenuUIPrivate *priv = PRIVATE (this);
-	char *filename;
-	char *uri;
+	char *path;
+	GFile *file;
+	GFileMonitor *monitor;
 
 	priv->recently_used_store_has_changed = TRUE; /* ensure the store gets read the first time we need it */
 
-	filename = get_recently_used_store_filename ();
-	uri = g_strconcat ("file://", filename, NULL);
-	g_free (filename);
+	path = get_recently_used_store_filename ();
+	file = g_file_new_for_path (path);
 
-	if (gnome_vfs_monitor_add (&priv->recently_used_store_monitor,
-				   uri,
-				   GNOME_VFS_MONITOR_FILE,
-				   recently_used_store_monitor_changed_cb,
-				   this) != GNOME_VFS_OK)
-		priv->recently_used_store_monitor = NULL;
-
-	g_free (uri);
+	monitor = g_file_monitor_file (file, 0, NULL, NULL);
+	if (monitor) {
+		g_file_monitor_set_rate_limit (monitor,
+					       RECENTLY_USED_STORE_THROTTLE_MILLISECONDS);
+		g_signal_connect (monitor, "changed",
+				  G_CALLBACK (recently_used_store_monitor_changed_cb),
+				  this);
+	}
 
-	setup_recently_used_throttle_timeout (this, is_startup);
+	priv->recently_used_store_monitor = monitor;
+	update_recently_used_sections (this);
 }
 
 static Tile *
@@ -1108,31 +1062,35 @@
 {
 	MainMenuUIPrivate *priv = PRIVATE (data);
 
-	GnomeVFSVolume *vol;
+	GMount         *mount;
+	GVolume        *volume;
+	GFile          *file;
+	char           *nfs_id;
 	gboolean        is_nfs = FALSE;
-	GnomeVFSURI    *gvfs_uri;
 	gboolean        is_local = TRUE;
 
 	GList *node;
 
-
 	if (! g_str_has_prefix (item->uri, "file://"))
 		return NULL;
 
 	for (node = priv->mounts; ! is_nfs && node; node = node->next) {
-		vol = (GnomeVFSVolume *) node->data;
+		mount = node->data;
+		volume = g_mount_get_volume (mount);
+
+		nfs_id = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_NFS_MOUNT);
+		is_nfs = (nfs_id != NULL);
 
-		is_nfs =
-			((gnome_vfs_volume_get_device_type (vol) == GNOME_VFS_DEVICE_TYPE_NFS) &&
-			g_str_has_prefix (item->uri, gnome_vfs_volume_get_activation_uri (vol)));
+		g_free (nfs_id);
+		g_object_unref (volume);
 	}
 
 	if (is_nfs)
 		return NULL;
 
-	gvfs_uri = gnome_vfs_uri_new (item->uri);
-	is_local = gnome_vfs_uri_is_local (gvfs_uri);
-	gnome_vfs_uri_unref (gvfs_uri);
+	file = g_file_new_for_uri (item->uri);
+	is_local = g_file_is_native (file);
+	g_object_unref (file);
 
 	if (! is_local)
 		return NULL;
@@ -1193,35 +1151,40 @@
 doc_uri_to_item (const gchar *uri, gpointer data)
 {
 	BookmarkItem *item;
-
-	GnomeVFSFileInfo        *info;
-	GnomeVFSMimeApplication *default_app;
-
+	GFile *file;
+	GFileInfo *info;
+	GAppInfo *default_app;
 
 	item = g_new0 (BookmarkItem, 1);
 
 	item->uri = g_strdup (uri);
 
-	info = gnome_vfs_file_info_new ();
-
-	gnome_vfs_get_file_info (
-		item->uri, info, 
-		GNOME_VFS_FILE_INFO_GET_MIME_TYPE | GNOME_VFS_FILE_INFO_FORCE_FAST_MIME_TYPE);
-
-	item->mime_type = g_strdup (info->mime_type);
-	item->mtime     = info->mtime;
+	file = g_file_new_for_uri (uri);
+	info = g_file_query_info (file,
+				  G_FILE_ATTRIBUTE_TIME_MODIFIED ","
+				  G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+				  0, NULL, NULL);
+	g_object_unref (file);
+
+	if (!info) {
+		item->mtime = 0;
+		item->mime_type = NULL;
+	} else {
+		item->mtime = (time_t) g_file_info_get_attribute_uint64 (info,
+									 G_FILE_ATTRIBUTE_TIME_MODIFIED);
+		item->mime_type = g_strdup (g_file_info_get_content_type (info));
+		g_object_unref (info);
+	}
 
 	if (item->mime_type) {
-		default_app = gnome_vfs_mime_get_default_application (item->mime_type);
+		default_app = g_app_info_get_default_for_type (item->mime_type, FALSE);
 
-		item->app_name = g_strdup (gnome_vfs_mime_application_get_name (default_app));
-		item->app_exec = g_strdup (gnome_vfs_mime_application_get_exec (default_app));
+		item->app_name = g_strdup (g_app_info_get_name (default_app));
+		item->app_exec = g_strdup (g_app_info_get_executable (default_app));
 
-		gnome_vfs_mime_application_free (default_app);
+		g_object_unref (default_app);
 	}
 
-	gnome_vfs_file_info_unref (info);
-
 	if (! (item->mime_type && item->app_name)) {
 		bookmark_item_free (item);
 		item = NULL;
@@ -1842,7 +1805,7 @@
 	}
 
 	if (!priv->recently_used_store_monitor)
-		setup_recently_used_store_monitor (this, FALSE); /* for if we couldn't create the monitor the first time */
+		setup_recently_used_store_monitor (this);
 
 	libslab_checkpoint ("main-menu-ui.c: update_recently_used_sections() end");
 }
@@ -2527,11 +2490,11 @@
 }
 
 static void
-volume_monitor_mount_cb (GnomeVFSVolumeMonitor *mon, GnomeVFSVolume *vol, gpointer data)
+volume_monitor_mount_cb (GVolumeMonitor *mon, GMount *mount, gpointer data)
 {
 	MainMenuUIPrivate *priv = PRIVATE (data);
 
-	g_list_foreach (priv->mounts, (GFunc) gnome_vfs_volume_unref, NULL);
+	g_list_foreach (priv->mounts, (GFunc) g_object_unref, NULL);
 	g_list_free (priv->mounts);
-	priv->mounts = gnome_vfs_volume_monitor_get_mounted_volumes (mon);
+	priv->mounts = g_volume_monitor_get_mounts (mon);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]