[PATCH] bug 75214: preferences:/// etc. should be read-only
- From: Diego González <diego pemas net>
- To: Nautilus List <nautilus-list lists eazel com>
- Cc: George <jirka 5z com>
- Subject: [PATCH] bug 75214: preferences:/// etc. should be read-only
- Date: 26 Apr 2002 15:26:18 +0200
hi
so here is the patch, the nautilus emblems are not showed, i was not
setting all the permissions and the wrong emblems where being showed. So
there is no ugliness!
Hope you like the patch.
regards,
Diego
Index: vfolder-desktop-method.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/modules/vfolder-desktop-method.c,v
retrieving revision 1.31
diff -u -r1.31 vfolder-desktop-method.c
--- vfolder-desktop-method.c 17 Feb 2002 23:22:37 -0000 1.31
+++ vfolder-desktop-method.c 26 Apr 2002 12:14:13 -0000
@@ -2683,6 +2683,40 @@
return TRUE;
}
+
+/**
+ * set_file_info_permissions:
+ * @vfolder:
+ * @info:
+ *
+ * Sets the permission bits for the file passed.
+ * If the scheme is "preferences" or "all-preferences", then the permissions
+ * are set to unwriteable.
+ **/
+
+static void
+set_file_info_permissions (VFolderInfo *vfolder, GnomeVFSFileInfo *info)
+{
+ const gchar *scheme;
+
+ scheme = vfolder->scheme;
+
+ if ((g_ascii_strncasecmp (scheme, "preferences", 11) == 0) ||
+ (g_ascii_strncasecmp (scheme, "all-preferences", 14) == 0)) {
+ info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS;
+
+ info->permissions &= ~(GNOME_VFS_PERM_USER_WRITE |
+ GNOME_VFS_PERM_GROUP_WRITE |
+ GNOME_VFS_PERM_OTHER_WRITE);
+
+ info->permissions |= (GNOME_VFS_PERM_USER_READ |
+ GNOME_VFS_PERM_GROUP_READ |
+ GNOME_VFS_PERM_OTHER_READ);
+
+ return;
+ }
+}
+
static VFolderInfo *
get_vfolder_info_unlocked (const char *scheme,
GnomeVFSResult *result,
@@ -4342,6 +4376,8 @@
file_info->mtime = dh->info->modification_time;
file_info->valid_fields |= (GNOME_VFS_FILE_INFO_FIELDS_CTIME |
GNOME_VFS_FILE_INFO_FIELDS_MTIME);
+
+ set_file_info_permissions (dh->info, file_info);
}
return GNOME_VFS_OK;
@@ -4400,8 +4436,6 @@
file_info->valid_fields &= ~(UNSUPPORTED_INFO_FIELDS);
gnome_vfs_uri_unref (file_uri);
-
- return result;
} else if (folder != NULL) {
file_info->valid_fields = GNOME_VFS_FILE_INFO_FIELDS_NONE;
@@ -4419,10 +4453,14 @@
file_info->valid_fields |= (GNOME_VFS_FILE_INFO_FIELDS_CTIME |
GNOME_VFS_FILE_INFO_FIELDS_MTIME);
- return GNOME_VFS_OK;
+ result = GNOME_VFS_OK;
} else {
return GNOME_VFS_ERROR_NOT_FOUND;
}
+
+ set_file_info_permissions (info, file_info);
+
+ return result;
}
static GnomeVFSResult
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]