Guarantee that DeviceFilePresentation always contain something meaningful
authorDavid Zeuthen <davidz@redhat.com>
Mon, 15 Mar 2010 22:31:58 +0000 (18:31 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Mon, 15 Mar 2010 22:31:58 +0000 (18:31 -0400)
This makes life easier for UI tools - they can always just display
:DeviceFilePresentation instead of having to check whether it's blank
and if so use :DeviceFile.

Signed-off-by: David Zeuthen <davidz@redhat.com>
data/org.freedesktop.UDisks.Device.xml
src/device.c

index ff9fdb3..ed722e6 100644 (file)
     </property>
     <property name="DeviceFilePresentation" type="s" access="read">
       <doc:doc><doc:description><doc:para>
-            If not blank, the preferred device file (typically a symlink to the value of the <doc:ref type="property" to="Device:DeviceFile">DeviceFile</doc:ref> property) to present in user interface.
+            Either the value of the
+            <doc:ref type="property" to="Device:DeviceFile">DeviceFile</doc:ref>
+            property, otherwise the preferred device file (typically a symlink to the value of the
+            <doc:ref type="property" to="Device:DeviceFile">DeviceFile</doc:ref>
+            property) to present in user interface.
             Example: <doc:tt>/dev/mapper/mpathb</doc:tt> or
             <doc:tt>/dev/vg_phobos/lv_root</doc:tt>.
       </doc:para></doc:description></doc:doc>
index f4204bf..bac971d 100644 (file)
@@ -383,7 +383,10 @@ get_property (GObject *object,
       g_value_set_string (value, device->priv->device_file);
       break;
     case PROP_DEVICE_FILE_PRESENTATION:
-      g_value_set_string (value, device->priv->device_file_presentation);
+      if (device->priv->device_file_presentation != NULL)
+        g_value_set_string (value, device->priv->device_file_presentation);
+      else
+        g_value_set_string (value, device->priv->device_file);
       break;
     case PROP_DEVICE_FILE_BY_ID:
       g_value_set_boxed (value, device->priv->device_file_by_id);