diff options
author | Alexander Schwinn <alexxcons@xfce.org> | 2019-04-30 22:38:24 +0200 |
---|---|---|
committer | Alexander Schwinn <alexxcons@xfce.org> | 2019-05-02 11:10:26 +0200 |
commit | 399090b197aee2cd98e3ba5c49a56632dd388eb8 (patch) | |
tree | f26bbd648e03c38adb789e9410429b6030484f7e | |
parent | 46e9511ee0dd6189049000dc6e4ab4064580424b (diff) | |
download | xfdesktop-399090b197aee2cd98e3ba5c49a56632dd388eb8.tar.gz |
Desktop icons order resets (Bug #11266) - Added link to last used configuration as fallback
-rw-r--r-- | src/xfdesktop-file-icon-manager.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/xfdesktop-file-icon-manager.c b/src/xfdesktop-file-icon-manager.c index 2c4a9b84..8b2a74f5 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 @@ -1943,7 +1947,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; @@ -1999,6 +2003,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"); } @@ -2071,6 +2083,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; |