[Goodies-commits] r5200 - xfburn/trunk/xfburn

David Mohr squisher at xfce.org
Tue Aug 5 23:45:53 CEST 2008


Author: squisher
Date: 2008-08-05 21:45:53 +0000 (Tue, 05 Aug 2008)
New Revision: 5200

Modified:
   xfburn/trunk/xfburn/xfburn-device-list.c
   xfburn/trunk/xfburn/xfburn-hal-manager.c
Log:
Fall back to libburn if there is a hal error trying to get the device list

Modified: xfburn/trunk/xfburn/xfburn-device-list.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-device-list.c	2008-08-05 20:12:00 UTC (rev 5199)
+++ xfburn/trunk/xfburn/xfburn-device-list.c	2008-08-05 21:45:53 UTC (rev 5200)
@@ -310,6 +310,7 @@
 #ifdef HAVE_HAL
   XfburnHalManager *halman = xfburn_hal_manager_get_instance ();
 #endif
+  int n_drives;
 
   if (devices) {
     g_list_foreach (devices, (GFunc) device_content_free, NULL);
@@ -318,10 +319,16 @@
   }
 
 #ifdef HAVE_HAL
-  return xfburn_hal_manager_get_devices (halman, &devices);
+  n_drives = xfburn_hal_manager_get_devices (halman, &devices);
+  if (n_drives == -1) {
+    /* some error occurred while checking hal properties, so try libburn instead */
+    n_drives = get_libburn_device_list ();
+  }
 #else
-  return get_libburn_device_list ();
+  n_drives = get_libburn_device_list ();
 #endif
+
+  return n_drives;
 }
 
 gboolean

Modified: xfburn/trunk/xfburn/xfburn-hal-manager.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-hal-manager.c	2008-08-05 20:12:00 UTC (rev 5199)
+++ xfburn/trunk/xfburn/xfburn-hal-manager.c	2008-08-05 21:45:53 UTC (rev 5200)
@@ -293,7 +293,7 @@
 
   if (dbus_error_is_set (&error)) {
     g_warning ("Could not get list of devices from HAL: %s", error.message);
-    return 0;
+    return -1;
   }
 
   for (devices = all_devices; *devices != NULL; devices++) {
@@ -302,15 +302,11 @@
     gboolean writer = FALSE;
     int write_speed;
 
-    if (dbus_error_is_set (&error)) {
-      g_warning ("Error printing HAL device %s: %s", *devices, error.message);
-      return 0;
-    }
-
     exists = libhal_device_property_exists (priv->hal_context, *devices, "info.capabilities", &error);
     if (dbus_error_is_set (&error)) {
       g_warning ("Error checking HAL property for %s: %s", *devices, error.message);
-      return 0;
+      dbus_error_free (error);
+      return -1;
     }
 
     if (!exists)
@@ -319,7 +315,8 @@
     cap_list = libhal_device_get_property_strlist (priv->hal_context, *devices, "info.capabilities", &error);
     if (dbus_error_is_set (&error)) {
       g_warning ("Error getting HAL property for %s: %s", *devices, error.message);
-      return 0;
+      dbus_error_free (error);
+      return -1;
     }
 
     for (caps = cap_list; *caps != NULL; caps++) {
@@ -327,7 +324,8 @@
         exists = libhal_device_property_exists (priv->hal_context, *devices, "storage.cdrom.write_speed", &error);
         if (dbus_error_is_set (&error)) {
           g_warning ("Error checking HAL property for %s: %s", *devices, error.message);
-          return 0;
+          dbus_error_free (error);
+          return -1;
         }
 
         if (!exists)
@@ -336,7 +334,8 @@
         write_speed = libhal_device_get_property_int (priv->hal_context, *devices, "storage.cdrom.write_speed", &error);
         if (dbus_error_is_set (&error)) {
           g_warning ("Error getting HAL property for %s: %s", *devices, error.message);
-          return 0;
+          dbus_error_free (error);
+          return -1;
         }
 
         if (write_speed > 0)
@@ -353,6 +352,12 @@
       /*
       libhal_device_print (priv->hal_context, *devices, &error);
       printf ("\n");
+
+      if (dbus_error_is_set (&error)) {
+        g_warning ("Error printing HAL device %s: %s", *devices, error.message);
+        dbus_error_free (error);
+        return -1;
+      }
       */
 
       device->accessible = FALSE;




More information about the Goodies-commits mailing list