diff --git a/gnome-screenshot/Makefile.am b/gnome-screenshot/Makefile.am
index 9f10af6..d844480 100644
--- a/gnome-screenshot/Makefile.am
+++ b/gnome-screenshot/Makefile.am
@@ -29,9 +29,6 @@ gnome_screenshot_SOURCES = \
 	screenshot-shadow.h		\
 	screenshot-utils.c		\
 	screenshot-utils.h		\
-	gnome-egg-xfer-dialog.c		\
-	gnome-egg-xfer-dialog.h		\
-	gnome-egg-xfer-dialog-icons.h	\
 	screenshot-save.c		\
 	screenshot-save.h		\
 	screenshot-xfer.c		\
diff --git a/gnome-screenshot/gnome-egg-xfer-dialog-icons.h b/gnome-screenshot/gnome-egg-xfer-dialog-icons.h
deleted file mode 100644
index 77fc2ac..0000000
--- a/gnome-screenshot/gnome-egg-xfer-dialog-icons.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
-
-static const guint8 progress_jar_empty_icon[] = 
-{ ""
-  /* Pixbuf magic (0x47646b50) */
-  "GdkP"
-  /* length: header (24) + pixel_data (346) */
-  "\0\0\1r"
-  /* pixdata_type (0x2010002) */
-  "\2\1\0\2"
-  /* rowstride (64) */
-  "\0\0\0@"
-  /* width (16) */
-  "\0\0\0\20"
-  /* height (16) */
-  "\0\0\0\20"
-  /* pixel_data: */
-  "\1\0\0\0\\\216\0\0\0\377\3\0\0\0\\\0\0\0\377\205\204\177\377\205\344"
-  "\342\334\377\4\352\350\343\377\344\342\334\377\352\350\343\377\344\342"
-  "\334\377\203\352\350\343\377\1\221\220\215\377\202\0\0\0\377\203\344"
-  "\342\334\377\4\352\350\343\377\344\342\334\377\352\350\343\377\344\342"
-  "\334\377\206\352\350\343\377\1\361\361\361\377\202\0\0\0\377\202\344"
-  "\342\334\377\213\352\350\343\377\1\377\377\377\377\202\0\0\0\377\1\344"
-  "\342\334\377\214\352\350\343\377\1\377\377\377\377\202\0\0\0\377\202"
-  "\344\342\334\377\213\352\350\343\377\1\377\377\377\377\202\0\0\0\377"
-  "\1\344\342\334\377\214\352\350\343\377\1\377\377\377\377\202\0\0\0\377"
-  "\202\344\342\334\377\213\352\350\343\377\1\377\377\377\377\202\0\0\0"
-  "\377\215\352\350\343\377\1\377\377\377\377\202\0\0\0\377\1\344\342\334"
-  "\377\214\352\350\343\377\1\377\377\377\377\202\0\0\0\377\1\344\342\334"
-  "\377\214\352\350\343\377\1\377\377\377\377\202\0\0\0\377\215\352\350"
-  "\343\377\1\377\377\377\377\202\0\0\0\377\215\352\350\343\377\1\377\377"
-  "\377\377\202\0\0\0\377\212\352\350\343\377\4\353\351\344\377\354\352"
-  "\346\377\352\350\343\377\377\377\377\377\202\0\0\0\377\2\221\220\215"
-  "\377\361\361\361\377\213\377\377\377\377\3\324\324\323\377\0\0\0\377"
-  "\0\0\0\\\216\0\0\0\377\1\0\0\0\\"};
-
-
-/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
-
-static const guint8 progress_jar_full_icon[] = 
-{ ""
-  /* Pixbuf magic (0x47646b50) */
-  "GdkP"
-  /* length: header (24) + pixel_data (817) */
-  "\0\0\3I"
-  /* pixdata_type (0x2010002) */
-  "\2\1\0\2"
-  /* rowstride (64) */
-  "\0\0\0@"
-  /* width (16) */
-  "\0\0\0\20"
-  /* height (16) */
-  "\0\0\0\20"
-  /* pixel_data: */
-  "\1\0\0\0\\\216\0\0\0\377\3\0\0\0\\\0\0\0\377k\204\223\377\214\201\246"
-  "\276\377\1n\207\230\377\202\0\0\0\377\3\201\246\276\377\335\347\354\377"
-  "\327\342\352\377\203\320\335\346\377\205\274\317\333\377\3\264\311\327"
-  "\377\225\264\310\377{\236\264\377\202\0\0\0\377\16\201\246\276\377\351"
-  "\357\362\377\263\310\327\377\247\277\317\377\245\277\317\377\227\265"
-  "\310\377\243\275\317\377\226\264\307\377\241\274\315\377\223\263\306"
-  "\377\223\261\306\377\221\257\302\377\220\257\301\377u\225\252\377\202"
-  "\0\0\0\377\7\201\246\276\377\332\345\353\377\260\306\324\377\226\263"
-  "\307\377\225\262\306\377\224\263\307\377\223\262\306\377\202\222\261"
-  "\305\377\5\220\256\303\377\220\256\301\377\214\253\277\377\211\251\276"
-  "\377u\225\252\377\202\0\0\0\377\7\201\246\276\377\325\341\350\377\242"
-  "\274\316\377\223\262\306\377\221\261\306\377\220\260\305\377\217\257"
-  "\304\377\202\216\255\303\377\5\214\253\277\377\211\250\274\377\210\251"
-  "\273\377\204\244\273\377l\217\245\377\202\0\0\0\377\4\201\246\276\377"
-  "\317\335\345\377\255\303\323\377\220\257\303\377\202\216\256\303\377"
-  "\10\214\254\301\377\212\252\277\377\210\252\275\377\204\246\273\377\203"
-  "\245\272\377\202\241\267\377~\240\265\377f\212\241\377\202\0\0\0\377"
-  "\3\201\246\276\377\310\330\342\377\235\267\311\377\202\214\253\301\377"
-  "\11\211\251\276\377\210\247\273\377\204\244\271\377\202\244\271\377\202"
-  "\243\267\377\177\241\264\377|\240\263\377{\237\262\377`\205\235\377\202"
-  "\0\0\0\377\7\201\246\276\377\300\322\336\377\210\252\277\377\210\247"
-  "\275\377\205\250\274\377\204\246\273\377\200\243\271\377\202\200\242"
-  "\267\377\5}\237\264\377{\236\262\377z\234\262\377x\232\257\377]\200\230"
-  "\377\202\0\0\0\377\16\201\246\276\377\260\305\323\377\225\263\305\377"
-  "\203\245\272\377\201\244\270\377\200\242\267\377~\240\265\377|\237\263"
-  "\377{\235\262\377x\234\257\377w\232\256\377u\232\256\377u\231\254\377"
-  "\\\177\225\377\202\0\0\0\377\12\201\246\276\377\252\277\317\377\201\244"
-  "\270\377\177\242\266\377~\241\265\377|\237\263\377z\236\263\377y\235"
-  "\260\377w\233\256\377v\230\255\377\202t\227\255\377\2q\230\254\377X|"
-  "\223\377\202\0\0\0\377\7\201\246\276\377\230\263\307\377\217\255\277"
-  "\377|\236\263\377{\235\262\377z\234\261\377x\234\261\377\202t\232\255"
-  "\377\5t\230\253\377p\227\253\377m\225\252\377l\225\253\377Tr\207\377"
-  "\202\0\0\0\377\16\201\246\276\377\216\251\300\377{\235\262\377y\235\262"
-  "\377x\232\257\377t\232\255\377t\227\255\377r\226\253\377p\224\253\377"
-  "n\226\253\377k\223\252\377k\225\252\377h\223\251\377Qn\202\377\202\0"
-  "\0\0\377\16\201\246\276\377\211\245\275\377w\232\260\377t\231\255\377"
-  "t\230\255\377s\227\254\377o\224\252\377m\224\252\377l\223\251\377k\223"
-  "\252\377h\223\251\377f\222\251\377f\220\251\377Rp\207\377\202\0\0\0\377"
-  "\1dz\212\377\202z\235\263\377\202u\225\252\377\13s\226\252\377h\213\243"
-  "\377a\206\236\377^\203\235\377Wy\216\377Vy\215\377Ux\216\377Tw\215\377"
-  "`v\204\377\0\0\0\377\0\0\0\\\216\0\0\0\377\1\0\0\0\\"};
-
-
diff --git a/gnome-screenshot/gnome-egg-xfer-dialog.c b/gnome-screenshot/gnome-egg-xfer-dialog.c
deleted file mode 100644
index 6551dfd..0000000
--- a/gnome-screenshot/gnome-egg-xfer-dialog.c
+++ /dev/null
@@ -1,725 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* dfos-xfer-progress-dialog.c - Progress dialog for transfer operations in the
-   GNOME Desktop File Operation Service.
-
-   Copyright (C) 1999, 2000 Free Software Foundation
-   Copyright (C) 2000, 2001 Eazel Inc.
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with this program; see the file COPYING.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.
-
-   Authors: 
-   	Ettore Perazzoli <ettore@gnu.org> 
-   	Pavel Cisler <pavel@eazel.com> 
-*/
-
-#include <config.h>
-#include <string.h>
-#include "gnome-egg-xfer-dialog.h"
-#include "gnome-egg-xfer-dialog-icons.h"
-
-#include <gtk/gtkhbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkprogressbar.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkvbox.h>
-#include <glib/gi18n.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-
-/* The default width of the progress dialog. It will be wider
- * only if the font is really huge and the fixed labels don't
- * fit in the window otherwise.
- */
-#define PROGRESS_DIALOG_WIDTH 400
-
-#define OUTER_BORDER       5
-#define VERTICAL_SPACING   8
-#define HORIZONTAL_SPACING 3
-
-#define MINIMUM_TIME_UP    1000
-
-#define SHOW_TIMEOUT	   1200
-#define TIME_REMAINING_TIMEOUT 1000
-
-static GdkPixbuf *empty_jar_pixbuf, *full_jar_pixbuf;
-
-static void gnome_egg_xfer_dialog_class_init (GnomeEggXferDialogClass *klass);
-static void gnome_egg_xfer_dialog_init       (GnomeEggXferDialog      *dialog);
-
-G_DEFINE_TYPE (GnomeEggXferDialog,
-	       gnome_egg_xfer_dialog,
-	       GTK_TYPE_DIALOG)
-
-struct GnomeEggXferDialogPrivate {
-	GtkWidget *progress_title_label;
-	GtkWidget *progress_count_label;
-	GtkWidget *operation_name_label;
-	GtkWidget *item_name;
-	GtkWidget *from_label;
-	GtkWidget *from_path_label;
-	GtkWidget *to_label;
-	GtkWidget *to_path_label;
-
-	GtkWidget *progress_bar;
-
-	const char *from_prefix;
-	const char *to_prefix;
-
-	gulong files_total;
-	
-	GnomeVFSFileSize bytes_copied;
-	GnomeVFSFileSize bytes_total;
-
-	/* system time (microseconds) when show timeout was started */
-	gint64 start_time;
-
-	/* system time (microseconds) when dialog was mapped */
-	gint64 show_time;
-	
-	/* time remaining in show timeout if it's paused and resumed */
-	guint remaining_time;
-
-	guint delayed_close_timeout_id;
-	guint delayed_show_timeout_id;
-
-	/* system time (microseconds) when first file transfer began */
-	gint64 first_transfer_time;
-	guint time_remaining_timeout_id;
-	
-	int progress_jar_position;
-};
-
-/* Private functions. */
-
-static void
-gnome_egg_xfer_dialog_update_icon (GnomeEggXferDialog *progress,
-					       double fraction)
-{
-	GdkPixbuf *pixbuf;
-	int position;
-
-	position = gdk_pixbuf_get_height (empty_jar_pixbuf) * (1 - fraction);
-
-	if (position == progress->priv->progress_jar_position) {
-		return;
-	}
-
-	progress->priv->progress_jar_position = position;
-	
-	pixbuf = gdk_pixbuf_copy (empty_jar_pixbuf);
-	gdk_pixbuf_copy_area (full_jar_pixbuf,
-			      0, position,
-			      gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf) - position,
-			      pixbuf,
-			      0, position);
-
-	gtk_window_set_icon (GTK_WINDOW (progress), pixbuf);
-	g_object_unref (pixbuf);
-}
-
-
-static void
-gnome_egg_xfer_dialog_update (GnomeEggXferDialog *progress)
-{
-	double fraction;
-
-	if (progress->priv->bytes_total == 0) {
-		/* We haven't set up the file count yet, do not update
-		 * the progress bar until we do.
-		 */
-		return;
-	}
-
-	fraction = (double)progress->priv->bytes_copied /
-		progress->priv->bytes_total;
-	
-	gtk_progress_bar_set_fraction
-		(GTK_PROGRESS_BAR (progress->priv->progress_bar),
-		 fraction);
-	gnome_egg_xfer_dialog_update_icon (progress, fraction);
-}
-
-/* Code copied from libeel.
- */
-static char *
-eel_make_valid_utf8 (const char *name)
-{
-	GString *string;
-	const char *remainder, *invalid;
-	int remaining_bytes, valid_bytes;
-
-	string = NULL;
-	remainder = name;
-	remaining_bytes = strlen (name);
-
-	while (remaining_bytes != 0) {
-		if (g_utf8_validate (remainder, remaining_bytes, &invalid)) {
-			break;
-		}
-		valid_bytes = invalid - remainder;
-
-		if (string == NULL) {
-			string = g_string_sized_new (remaining_bytes);
-		}
-		g_string_append_len (string, remainder, valid_bytes);
-		g_string_append_c (string, '?');
-
-		remaining_bytes -= valid_bytes + 1;
-		remainder = invalid + 1;
-	}
-
-	if (string == NULL) {
-		return g_strdup (name);
-	}
-
-	g_string_append (string, remainder);
-	g_string_append (string, _(" (invalid Unicode)"));
-	g_assert (g_utf8_validate (string->str, -1, NULL));
-
-	return g_string_free (string, FALSE);
-}
-
-static void
-eel_gtk_label_make_bold (GtkLabel *label)
-{
-	PangoFontDescription *font_desc;
-
-	font_desc = pango_font_description_new ();
-
-	pango_font_description_set_weight (font_desc,
-					   PANGO_WEIGHT_BOLD);
-
-	/* This will only affect the weight of the font, the rest is
-	 * from the current state of the widget, which comes from the
-	 * theme or user prefs, since the font desc only has the
-	 * weight flag turned on.
-	 */
-	gtk_widget_modify_font (GTK_WIDGET (label), font_desc);
-
-	pango_font_description_free (font_desc);
-}
-
-static gint64
-eel_get_system_time (void)
-{
-	GTimeVal current_time;
-
-	g_get_current_time (&current_time);
-
-	return (gint64)current_time.tv_usec + (gint64)current_time.tv_sec * G_GINT64_CONSTANT (1000000);
-}
-
-
-static void
-set_text_unescaped_trimmed (GtkWidget *label, const char *text)
-{
-	char *unescaped_text;
-	char *unescaped_utf8;
-	
-	if (text == NULL || text[0] == '\0') {
-		gtk_label_set_text (GTK_LABEL (label), "");
-		return;
-	}
-	
-	unescaped_text = gnome_vfs_unescape_string_for_display (text);
-	unescaped_utf8 = eel_make_valid_utf8 (unescaped_text);
-	gtk_label_set_text (GTK_LABEL (label), unescaped_utf8);
-	g_free (unescaped_utf8);
-	g_free (unescaped_text);
-}
-
-/* This is just to make sure the dialog is not closed without explicit
- * intervention.
- */
-static void
-close_callback (GtkDialog *dialog)
-{
-}
-
-/* GObject methods. */
-static void
-gnome_egg_xfer_dialog_finalize (GObject *object)
-{
-	GnomeEggXferDialog *progress;
-
-	progress = GNOME_EGG_XFER_DIALOG (object);
-
-	g_free (progress->priv);
-
-	G_OBJECT_CLASS (gnome_egg_xfer_dialog_parent_class)->finalize (object);
-}
-
-/* GtkObject methods.  */
-
-static void
-gnome_egg_xfer_dialog_destroy (GtkObject *object)
-{
-	GnomeEggXferDialog *progress;
-
-	progress = GNOME_EGG_XFER_DIALOG (object);
-
-	if (progress->priv->delayed_close_timeout_id != 0) {
-		g_source_remove (progress->priv->delayed_close_timeout_id);
-		progress->priv->delayed_close_timeout_id = 0;
-	}
-	
-	if (progress->priv->delayed_show_timeout_id != 0) {
-		g_source_remove (progress->priv->delayed_show_timeout_id);
-		progress->priv->delayed_show_timeout_id = 0;
-	}
-
-	if (progress->priv->time_remaining_timeout_id != 0) {
-		g_source_remove (progress->priv->time_remaining_timeout_id);
-		progress->priv->time_remaining_timeout_id = 0;
-	}
-	
-	GTK_OBJECT_CLASS (gnome_egg_xfer_dialog_parent_class)->destroy (object);
-}
-
-/* Initialization.  */
-
-static void
-create_titled_label (GtkTable *table, int row, GtkWidget **title_widget, GtkWidget **label_text_widget)
-{
-	*title_widget = gtk_label_new ("");
-	eel_gtk_label_make_bold (GTK_LABEL (*title_widget));
-	gtk_misc_set_alignment (GTK_MISC (*title_widget), 1, 0);
-	gtk_table_attach (table, *title_widget,
-			  0, 1,
-			  row, row + 1,
-			  GTK_FILL, 0,
-			  0, 0);
-	gtk_widget_show (*title_widget);
-
-	*label_text_widget = gtk_label_new ("");
-	gtk_label_set_ellipsize (GTK_LABEL (*label_text_widget), PANGO_ELLIPSIZE_START);
-	gtk_table_attach (table, *label_text_widget,
-			  1, 2,
-			  row, row + 1,
-			  GTK_FILL | GTK_EXPAND, 0,
-			  0, 0);
-	gtk_widget_show (*label_text_widget);
-	gtk_misc_set_alignment (GTK_MISC (*label_text_widget), 0, 0);
-}
-
-static void
-map_callback (GtkWidget *widget)
-{
-	GnomeEggXferDialog *progress;
-
-	progress = GNOME_EGG_XFER_DIALOG (widget);
-
-	GTK_WIDGET_CLASS (gnome_egg_xfer_dialog_parent_class)->map (widget);
-
-	progress->priv->show_time = eel_get_system_time ();
-}
-
-static gboolean
-delete_event_callback (GtkWidget *widget,
-		       GdkEventAny *event)
-{
-	/* Do nothing -- we shouldn't be getting a close event because
-	 * the dialog should not have a close box.
-	 */
-	return TRUE;
-}
-
-static void
-gnome_egg_xfer_dialog_init (GnomeEggXferDialog *progress)
-{
-	GtkWidget *hbox, *vbox;
-	GtkTable *titled_label_table;
-
-	progress->priv = g_new0 (GnomeEggXferDialogPrivate, 1);
-
-	vbox = gtk_vbox_new (FALSE, VERTICAL_SPACING);
-	gtk_container_set_border_width (GTK_CONTAINER (vbox), OUTER_BORDER);
-	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (progress)->vbox), vbox, TRUE, TRUE, VERTICAL_SPACING);
-
-	hbox = gtk_hbox_new (FALSE, 0);
-	gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, HORIZONTAL_SPACING);
-
-	/* label- */
-	/* Files remaining to be copied: */
-	progress->priv->progress_title_label = gtk_label_new ("");
-	gtk_label_set_justify (GTK_LABEL (progress->priv->progress_title_label), GTK_JUSTIFY_LEFT);
-	gtk_box_pack_start (GTK_BOX (hbox), progress->priv->progress_title_label, FALSE, FALSE, 0);
-	eel_gtk_label_make_bold (GTK_LABEL (progress->priv->progress_title_label));
-
-
-	/* label -- */
-	/* 24 of 30 */
-	progress->priv->progress_count_label = gtk_label_new ("");
-	gtk_label_set_justify (GTK_LABEL (progress->priv->progress_count_label), GTK_JUSTIFY_RIGHT);
-	gtk_box_pack_end (GTK_BOX (hbox), progress->priv->progress_count_label, FALSE, FALSE, 0);
-	eel_gtk_label_make_bold (GTK_LABEL (progress->priv->progress_count_label));
-
-	/* progress bar */
-	progress->priv->progress_bar = gtk_progress_bar_new ();
-	gtk_window_set_default_size (GTK_WINDOW (progress), PROGRESS_DIALOG_WIDTH, -1);
-	gtk_box_pack_start (GTK_BOX (vbox), progress->priv->progress_bar, FALSE, TRUE, 0);
-	/* prevent a resizing of the bar when a real text is inserted later */
-	gtk_progress_bar_set_text (GTK_PROGRESS_BAR (progress->priv->progress_bar), " ");
-
-	titled_label_table = GTK_TABLE (gtk_table_new (3, 2, FALSE));
-	gtk_table_set_row_spacings (titled_label_table, 4);
-	gtk_table_set_col_spacings (titled_label_table, 4);
-
-	create_titled_label (titled_label_table, 0,
-			     &progress->priv->operation_name_label, 
-			     &progress->priv->item_name);
-	create_titled_label (titled_label_table, 1,
-			     &progress->priv->from_label, 
-			     &progress->priv->from_path_label);
-	create_titled_label (titled_label_table, 2,
-			     &progress->priv->to_label, 
-			     &progress->priv->to_path_label);
-
-	gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (titled_label_table), FALSE, FALSE, 0);
-
-	/* Set window icon */
-	gtk_window_set_icon (GTK_WINDOW (progress), empty_jar_pixbuf);
-
-	/* Set progress jar position */
-	progress->priv->progress_jar_position = gdk_pixbuf_get_height (empty_jar_pixbuf);
-
-	gtk_widget_show_all (vbox);
-}
-
-static void
-gnome_egg_xfer_dialog_class_init (GnomeEggXferDialogClass *klass)
-{
-	GObjectClass *gobject_class;
-	GtkObjectClass *object_class;
-	GtkWidgetClass *widget_class;
-	GtkDialogClass *dialog_class;
-
-	gobject_class = G_OBJECT_CLASS (klass);
-	object_class = GTK_OBJECT_CLASS (klass);
-	widget_class = GTK_WIDGET_CLASS (klass);
-	dialog_class = GTK_DIALOG_CLASS (klass);
-
-
-	gobject_class->finalize = gnome_egg_xfer_dialog_finalize;
-	
-	object_class->destroy = gnome_egg_xfer_dialog_destroy;
-
-	/* The progress dialog should not have a title and a close box.
-	 * Some broken window manager themes still show the window title.
-	 * Make clicking the close box do nothing in that case to prevent
-	 * a crash.
-	 */
-	widget_class->delete_event = delete_event_callback;
-	widget_class->map = map_callback;
-
-	dialog_class->close = close_callback;
-
-	/* Load the jar pixbufs */
-	empty_jar_pixbuf = gdk_pixbuf_new_from_inline (-1, progress_jar_empty_icon, FALSE, NULL);
-	full_jar_pixbuf = gdk_pixbuf_new_from_inline (-1, progress_jar_full_icon, FALSE, NULL);
-	
-}
-
-static gboolean
-time_remaining_callback (gpointer callback_data)
-{
-	int elapsed_time;
-	int transfer_rate;
-	int time_remaining;
-	char *str;
-	GnomeEggXferDialog *progress;
-	
-	progress = GNOME_EGG_XFER_DIALOG (callback_data);
-	
-	elapsed_time = (eel_get_system_time () - progress->priv->first_transfer_time) / 1000000;
-
-	if (elapsed_time == 0) {
-		progress->priv->time_remaining_timeout_id =
-			g_timeout_add (TIME_REMAINING_TIMEOUT, time_remaining_callback, progress);
-		
-		return FALSE;
-	}
-	
-	transfer_rate = progress->priv->bytes_copied / elapsed_time;
-
-	if (transfer_rate == 0) {
-		progress->priv->time_remaining_timeout_id =
-			g_timeout_add (TIME_REMAINING_TIMEOUT, time_remaining_callback, progress);
-
-		return FALSE;
-	}
-
-	time_remaining = (progress->priv->bytes_total -
-			  progress->priv->bytes_copied) / transfer_rate;
-
-	if (time_remaining >= 3600) {
-		str = g_strdup_printf (_("(%d:%02d:%d Remaining)"), 
-				       time_remaining / 3600, (time_remaining % 3600) / 60, (time_remaining % 3600) % 60);
-
-	}
-	else {
-		str = g_strdup_printf (_("(%d:%02d Remaining)"), 
-				       time_remaining / 60, time_remaining % 60);
-	}
-	gtk_progress_bar_set_text (GTK_PROGRESS_BAR (progress->priv->progress_bar), str);
-	
-	g_free (str);
-
-	progress->priv->time_remaining_timeout_id =
-		g_timeout_add (TIME_REMAINING_TIMEOUT, time_remaining_callback, progress);
-	
-	return FALSE;
-}
-
-static gboolean
-delayed_show_callback (gpointer callback_data)
-{
-	GnomeEggXferDialog *progress;
-	
-	progress = GNOME_EGG_XFER_DIALOG (callback_data);
-	
-	progress->priv->delayed_show_timeout_id = 0;
-	
-	gtk_widget_show (GTK_WIDGET (progress));
-	
-	return FALSE;
-}
-
-GtkWidget *
-gnome_egg_xfer_dialog_new (const char *title,
-			   const char *operation_string,
-			   const char *from_prefix,
-			   const char *to_prefix,
-			   gulong total_files,
-			   GnomeVFSFileSize total_bytes,
-			   gboolean use_timeout)
-{
-	GtkWidget *widget;
-	GnomeEggXferDialog *progress;
-
-	widget = gtk_widget_new (gnome_egg_xfer_dialog_get_type (), NULL);
-	progress = GNOME_EGG_XFER_DIALOG (widget);
-
-	gnome_egg_xfer_dialog_set_operation_string (progress, operation_string);
-	gnome_egg_xfer_dialog_set_total (progress, total_files, total_bytes);
-
-	gtk_window_set_title (GTK_WINDOW (widget), title);
-	gtk_window_set_wmclass (GTK_WINDOW (widget), "file_progress", "Nautilus");
-
-	gtk_dialog_add_button (GTK_DIALOG (widget), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
-
-	progress->priv->from_prefix = from_prefix;
-	progress->priv->to_prefix = to_prefix;
-
-	if (use_timeout) {
-		progress->priv->start_time = eel_get_system_time ();	
-		progress->priv->delayed_show_timeout_id =
-			g_timeout_add (SHOW_TIMEOUT, delayed_show_callback, progress);
-	}
-	
-	return widget;
-}
-
-void
-gnome_egg_xfer_dialog_set_total (GnomeEggXferDialog *progress,
-					     gulong files_total,
-					     GnomeVFSFileSize bytes_total)
-{
-	g_return_if_fail (GNOME_IS_EGG_XFER_DIALOG (progress));
-
-	progress->priv->files_total = files_total;
-	progress->priv->bytes_total = bytes_total;
-
-	gnome_egg_xfer_dialog_update (progress);
-}
-
-void
-gnome_egg_xfer_dialog_set_operation_string (GnomeEggXferDialog *progress,
-							const char *operation_string)
-{
-	g_return_if_fail (GNOME_IS_EGG_XFER_DIALOG (progress));
-
-	gtk_label_set_text (GTK_LABEL (progress->priv->progress_title_label),
-			    operation_string);
-}
-
-void
-gnome_egg_xfer_dialog_new_file (GnomeEggXferDialog *progress,
-					    const char *progress_verb,
-					    const char *item_name,
-					    const char *from_path,
-					    const char *to_path,
-					    const char *from_prefix,
-					    const char *to_prefix,
-					    gulong file_index,
-					    GnomeVFSFileSize size)
-{
-	char *progress_count;
-
-	g_return_if_fail (GNOME_IS_EGG_XFER_DIALOG (progress));
-
-	progress->priv->from_prefix = from_prefix;
-	progress->priv->to_prefix = to_prefix;
-
-	if (progress->priv->bytes_total > 0) {
-		/* we haven't set up the file count yet, do not update the progress
-		 * count until we do
-		 */
-		gtk_label_set_text (GTK_LABEL (progress->priv->operation_name_label),
-				    progress_verb);
-		set_text_unescaped_trimmed (progress->priv->item_name, item_name);
-
-		progress_count = g_strdup_printf (_("%ld of %ld"),
-						  file_index, 
-						  progress->priv->files_total);
-		gtk_label_set_text (GTK_LABEL (progress->priv->progress_count_label), progress_count);
-		g_free (progress_count);
-
-		gtk_label_set_text (GTK_LABEL (progress->priv->from_label), from_prefix);
-		set_text_unescaped_trimmed (progress->priv->from_path_label, from_path);
-	
-		if (progress->priv->to_prefix != NULL && progress->priv->to_path_label != NULL) {
-			gtk_label_set_text (GTK_LABEL (progress->priv->to_label), to_prefix);
-			set_text_unescaped_trimmed (progress->priv->to_path_label, to_path);
-		}
-
-		if (progress->priv->first_transfer_time == 0) {
-			progress->priv->first_transfer_time = eel_get_system_time ();
-		}
-	}
-
-	gnome_egg_xfer_dialog_update (progress);
-}
-
-void
-gnome_egg_xfer_dialog_clear (GnomeEggXferDialog *progress)
-{
-	gtk_label_set_text (GTK_LABEL (progress->priv->from_label), "");
-	gtk_label_set_text (GTK_LABEL (progress->priv->from_path_label), "");
-	gtk_label_set_text (GTK_LABEL (progress->priv->to_label), "");
-	gtk_label_set_text (GTK_LABEL (progress->priv->to_path_label), "");
-
-	progress->priv->files_total = 0;
-	progress->priv->bytes_total = 0;
-
-	gnome_egg_xfer_dialog_update (progress);
-}
-
-void
-gnome_egg_xfer_dialog_update_sizes (GnomeEggXferDialog *progress,
-						GnomeVFSFileSize bytes_done_in_file,
-						GnomeVFSFileSize bytes_done)
-{
-	g_return_if_fail (GNOME_IS_EGG_XFER_DIALOG (progress));
-
-	progress->priv->bytes_copied = bytes_done;
-
-
-	if (progress->priv->time_remaining_timeout_id == 0) {
-		/* The first time we wait five times as long before
-		 * starting to show the time remaining */
-		progress->priv->time_remaining_timeout_id =
-				g_timeout_add (TIME_REMAINING_TIMEOUT * 5, time_remaining_callback, progress);
-
-	}
-	
-	gnome_egg_xfer_dialog_update (progress);
-}
-
-static gboolean
-delayed_close_callback (gpointer callback_data)
-{
-	GnomeEggXferDialog *progress;
-
-	progress = GNOME_EGG_XFER_DIALOG (callback_data);
-
-	progress->priv->delayed_close_timeout_id = 0;
-	gtk_object_destroy (GTK_OBJECT (progress));
-	return FALSE;
-}
-
-void
-gnome_egg_xfer_dialog_done (GnomeEggXferDialog *progress)
-{
-	guint time_up;
-
-	if (!GTK_WIDGET_MAPPED (progress)) {
-		gtk_object_destroy (GTK_OBJECT (progress));
-		return;
-	}
-	g_assert (progress->priv->start_time != 0);
-
-	/* compute time up in milliseconds */
-	time_up = (eel_get_system_time () - progress->priv->show_time) / 1000;
-	if (time_up >= MINIMUM_TIME_UP) {
-		gtk_object_destroy (GTK_OBJECT (progress));
-		return;
-	}
-	
-	/* No cancel button once the operation is done. */
-	gtk_dialog_set_response_sensitive (GTK_DIALOG (progress), GTK_RESPONSE_CANCEL, FALSE);
-
-	progress->priv->delayed_close_timeout_id = g_timeout_add
-		(MINIMUM_TIME_UP - time_up,
-		 delayed_close_callback,
-		 progress);
-}
-
-void
-gnome_egg_xfer_dialog_pause_timeout (GnomeEggXferDialog *progress)
-{
-	guint time_up;
-
-	if (progress->priv->delayed_show_timeout_id == 0) {
-		progress->priv->remaining_time = 0;
-		return;
-	}
-	
-	time_up = (eel_get_system_time () - progress->priv->start_time) / 1000;
-	
-	if (time_up >= SHOW_TIMEOUT) {
-		progress->priv->remaining_time = 0;
-		return;
-	}
-	
-	g_source_remove (progress->priv->delayed_show_timeout_id);
-	progress->priv->delayed_show_timeout_id = 0;
-	progress->priv->remaining_time = SHOW_TIMEOUT - time_up;
-}
-
-void
-gnome_egg_xfer_dialog_resume_timeout (GnomeEggXferDialog *progress)
-{
-	if (progress->priv->delayed_show_timeout_id != 0) {
-		return;
-	}
-	
-	if (progress->priv->remaining_time <= 0) {
-		return;
-	}
-	
-	progress->priv->delayed_show_timeout_id =
-		g_timeout_add (progress->priv->remaining_time,
-			       delayed_show_callback,
-			       progress);
-			       
-	progress->priv->start_time = eel_get_system_time () - 
-			1000 * (SHOW_TIMEOUT - progress->priv->remaining_time);
-					
-	progress->priv->remaining_time = 0;
-}
diff --git a/gnome-screenshot/gnome-egg-xfer-dialog.h b/gnome-screenshot/gnome-egg-xfer-dialog.h
deleted file mode 100644
index 4eb7f6c..0000000
--- a/gnome-screenshot/gnome-egg-xfer-dialog.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* gnome-egg-xfer-dialog.h - Progress dialog for transfer 
-   operations in the GNOME Desktop File Operation Service.
-
-   Copyright (C) 1999, 2000 Free Software Foundation
-   Copyright (C) 2000, 2001 Eazel Inc.
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with this program; see the file COPYING.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.
-
-   Author: 
-        Ettore Perazzoli <ettore@gnu.org> 
-        Pavel Cisler <pavel@eazel.com>
-*/
-
-#ifndef GNOME_EGG_XFER_DIALOG_H
-#define GNOME_EGG_XFER_DIALOG_H
-
-#include <gtk/gtkdialog.h>
-#include <libgnomevfs/gnome-vfs-file-size.h>
-
-#define GNOME_TYPE_EGG_XFER_DIALOG              (gnome_egg_xfer_dialog_get_type ())
-#define GNOME_EGG_XFER_DIALOG(widget)           (G_TYPE_CHECK_INSTANCE_CAST ((widget), GNOME_TYPE_EGG_XFER_DIALOG, GnomeEggXferDialog))
-#define GNOME_EGG_XFER_DIALOG_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_EGG_XFER_DIALOG, GnomeEggXferDialogClass))
-#define GNOME_IS_EGG_XFER_DIALOG(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_EGG_XFER_DIALOG))
-#define GNOME_IS_EGG_XFER_DIALOG_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_EGG_XFER_DIALOG))
-#define GNOME_EGG_XFER_DIALOG_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_EGG_XFER_DIALOG, GnomeEggXferDialogClass))
-
-typedef struct GnomeEggXferDialogPrivate GnomeEggXferDialogPrivate;
-
-typedef struct
-{
-  GtkDialog dialog;
-  GnomeEggXferDialogPrivate *priv;
-} GnomeEggXferDialog;
-
-typedef struct
-{
-  GtkDialogClass parent_class;
-} GnomeEggXferDialogClass;
-
-GType      gnome_egg_xfer_dialog_get_type             (void);
-GtkWidget *gnome_egg_xfer_dialog_new                  (const char         *title,
-                                                       const char         *operation_string,
-                                                       const char         *from_prefix,
-                                                       const char         *to_prefix,
-                                                       gulong              files_total,
-                                                       GnomeVFSFileSize    bytes_total,
-                                                       gboolean            use_timeout);
-void       gnome_egg_xfer_dialog_done                 (GnomeEggXferDialog *dialog);
-void       gnome_egg_xfer_dialog_set_progress_title   (GnomeEggXferDialog *dialog,
-                                                       const char         *progress_title);
-void       gnome_egg_xfer_dialog_set_total            (GnomeEggXferDialog *dialog,
-                                                       gulong              files_total,
-                                                       GnomeVFSFileSize    bytes_total);
-void       gnome_egg_xfer_dialog_set_operation_string (GnomeEggXferDialog *dialog,
-                                                       const char         *operation_string);
-void       gnome_egg_xfer_dialog_clear                (GnomeEggXferDialog *dialog);
-void       gnome_egg_xfer_dialog_new_file             (GnomeEggXferDialog *dialog,
-                                                       const char         *progress_verb,
-                                                       const char         *item_name,
-                                                       const char         *from_path,
-                                                       const char         *to_path,
-                                                       const char         *from_prefix,
-                                                       const char         *to_prefix,
-                                                       gulong              file_index,
-                                                       GnomeVFSFileSize    size);
-void       gnome_egg_xfer_dialog_update_sizes         (GnomeEggXferDialog *dialog,
-                                                       GnomeVFSFileSize    bytes_done_in_file,
-                                                       GnomeVFSFileSize    bytes_done);
-void       gnome_egg_xfer_dialog_pause_timeout        (GnomeEggXferDialog *progress);
-void       gnome_egg_xfer_dialog_resume_timeout       (GnomeEggXferDialog *progress);
-
-
-
-#endif /* GNOME_EGG_XFER_DIALOG_H */
diff --git a/gnome-screenshot/gnome-screenshot.c b/gnome-screenshot/gnome-screenshot.c
index ab4dfff..6c0a8cc 100644
--- a/gnome-screenshot/gnome-screenshot.c
+++ b/gnome-screenshot/gnome-screenshot.c
@@ -2,6 +2,7 @@
  *
  * Copyright (C) 2001 Jonathan Blandford <jrb@alum.mit.edu>
  * Copyright (C) 2006 Emmanuele Bassi <ebassi@gnome.org>
+ * Copyright (C) 2008 Cosimo Cecchi <cosimoc@gnome.org>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -37,9 +38,8 @@
 #include <errno.h>
 #include <locale.h>
 #include <glib/gi18n.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-#include <libgnomevfs/gnome-vfs-async-ops.h>
-#include <libgnomevfs/gnome-vfs-ops.h>
+#include <gio/gio.h>
+#include <pwd.h>
 #include <X11/Xutil.h>
 
 #include "screenshot-shadow.h"
@@ -71,6 +71,21 @@ typedef enum {
   SCREENSHOT_EFFECT_BORDER
 } ScreenshotEffectType;
 
+typedef enum
+{
+  TEST_LAST_DIR = 0,
+  TEST_DESKTOP = 1,
+  TEST_TMP = 2,
+} TestType;
+
+typedef struct 
+{
+  char *base_uris[3];
+  char *retval;
+  int iteration;
+  TestType type;
+} AsyncExistenceJob;
+
 static GdkPixbuf *screenshot = NULL;
 
 /* Global variables*/
@@ -491,84 +506,6 @@ create_interactive_dialog (void)
   return retval;
 }
 
