[Xfce4-commits] <xfdesktop:master> Fix for renames removing icons
Eric Koegel
noreply at xfce.org
Sun Sep 22 18:04:01 CEST 2013
Updating branch refs/heads/master
to c59a41c48a75d9567fa3dc0d34a4fcc1381da4db (commit)
from 7594c2ffa8bb8d695515335587b785745aeada56 (commit)
commit c59a41c48a75d9567fa3dc0d34a4fcc1381da4db
Author: Eric Koegel <eric.koegel at gmail.com>
Date: Sun Sep 22 18:47:15 2013 +0300
Fix for renames removing icons
When programs like Firefox use a temporary file and then rename
it to the primary file a deleted event can cause the icon to be
removed from the desktop. This patch checks if the file still
exists before removing the icon.
src/xfdesktop-file-icon-manager.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/xfdesktop-file-icon-manager.c b/src/xfdesktop-file-icon-manager.c
index 12b40b9..c546055 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -2293,6 +2293,7 @@ xfdesktop_file_icon_manager_file_changed(GFileMonitor *monitor,
XfdesktopFileIcon *icon;
GFileInfo *file_info;
guint16 row, col;
+ gchar *filename;
switch(event) {
case G_FILE_MONITOR_EVENT_MOVED:
@@ -2389,6 +2390,17 @@ xfdesktop_file_icon_manager_file_changed(GFileMonitor *monitor,
case G_FILE_MONITOR_EVENT_DELETED:
DBG("got deleted event");
+ filename = g_file_get_path(file);
+
+ /* If the file still exists, then keep it. Firefox does this when
+ * downloading files (deletes the main fail and moves the .part
+ * file to the main file). */
+ if(g_file_test(filename, G_FILE_TEST_EXISTS)) {
+ DBG("file still exists, not deleting");
+ g_free(filename);
+ return;
+ }
+
icon = g_hash_table_lookup(fmanager->priv->icons, file);
if(icon) {
/* Always try to remove thumbnail so it doesn't take up
@@ -2410,6 +2422,9 @@ xfdesktop_file_icon_manager_file_changed(GFileMonitor *monitor,
xfdesktop_file_icon_manager_refresh_icons(fmanager);
}
}
+
+ if(filename)
+ g_free(filename);
break;
default:
break;
More information about the Xfce4-commits
mailing list