diff -Naurp xfdesktop.bak/configure.ac.in xfdesktop/configure.ac.in --- xfdesktop.bak/configure.ac.in 2008-09-16 05:22:23.000000000 +0200 +++ xfdesktop/configure.ac.in 2008-09-16 05:55:13.000000000 +0200 @@ -255,6 +255,22 @@ if test "x$enable_xml2po" = "xyes"; then fi AM_CONDITIONAL([ENABLE_XML2PO], [test "x$enable_xml2po" = "xyes"]) +dnl Check whether to support xdg user dirs. glib >= 2.14.0 needed. +AC_ARG_ENABLE([xdg-user-dirs], + [AC_HELP_STRING([--enable-xdg-user-dirs], + [Enable support for the xdg user special directories (glib >= 2.14.0 needed) [default=yes]])], + [ac_bm_xfdesktop_xdg_user_dirs=$enableval], + [ac_bm_xfdesktop_xdg_user_dirs=yes]) + +AC_MSG_CHECKING([whether to build support for xdg user dirs]) + +if test "x$ac_bm_xfdesktop_xdg_user_dirs" = "xyes"; then + XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.14.0]) + AC_DEFINE([XDG_USER_SPECIAL_DIRS], [1], [Define if support for xdg user special dirs should be built]) +else + AC_MSG_RESULT([no]) +fi + dnl check for debugging support XDT_FEATURE_DEBUG @@ -290,4 +306,5 @@ echo " Build desktop menu module: echo " Build desktop menu panel plugin: $build_panel_plugin" echo " Build support for desktop icons: $enable_desktop_icons" echo " Include support for file/launcher icons: $enable_file_icons" +echo " Support for XDG user directories: $ac_bm_xfdesktop_xdg_user_dirs" echo diff -Naurp xfdesktop.bak/src/xfce-desktop.c xfdesktop/src/xfce-desktop.c --- xfdesktop.bak/src/xfce-desktop.c 2008-09-16 05:22:16.000000000 +0200 +++ xfdesktop/src/xfce-desktop.c 2008-09-16 05:54:29.000000000 +0200 @@ -214,8 +214,12 @@ xfce_desktop_setup_icon_view(XfceDesktop case XFCE_DESKTOP_ICON_STYLE_FILES: { ThunarVfsPath *path; +#ifdef XDG_USER_SPECIAL_DIRS + const gchar *desktop_path = g_get_user_special_dir(G_USER_DIRECTORY_DESKTOP); +#else /* XDG_USER_SPECIAL_DIRS */ gchar *desktop_path = xfce_get_homefile("Desktop", NULL); +#endif /* XDG_USER_SPECIAL_DIRS */ path = thunar_vfs_path_new(desktop_path, NULL); if(path) { @@ -226,7 +230,9 @@ xfce_desktop_setup_icon_view(XfceDesktop g_critical("Unable to create ThunarVfsPath for '%s'", desktop_path); } +#ifndef XDG_USER_SPECIAL_DIRS g_free(desktop_path); +#endif /* XDG_USER_SPECIAL_DIRS */ } break; #endif diff -Naurp xfdesktop.bak/src/xfdesktop-file-icon-manager.c xfdesktop/src/xfdesktop-file-icon-manager.c --- xfdesktop.bak/src/xfdesktop-file-icon-manager.c 2008-09-16 05:22:16.000000000 +0200 +++ xfdesktop/src/xfdesktop-file-icon-manager.c 2008-09-16 05:54:29.000000000 +0200 @@ -1648,6 +1648,9 @@ xfdesktop_file_icon_manager_populate_con GtkMenuShell *menu, gpointer user_data) { +#ifdef XDG_USER_SPECIAL_DIRS + gboolean was_templates_dir_found = TRUE; +#endif /* XDG_USER_SPECIAL_DIRS */ XfdesktopFileIconManager *fmanager = XFDESKTOP_FILE_ICON_MANAGER(user_data); XfdesktopFileIcon *file_icon = NULL; const ThunarVfsInfo *info = NULL; @@ -1797,11 +1800,26 @@ xfdesktop_file_icon_manager_populate_con gtk_widget_show(tmpl_menu); gtk_menu_item_set_submenu(GTK_MENU_ITEM(mi), tmpl_menu); +#ifdef XDG_USER_SPECIAL_DIRS + templates_path_str = g_get_user_special_dir(G_USER_DIRECTORY_TEMPLATES); + if (G_UNLIKELY(templates_path_str == NULL)) { + templates_path_str = g_build_filename(xfce_get_homedir(), + "Templates", + NULL); + was_templates_dir_found = FALSE; + } +#else /* XDG_USER_SPECIAL_DIRS */ templates_path_str = g_build_filename(xfce_get_homedir(), "Templates", NULL); +#endif /* XDG_USER_SPECIAL_DIRS */ templates_path = thunar_vfs_path_new(templates_path_str, NULL); +#ifdef XDG_USER_SPECIAL_DIRS + if (G_UNLIKELY(was_templates_dir_found == FALSE)) + g_free(templates_path_str); +#else /* XDG_USER_SPECIAL_DIRS */ g_free(templates_path_str); +#endif /* XDG_USER_SPECIAL_DIRS */ if(templates_path) { have_templates = xfdesktop_file_icon_menu_fill_template_menu(tmpl_menu, templates_path,