-/* We assume that uri is valid and has been tested elsewhere
- */
-static char *
-generate_filename_for_uri (const char *uri)
-{
-  char *retval;
-  char *file_name;
-  int i = 1;
-
-  if (window_title)
-    {
-      /* translators: this is the name of the file that gets made up
-       * with the screenshot if a specific window is taken */
-      file_name = g_strdup_printf (_("Screenshot-%s.png"), window_title);
-    }
-  else
-    {
-      /* translators: this is the name of the file that gets made up
-       * with the screenshot if the entire screen is taken */
-      file_name = g_strdup (_("Screenshot.png"));
-    }
-
-  retval = g_build_filename (uri, file_name, NULL);
-  g_free (file_name);
-
-  do
-    {
-      GnomeVFSFileInfo *info;
-      GnomeVFSResult result;
-
-      info = gnome_vfs_file_info_new ();
-      result = gnome_vfs_get_file_info (retval, info,
-                                        GNOME_VFS_FILE_INFO_DEFAULT |
-                                        GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
-      gnome_vfs_file_info_unref (info);
-
-      switch (result)
-	{
-	case GNOME_VFS_ERROR_NOT_FOUND:
-	  return retval;
-	case GNOME_VFS_OK:
-	  g_free (retval);
-	  break;
-	case GNOME_VFS_ERROR_PROTOCOL_ERROR:
-	  /* try again?  I'm getting these errors sporadically */
-	default:
-	  g_warning ("ERROR: %s:%s\n",
-                     retval,
-                     gnome_vfs_result_to_string (result));
-	  g_free (retval);
-	  return NULL;
-	}
-
-      /* We had a hit.  We need to make a new file */
-      if (window_title)
-	{
-	  /* translators: this is the name of the file that gets
-	   * made up with the screenshot if a specific window is
-	   * taken */
-	  file_name = g_strdup_printf (_("Screenshot-%s-%d.png"),
-				       window_title, i);
-	}
-      else
-	{
-	  /* translators: this is the name of the file that gets
-	   * made up with the screenshot if the entire screen is
-	   * taken */
-	  file_name = g_strdup_printf (_("Screenshot-%d.png"), i);
-	}
-
-      retval = g_build_filename (uri, file_name, NULL);
-      g_free (file_name);
-
-      i++;
-    }
-  while (TRUE);
-}
-
 static void
 save_folder_to_gconf (ScreenshotDialog *dialog)
 {
@@ -586,37 +523,95 @@ save_folder_to_gconf (ScreenshotDialog *dialog)
   g_object_unref (gconf_client);
 }
 
-static gboolean
-try_to_save (ScreenshotDialog *dialog,
-	     const char       *target)
+static void
+error_dialog_response_cb (GtkDialog *d,
+                          gint response,
+                          ScreenshotDialog *dialog)
 {
-  GnomeVFSResult result;
-  GnomeVFSURI *source_uri;
-  GnomeVFSURI *target_uri;
-
-  g_assert (temporary_file);
-
-  screenshot_dialog_set_busy (dialog, TRUE);
-
-  source_uri = gnome_vfs_uri_new (temporary_file);
-  target_uri = gnome_vfs_uri_new (target);
-
-  result = screenshot_xfer_uri (source_uri,
-				target_uri,
-				screenshot_dialog_get_toplevel (dialog));
-
-  gnome_vfs_uri_unref (source_uri);
-  gnome_vfs_uri_unref (target_uri);
+  gtk_widget_destroy (GTK_WIDGET (d));
+  
+  screenshot_dialog_focus_entry (dialog);
+}
 
+static void
+save_callback (TransferResult result,
+               char *error_message,
+               gpointer data)
+{
+  ScreenshotDialog *dialog = data;
+  GtkWidget *toplevel;
+  
+  toplevel = screenshot_dialog_get_toplevel (dialog);
   screenshot_dialog_set_busy (dialog, FALSE);
 
-  if (result == GNOME_VFS_OK)
+  if (result == TRANSFER_OK)
     {
       save_folder_to_gconf (dialog);
-      return TRUE;
+      gtk_widget_destroy (toplevel);
+      
+      /* we're done, stop the mainloop now */
+      gtk_main_quit ();
     }
+  else if (result == TRANSFER_OVERWRITE ||
+           result == TRANSFER_CANCELLED)
+    {
+      /* user has canceled the overwrite dialog or the transfer itself, let him
+       * choose another name.
+       */
+      screenshot_dialog_focus_entry (dialog);
+    }
+  else /* result == TRANSFER_ERROR */
+    {
+      /* we had an error, display a dialog to the user and let him choose
+       * another name/location to save the screenshot.
+       */
+      GtkWidget *error_dialog;
+      char *uri;
+      
+      uri = screenshot_dialog_get_uri (dialog);
+      error_dialog = gtk_message_dialog_new (GTK_WINDOW (toplevel),
+                                       GTK_DIALOG_DESTROY_WITH_PARENT,
+                                       GTK_MESSAGE_ERROR,
+                                       GTK_BUTTONS_OK,
+                                       _("Error while saving screenshot"),
+                                       NULL);
+      /* translators: first %s is the file path, second %s is the VFS error */
+      gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (error_dialog),
+                                                _("Impossible to save the screenshot "
+                                                  "to %s.\n Error was %s\n. Please choose another "
+                                                  "location and retry."), uri, error_message);
+      gtk_widget_show (error_dialog);
+      g_signal_connect (error_dialog,
+                        "response",
+                        G_CALLBACK (error_dialog_response_cb),
+                        dialog);
+
+      g_free (uri);
+    }
+      
+}
 
