From 4d05c3bdbd8320620b3bee0e0b97cbda7e30c925 Mon Sep 17 00:00:00 2001
From: Benedikt Meurer <benny@xfce.org>
Date: Mon, 13 Feb 2006 21:19:42 +0000
Subject: [PATCH] 2006-02-13	Benedikt Meurer <benny@xfce.org>

	* thunar/thunar-dbus-service.c: Print a warning to stderr, instead of
	  using g_warning() if unable to connect to the session bus.
	* configure.in.in, thunar-vfs/thunar-vfs-volume-hal.c: Update to use
	  HAL 0.5.x API.




(Old svn revision: 19860)
---
 ChangeLog                          |   7 +
 configure.in.in                    |   4 +-
 thunar-vfs/thunar-vfs-volume-hal.c | 244 ++++++++++++++++-------------
 thunar/thunar-dbus-service.c       |   4 +-
 4 files changed, 148 insertions(+), 111 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cd8759e10..b459f7bb2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-02-13	Benedikt Meurer <benny@xfce.org>
+
+	* thunar/thunar-dbus-service.c: Print a warning to stderr, instead of
+	  using g_warning() if unable to connect to the session bus.
+	* configure.in.in, thunar-vfs/thunar-vfs-volume-hal.c: Update to use
+	  HAL 0.5.x API.
+
 2006-02-13	Benedikt Meurer <benny@xfce.org>
 
 	* thunar/thunar-folder.c(thunar_folder_reload): Properly cancel any
diff --git a/configure.in.in b/configure.in.in
index 3111fd80a..c2d464ca3 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -237,14 +237,13 @@ AC_SUBST([LIBFAM_LIBS])
 dnl ************************************
 dnl *** Check for the system flavour ***
 dnl ************************************
-AC_MSG_CHECKING([for system flavour])
 case "$target_os" in
 *bsd*)
   FLAVOUR="bsd"
   ;;
 *linux*)
   # on Linux, we try to use HAL first, and fallback to generic
