[Xfce4-commits] [xfce/xfdesktop] 03/03: Fix for moving icons into folders on the desktop (Bug 10785)

noreply at xfce.org noreply at xfce.org
Thu Apr 3 15:42:08 CEST 2014


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository xfce/xfdesktop.

commit 31143fed1e365f3cbc36a3e721853663e2e07d67
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Thu Apr 3 16:37:51 2014 +0300

    Fix for moving icons into folders on the desktop (Bug 10785)
    
    When monitoring folders with a g_file_monitor, GIO sends move
    notifications instead of delete to the file icon manager's file
    monitor. Because of that, we need to update the monitor to check
    if the icon has been moved off the desktop and only delete the
    icon.
---
 common/xfdesktop-common.c         |   17 +++++++++++++++++
 common/xfdesktop-common.h         |    2 ++
 src/xfdesktop-file-icon-manager.c |    9 +++++++++
 3 files changed, 28 insertions(+)

diff --git a/common/xfdesktop-common.c b/common/xfdesktop-common.c
index f36c500..f272861 100644
--- a/common/xfdesktop-common.c
+++ b/common/xfdesktop-common.c
@@ -54,6 +54,23 @@
 #include "xfce-backdrop.h" /* for XfceBackdropImageStyle */
 
 
+gint
+xfdesktop_compare_basenames(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);
+
+    ret = g_strcmp0(path_a, path_b);
+
+    g_free(path_a);
+    g_free(path_b);
+
+    return ret;
+}
+
 gchar *
 xfdesktop_get_file_mimetype(const gchar *file)
 {
diff --git a/common/xfdesktop-common.h b/common/xfdesktop-common.h
index 0c4c6fc..6001ce8 100644
--- a/common/xfdesktop-common.h
+++ b/common/xfdesktop-common.h
@@ -87,6 +87,8 @@
 
 G_BEGIN_DECLS
 
+gint xfdesktop_compare_basenames(GFile *a, GFile *b);
+
 gboolean xfdesktop_image_file_is_valid(const gchar *filename);
 
 gchar *xfdesktop_get_file_mimetype(const gchar *file);
diff --git a/src/xfdesktop-file-icon-manager.c b/src/xfdesktop-file-icon-manager.c
index c0f8551..42b5935 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -2413,6 +2413,15 @@ 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) {
+                DBG("icon moved off the desktop");
+                /* Nothing moved, this is actually a delete */
+                if(file_info)
+                    g_object_unref(file_info);
+
+                return;
+            }
+
             if(file_info) {
                 gboolean is_hidden;
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list