[Xfce4-commits] r29974 - xfdesktop/branches/xfce_4_6/src
Brian Tarricone
kelnos at xfce.org
Sat May 23 04:27:49 CEST 2009
Author: kelnos
Date: 2009-05-23 02:27:49 +0000 (Sat, 23 May 2009)
New Revision: 29974
Modified:
xfdesktop/branches/xfce_4_6/src/xfdesktop-regular-file-icon.c
Log:
fix detection of rename/delete ability
Modified: xfdesktop/branches/xfce_4_6/src/xfdesktop-regular-file-icon.c
===================================================================
--- xfdesktop/branches/xfce_4_6/src/xfdesktop-regular-file-icon.c 2009-05-22 13:19:13 UTC (rev 29973)
+++ xfdesktop/branches/xfce_4_6/src/xfdesktop-regular-file-icon.c 2009-05-23 02:27:49 UTC (rev 29974)
@@ -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);
More information about the Xfce4-commits
mailing list