[gnome-disk-utility/new-ui] Handle DrivePort -> DrivePorts change in the daemon
- From: David Zeuthen <davidz src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility/new-ui] Handle DrivePort -> DrivePorts change in the daemon
- Date: Sun, 29 Nov 2009 20:42:45 +0000 (UTC)
commit afe2604bf57d49219def68042a787fb079f38ec2
Author: David Zeuthen <davidz redhat com>
Date: Sun Nov 29 15:42:26 2009 -0500
Handle DrivePort -> DrivePorts change in the daemon
src/gdu/gdu-device.c | 27 ++++++++++++++++++---------
src/gdu/gdu-device.h | 2 +-
src/palimpsest/gdu-section-drive.c | 11 +++++++----
3 files changed, 26 insertions(+), 14 deletions(-)
---
diff --git a/src/gdu/gdu-device.c b/src/gdu/gdu-device.c
index 88b977c..e5083e4 100644
--- a/src/gdu/gdu-device.c
+++ b/src/gdu/gdu-device.c
@@ -124,7 +124,7 @@ typedef struct
guint drive_rotation_rate;
char *drive_write_cache;
char *drive_adapter;
- char *drive_port;
+ char **drive_ports;
gboolean optical_disc_is_blank;
gboolean optical_disc_is_appendable;
@@ -322,8 +322,17 @@ collect_props (const char *key, const GValue *value, DeviceProperties *props)
props->drive_write_cache = g_strdup (g_value_get_string (value));
else if (strcmp (key, "DriveAdapter") == 0)
props->drive_adapter = g_strdup (g_value_get_boxed (value));
- else if (strcmp (key, "DrivePort") == 0)
- props->drive_port = g_strdup (g_value_get_boxed (value));
+ else if (strcmp (key, "DrivePorts") == 0) {
+ guint n;
+ GPtrArray *object_paths;
+
+ object_paths = g_value_get_boxed (value);
+
+ props->drive_ports = g_new0 (char *, object_paths->len + 1);
+ for (n = 0; n < object_paths->len; n++)
+ props->drive_ports[n] = g_strdup (object_paths->pdata[n]);
+ props->drive_ports[n] = NULL;
+ }
else if (strcmp (key, "OpticalDiscIsBlank") == 0)
props->optical_disc_is_blank = g_value_get_boolean (value);
@@ -385,13 +394,13 @@ collect_props (const char *key, const GValue *value, DeviceProperties *props)
else if (strcmp (key, "LinuxMdVersion") == 0)
props->linux_md_version = g_strdup (g_value_get_string (value));
else if (strcmp (key, "LinuxMdSlaves") == 0) {
- int n;
+ guint n;
GPtrArray *object_paths;
object_paths = g_value_get_boxed (value);
props->linux_md_slaves = g_new0 (char *, object_paths->len + 1);
- for (n = 0; n < (int) object_paths->len; n++)
+ for (n = 0; n < object_paths->len; n++)
props->linux_md_slaves[n] = g_strdup (object_paths->pdata[n]);
props->linux_md_slaves[n] = NULL;
}
@@ -445,7 +454,7 @@ device_properties_free (DeviceProperties *props)
g_free (props->drive_media);
g_free (props->drive_write_cache);
g_free (props->drive_adapter);
- g_free (props->drive_port);
+ g_strfreev (props->drive_ports);
g_free (props->drive_ata_smart_status);
g_free (props->drive_ata_smart_blob);
@@ -1096,10 +1105,10 @@ gdu_device_drive_get_adapter (GduDevice *device)
return device->priv->props->drive_adapter;
}
-const char *
-gdu_device_drive_get_port (GduDevice *device)
+char **
+gdu_device_drive_get_ports (GduDevice *device)
{
- return device->priv->props->drive_port;
+ return device->priv->props->drive_ports;
}
gboolean
diff --git a/src/gdu/gdu-device.h b/src/gdu/gdu-device.h
index 78d9855..5cebf67 100644
--- a/src/gdu/gdu-device.h
+++ b/src/gdu/gdu-device.h
@@ -145,7 +145,7 @@ gboolean gdu_device_drive_get_is_rotational (GduDevice *device);
guint gdu_device_drive_get_rotation_rate (GduDevice *device);
const char *gdu_device_drive_get_write_cache (GduDevice *device);
const char *gdu_device_drive_get_adapter (GduDevice *device);
-const char *gdu_device_drive_get_port (GduDevice *device);
+char **gdu_device_drive_get_ports (GduDevice *device);
gboolean gdu_device_optical_disc_get_is_blank (GduDevice *device);
gboolean gdu_device_optical_disc_get_is_appendable (GduDevice *device);
diff --git a/src/palimpsest/gdu-section-drive.c b/src/palimpsest/gdu-section-drive.c
index fa011b9..9ad7833 100644
--- a/src/palimpsest/gdu-section-drive.c
+++ b/src/palimpsest/gdu-section-drive.c
@@ -104,7 +104,7 @@ gdu_section_drive_update (GduSection *_section)
guint rotation_rate;
gboolean is_rotational;
GIcon *icon;
- const gchar *port_object_path;
+ gchar **port_object_paths;
GduPort *port;
gboolean show_cddvd_button;
gboolean show_format_button;
@@ -129,11 +129,12 @@ gdu_section_drive_update (GduSection *_section)
if (d == NULL)
goto out;
- port_object_path = gdu_device_drive_get_port (d);
- if (port_object_path != NULL && strlen (port_object_path) > 1) {
+ /* TODO: handle multiple ports */
+ port_object_paths = gdu_device_drive_get_ports (d);
+ if (port_object_paths != NULL && port_object_paths[0] != NULL) {
GduPool *pool;
pool = gdu_device_get_pool (d);
- port = gdu_pool_get_port_by_object_path (pool, port_object_path);
+ port = gdu_pool_get_port_by_object_path (pool, port_object_paths[0]);
g_object_unref (pool);
}
if (port != NULL) {
@@ -141,6 +142,8 @@ gdu_section_drive_update (GduSection *_section)
port_number = gdu_port_get_number (port);
if (port_number >= 0) {
+ /* TODO: provide a link to the HBA? Probably */
+
/* Translators: This is used in the "Location" element for a disk
* directly connected to the Host Adapter (aka HBA) - port numbers
* start at 1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]