From eb2ef30f4de9e148fc77f8fdaad5464cb2a01c1e Mon Sep 17 00:00:00 2001 From: Eric Koegel Date: Sat, 5 Apr 2014 21:12:53 +0300 Subject: [PATCH] Fix issues with file move events (Bug 10796) Commit 31143fed1e36 compared file basenames which isn't what we should be doing. We need to compare the file's parent with our desktop folder to determine if the file move keeps the file on the desktop. --- common/xfdesktop-common.c | 8 +++++--- common/xfdesktop-common.h | 2 +- src/xfdesktop-file-icon-manager.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/common/xfdesktop-common.c b/common/xfdesktop-common.c index f272861..d253ae1 100644 --- a/common/xfdesktop-common.c +++ b/common/xfdesktop-common.c @@ -55,13 +55,15 @@ gint -xfdesktop_compare_basenames(GFile *a, GFile *b) +xfdesktop_compare_paths(GFile *a, GFile *b) { gchar *path_a, *path_b; gboolean ret; - path_a = g_file_get_basename(a); - path_b = g_file_get_basename(b); + path_a = g_file_get_path(a); + path_b = g_file_get_path(b); + + DBG("a %s, b %s", path_a, path_b); ret = g_strcmp0(path_a, path_b); diff --git a/common/xfdesktop-common.h b/common/xfdesktop-common.h index 6001ce8..a879d25 100644 --- a/common/xfdesktop-common.h +++ b/common/xfdesktop-common.h @@ -87,7 +87,7 @@ G_BEGIN_DECLS -gint xfdesktop_compare_basenames(GFile *a, GFile *b); +gint xfdesktop_compare_paths(GFile *a, GFile *b); gboolean xfdesktop_image_file_is_valid(const gchar *filename); diff --git a/src/xfdesktop-file-icon-manager.c b/src/xfdesktop-file-icon-manager.c index 42b5935..4ae7853 100644 --- a/src/xfdesktop-file-icon-manager.c +++ b/src/xfdesktop-file-icon-manager.c @@ -2413,7 +2413,7 @@ xfdesktop_file_icon_manager_file_changed(GFileMonitor *monitor, xfdesktop_file_icon_manager_remove_icon(fmanager, moved_icon); } - if(xfdesktop_compare_basenames(other_file, fmanager->priv->folder) != 0) { + if(xfdesktop_compare_paths(g_file_get_parent(other_file), fmanager->priv->folder)) { DBG("icon moved off the desktop"); /* Nothing moved, this is actually a delete */ if(file_info) -- 1.9.1