[glib/glib-2-22] Keep metadata when files are renamed and trashed
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-22] Keep metadata when files are renamed and trashed
- Date: Sat, 13 Mar 2010 19:28:18 +0000 (UTC)
commit afd5dcc026fc6f339911575ef665bed44afaa13d
Author: Alexander Larsson <alexl redhat com>
Date: Mon Feb 22 12:37:16 2010 +0100
Keep metadata when files are renamed and trashed
This fixes https://bugzilla.gnome.org/show_bug.cgi?id=609813
(cherry picked from commit 4535683b3f42b6840e01bd94fe6ea792b0ebeecf)
gio/glocalfile.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/gio/glocalfile.c b/gio/glocalfile.c
index 44831f4..174a701 100644
--- a/gio/glocalfile.c
+++ b/gio/glocalfile.c
@@ -1105,6 +1105,8 @@ g_local_file_set_display_name (GFile *file,
GLocalFile *local, *new_local;
GFile *new_file, *parent;
struct _g_stat_struct statbuf;
+ GVfsClass *class;
+ GVfs *vfs;
int errsv;
parent = g_file_get_parent (file);
@@ -1163,7 +1165,12 @@ g_local_file_set_display_name (GFile *file,
g_object_unref (new_file);
return NULL;
}
-
+
+ vfs = g_vfs_get_default ();
+ class = G_VFS_GET_CLASS (vfs);
+ if (class->local_file_moved)
+ class->local_file_moved (vfs, local->filename, new_local->filename);
+
return new_file;
}
@@ -1803,7 +1810,9 @@ g_local_file_trash (GFile *file,
int fd;
struct _g_stat_struct trash_stat, global_stat;
char *dirname, *globaldir;
-
+ GVfsClass *class;
+ GVfs *vfs;
+
if (g_lstat (local->filename, &file_stat) != 0)
{
int errsv = errno;
@@ -2026,6 +2035,11 @@ g_local_file_trash (GFile *file,
return FALSE;
}
+ vfs = g_vfs_get_default ();
+ class = G_VFS_GET_CLASS (vfs);
+ if (class->local_file_moved)
+ class->local_file_moved (vfs, local->filename, trashfile);
+
g_free (trashfile);
/* TODO: Do we need to update mtime/atime here after the move? */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]