-  return FALSE;
+static void
+try_to_save (ScreenshotDialog *dialog,
+	     const char       *target)
+{
+  GFile *source_file, *target_file;
+
+  g_assert (temporary_file);
+
+  screenshot_dialog_set_busy (dialog, TRUE);
+
+  source_file = g_file_new_for_path (temporary_file);
+  target_file = g_file_new_for_uri (target);
+  
+  screenshot_xfer_uri (source_file,
+                       target_file,
+                       screenshot_dialog_get_toplevel (dialog),
+                       save_callback, dialog);
+  
+  /* screenshot_xfer_uri () holds a ref, so we can unref now */
+  g_object_unref (source_file);
+  g_object_unref (target_file);
 }
 
 static void
@@ -637,54 +632,61 @@ save_done_notification (gpointer data)
 }
 
 static void
-run_dialog (ScreenshotDialog *dialog)
+screenshot_dialog_response_cb (GtkDialog *d,
+                               gint response_id,
+                               ScreenshotDialog *dialog)
 {
-  GtkWidget *toplevel;
-  int result;
-  int keep_going;
   char *uri;
 
-  toplevel = screenshot_dialog_get_toplevel (dialog);
-
-  do
+  if (response_id == GTK_RESPONSE_HELP)
     {
-      keep_going = FALSE;
-      result = gtk_dialog_run (GTK_DIALOG (toplevel));
-      switch (result)
-	{
-	case GTK_RESPONSE_HELP:
-	  display_help (GTK_WINDOW (toplevel));
-	  keep_going = TRUE;
-	  break;
-	case GTK_RESPONSE_OK:
-	  uri = screenshot_dialog_get_uri (dialog);
-	  if (temporary_file == NULL)
-	    {
-	      save_immediately = TRUE;
-	      screenshot_dialog_set_busy (dialog, TRUE);
-	      keep_going = TRUE;
-	    }
-	  else
-	    {
-	      /* We've saved the temporary file.  Lets try to copy it to the
-	       * correct location */
-	      if (! try_to_save (dialog, uri))
-		keep_going = TRUE;
-	    }
-	  break;
-	default:
-	  break;
-	}
+      display_help (GTK_WINDOW (d));
+    }
+  else if (response_id == GTK_RESPONSE_OK)
+    {
+      uri = screenshot_dialog_get_uri (dialog);
+      if (temporary_file == NULL)
+        {
+          save_immediately = TRUE;
+          screenshot_dialog_set_busy (dialog, TRUE);
+        }
+      else
+        {
+          /* we've saved the temporary file, lets try to copy it to the
+           * correct location.
+           */
+          try_to_save (dialog, uri);
+        }
+      g_free (uri);
+    }
+  else /* dialog was canceled */
+    {
+      gtk_widget_destroy (GTK_WIDGET (d));
+      gtk_main_quit ();
     }
-  while (keep_going);
 }
