Author: kelnos Date: 2009-05-23 02:31:07 +0000 (Sat, 23 May 2009) New Revision: 29976
Modified: xfdesktop/trunk/NEWS xfdesktop/trunk/src/xfdesktop-regular-file-icon.c Log: fix detection of rename/delete ability Modified: xfdesktop/trunk/NEWS =================================================================== --- xfdesktop/trunk/NEWS 2009-05-23 02:28:52 UTC (rev 29975) +++ xfdesktop/trunk/NEWS 2009-05-23 02:31:07 UTC (rev 29976) @@ -2,6 +2,7 @@ ---------- * Add Catalan and Galician translations of the manual. + * Fix inability to delete broken symlinks on the desktop. Xfce 4.6.1 Modified: xfdesktop/trunk/src/xfdesktop-regular-file-icon.c =================================================================== --- xfdesktop/trunk/src/xfdesktop-regular-file-icon.c 2009-05-23 02:28:52 UTC (rev 29975) +++ xfdesktop/trunk/src/xfdesktop-regular-file-icon.c 2009-05-23 02:31:07 UTC (rev 29976) @@ -79,6 +79,7 @@ static G_CONST_RETURN ThunarVfsInfo *xfdesktop_regular_file_icon_peek_info(XfdesktopFileIcon *icon); static void xfdesktop_regular_file_icon_update_info(XfdesktopFileIcon *icon, ThunarVfsInfo *info); +static gboolean xfdesktop_regular_file_can_write_parent(XfdesktopFileIcon *icon); static gboolean xfdesktop_regular_file_can_write_file(XfdesktopFileIcon *icon); static gboolean xfdesktop_regular_file_icon_rename_file(XfdesktopFileIcon *icon, const gchar *new_name); @@ -127,9 +128,9 @@ file_icon_class->peek_info = xfdesktop_regular_file_icon_peek_info; file_icon_class->update_info = xfdesktop_regular_file_icon_update_info; - file_icon_class->can_rename_file = xfdesktop_regular_file_can_write_file; + file_icon_class->can_rename_file = xfdesktop_regular_file_can_write_parent; file_icon_class->rename_file = xfdesktop_regular_file_icon_rename_file; - file_icon_class->can_delete_file = xfdesktop_regular_file_can_write_file; + file_icon_class->can_delete_file = xfdesktop_regular_file_can_write_parent; file_icon_class->delete_file = xfdesktop_regular_file_icon_delete_file; } @@ -497,6 +498,31 @@ } static gboolean +xfdesktop_regular_file_can_write_parent(XfdesktopFileIcon *icon) +{ + XfdesktopRegularFileIcon *file_icon = XFDESKTOP_REGULAR_FILE_ICON(icon); + ThunarVfsPath *parent; + ThunarVfsInfo *parent_info; + gboolean writable; + + g_return_val_if_fail(file_icon && file_icon->priv->info, FALSE); + + parent = thunar_vfs_path_get_parent(file_icon->priv->info->path); + if(!parent) + return FALSE; + + parent_info = thunar_vfs_info_new_for_path(parent, NULL); + if(!parent_info) + return FALSE; + + writable = (parent_info->flags & THUNAR_VFS_FILE_FLAGS_WRITABLE); + thunar_vfs_info_unref(parent_info); + + return writable; + +} + +static gboolean xfdesktop_regular_file_can_write_file(XfdesktopFileIcon *icon) { XfdesktopRegularFileIcon *file_icon = XFDESKTOP_REGULAR_FILE_ICON(icon); _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits