[Xfce4-commits] [xfce/xfdesktop] 01/01: Desktop icons order resets (Bug #11266) - Added link to last used configuration as fallback

noreply at xfce.org noreply at xfce.org
Thu May 2 21:11:20 CEST 2019


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

a   l   e   x       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfdesktop.

commit e8bf69ddd4bb7099cdb389ac6715c097b50d43aa
Author: Alexander Schwinn <alexxcons at xfce.org>
Date:   Fri Apr 26 23:33:06 2019 +0200

    Desktop icons order resets (Bug #11266) - Added link to last used configuration as fallback
---
 src/xfdesktop-file-icon-manager.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/xfdesktop-file-icon-manager.c b/src/xfdesktop-file-icon-manager.c
index 9787cce..3605258 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -48,6 +48,10 @@
 #include <errno.h>
 #endif
 
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 #ifndef PATH_MAX
 #define PATH_MAX 4096
 #endif
@@ -1897,7 +1901,7 @@ static gboolean
 xfdesktop_file_icon_manager_save_icons(gpointer user_data)
 {
     XfdesktopFileIconManager *fmanager = XFDESKTOP_FILE_ICON_MANAGER(user_data);
-    gchar relpath[PATH_MAX], *tmppath, *path;
+    gchar relpath[PATH_MAX], *tmppath, *path, *last_path;
     XfceRc *rcfile;
     gint x = 0, y = 0, width = 0, height = 0;
 
@@ -1967,6 +1971,14 @@ xfdesktop_file_icon_manager_save_icons(gpointer user_data)
                       strerror(errno));
             unlink(tmppath);
         }
+        else {
+            last_path = xfce_resource_save_location(XFCE_RESOURCE_CONFIG, "xfce4/desktop/icons.screen.latest.rc", TRUE);
+            if(last_path != NULL) {
+                unlink(last_path);
+                symlink(path, last_path);
+                g_free(last_path);
+            }
+        }
     } else {
         XF_DEBUG("didn't write anything in the RC file, desktop is probably empty");
     }
@@ -2051,6 +2063,11 @@ xfdesktop_file_icon_manager_get_cached_icon_position(XfdesktopFileIconManager *f
         filename = xfce_resource_lookup(XFCE_RESOURCE_CONFIG, relpath);
     }
 
+    /* Still nothing ? Just use the latest available file as fallback */
+    if(filename == NULL) {
+        filename = xfce_resource_lookup(XFCE_RESOURCE_CONFIG, "xfce4/desktop/icons.screen.latest.rc");
+    }
+
     if(filename != NULL) {
         XfceRc *rcfile;
         const gchar *icon_name;

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


More information about the Xfce4-commits mailing list