+                               
 
 static void
-prepare_screenshot (void)
+run_dialog (ScreenshotDialog *dialog)
 {
+  GtkWidget *toplevel;
+
+  toplevel = screenshot_dialog_get_toplevel (dialog);
+  
+  gtk_widget_show (toplevel);
+  
+  g_signal_connect (toplevel,
+                    "response",
+                    G_CALLBACK (screenshot_dialog_response_cb),
+                    dialog);
+}
+
+static void
+finish_prepare_screenshot (char *initial_uri)
+{  
   ScreenshotDialog *dialog;
   Window win;
-  char *initial_uri;
 
   if (!screenshot_grab_lock ())
     exit (0);
@@ -739,41 +741,168 @@ prepare_screenshot (void)
       exit (1);
     }
 
+  dialog = screenshot_dialog_new (screenshot, initial_uri, take_window_shot);
+  g_free (initial_uri);
 
-  /* If uri isn't local, we should do this async before taking the sshot */
-  initial_uri = generate_filename_for_uri (last_save_dir);
-  if (initial_uri == NULL)
-    {
-      gchar *desktop_dir;
+  screenshot_save_start (screenshot, save_done_notification, dialog);
 
-      /* We failed to make a new name for the last save dir. We try again
-       * with our Desktop directory.
-       */
-      desktop_dir = get_desktop_dir ();
-      initial_uri = generate_filename_for_uri (desktop_dir);
-      g_free (desktop_dir);
-    }
+  run_dialog (dialog);
+}
+
+static gboolean
+check_file_done (gpointer user_data)
+{
+  char *retval;
+  AsyncExistenceJob *job = user_data;
+
+  retval = job->retval;
+  g_free (job->base_uris[1]);
+  g_slice_free (AsyncExistenceJob, job);
+  
+  finish_prepare_screenshot (retval);
+  
+  return FALSE;
+}
 
