[brasero] Don't use udi anymore when creating or scanning for drives but a GDrive instead
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Subject: [brasero] Don't use udi anymore when creating or scanning for drives but a GDrive instead
- Date: Fri, 10 Jul 2009 14:04:22 +0000 (UTC)
commit e26a19462b75a05f10c2138811741eddbbaea309
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Mon Jul 6 13:13:27 2009 +0200
Don't use udi anymore when creating or scanning for drives but a GDrive instead
libbrasero-media/brasero-drive.c | 3 +-
libbrasero-media/brasero-medium-monitor.c | 43 +++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 1 deletions(-)
---
diff --git a/libbrasero-media/brasero-drive.c b/libbrasero-media/brasero-drive.c
index 2214f80..55633d2 100644
--- a/libbrasero-media/brasero-drive.c
+++ b/libbrasero-media/brasero-drive.c
@@ -1087,7 +1087,7 @@ brasero_drive_class_init (BraseroDriveClass *klass)
"Deprecated",
"HAL udi as a string (Deprecated)",
NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ G_PARAM_READABLE));
g_object_class_install_property (object_class,
PROP_GDRIVE,
g_param_spec_object ("gdrive",
@@ -1096,3 +1096,4 @@ brasero_drive_class_init (BraseroDriveClass *klass)
G_TYPE_DRIVE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
+
diff --git a/libbrasero-media/brasero-medium-monitor.c b/libbrasero-media/brasero-medium-monitor.c
index f82deaf..f7c0445 100644
--- a/libbrasero-media/brasero-medium-monitor.c
+++ b/libbrasero-media/brasero-medium-monitor.c
@@ -283,6 +283,49 @@ brasero_medium_monitor_get_media (BraseroMediumMonitor *monitor,
return list;
}
+static GDrive *
+brasero_medium_monitor_get_gdrive (BraseroMediumMonitor *monitor,
+ const gchar *volume_path)
+{
+ BraseroMediumMonitorPrivate *priv;
+ GDrive *gdrive = NULL;
+ GList *drives;
+ GList *iter;
+
+ g_return_val_if_fail (volume_path != NULL, NULL);
+
+ priv = BRASERO_MEDIUM_MONITOR_PRIVATE (monitor);
+
+ /* NOTE: medium-monitor already holds a reference for GVolumeMonitor */
+ drives = g_volume_monitor_get_connected_drives (priv->gmonitor);
+ for (iter = drives; iter; iter = iter->next) {
+ gchar *device_path;
+ GDrive *tmp;
+
+ tmp = iter->data;
+ device_path = g_drive_get_identifier (tmp, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
+ if (!device_path)
+ continue;
+
+ BRASERO_MEDIA_LOG ("Found drive %s", device_path);
+ if (!strcmp (device_path, volume_path)) {
+ gdrive = tmp;
+ g_free (device_path);
+ g_object_ref (gdrive);
+ break;
+ }
+
+ g_free (device_path);
+ }
+ g_list_foreach (drives, (GFunc) g_object_unref, NULL);
+ g_list_free (drives);
+
+ if (!gdrive)
+ BRASERO_MEDIA_LOG ("No drive found for medium");
+
+ return gdrive;
+}
+
static void
brasero_medium_monitor_medium_added_cb (BraseroDrive *drive,
BraseroMedium *medium,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]