gvfs/gvfs-1.1.7-gdu-computer-expose-devices.patch

40 lines
1.4 KiB
Diff

diff -up gvfs-1.1.7/daemon/gvfsbackendcomputer.c.orig gvfs-1.1.7/daemon/gvfsbackendcomputer.c
--- gvfs-1.1.7/daemon/gvfsbackendcomputer.c.orig 2009-02-10 13:56:11.000000000 +0100
+++ gvfs-1.1.7/daemon/gvfsbackendcomputer.c 2009-03-09 16:07:22.000000000 +0100
@@ -595,11 +595,16 @@ try_open_for_read (GVfsBackend *backend,
return TRUE;
}
+/* TODO: push upstream */
+#define G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE_FILE "mountable::unix-device-file"
+
+
static void
file_info_from_file (ComputerFile *file,
GFileInfo *info)
{
char *uri;
+ char *device_file = NULL;
g_file_info_set_name (info, file->filename);
g_file_info_set_display_name (info, file->display_name);
@@ -627,6 +632,18 @@ file_info_from_file (ComputerFile *file,
g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, FALSE);
g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, FALSE);
g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE);
+
+ if (file->volume)
+ /* Take volume as a precedence */
+ device_file = g_volume_get_identifier (file->volume, "unix-device");
+ else
+ if (file->drive)
+ device_file = g_drive_get_identifier (file->drive, "unix-device");
+ if (device_file)
+ {
+ g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE_FILE, device_file);
+ g_free (device_file);
+ }
}
static gboolean