-  /* desperate fallback: /tmp */
-  if (initial_uri == NULL)
+static char *
+build_uri (AsyncExistenceJob *job)
+{
+  char *retval, *file_name;
+
+  if (window_title)
     {
-      const gchar *tmp_dir = g_get_tmp_dir ();
-      initial_uri = generate_filename_for_uri (tmp_dir);
+      /* translators: this is the name of the file that gets made up
+       * with the screenshot if a specific window is taken */
+      if (job->iteration == 0)
+        {
+          file_name = g_strdup_printf (_("Screenshot-%s.png"), window_title);
+        }
+      else
+        {
+          /* translators: this is the name of the file that gets
+           * made up with the screenshot if a specific window is
+           * taken */
+          file_name = g_strdup_printf (_("Screenshot-%s-%d.png"),
+                                       window_title, job->iteration);
+        }
+    }
+  else
+    {
+      if (job->iteration == 0)
+        {
+          /* translators: this is the name of the file that gets made up
+           * with the screenshot if the entire screen is taken */
+          file_name = g_strdup (_("Screenshot.png"));
+        }
+      else
+        {
+          /* translators: this is the name of the file that gets
+           * made up with the screenshot if the entire screen is
+           * taken */
+          file_name = g_strdup_printf (_("Screenshot-%d.png"), job->iteration);
+        }
     }
 
-  dialog = screenshot_dialog_new (screenshot, initial_uri, take_window_shot);
-  g_free (initial_uri);
+  retval = g_build_filename (job->base_uris[job->type], file_name, NULL);
+  g_free (file_name);
+  
+  return retval;
+}
 
-  screenshot_save_start (screenshot, save_done_notification, dialog);
+static gboolean
+try_check_file (GIOSchedulerJob *io_job,
+                GCancellable *cancellable,
+                gpointer data)
+{
+  AsyncExistenceJob *job = data;
+  GFile *file;
+  GFileInfo *info;
+  GError *error;
+  char *uri;
 
-  run_dialog (dialog);
+retry:
+  error = NULL;
+  uri = build_uri (job);
+  file = g_file_new_for_uri (uri);
+  
+  info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE,
+			    G_FILE_QUERY_INFO_NONE, cancellable, &error);
+  if (info != NULL)
+    {
+      /* file already exists, iterate again */
+      g_object_unref (info);
+      g_object_unref (file);
+      (job->iteration)++;
+
+      goto retry;
+    }
+  else
+    {
+      /* see the error to check whether the location is not accessible
+       * or the file does not exist.
+       */
+      if (error->code == G_IO_ERROR_NOT_FOUND)
+        {
+          job->retval = uri;
+          goto out;
+        }
+      else
+        {
+          /* another kind of error, assume this location is not
+           * accessible.
+           */
+          g_free (uri);
+          if (job->type == TEST_TMP)
+            {
+              job->retval = NULL;
+              goto out;
+            }
+          else
+            {
+              (job->type)++;
+              job->iteration = 0;
+
+              g_error_free (error);
+              g_object_unref (file);
+              goto retry;
+            }
+        }
+    }
+
+out:
+  g_error_free (error);
+  g_object_unref (file);
+    
+  g_io_scheduler_job_send_to_mainloop_async (io_job,
+                                             check_file_done,
+                                             job,
+                                             NULL);
+  return FALSE;
+}
 
