[Goodies-commits] r2788 - xfce4-volstatus-icon/trunk/ghal

Brian Tarricone kelnos at xfce.org
Sun May 27 22:25:08 CEST 2007


Author: kelnos
Date: 2007-05-27 20:25:08 +0000 (Sun, 27 May 2007)
New Revision: 2788

Modified:
   xfce4-volstatus-icon/trunk/ghal/ghal-context.c
Log:
match on capabilities instead of category when determining what subclass of
GHalDevice to return


Modified: xfce4-volstatus-icon/trunk/ghal/ghal-context.c
===================================================================
--- xfce4-volstatus-icon/trunk/ghal/ghal-context.c	2007-05-27 15:39:15 UTC (rev 2787)
+++ xfce4-volstatus-icon/trunk/ghal/ghal-context.c	2007-05-27 20:25:08 UTC (rev 2788)
@@ -398,7 +398,7 @@
                                 const gchar *udi)
 {
     GHalDevice *device;
-    char *category;
+    dbus_bool_t is_storage, is_volume;
     
     device = g_hash_table_lookup(context->priv->devices, udi);
     if(device)
@@ -406,12 +406,14 @@
     
     /* we return special objects for devices that are also either drives
      * or storage volumes */
-    category = libhal_device_get_property_string(context->priv->hal_ctx,
-                                                 udi, "info.category", NULL);
+    is_storage = libhal_device_query_capability(context->priv->hal_ctx,
+                                                udi, "storage", NULL);
+    is_volume = libhal_device_query_capability(context->priv->hal_ctx,
+                                               udi, "volume", NULL);
     
-    if(category && !g_ascii_strcasecmp(category, "storage"))
+    if(is_storage)
         device = g_object_new(GHAL_TYPE_DRIVE, NULL);
-    else if(category && !g_ascii_strcasecmp(category, "volume")) {
+    else if(is_volume) {
         if(libhal_device_get_property_bool(context->priv->hal_ctx, udi,
                                            "volume.is_disc", NULL))
         {
@@ -420,7 +422,6 @@
             device = g_object_new(GHAL_TYPE_VOLUME, NULL);
     } else
         device = g_object_new(GHAL_TYPE_DEVICE, NULL);
-    libhal_free_string(category);
     
     _ghal_device_set_context(device, context);
     _ghal_device_set_udi(device, udi);




More information about the Goodies-commits mailing list