Support moving files in the burn backend

This commit is contained in:
Matthias Clasen 2009-01-10 03:00:18 +00:00
parent 9f524eed2e
commit 92a5638e77
2 changed files with 70 additions and 1 deletions

62
gvfs-burn-move.patch Normal file
View File

@ -0,0 +1,62 @@
Index: daemon/gvfsbackendburn.c
===================================================================
--- daemon/gvfsbackendburn.c (revisione 2144)
+++ daemon/gvfsbackendburn.c (copia locale)
@@ -953,6 +953,49 @@
return TRUE;
}
+static gboolean
+try_move (GVfsBackend *backend,
+ GVfsJobMove *job,
+ const char *source,
+ const char *destination,
+ GFileCopyFlags flags,
+ GFileProgressCallback progress_callback,
+ gpointer progress_callback_data)
+{
+ VirtualNode *source_node, *root_node, *source_dir, *dest_dir;
+
+ root_node = G_VFS_BACKEND_BURN (backend)->root_node;
+
+ source_node = virtual_node_lookup (root_node, source, &source_dir);
+ if (source_node == NULL)
+ {
+ g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR,
+ G_IO_ERROR_NOT_FOUND,
+ _("No such file or directory"));
+ return TRUE;
+ }
+
+ if (virtual_node_lookup (root_node, destination, &dest_dir) != NULL)
+ {
+ g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR,
+ G_IO_ERROR_EXISTS,
+ _("File exists"));
+ return TRUE;
+ }
+
+ g_free (source_node->filename);
+ source_node->filename = g_path_get_basename (destination);
+
+ if (source_dir != dest_dir) {
+ source_dir->children = g_list_remove (source_dir->children, source_node);
+ dest_dir->children = g_list_append (dest_dir->children, source_node);
+ }
+
+ g_vfs_job_succeeded (G_VFS_JOB (job));
+
+ return TRUE;
+}
+
static void
g_vfs_backend_burn_class_init (GVfsBackendBurnClass *klass)
{
@@ -970,6 +1013,7 @@
backend_class->try_set_display_name = try_set_display_name;
backend_class->try_push = try_push;
backend_class->try_delete = try_delete;
+ backend_class->try_move = try_move;
backend_class->read = do_read;
backend_class->seek_on_read = do_seek_on_read;
backend_class->close_read = do_close_read;

View File

@ -1,7 +1,7 @@
Summary: Backends for the gio framework in GLib
Name: gvfs
Version: 1.1.3
Release: 1%{?dist}
Release: 2%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
URL: http://www.gtk.org
@ -28,8 +28,11 @@ Requires(postun): desktop-file-utils
# The patch touches Makefile.am files:
BuildRequires: automake autoconf
BuildRequires: libtool
# http://bugzilla.gnome.org/show_bug.cgi?id=567235
Patch1: gvfs-0.99.2-archive-integration.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=565041
Patch2: gvfs-burn-move.patch
%description
The gvfs package provides backend implementations for the gio
@ -112,6 +115,7 @@ media players (Media Transfer Protocol) to applications using gvfs.
%prep
%setup -q
%patch1 -p0 -b .archive-integration
%patch2 -p0 -b .burn-move
%build
@ -252,6 +256,9 @@ update-desktop-database &> /dev/null ||:
%changelog
* Fri Jan 9 2009 Matthias Clasen <mclasen@redhat.com> - 1.1.3-2
- Support moving files in the burn backend
* Tue Jan 6 2009 Tomas Bzatek <tbzatek@redhat.com> - 1.1.3-1
- Update to 1.1.3