[rhythmbox] libmediaplayerid: new fs-uuid property, containing the filesystem uuid
- From: Jonathan Matthew <jmatthew src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rhythmbox] libmediaplayerid: new fs-uuid property, containing the filesystem uuid
- Date: Mon, 10 Aug 2009 12:36:25 +0000 (UTC)
commit 00db513ef58fc48c4ebf14ce7b9131b830c1801d
Author: Jonathan Matthew <jonathan d14n org>
Date: Mon Aug 10 22:35:40 2009 +1000
libmediaplayerid: new fs-uuid property, containing the filesystem uuid
lib/libmediaplayerid/mediaplayerid.h | 1 +
lib/libmediaplayerid/mpid-device.c | 13 +++++++++++++
lib/libmediaplayerid/mpid-hal.c | 4 ++++
lib/libmediaplayerid/mpid-udev.c | 3 ++-
4 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/lib/libmediaplayerid/mediaplayerid.h b/lib/libmediaplayerid/mediaplayerid.h
index 53a21f7..66905d2 100644
--- a/lib/libmediaplayerid/mediaplayerid.h
+++ b/lib/libmediaplayerid/mediaplayerid.h
@@ -79,6 +79,7 @@ struct _MPIDDevice
char *model;
char *vendor;
+ char *fs_uuid;
char *drive_type;
gboolean requires_eject;
diff --git a/lib/libmediaplayerid/mpid-device.c b/lib/libmediaplayerid/mpid-device.c
index e6fa35c..78325f0 100644
--- a/lib/libmediaplayerid/mpid-device.c
+++ b/lib/libmediaplayerid/mpid-device.c
@@ -35,6 +35,7 @@ enum
PROP_SOURCE,
PROP_MODEL,
PROP_VENDOR,
+ PROP_FS_UUID,
PROP_DRIVE_TYPE,
PROP_REQUIRES_EJECT,
PROP_ACCESS_PROTOCOLS,
@@ -69,6 +70,7 @@ mpid_device_debug (MPIDDevice *device, const char *what)
}
mpid_debug_str ("model", device->model);
mpid_debug_str ("vendor", device->vendor);
+ mpid_debug_str ("filesystem uuid", device->fs_uuid);
mpid_debug_str ("drive type", device->drive_type);
mpid_debug ("requires eject: %s\n", device->requires_eject ? "true" : "false");
mpid_debug_strv ("access protocols", device->access_protocols);
@@ -207,6 +209,9 @@ mpid_device_get_property (GObject *object, guint prop_id, GValue *value, GParamS
case PROP_VENDOR:
g_value_set_string (value, device->vendor);
break;
+ case PROP_FS_UUID:
+ g_value_set_string (value, device->fs_uuid);
+ break;
case PROP_DRIVE_TYPE:
g_value_set_string (value, device->drive_type);
break;
@@ -247,6 +252,7 @@ mpid_device_finalize (GObject *object)
g_free (device->model);
g_free (device->vendor);
+ g_free (device->fs_uuid);
g_free (device->drive_type);
g_strfreev (device->access_protocols);
@@ -336,6 +342,13 @@ mpid_device_class_init (MPIDDeviceClass *klass)
NULL,
G_PARAM_READABLE));
g_object_class_install_property (object_class,
+ PROP_FS_UUID,
+ g_param_spec_string ("fs-uuid",
+ "device filesystem UUID",
+ "device filesystem UUID",
+ NULL,
+ G_PARAM_READABLE));
+ g_object_class_install_property (object_class,
PROP_DRIVE_TYPE,
g_param_spec_string ("drive-type",
"drive type",
diff --git a/lib/libmediaplayerid/mpid-hal.c b/lib/libmediaplayerid/mpid-hal.c
index 1964769..e97730e 100644
--- a/lib/libmediaplayerid/mpid-hal.c
+++ b/lib/libmediaplayerid/mpid-hal.c
@@ -101,6 +101,10 @@ find_portable_audio_player_udi (LibHalContext *context, MPIDDevice *device, cons
udi = g_strdup (udis[0]);
libhal_free_string_array (udis);
+ /* while we're here, grab the volume UUID */
+ device->fs_uuid = libhal_device_get_property_string (context, udi, "volume.uuid", &error);
+ free_dbus_error ("finding volume UUID", &error);
+
/* walk up the device hierarchy until we find something with the portable_audio_player
* capability. if we don't find anything, give up.
*/
diff --git a/lib/libmediaplayerid/mpid-udev.c b/lib/libmediaplayerid/mpid-udev.c
index c305108..aee4efa 100644
--- a/lib/libmediaplayerid/mpid-udev.c
+++ b/lib/libmediaplayerid/mpid-udev.c
@@ -45,9 +45,10 @@ mpid_device_db_lookup (MPIDDevice *device)
udevice = g_udev_client_query_by_device_file (client, devpath);
if (udevice != NULL) {
- /* get vendor and model names */
+ /* get vendor and model names and the UUID */
device->model = g_strdup (g_udev_device_get_property (udevice, "ID_MODEL"));
device->vendor = g_strdup (g_udev_device_get_property (udevice, "ID_VENDOR"));
+ device->fs_uuid = g_strdup (g_udev_device_get_property (udevice, "ID_FS_UUID"));
/* get media player information */
device_file = g_udev_device_get_property (udevice, "ID_MEDIA_PLAYER");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]