+static void
+prepare_screenshot (void)
+{
+  AsyncExistenceJob *job;
+  
+  job = g_slice_new0 (AsyncExistenceJob);
+  job->base_uris[0] = last_save_dir;
+  /* we'll have to free this */
+  job->base_uris[1] = get_desktop_dir ();
+  job->base_uris[2] = (char *) g_get_tmp_dir ();
+  job->iteration = 0;
+  job->type = TEST_LAST_DIR;
+
+  g_io_scheduler_push_job (try_check_file,
+                           job,
+                           NULL,
+                           0, NULL);
+                           
 }
 
 static gboolean
 prepare_screenshot_timeout (gpointer data)
 {
-  gtk_main_quit ();
   prepare_screenshot ();
 
   return FALSE;
@@ -801,6 +930,36 @@ get_desktop_dir (void)
   return desktop_dir;
 }
 
+/* Taken from gnome-vfs-utils.c */
+static char *
+expand_initial_tilde (const char *path)
+{
+  char *slash_after_user_name, *user_name;
+  struct passwd *passwd_file_entry;
+
+  if (path[1] == '/' || path[1] == '\0') {
+    return g_strconcat (g_get_home_dir (), &path[1], NULL);
+  }
+  
+  slash_after_user_name = strchr (&path[1], '/');
+  if (slash_after_user_name == NULL) {
+    user_name = g_strdup (&path[1]);
+  } else {
+    user_name = g_strndup (&path[1],
+                           slash_after_user_name - &path[1]);
+  }
+  passwd_file_entry = getpwnam (user_name);
+  g_free (user_name);
+  
+  if (passwd_file_entry == NULL || passwd_file_entry->pw_dir == NULL) {
+    return g_strdup (path);
+  }
+  
+  return g_strconcat (passwd_file_entry->pw_dir,
+                      slash_after_user_name,
+                      NULL);
+}
+
 /* Load options */
 static void
 load_options (void)
@@ -823,7 +982,7 @@ load_options (void)
     }
   else if (last_save_dir[0] == '~')
     {
-      char *tmp = gnome_vfs_expand_initial_tilde (last_save_dir);
+      char *tmp = expand_initial_tilde (last_save_dir);
       g_free (last_save_dir);
       last_save_dir = tmp;
     }