-  XDT_CHECK_PACKAGE([HAL], [hal-storage], [0.4],
+  XDT_CHECK_PACKAGE([HAL], [hal-storage], [0.5.0],
   [
     # we also need D-BUS GLib bindings, but 0.23 will do
     XDT_CHECK_PACKAGE([HAL_DBUS], [dbus-glib-1], [0.23],
@@ -263,6 +262,7 @@ case "$target_os" in
   FLAVOUR="sysv"
   ;;
 esac
+AC_MSG_CHECKING([for system flavour])
 AC_MSG_RESULT([$FLAVOUR])
 
 dnl **********************************************************
diff --git a/thunar-vfs/thunar-vfs-volume-hal.c b/thunar-vfs/thunar-vfs-volume-hal.c
index 7b4bc8a6b..4e3c55fc7 100644
--- a/thunar-vfs/thunar-vfs-volume-hal.c
+++ b/thunar-vfs/thunar-vfs-volume-hal.c
@@ -61,8 +61,8 @@ static gboolean              thunar_vfs_volume_hal_unmount          (ThunarVfsVo
                                                                      GError                 **error);
 static void                  thunar_vfs_volume_hal_update           (ThunarVfsVolumeHal      *volume_hal,
                                                                      LibHalContext           *context,
-                                                                     HalVolume               *hv,
-                                                                     HalDrive                *hd);
+                                                                     LibHalVolume            *hv,
+                                                                     LibHalDrive             *hd);
 
 
 
@@ -410,35 +410,35 @@ thunar_vfs_volume_hal_unmount (ThunarVfsVolume *volume,
 static void
 thunar_vfs_volume_hal_update (ThunarVfsVolumeHal *volume_hal,
                               LibHalContext      *context,
-                              HalVolume          *hv,
-                              HalDrive           *hd)
+                              LibHalVolume       *hv,
+                              LibHalDrive        *hd)
 {
-  HalStoragePolicy *policy;
-  struct mntent    *mntent;
-  const gchar      *desired_mount_point;
-  const gchar      *volume_label;
-  gchar            *mount_root;
-  gchar            *basename;
-  gchar            *filename;
-  FILE             *fp;
+  LibHalStoragePolicy *policy;
+  struct mntent       *mntent;
+  const gchar         *desired_mount_point;
+  const gchar         *volume_label;
+  gchar               *mount_root;
+  gchar               *basename;
+  gchar               *filename;
+  FILE                *fp;
 
   g_return_if_fail (THUNAR_VFS_IS_VOLUME_HAL (volume_hal));
   g_return_if_fail (hv != NULL);
   g_return_if_fail (hd != NULL);
 
   /* just allocate a policy (doesn't seem to be very useful) */
-  policy = hal_storage_policy_new ();
+  policy = libhal_storage_policy_new ();
 
   /* reset the volume status */
   volume_hal->status = 0;
 
   /* determine the new device file */
   g_free (volume_hal->device_file);
-  volume_hal->device_file = g_strdup (hal_volume_get_device_file (hv));
+  volume_hal->device_file = g_strdup (libhal_volume_get_device_file (hv));
 
   /* determine the new label */
   g_free (volume_hal->device_label);
-  volume_label = hal_volume_get_label (hv);
+  volume_label = libhal_volume_get_label (hv);
   if (G_LIKELY (volume_label != NULL && *volume_label != '\0'))
     {
       /* just use the label provided by HAL */
@@ -458,45 +458,45 @@ thunar_vfs_volume_hal_update (ThunarVfsVolumeHal *volume_hal,
     }
 
   /* determine the type of the volume */
-  switch (hal_drive_get_type (hd))
+  switch (libhal_drive_get_type (hd))
     {
-    case HAL_DRIVE_TYPE_CDROM:
+    case LIBHAL_DRIVE_TYPE_CDROM:
       /* check which kind of CD-ROM/DVD we have */
-      switch (hal_volume_get_disc_type (hv))
+      switch (libhal_volume_get_disc_type (hv))
         {
-        case HAL_VOLUME_DISC_TYPE_CDROM:
+        case LIBHAL_VOLUME_DISC_TYPE_CDROM:
           volume_hal->kind = THUNAR_VFS_VOLUME_KIND_CDROM;
           break;
 
-        case HAL_VOLUME_DISC_TYPE_CDR:
+        case LIBHAL_VOLUME_DISC_TYPE_CDR:
           volume_hal->kind = THUNAR_VFS_VOLUME_KIND_CDR;
           break;
 
-        case HAL_VOLUME_DISC_TYPE_CDRW:
+        case LIBHAL_VOLUME_DISC_TYPE_CDRW:
           volume_hal->kind = THUNAR_VFS_VOLUME_KIND_CDRW;
           break;
 
-        case HAL_VOLUME_DISC_TYPE_DVDROM:
+        case LIBHAL_VOLUME_DISC_TYPE_DVDROM:
           volume_hal->kind = THUNAR_VFS_VOLUME_KIND_DVDROM;
           break;
 
-        case HAL_VOLUME_DISC_TYPE_DVDRAM:
+        case LIBHAL_VOLUME_DISC_TYPE_DVDRAM:
           volume_hal->kind = THUNAR_VFS_VOLUME_KIND_DVDRAM;
           break;
 
-        case HAL_VOLUME_DISC_TYPE_DVDR:
+        case LIBHAL_VOLUME_DISC_TYPE_DVDR:
           volume_hal->kind = THUNAR_VFS_VOLUME_KIND_DVDR;
           break;
 
-        case HAL_VOLUME_DISC_TYPE_DVDRW:
+        case LIBHAL_VOLUME_DISC_TYPE_DVDRW:
           volume_hal->kind = THUNAR_VFS_VOLUME_KIND_DVDRW;
           break;
 
-        case HAL_VOLUME_DISC_TYPE_DVDPLUSR:
+        case LIBHAL_VOLUME_DISC_TYPE_DVDPLUSR:
           volume_hal->kind = THUNAR_VFS_VOLUME_KIND_DVDPLUSR;
           break;
 
-        case HAL_VOLUME_DISC_TYPE_DVDPLUSRW:
+        case LIBHAL_VOLUME_DISC_TYPE_DVDPLUSRW:
           volume_hal->kind = THUNAR_VFS_VOLUME_KIND_DVDPLUSRW;
           break;
 
@@ -507,18 +507,18 @@ thunar_vfs_volume_hal_update (ThunarVfsVolumeHal *volume_hal,
         }
       break;
 
-    case HAL_DRIVE_TYPE_FLOPPY:
+    case LIBHAL_DRIVE_TYPE_FLOPPY:
       volume_hal->kind = THUNAR_VFS_VOLUME_KIND_FLOPPY;
       break;
 
-    case HAL_DRIVE_TYPE_PORTABLE_AUDIO_PLAYER:
+    case LIBHAL_DRIVE_TYPE_PORTABLE_AUDIO_PLAYER:
       volume_hal->kind = THUNAR_VFS_VOLUME_KIND_AUDIO_PLAYER;
       break;
 
-    case HAL_DRIVE_TYPE_MEMORY_STICK:
-    case HAL_DRIVE_TYPE_REMOVABLE_DISK:
+    case LIBHAL_DRIVE_TYPE_MEMORY_STICK:
+    case LIBHAL_DRIVE_TYPE_REMOVABLE_DISK:
       /* check if the drive is connected to the USB bus */
-      if (hal_drive_get_bus (hd) == HAL_DRIVE_BUS_USB)
+      if (libhal_drive_get_bus (hd) == LIBHAL_DRIVE_BUS_USB)
         {
           /* we consider the drive to be an USB stick */
           volume_hal->kind = THUNAR_VFS_VOLUME_KIND_USBSTICK;
@@ -533,14 +533,14 @@ thunar_vfs_volume_hal_update (ThunarVfsVolumeHal *volume_hal,
     }
 
   /* non-disc drives are always present, otherwise it must be a data disc to be usable */
-  if (!hal_volume_is_disc (hv) || hal_volume_disc_has_data (hv))
+  if (!libhal_volume_is_disc (hv) || libhal_volume_disc_has_data (hv))
     volume_hal->status |= THUNAR_VFS_VOLUME_STATUS_PRESENT;
 
   /* check if the volume is currently mounted */
-  if (hal_volume_is_mounted (hv))
+  if (libhal_volume_is_mounted (hv))
     {
       /* try to determine the new mount point */
-      volume_hal->mount_point = thunar_vfs_path_new (hal_volume_get_mount_point (hv), NULL);
+      volume_hal->mount_point = thunar_vfs_path_new (libhal_volume_get_mount_point (hv), NULL);
 
       /* we only mark the volume as mounted if we have a valid mount point */
       if (G_LIKELY (volume_hal->mount_point != NULL))
@@ -551,7 +551,7 @@ thunar_vfs_volume_hal_update (ThunarVfsVolumeHal *volume_hal,
   if (G_UNLIKELY (volume_hal->mount_point == NULL))
     {
       /* ask HAL for the default mount root (fallback to /media) */
-      mount_root = hal_drive_policy_default_get_mount_root (context);
+      mount_root = libhal_drive_policy_default_get_mount_root (context);
       if (G_UNLIKELY (mount_root == NULL || !g_path_is_absolute (mount_root)))
         {
           /* fallback to /media (seems to be sane) */
@@ -588,7 +588,7 @@ thunar_vfs_volume_hal_update (ThunarVfsVolumeHal *volume_hal,
       if (G_UNLIKELY (volume_hal->mount_point == NULL))
         {
           /* determine the desired mount point and prepend the mount root */
-          desired_mount_point = hal_volume_policy_get_desired_mount_point (hd, hv, policy);
+          desired_mount_point = libhal_volume_policy_get_desired_mount_point (hd, hv, policy);
           if (G_LIKELY (desired_mount_point != NULL && *desired_mount_point != '\0'))
             {
               filename = g_build_filename (mount_root, desired_mount_point, NULL);
@@ -619,7 +619,7 @@ thunar_vfs_volume_hal_update (ThunarVfsVolumeHal *volume_hal,
   thunar_vfs_volume_changed (THUNAR_VFS_VOLUME (volume_hal));
 
   /* and release the policy again */
-  hal_storage_policy_free (policy);
+  libhal_storage_policy_free (policy);
 }
 
 
@@ -636,8 +636,6 @@ static ThunarVfsVolumeHal *thunar_vfs_volume_manager_hal_get_volume_by_udi
                                                                                    const gchar                    *udi);
 static void                thunar_vfs_volume_manager_hal_update_volume_by_udi     (ThunarVfsVolumeManagerHal      *manager_hal,
                                                                                    const gchar                    *udi);
-static void                thunar_vfs_volume_manager_hal_main_loop_integration    (LibHalContext                  *context,
-                                                                                   DBusConnection                 *dbus_connection);
 static void                thunar_vfs_volume_manager_hal_device_added             (LibHalContext                  *context,
                                                                                    const gchar                    *udi);
 static void                thunar_vfs_volume_manager_hal_device_removed           (LibHalContext                  *context,
@@ -663,9 +661,10 @@ struct _ThunarVfsVolumeManagerHalClass
 
 struct _ThunarVfsVolumeManagerHal
 {
-  GObject        __parent__;
-  LibHalContext *context;
-  GList         *volumes;
+  GObject         __parent__;
+  DBusConnection *dbus_connection;
+  LibHalContext  *context;
+  GList          *volumes;
 };
 
 
@@ -701,43 +700,75 @@ thunar_vfs_volume_manager_hal_manager_init (ThunarVfsVolumeManagerIface *iface)
 static void
 thunar_vfs_volume_manager_hal_init (ThunarVfsVolumeManagerHal *manager_hal)
 {
-  /* the HAL virtual function table */
-  static const LibHalFunctions HAL_FUNCTIONS =
-  {
-    thunar_vfs_volume_manager_hal_main_loop_integration,
-    thunar_vfs_volume_manager_hal_device_added,
-    thunar_vfs_volume_manager_hal_device_removed,
-    thunar_vfs_volume_manager_hal_device_new_capability,
-    thunar_vfs_volume_manager_hal_device_lost_capability,
-    thunar_vfs_volume_manager_hal_device_property_modified,
-    NULL,
-  };
-
-  gchar **udis;
-  gint    n_udis;
-  gint    n;
-
-  /* allocate the HAL context */
-  manager_hal->context = hal_initialize (&HAL_FUNCTIONS, FALSE);
-  if (G_LIKELY (manager_hal->context != NULL))
+  DBusError error;
+  gchar   **udis;
+  gint      n_udis;
+  gint      n;
+
+  /* initialize the D-BUS error */
+  dbus_error_init (&error);
+
+  /* allocate a HAL context */
+  manager_hal->context = libhal_ctx_new ();
+  if (G_UNLIKELY (manager_hal->context == NULL))
+    return;
+
+  /* try to connect to the system bus */
+  manager_hal->dbus_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
+  if (G_UNLIKELY (manager_hal->dbus_connection == NULL))
+    goto failed;
+
+  /* setup the D-BUS connection for the HAL context */
+  libhal_ctx_set_dbus_connection (manager_hal->context, manager_hal->dbus_connection);
+
+  /* connect our manager object to the HAL context */
+  libhal_ctx_set_user_data (manager_hal->context, manager_hal);
+
+  /* setup callbacks */
+  libhal_ctx_set_device_added (manager_hal->context, thunar_vfs_volume_manager_hal_device_added);
+  libhal_ctx_set_device_removed (manager_hal->context, thunar_vfs_volume_manager_hal_device_removed);
+  libhal_ctx_set_device_new_capability (manager_hal->context, thunar_vfs_volume_manager_hal_device_new_capability);
+  libhal_ctx_set_device_lost_capability (manager_hal->context, thunar_vfs_volume_manager_hal_device_lost_capability);
+  libhal_ctx_set_device_property_modified (manager_hal->context, thunar_vfs_volume_manager_hal_device_property_modified);
+
+  /* try to initialize the HAL context */
+  if (!libhal_ctx_init (manager_hal->context, &error))
+    goto failed;
+
+  /* setup the D-BUS connection with the GLib main loop */
+  dbus_connection_setup_with_g_main (manager_hal->dbus_connection, NULL);
+
+  /* lookup all volumes currently known to HAL */
+  udis = libhal_find_device_by_capability (manager_hal->context, "volume", &n_udis, NULL);
+  if (G_LIKELY (udis != NULL))
     {
-      /* connect our manager object to the HAL context */
-      hal_ctx_set_user_data (manager_hal->context, manager_hal);
+      /* add volumes for all given UDIs */
+      for (n = 0; n < n_udis; ++n)
+        thunar_vfs_volume_manager_hal_device_added (manager_hal->context, udis[n]);
 
-      /* lookup all volumes currently known to HAL */
-      udis = hal_find_device_by_capability (manager_hal->context, "volume", &n_udis);
-      if (G_LIKELY (udis != NULL))
-        {
-          /* add volumes for all given UDIs */
-          for (n = 0; n < n_udis; ++n)
-            thunar_vfs_volume_manager_hal_device_added (manager_hal->context, udis[n]);
+      /* release the UDIs */
+      libhal_free_string_array (udis);
+    }
 
-          /* release the UDIs */
-          hal_free_string_array (udis);
-        }
+  /* watch all devices for changes */
+  if (!libhal_device_property_watch_all (manager_hal->context, &error))
+    goto failed;
+
+  return;
 
-      /* watch all devices for changes */
-      hal_device_property_watch_all (manager_hal->context);
+failed:
+  /* release the HAL context */
+  if (G_LIKELY (manager_hal->context != NULL))
+    {
+      libhal_ctx_free (manager_hal->context);
+      manager_hal->context = NULL;
+    }
+
+  /* print a warning message */
+  if (dbus_error_is_set (&error))
+    {
+      g_warning ("Failed to connect to the HAL daemon: %s", error.message);
+      dbus_error_free (&error);
     }
 }
 
@@ -756,7 +787,14 @@ thunar_vfs_volume_manager_hal_finalize (GObject *object)
 
   /* shutdown the HAL context */
   if (G_LIKELY (manager_hal->context != NULL))
-    hal_shutdown (manager_hal->context);
+    {
+      libhal_ctx_shutdown (manager_hal->context, NULL);
+      libhal_ctx_free (manager_hal->context);
+    }
+
+  /* shutdown the D-BUS connection */
+  if (G_LIKELY (manager_hal->dbus_connection != NULL))
+    dbus_connection_unref (manager_hal->dbus_connection);
 
   (*G_OBJECT_CLASS (thunar_vfs_volume_manager_hal_parent_class)->finalize) (object);
 }
@@ -801,9 +839,9 @@ thunar_vfs_volume_manager_hal_update_volume_by_udi (ThunarVfsVolumeManagerHal *m
                                                     const gchar               *udi)
 {
   ThunarVfsVolumeHal *volume_hal;
+  LibHalVolume       *hv = NULL;
+  LibHalDrive        *hd = NULL;
   const gchar        *drive_udi;
-  HalVolume          *hv = NULL;
-  HalDrive           *hd = NULL;
 
   /* check if we have a volume for the UDI */
   volume_hal = thunar_vfs_volume_manager_hal_get_volume_by_udi (manager_hal, udi);
@@ -811,7 +849,7 @@ thunar_vfs_volume_manager_hal_update_volume_by_udi (ThunarVfsVolumeManagerHal *m
     return;
 
   /* check if we have a volume here */
-  hv = hal_volume_from_udi (manager_hal->context, udi);
+  hv = libhal_volume_from_udi (manager_hal->context, udi);
   if (G_UNLIKELY (hv == NULL))
     {
       /* the device is no longer a volume, so drop it */
@@ -820,11 +858,11 @@ thunar_vfs_volume_manager_hal_update_volume_by_udi (ThunarVfsVolumeManagerHal *m
     }
 
   /* determine the UDI of the drive to which this volume belongs */
-  drive_udi = hal_volume_get_storage_device_udi (hv);
+  drive_udi = libhal_volume_get_storage_device_udi (hv);
   if (G_LIKELY (drive_udi != NULL))
     {
       /* determine the drive for the volume */
-      hd = hal_drive_from_udi (manager_hal->context, drive_udi);
+      hd = libhal_drive_from_udi (manager_hal->context, drive_udi);
     }
 
   /* check if we have the drive for the volume */
@@ -834,7 +872,7 @@ thunar_vfs_volume_manager_hal_update_volume_by_udi (ThunarVfsVolumeManagerHal *m
       thunar_vfs_volume_hal_update (volume_hal, manager_hal->context, hv, hd);
 
       /* release the drive */
-      hal_drive_free (hd);
+      libhal_drive_free (hd);
     }
   else
     {
@@ -843,17 +881,7 @@ thunar_vfs_volume_manager_hal_update_volume_by_udi (ThunarVfsVolumeManagerHal *m
     }
 
   /* release the volume */
-  hal_volume_free (hv);
-}
-
-
-
-static void
-thunar_vfs_volume_manager_hal_main_loop_integration (LibHalContext  *context,
-                                                     DBusConnection *dbus_connection)
-{
-  /* ok, this is easy, just add the D-BUS connection to the GLib main loop */
-  dbus_connection_setup_with_g_main (dbus_connection, NULL);
+  libhal_volume_free (hv);
 }
 
 
@@ -862,34 +890,34 @@ static void
 thunar_vfs_volume_manager_hal_device_added (LibHalContext *context,
                                             const gchar   *udi)
 {
-  ThunarVfsVolumeManagerHal *manager_hal = hal_ctx_get_user_data (context);
+  ThunarVfsVolumeManagerHal *manager_hal = libhal_ctx_get_user_data (context);
   ThunarVfsVolumeHal        *volume_hal;
+  LibHalVolume              *hv;
+  LibHalDrive               *hd;
   const gchar               *drive_udi;
-  HalVolume                 *hv;
-  HalDrive                  *hd;
   GList                      volume_list;
 
   g_return_if_fail (THUNAR_VFS_IS_VOLUME_MANAGER_HAL (manager_hal));
   g_return_if_fail (manager_hal->context == context);
 
   /* check if we have a volume here */
-  hv = hal_volume_from_udi (context, udi);
+  hv = libhal_volume_from_udi (context, udi);
   if (G_UNLIKELY (hv == NULL))
     return;
 
   /* we don't care for anything other than mountable filesystems */
-  if (G_UNLIKELY (hal_volume_get_fsusage (hv) != HAL_VOLUME_USAGE_MOUNTABLE_FILESYSTEM))
+  if (G_UNLIKELY (libhal_volume_get_fsusage (hv) != LIBHAL_VOLUME_USAGE_MOUNTABLE_FILESYSTEM))
     {
-      hal_volume_free (hv);
+      libhal_volume_free (hv);
       return;
     }
 
   /* determine the UDI of the drive to which this volume belongs */
-  drive_udi = hal_volume_get_storage_device_udi (hv);
+  drive_udi = libhal_volume_get_storage_device_udi (hv);
   if (G_LIKELY (drive_udi != NULL))
     {
       /* determine the drive for the volume */
-      hd = hal_drive_from_udi (context, drive_udi);
+      hd = libhal_drive_from_udi (context, drive_udi);
       if (G_LIKELY (hd != NULL))
         {
           /* check if we already have a volume object for the UDI */
@@ -919,12 +947,12 @@ thunar_vfs_volume_manager_hal_device_added (LibHalContext *context,
             }
 
           /* release the HAL drive */
-          hal_drive_free (hd);
+          libhal_drive_free (hd);
         }
     }
 
   /* release the HAL volume */
-  hal_volume_free (hv);
+  libhal_volume_free (hv);
 }
 
 
@@ -933,7 +961,7 @@ static void
 thunar_vfs_volume_manager_hal_device_removed (LibHalContext *context,
                                               const gchar   *udi)
 {
-  ThunarVfsVolumeManagerHal *manager_hal = hal_ctx_get_user_data (context);
+  ThunarVfsVolumeManagerHal *manager_hal = libhal_ctx_get_user_data (context);
   ThunarVfsVolumeHal        *volume_hal;
   GList                      volume_list;
 
@@ -965,7 +993,7 @@ thunar_vfs_volume_manager_hal_device_new_capability (LibHalContext *context,
                                                      const gchar   *udi,
                                                      const gchar   *capability)
 {
-  ThunarVfsVolumeManagerHal *manager_hal = hal_ctx_get_user_data (context);
+  ThunarVfsVolumeManagerHal *manager_hal = libhal_ctx_get_user_data (context);
 
   g_return_if_fail (THUNAR_VFS_IS_VOLUME_MANAGER_HAL (manager_hal));
   g_return_if_fail (manager_hal->context == context);
@@ -981,7 +1009,7 @@ thunar_vfs_volume_manager_hal_device_lost_capability (LibHalContext *context,
                                                       const gchar   *udi,
                                                       const gchar   *capability)
 {
-  ThunarVfsVolumeManagerHal *manager_hal = hal_ctx_get_user_data (context);
+  ThunarVfsVolumeManagerHal *manager_hal = libhal_ctx_get_user_data (context);
 
   g_return_if_fail (THUNAR_VFS_IS_VOLUME_MANAGER_HAL (manager_hal));
   g_return_if_fail (manager_hal->context == context);
@@ -999,7 +1027,7 @@ thunar_vfs_volume_manager_hal_device_property_modified (LibHalContext *context,
                                                         dbus_bool_t    is_removed,
                                                         dbus_bool_t    is_added)
 {
-  ThunarVfsVolumeManagerHal *manager_hal = hal_ctx_get_user_data (context);
+  ThunarVfsVolumeManagerHal *manager_hal = libhal_ctx_get_user_data (context);
 
   g_return_if_fail (THUNAR_VFS_IS_VOLUME_MANAGER_HAL (manager_hal));
   g_return_if_fail (manager_hal->context == context);
diff --git a/thunar/thunar-dbus-service.c b/thunar/thunar-dbus-service.c
index da4bef656..c9d04d74c 100644
--- a/thunar/thunar-dbus-service.c
+++ b/thunar/thunar-dbus-service.c
@@ -25,6 +25,8 @@
 #include <dbus/dbus-glib-lowlevel.h>
 #include <dbus/dbus.h>
 
+#include <glib/gstdio.h>
+
 #include <thunar/thunar-application.h>
 #include <thunar/thunar-dbus-service.h>
 #include <thunar/thunar-file.h>
@@ -152,7 +154,7 @@ thunar_dbus_service_init (ThunarDBusService *dbus_service)
   else
     {
       /* notify the user that D-BUS service won't be available */
-      g_warning ("Failed to connect to the D-BUS session bus: %s", error->message);
+      g_fprintf (stderr, "Thunar: Failed to connect to the D-BUS session bus: %s\n", error->message);
       g_error_free (error);
     }
 }
-- 
GitLab