@@ -865,12 +1024,8 @@ register_screenshooter_icon (GtkIconFactory * factory)
 static void
 screenshooter_init_stock_icons (void)
 {
-  GtkIconFactory * factory;
-  GtkIconSize screenshooter_icon_size;
+  GtkIconFactory *factory;
 
-  screenshooter_icon_size = gtk_icon_size_register ("panel-menu", 
-	                                            GTK_ICON_SIZE_DIALOG,
-	                                            GTK_ICON_SIZE_DIALOG);
   factory = gtk_icon_factory_new ();
   gtk_icon_factory_add_default (factory);
 
@@ -916,8 +1071,6 @@ main (int argc, char *argv[])
   g_option_context_set_help_enabled (context, TRUE);
   g_option_context_set_main_group (context, group);
 
-  gnome_authentication_manager_init ();
-
   program = gnome_program_init ("gnome-screenshot", VERSION,
 				LIBGNOMEUI_MODULE,
 				argc, argv,
@@ -974,13 +1127,15 @@ main (int argc, char *argv[])
       g_timeout_add (delay * 1000,
 		     prepare_screenshot_timeout,
 		     NULL);
-      gtk_main ();
     }
   else
     {
-      prepare_screenshot ();
+      /* start this in an idle anyway and fire up the mainloop */
+      g_idle_add (prepare_screenshot_timeout, NULL);
     }
 
+  gtk_main ();
+
   g_object_unref (program);
 
   return EXIT_SUCCESS;
diff --git a/gnome-screenshot/screenshot-dialog.c b/gnome-screenshot/screenshot-dialog.c
index 9cccd05..4c2dea0 100644
--- a/gnome-screenshot/screenshot-dialog.c
+++ b/gnome-screenshot/screenshot-dialog.c
@@ -1,14 +1,32 @@
+/* screenshot-dialog.c - main GNOME Screenshot dialog
+ *
+ * Copyright (C) 2001-2006  Jonathan Blandford <jrb@alum.mit.edu>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ */
+
 #include <config.h>
 #include <string.h>
 #include <stdlib.h>
 
 #include "screenshot-dialog.h"
 #include "screenshot-save.h"
-#include <libgnomevfs/gnome-vfs.h>
 #include <gdk/gdkkeysyms.h>
 #include <glib/gi18n.h>
 #include <glade/glade.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
+#include <gio/gio.h>
 
 enum {
   TYPE_IMAGE_PNG,
@@ -195,16 +213,16 @@ screenshot_dialog_new (GdkPixbuf *screenshot,
   char *current_name;
   char *ext;
   gint pos;
-  GnomeVFSURI *tmp_uri;
-  GnomeVFSURI *parent_uri;
+  GFile *tmp_file;
+  GFile *parent_file;
 
-  tmp_uri = gnome_vfs_uri_new (initial_uri);
-  parent_uri = gnome_vfs_uri_get_parent (tmp_uri);
+  tmp_file = g_file_new_for_uri (initial_uri);
+  parent_file = g_file_get_parent (tmp_file);
 
-  current_name = gnome_vfs_uri_extract_short_name (tmp_uri);
-  current_folder = gnome_vfs_uri_to_string (parent_uri, GNOME_VFS_URI_HIDE_NONE);
-  gnome_vfs_uri_unref (tmp_uri);
-  gnome_vfs_uri_unref (parent_uri);
+  current_name = g_file_get_basename (tmp_file);
+  current_folder = g_file_get_uri (parent_file);
+  g_object_unref (tmp_file);
+  g_object_unref (parent_file);
 
   dialog = g_new0 (ScreenshotDialog, 1);
 
@@ -287,6 +305,12 @@ screenshot_dialog_new (GdkPixbuf *screenshot,
 }
 
 void
+screenshot_dialog_focus_entry (ScreenshotDialog *dialog)
+{
+  gtk_widget_grab_focus (dialog->filename_entry);
+}
+
+void
 screenshot_dialog_enable_dnd (ScreenshotDialog *dialog)
 {
   GtkWidget *preview_darea;
@@ -329,7 +353,7 @@ screenshot_dialog_get_uri (ScreenshotDialog *dialog)
       tmp = g_strdup (_("Screenshot.png"));
     }
 
-  file = gnome_vfs_escape_host_and_path_string (tmp);
+  file = g_uri_escape_string (tmp, NULL, FALSE);
   uri = g_build_filename (folder, file, NULL);
 
   g_free (folder);
diff --git a/gnome-screenshot/screenshot-dialog.h b/gnome-screenshot/screenshot-dialog.h
index f3d2546..bb731a9 100644
--- a/gnome-screenshot/screenshot-dialog.h
+++ b/gnome-screenshot/screenshot-dialog.h
@@ -1,3 +1,22 @@
+/* screenshot-dialog.h - main GNOME Screenshot dialog
+ *
+ * Copyright (C) 2001-2006  Jonathan Blandford <jrb@alum.mit.edu>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ */
+
 #ifndef __SCREENSHOT_DIALOG_H__
 #define __SCREENSHOT_DIALOG_H__
 
@@ -15,4 +34,5 @@ char             *screenshot_dialog_get_uri      (ScreenshotDialog *dialog);
 char             *screenshot_dialog_get_folder   (ScreenshotDialog *dialog);
 void              screenshot_dialog_set_busy     (ScreenshotDialog *dialog,
 						  gboolean          busy);
+void              screenshot_dialog_focus_entry  (ScreenshotDialog *dialog);
 #endif /* __SCREENSHOT_DIALOG_H__ */
diff --git a/gnome-screenshot/screenshot-save.c b/gnome-screenshot/screenshot-save.c
index 3b4ae59..a57c435 100644
--- a/gnome-screenshot/screenshot-save.c
+++ b/gnome-screenshot/screenshot-save.c
@@ -18,12 +18,12 @@
  */
 
 #include <config.h>
-#include <gnome.h>
+#include <stdlib.h>
+#include <unistd.h>
 #include <errno.h>
 #include <signal.h>
 #include <string.h>
 #include <glib/gi18n.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
 
 #include "screenshot-save.h"
 
@@ -271,7 +271,9 @@ screenshot_sanitize_filename (const char *filename)
   g_assert (filename);
   g_assert (g_utf8_validate (filename, -1, NULL));
 
-  retval = gnome_vfs_escape_host_and_path_string (filename);
+  retval = g_uri_escape_string (filename,
+                                NULL,
+                                TRUE);
 
   for (p = retval; *p != '\000'; p = g_utf8_next_char (p))
     {
diff --git a/gnome-screenshot/screenshot-shadow.c b/gnome-screenshot/screenshot-shadow.c
index eddfed2..2daddaa 100644
--- a/gnome-screenshot/screenshot-shadow.c
+++ b/gnome-screenshot/screenshot-shadow.c
@@ -1,3 +1,22 @@
+/* screenshot-shadow.c - part of GNOME Screenshot
+ *
+ * Copyright (C) 2001-2006  Jonathan Blandford <jrb@alum.mit.edu>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ */
+
 /* Shadow code from anders */
 
 #include "screenshot-shadow.h"
diff --git a/gnome-screenshot/screenshot-shadow.h b/gnome-screenshot/screenshot-shadow.h
index 28b1543..cac37db 100644
--- a/gnome-screenshot/screenshot-shadow.h
+++ b/gnome-screenshot/screenshot-shadow.h
@@ -1,3 +1,22 @@
+/* screenshot-shadow.h - part of GNOME Screenshot
+ *
+ * Copyright (C) 2001-2006  Jonathan Blandford <jrb@alum.mit.edu>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ */
+
 #ifndef __SCREENSHOT_SHADOW_H__
 #define __SCREENSHOT_SHADOW_H__
 
diff --git a/gnome-screenshot/screenshot-xfer.c b/gnome-screenshot/screenshot-xfer.c
index 349076d..ada2991 100644
--- a/gnome-screenshot/screenshot-xfer.c
+++ b/gnome-screenshot/screenshot-xfer.c
@@ -1,189 +1,82 @@
+/* screenshot-xfer.c - file transfer functions for GNOME Screenshot
+ *
+ * Copyright (C) 2001-2006  Jonathan Blandford <jrb@alum.mit.edu>
+ * Copyright (C) 2008  Cosimo Cecchi <cosimoc@gnome.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ */
+
 #include "config.h"
 
 #include "screenshot-xfer.h"
-#include "gnome-egg-xfer-dialog.h"
 
 #include <time.h>
 #include <glib/gi18n.h>
 
 typedef struct
 {
-  GnomeVFSAsyncHandle *handle;
-  const char *operation_title;	/* "Copying files" */
-  const char *action_label;	/* "Files copied:" */
-  const char *progress_verb;	/* "Copying" */
-  const char *preparation_name;	/* "Preparing To Copy..." */
-  const char *cleanup_name;	/* "Finishing Move..." */
-  GtkWidget *parent_dialog;
-  GtkWidget *progress_dialog;
-  gboolean delete_target;
-  guint timeout_id;
-  gboolean canceled;
-} TransferInfo;
-
-static gboolean show_dialog_timeout (TransferInfo *transfer_info);
-
-static void
-remove_timeout (TransferInfo *transfer_info)
-{
-  g_assert (transfer_info);
-
-  if (transfer_info->timeout_id)
-    {
-      g_source_remove (transfer_info->timeout_id);
-      transfer_info->timeout_id = 0;
-    }
-}
-
-static void
-add_timeout (TransferInfo *transfer_info)
-{
-  if (transfer_info->timeout_id == 0)
-    transfer_info->timeout_id = g_timeout_add (1000, (GSourceFunc) show_dialog_timeout, transfer_info);
-}
+  GtkWidget *dialog;
+  GtkWidget *progress_bar;
+  GCancellable *cancellable;
+} TransferDialog;
 
-static GtkWidget *
-transfer_info_get_parent (TransferInfo *transfer_info)
+typedef struct
 {
-  g_assert (transfer_info);
-
-  if (transfer_info->progress_dialog)
-    return transfer_info->progress_dialog;
-  if (transfer_info->parent_dialog)
-    return transfer_info->parent_dialog;
-  return NULL;
-}
+  GFile *source;
+  GFile *dest;
+  GFileCopyFlags flags;
+  TransferCallback callback;
+  gpointer callback_data;
+  GCancellable *cancellable;
+  GtkWidget *parent;
+  TransferDialog *dialog;
+  TransferResult result;
+  GIOSchedulerJob *io_job;
+  char *error;
+  gint dialog_timeout_id;
+  goffset total_bytes;
+  goffset current_bytes;
+} TransferJob;
 
-static int
-handle_transfer_ok (const GnomeVFSXferProgressInfo *progress_info,
-		    TransferInfo                   *transfer_info)
+typedef struct
 {
-  if (transfer_info->canceled
-      && progress_info->phase != GNOME_VFS_XFER_PHASE_COMPLETED)
-    {
-      /* If cancelled, delete any partially copied files that are laying
-       * around and return. Don't delete the source though..
-       */
-      if (progress_info->target_name != NULL
-	  && progress_info->source_name != NULL
-	  && strcmp (progress_info->source_name, progress_info->target_name) != 0
-	  && progress_info->bytes_total != progress_info->bytes_copied)
-	{
-	  transfer_info->delete_target = TRUE;
-	}
-
-      gtk_main_quit ();
-      return 0;
-    }
-
-  if (progress_info->phase == GNOME_VFS_XFER_PHASE_COMPLETED)
-    {
-      remove_timeout (transfer_info);
-      if (transfer_info->progress_dialog)
-	{
-	  gtk_widget_destroy (transfer_info->progress_dialog);
-	  transfer_info->progress_dialog = NULL;
-	}
-      gtk_main_quit ();
-      return 0;
-    }
-
-  /* Update the dialog, if need be */
-  if (transfer_info->progress_dialog == NULL)
-    return 1;
-
-  switch (progress_info->phase)
-    {
-      /* Initial phase */
-    case GNOME_VFS_XFER_PHASE_INITIAL:
-      /* Checking if destination can handle move/copy */
-      return 1;
-    case GNOME_VFS_XFER_PHASE_COLLECTING:
-    case GNOME_VFS_XFER_CHECKING_DESTINATION:
-      gnome_egg_xfer_dialog_set_operation_string (GNOME_EGG_XFER_DIALOG (transfer_info->progress_dialog),
-						  _("Preparing to copy"));
-      return 1;
-    case GNOME_VFS_XFER_PHASE_READYTOGO:
-      gnome_egg_xfer_dialog_set_operation_string
-	(GNOME_EGG_XFER_DIALOG (transfer_info->progress_dialog),
-	 transfer_info->action_label);
-      gnome_egg_xfer_dialog_set_total
-	(GNOME_EGG_XFER_DIALOG (transfer_info->progress_dialog),
-	 progress_info->files_total,
-	 progress_info->bytes_total);
-      return 1;
-    case GNOME_VFS_XFER_PHASE_OPENSOURCE:
-    case GNOME_VFS_XFER_PHASE_OPENTARGET:
-    case GNOME_VFS_XFER_PHASE_COPYING:
-    case GNOME_VFS_XFER_PHASE_WRITETARGET:
-    case GNOME_VFS_XFER_PHASE_CLOSETARGET:
-      if (progress_info->bytes_copied == 0)
-	{
-	}
-      else
-	{
-	  gnome_egg_xfer_dialog_update_sizes
-	    (GNOME_EGG_XFER_DIALOG (transfer_info->progress_dialog),
-	     MIN (progress_info->bytes_copied, 
-		  progress_info->bytes_total),
-	     MIN (progress_info->total_bytes_copied,
-		  progress_info->bytes_total));
-	}
-      return 1;
-    case GNOME_VFS_XFER_PHASE_FILECOMPLETED:
-    case GNOME_VFS_XFER_PHASE_CLEANUP:
-      return 1;
-      /* Phases we don't expect to see */
-    case GNOME_VFS_XFER_PHASE_COMPLETED:
-    case GNOME_VFS_XFER_PHASE_SETATTRIBUTES:
-    case GNOME_VFS_XFER_PHASE_CLOSESOURCE:
-    case GNOME_VFS_XFER_PHASE_MOVING:
-    case GNOME_VFS_XFER_PHASE_DELETESOURCE:
-    case GNOME_VFS_XFER_PHASE_READSOURCE:
-    default:
-      g_print ("Unexpected phase (%d) hit\n", progress_info->phase);
-      g_assert_not_reached ();
-      return 0;
-    }
-  return 1;
-}
+  int resp;
+  GtkWidget *parent;
+  char *basename;
+} ErrorDialogData;
 
-static gint
-handle_transfer_vfs_error (GnomeVFSXferProgressInfo *progress_info,
-			   TransferInfo             *transfer_info)
-{
-  g_print ("handle_transfer_vfs_error!\n");
-  remove_timeout (transfer_info);
-  if (transfer_info->progress_dialog)
-    {
-      gtk_widget_destroy (transfer_info->progress_dialog);
-      transfer_info->progress_dialog = NULL;
-    }
-  gtk_main_quit ();
-  return 1;
-}
+static goffset total_size = 0;
 
-static int
-handle_transfer_overwrite (const GnomeVFSXferProgressInfo *progress_info,
-			   TransferInfo                   *transfer_info)
+static gboolean
+do_run_overwrite_confirm_dialog (gpointer _data)
 {
+  ErrorDialogData *data = _data;
   GtkWidget *dialog;
   gint response;
-  gint need_timeout;
-
-  need_timeout = (transfer_info->timeout_id > 0);
-  remove_timeout (transfer_info);
 
-  /* We need to ask the user if they want to overrwrite this file */
-  dialog = gtk_message_dialog_new (GTK_WINDOW (transfer_info_get_parent (transfer_info)),
-				   GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
+  /* we need to ask the user if they want to overwrite this file */
+  dialog = gtk_message_dialog_new (GTK_WINDOW (data->parent),
+				   GTK_DIALOG_DESTROY_WITH_PARENT,
 				   GTK_MESSAGE_QUESTION,
 				   GTK_BUTTONS_NONE,
 				   _("File already exists"));
 
   gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-					    _("The file \"%s\" already exists.  Would you like to replace it?"), 
-					    progress_info->target_name);
+					    _("The file \"%s\" already exists. "
+                                              "Would you like to replace it?"), 
+					    data->basename);
   gtk_dialog_add_button (GTK_DIALOG (dialog),
 			 GTK_STOCK_CANCEL,
 			 GTK_RESPONSE_CANCEL);
@@ -193,91 +86,312 @@ handle_transfer_overwrite (const GnomeVFSXferProgressInfo *progress_info,
 
   response = gtk_dialog_run (GTK_DIALOG (dialog));
   gtk_widget_destroy (dialog);
-  if (response == GTK_RESPONSE_OK)
-    return GNOME_VFS_XFER_OVERWRITE_ACTION_REPLACE;
-  else
-    return GNOME_VFS_XFER_OVERWRITE_ACTION_SKIP;
 
+  data->resp = response;
+  
+  return FALSE;
+}
+
+static void
+transfer_dialog_response_cb (GtkDialog *d,
+                             gint response,
+                             GCancellable *cancellable)
+{
+  if (response == GTK_RESPONSE_CANCEL)
+    {
+      if (!g_cancellable_is_cancelled (cancellable))
+        {
+          g_cancellable_cancel (cancellable);
+        }
+    }
+}
+
+static gboolean
+transfer_progress_dialog_new (TransferJob *job)
+{
+  TransferDialog *dialog;
+  GtkWidget *gdialog;
+  GtkWidget *widget;
+  
+  dialog = g_new0 (TransferDialog, 1);
+  
+  gdialog = gtk_message_dialog_new (GTK_WINDOW (job->parent),
+                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_OTHER,
+                                    GTK_BUTTONS_CANCEL,
+                                    _("Saving file..."),
+                                    NULL);
+  widget = gtk_progress_bar_new ();
+  gtk_box_pack_start (GTK_BOX (GTK_MESSAGE_DIALOG (gdialog)->label->parent),
+                      widget, FALSE, 0, 0);
+  gtk_widget_show (widget);
+  dialog->progress_bar = widget;
+  dialog->dialog = gdialog;
+  
+  g_signal_connect (gdialog,
+                    "response",
+                    G_CALLBACK (transfer_dialog_response_cb),
+                    job->cancellable);
+
+  job->dialog = dialog;
+  gtk_widget_show (gdialog);
+  
+  return FALSE;
+}
+
+static void
+transfer_progress_dialog_start (TransferJob *job)
+{
+  /* sends to the mainloop and schedules show */
+  if (job->dialog_timeout_id == 0)
+    job->dialog_timeout_id = g_timeout_add_seconds (1,
+                                                    (GSourceFunc) transfer_progress_dialog_new,
+                                                    job);
+}
+
+static int
+run_overwrite_confirm_dialog (TransferJob *job)
+{
+  ErrorDialogData *data;
+  gboolean need_timeout;
+  int response;
+  char *basename;
+
+  basename = g_file_get_basename (job->dest);
+
+  data = g_slice_new0 (ErrorDialogData);
+  data->parent = job->parent;
+  data->basename = basename;
+
+  need_timeout = (job->dialog_timeout_id > 0);
+  
   if (need_timeout)
-    add_timeout (transfer_info);
+    {
+      g_source_remove (job->dialog_timeout_id);
+      job->dialog_timeout_id = 0;
+    } 
+
+  g_io_scheduler_job_send_to_mainloop (job->io_job,
+                                       do_run_overwrite_confirm_dialog,
+                                       data,
+                                       NULL);
+  response = data->resp;
+
+  if (need_timeout)
+    transfer_progress_dialog_start (job);
+  
+  g_free (basename);
+  g_slice_free (ErrorDialogData, data);
+
+  return response;                                       
 }
 
-static gint
-handle_transfer_duplicate (GnomeVFSXferProgressInfo *progress_info,
-			   TransferInfo             *transfer_info)
+static gboolean
+transfer_progress_dialog_update (TransferJob *job)
 {
-  g_print ("handle_transfer_duplicate!\n");
-  return 1;
+  TransferDialog *dialog = job->dialog;
+  double fraction;
+  
+  fraction = ((double) job->current_bytes) / ((double) job->total_bytes);
+
+  gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (dialog->progress_bar),
+                                 fraction);
+  
+  return FALSE;
 }
 
-static gint
-screenshot_async_xfer_progress (GnomeVFSAsyncHandle      *handle,
-				GnomeVFSXferProgressInfo *progress_info,
-				gpointer                  data)
+static gboolean
+transfer_job_done (gpointer user_data)
 {
-  TransferInfo *transfer_info = data;
+  TransferJob *job = user_data;
+  TransferDialog *dialog;
+  
+  dialog = job->dialog;
+  
+  if (job->dialog_timeout_id)
+    {
+      g_source_remove (job->dialog_timeout_id);
+      job->dialog_timeout_id = 0;
+    }
+  if (dialog)
+      gtk_widget_destroy (dialog->dialog);
+  
+  if (job->callback)
+    {
+      (job->callback) (job->result,
+                       job->error,
+                       job->callback_data);
+    }
+  
+  g_object_unref (job->source);
+  g_object_unref (job->dest);
+  g_object_unref (job->cancellable);
+
+  g_free (dialog);
+  g_free (job->error);
+  g_slice_free (TransferJob, job);
+  
+  return FALSE;
+}
 
-  switch (progress_info->status)
+static void
+transfer_progress_cb (goffset current_num_bytes,
+                      goffset total_num_bytes,
+                      TransferJob *job)
+{  
+  job->current_bytes = current_num_bytes;
+
+  if (!job->dialog)
+    return;
+   
+  g_io_scheduler_job_send_to_mainloop_async (job->io_job,
+                                             (GSourceFunc) transfer_progress_dialog_update,
+                                             job,
+                                             NULL);
+}
+
+static goffset
+get_file_size (GFile *file)
+{
+  GFileInfo *file_info;
+  goffset size;
+  
+  file_info = g_file_query_info (file,
+                                 G_FILE_ATTRIBUTE_STANDARD_SIZE,
+                                 0, NULL, NULL);
+  if (file_info != NULL)
     {
-    case GNOME_VFS_XFER_PROGRESS_STATUS_OK:
-      return handle_transfer_ok (progress_info, transfer_info);
-    case GNOME_VFS_XFER_PROGRESS_STATUS_VFSERROR:
-      return handle_transfer_vfs_error (progress_info, transfer_info);
-    case GNOME_VFS_XFER_PROGRESS_STATUS_OVERWRITE:
-      return handle_transfer_overwrite (progress_info, transfer_info);
-    case GNOME_VFS_XFER_PROGRESS_STATUS_DUPLICATE:
-      return handle_transfer_duplicate (progress_info, transfer_info);
-    default:
-      g_warning (_("Unknown GnomeVFSXferProgressStatus %d"),
-		 progress_info->status);
-      return 0;
+      size = g_file_info_get_size (file_info);
+      g_object_unref (file_info);
     }
+  else
+    {
+      /* this should never fail as the source file is always local and in /tmp,
+       * but you never know.
+       */
+      size = -1;
+    }
+  
+  return size;
 }
 
 static gboolean
-show_dialog_timeout (TransferInfo *transfer_info)
+transfer_file (GIOSchedulerJob *io_job,
+               GCancellable *cancellable,
+               gpointer user_data)
 {
-  transfer_info->progress_dialog =
-	  gnome_egg_xfer_dialog_new (NULL, NULL, NULL, NULL, 0, 0, FALSE);
-  gtk_widget_show (transfer_info->progress_dialog);
-  transfer_info->timeout_id = 0;
+  TransferJob *job = user_data;
+  GError *error;
+  gboolean result;
+  
+  job->io_job = io_job;
+  job->total_bytes = get_file_size (job->source);
+  if (job->total_bytes == -1)
+    {
+      /* we can't access the source file, abort early */
+      error = NULL;
+      job->result = TRANSFER_ERROR;
+      job->error = g_strdup (_("Can't access source file"));
+      
+      goto out;
+    }
+
+  transfer_progress_dialog_start (job);
+
+retry:
+  error = NULL;
+  if (!g_file_copy (job->source,
+                    job->dest,
+                    job->flags,
+                    job->cancellable,
+                    (GFileProgressCallback) transfer_progress_cb,
+                    job,
+                    &error))
+    {
+      if (error->code == G_IO_ERROR_EXISTS)
+        {
+          int response;
+          /* ask the user if he wants to overwrite, otherwise
+           * return and report what happened.
+           */
+          response = run_overwrite_confirm_dialog (job);
+          if (response == GTK_RESPONSE_OK)
+            {
+              job->flags |= G_FILE_COPY_OVERWRITE;
+              g_error_free (error);
+
+              goto retry;
+            }
+          else
+            {
+              g_cancellable_cancel (job->cancellable);
+              job->result = TRANSFER_OVERWRITE;
+              goto out;
+            }
+        }
+      else if (error->code == G_IO_ERROR_CANCELLED)
+        {
+          job->result = TRANSFER_CANCELLED;
+
+          goto out;
+        }
+      else
+        {
+          /* other vfs error, abort the transfer and report
+           * the error.
+           */
+          g_cancellable_cancel (job->cancellable);
+          job->result = TRANSFER_ERROR;
+          job->error = g_strdup (error->message);
+          
+          goto out;
+        }
+    }
+  else
+    {
+      /* success */
+      job->result = TRANSFER_OK;
+      
+      goto out;
+    }
 
+out:
+  if (error)
+      g_error_free (error);
+    
+  g_io_scheduler_job_send_to_mainloop_async (io_job,
+                                             transfer_job_done,
+                                             job,
+                                             NULL);  
   return FALSE;
 }
 
-GnomeVFSResult
-screenshot_xfer_uri (GnomeVFSURI *source_uri,
-		     GnomeVFSURI *target_uri,
-		     GtkWidget   *parent)
+void
+screenshot_xfer_uri (GFile *source_file,
+                     GFile *target_file,
+		     GtkWidget *parent,
+                     TransferCallback done_callback,
+                     gpointer done_callback_data)
 {
-  GnomeVFSResult result;
-  GList *source_uri_list = NULL;
-  GList *target_uri_list = NULL;
-  TransferInfo *transfer_info;
-
-  source_uri_list = g_list_prepend (source_uri_list, source_uri);
-  target_uri_list = g_list_prepend (target_uri_list, target_uri);
-
-  transfer_info = g_new0 (TransferInfo, 1);
-  transfer_info->parent_dialog = parent;
-  add_timeout (transfer_info);
-
-  result = gnome_vfs_async_xfer (&transfer_info->handle,
-				 source_uri_list, target_uri_list,
-				 GNOME_VFS_XFER_DEFAULT,
-				 GNOME_VFS_XFER_ERROR_MODE_QUERY,
-				 GNOME_VFS_XFER_OVERWRITE_MODE_QUERY,
-				 GNOME_VFS_PRIORITY_DEFAULT,
-				 screenshot_async_xfer_progress, transfer_info,
-				 NULL, NULL);
-  gtk_main ();
-  remove_timeout (transfer_info);
-  g_list_free (source_uri_list);
-  g_list_free (target_uri_list);
-
-  if (transfer_info->delete_target)
-    ;/* try to delete the target, iff it started writing */
-
-  return GNOME_VFS_OK;
+  TransferJob *job;
+  GCancellable *cancellable;
+
+  cancellable = g_cancellable_new ();
+
+  job = g_slice_new0 (TransferJob);
+  job->parent = parent;
+  job->source = g_object_ref (source_file);
+  job->dest = g_object_ref (target_file);
+  job->flags = 0;
+  job->error = NULL;
+  job->dialog = NULL;
+  job->callback = done_callback;
+  job->callback_data = done_callback_data;
+  job->cancellable = cancellable;
+
+  g_io_scheduler_push_job (transfer_file,
+                           job,
+                           NULL, 0,
+                           job->cancellable);
 }
 
diff --git a/gnome-screenshot/screenshot-xfer.h b/gnome-screenshot/screenshot-xfer.h
index 7b85b5a..a8a7d34 100644
--- a/gnome-screenshot/screenshot-xfer.h
+++ b/gnome-screenshot/screenshot-xfer.h
@@ -1,11 +1,45 @@
+/* screenshot-xfer.h - file transfer functions for GNOME Screenshot
+ *
+ * Copyright (C) 2001-2006  Jonathan Blandford <jrb@alum.mit.edu>
+ * Copyright (C) 2008  Cosimo Cecchi <cosimoc@gnome.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ */
+
 #ifndef __SCREENSHOT_XFER_H__
 #define __SCREENSHOT_XFER_H__
 
 #include <gtk/gtk.h>
-#include <libgnomevfs/gnome-vfs.h>
+#include <gio/gio.h>
+
+typedef enum
+{
+  TRANSFER_OK,
+  TRANSFER_OVERWRITE,
+  TRANSFER_CANCELLED,
+  TRANSFER_ERROR
+} TransferResult;
+
+typedef void (* TransferCallback) (TransferResult result,
+                                   char *error_message,
+                                   gpointer data);
 
-GnomeVFSResult screenshot_xfer_uri (GnomeVFSURI *source_uri,
-				    GnomeVFSURI *target_uri,
-				    GtkWidget   *parent);
+void screenshot_xfer_uri (GFile *source_file,
+                          GFile *target_file,
+                          GtkWidget *parent,
+                          TransferCallback done_callback,
+                          gpointer done_callback_data);
 
 #endif /* __SCREENSHOT_XFER_H__ */
