r925 - trunk/gnome-vfs

jim at linuxfromscratch.org jim at linuxfromscratch.org
Sun Apr 24 13:05:32 PDT 2005


Author: jim
Date: 2005-04-24 14:05:32 -0600 (Sun, 24 Apr 2005)
New Revision: 925

Added:
   trunk/gnome-vfs/gnome-vfs-2.10.1-hal_0.5.0-1.patch
Log:
Added: gnome-vfs-2.10.1-hal_0.5.0-1.patch

Added: trunk/gnome-vfs/gnome-vfs-2.10.1-hal_0.5.0-1.patch
===================================================================
--- trunk/gnome-vfs/gnome-vfs-2.10.1-hal_0.5.0-1.patch	2005-04-24 20:04:42 UTC (rev 924)
+++ trunk/gnome-vfs/gnome-vfs-2.10.1-hal_0.5.0-1.patch	2005-04-24 20:05:32 UTC (rev 925)
@@ -0,0 +1,645 @@
+Submitted By:            Randy McMurchy <randy_at_linuxfromscratch_dot_org>
+Date:                    2005-04-22
+Initial Package Version: 2.10.1
+Upstream Status:         Already in CVS
+Origin:                  GNOME CVS
+Description:             Port to the new HAL API (hal-0.5.0)
+
+diff -Naur gnome-vfs-2.10.1-orig/libgnomevfs/gnome-vfs-hal-mounts.c gnome-vfs-2.10.1/libgnomevfs/gnome-vfs-hal-mounts.c
+--- gnome-vfs-2.10.1-orig/libgnomevfs/gnome-vfs-hal-mounts.c	2004-12-10 21:33:53.000000000 +0000
++++ gnome-vfs-2.10.1/libgnomevfs/gnome-vfs-hal-mounts.c	2005-04-22 05:13:23.000000000 +0000
+@@ -49,16 +49,9 @@
+ 
+ typedef struct {
+ 	GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
+-	HalStoragePolicy *hal_storage_policy;
++	LibHalStoragePolicy *hal_storage_policy;
+ } GnomeVFSHalUserData;
+ 
+-static void
+-_hal_mainloop_integration (LibHalContext *ctx, 
+-			   DBusConnection * dbus_connection)
+-{
+-        dbus_connection_setup_with_g_main (dbus_connection, NULL);
+-}
+-
+ static void 
+ _hal_device_added (LibHalContext *hal_ctx, 
+ 		   const char *udi)
+@@ -66,16 +59,16 @@
+ 	GnomeVFSHalUserData *hal_userdata;
+ 	GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
+ 	
+-	hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
++	hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (hal_ctx);
+ 	volume_monitor_daemon = hal_userdata->volume_monitor_daemon;
+ 
+ 	/* Handle optical discs without data since these are not handled
+ 	 * by GNOME VFS
+ 	 */
+-	if (hal_device_get_property_bool (hal_ctx, udi, "volume.is_disc")) {
++	if (libhal_device_get_property_bool (hal_ctx, udi, "volume.is_disc", NULL)) {
+ 		const char *storage_udi;
+ 
+-		storage_udi = hal_device_get_property_string (hal_ctx, udi, "block.storage_device");
++		storage_udi = libhal_device_get_property_string (hal_ctx, udi, "block.storage_device", NULL);
+ 		if (storage_udi != NULL) {
+ 			GnomeVFSDrive *drive;
+ 
+@@ -97,7 +90,7 @@
+ 	GnomeVFSHalUserData *hal_userdata;
+ 	GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
+ 	
+-	hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
++	hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (hal_ctx);
+ 	volume_monitor_daemon = hal_userdata->volume_monitor_daemon;
+ 
+ 	drive = _gnome_vfs_volume_monitor_find_drive_by_hal_udi (
+@@ -122,153 +115,93 @@
+ 	}
+ }
+ 
+-static void 
+-_hal_device_new_capability (LibHalContext *hal_ctx, 
+-			    const char *udi, 
+-			    const char *capability)
+-{
+-	GnomeVFSHalUserData *hal_userdata;
+-	GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
+-	
+-	hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
+-	volume_monitor_daemon = hal_userdata->volume_monitor_daemon;
+-
+-	/* do nothing */
+-}
+-
+-static void 
+-_hal_device_lost_capability (LibHalContext *hal_ctx, 
+-			     const char *udi,
+-			     const char *capability)
+-{
+-	GnomeVFSHalUserData *hal_userdata;
+-	GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
+-	
+-	hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
+-	volume_monitor_daemon = hal_userdata->volume_monitor_daemon;
+ 
+-	/* do nothing */
+-}
+ 
+-static void 
+-_hal_device_property_modified (LibHalContext *hal_ctx, 
+-			       const char *udi,
+-			       const char *key,
+-			       dbus_bool_t is_removed,
+-			       dbus_bool_t is_added)
+-{
+-	GnomeVFSHalUserData *hal_userdata;
+-	GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
+-	
+-	hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
+-	volume_monitor_daemon = hal_userdata->volume_monitor_daemon;
+-
+-	/* do nothing */
+-}
+-
+-static void 
+-_hal_device_condition (LibHalContext *hal_ctx, 
+-		       const char *udi,
+-		       const char *condition_name,
+-		       DBusMessage *message)
+-{
+-	GnomeVFSHalUserData *hal_userdata;
+-	GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
+-	
+-	hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
+-	volume_monitor_daemon = hal_userdata->volume_monitor_daemon;
+-
+-	/* do nothing */
+-}
+-
+-static LibHalFunctions
+-hal_functions = { _hal_mainloop_integration,
+-		  _hal_device_added,
+-		  _hal_device_removed,
+-		  _hal_device_new_capability,
+-		  _hal_device_lost_capability,
+-		  _hal_device_property_modified,
+-		  _hal_device_condition };
+-
+-static HalStoragePolicyIconPair icon_mapping[] = {
+-	{HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK,           "gnome-dev-removable"},
+-	{HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_IDE,       "gnome-dev-removable"},
+-	{HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_SCSI,      "gnome-dev-removable"},
+-	{HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_USB,       "gnome-dev-removable-usb"},
+-	{HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_IEEE1394,  "gnome-dev-removable-1394"},
+-	{HAL_STORAGE_ICON_DRIVE_DISK,                     "gnome-dev-removable"},
+-	{HAL_STORAGE_ICON_DRIVE_DISK_IDE,                 "gnome-dev-removable"},
+-	{HAL_STORAGE_ICON_DRIVE_DISK_SCSI,                "gnome-dev-removable"},
+-	{HAL_STORAGE_ICON_DRIVE_DISK_USB,                 "gnome-dev-removable-usb"},
+-	{HAL_STORAGE_ICON_DRIVE_DISK_IEEE1394,            "gnome-dev-removable-1394"},
+-	{HAL_STORAGE_ICON_DRIVE_CDROM,                    "gnome-dev-removable"},
+-	{HAL_STORAGE_ICON_DRIVE_CDROM_IDE,                "gnome-dev-removable"},
+-	{HAL_STORAGE_ICON_DRIVE_CDROM_SCSI,               "gnome-dev-removable"},
+-	{HAL_STORAGE_ICON_DRIVE_CDROM_USB,                "gnome-dev-removable-usb"},
+-	{HAL_STORAGE_ICON_DRIVE_CDROM_IEEE1394,           "gnome-dev-removable-1394"},
+-	{HAL_STORAGE_ICON_DRIVE_FLOPPY,                   "gnome-dev-removable"},
+-	{HAL_STORAGE_ICON_DRIVE_FLOPPY_IDE,               "gnome-dev-removable"},
+-	{HAL_STORAGE_ICON_DRIVE_FLOPPY_SCSI,              "gnome-dev-removable"},
+-	{HAL_STORAGE_ICON_DRIVE_FLOPPY_USB,               "gnome-dev-removable-usb"},
+-	{HAL_STORAGE_ICON_DRIVE_FLOPPY_IEEE1394,          "gnome-dev-removable-1394"},
+-	{HAL_STORAGE_ICON_DRIVE_TAPE,                     "gnome-dev-removable"},
+-	{HAL_STORAGE_ICON_DRIVE_COMPACT_FLASH,            "gnome-dev-removable"},
+-	{HAL_STORAGE_ICON_DRIVE_MEMORY_STICK,             "gnome-dev-removable"},
+-	{HAL_STORAGE_ICON_DRIVE_SMART_MEDIA,              "gnome-dev-removable"},
+-	{HAL_STORAGE_ICON_DRIVE_SD_MMC,                   "gnome-dev-removable"},
+-	{HAL_STORAGE_ICON_DRIVE_CAMERA,                   "gnome-dev-removable"},
+-	{HAL_STORAGE_ICON_DRIVE_PORTABLE_AUDIO_PLAYER,    "gnome-dev-removable"},
+-
+-	{HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK,          "gnome-dev-harddisk"},
+-	{HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_IDE,      "gnome-dev-harddisk"},
+-	{HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_SCSI,     "gnome-dev-harddisk"},
+-	{HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_USB,      "gnome-dev-harddisk-usb"},
+-	{HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_IEEE1394, "gnome-dev-harddisk-1394"},
+-	{HAL_STORAGE_ICON_VOLUME_DISK,                    "gnome-dev-harddisk"},
+-	{HAL_STORAGE_ICON_VOLUME_DISK_IDE,                "gnome-dev-harddisk"},
+-	{HAL_STORAGE_ICON_VOLUME_DISK_SCSI,               "gnome-dev-harddisk"},
+-	{HAL_STORAGE_ICON_VOLUME_DISK_USB,                "gnome-dev-harddisk-usb"},
+-	{HAL_STORAGE_ICON_VOLUME_DISK_IEEE1394,           "gnome-dev-harddisk-1394"},
+-	{HAL_STORAGE_ICON_VOLUME_CDROM,                   "gnome-dev-cdrom"},
+-	{HAL_STORAGE_ICON_VOLUME_CDROM_IDE,               "gnome-dev-cdrom"},
+-	{HAL_STORAGE_ICON_VOLUME_CDROM_SCSI,              "gnome-dev-cdrom"},
+-	{HAL_STORAGE_ICON_VOLUME_CDROM_USB,               "gnome-dev-cdrom"},
+-	{HAL_STORAGE_ICON_VOLUME_CDROM_IEEE1394,          "gnome-dev-cdrom"},
+-	{HAL_STORAGE_ICON_VOLUME_FLOPPY,                  "gnome-dev-floppy"},
+-	{HAL_STORAGE_ICON_VOLUME_FLOPPY_IDE,              "gnome-dev-floppy"},
+-	{HAL_STORAGE_ICON_VOLUME_FLOPPY_SCSI,             "gnome-dev-floppy"},
+-	{HAL_STORAGE_ICON_VOLUME_FLOPPY_USB,              "gnome-dev-floppy"},
+-	{HAL_STORAGE_ICON_VOLUME_FLOPPY_IEEE1394,         "gnome-dev-floppy"},
+-	{HAL_STORAGE_ICON_VOLUME_TAPE,                    "gnome-dev-harddisk"},
+-	{HAL_STORAGE_ICON_VOLUME_COMPACT_FLASH,           "gnome-dev-media-cf"},
+-	{HAL_STORAGE_ICON_VOLUME_MEMORY_STICK,            "gnome-dev-media-ms"},
+-	{HAL_STORAGE_ICON_VOLUME_SMART_MEDIA,             "gnome-dev-media-sm"},
+-	{HAL_STORAGE_ICON_VOLUME_SD_MMC,                  "gnome-dev-media-sdmmc"},
+-	{HAL_STORAGE_ICON_VOLUME_CAMERA,                  "camera"},
+-	{HAL_STORAGE_ICON_VOLUME_PORTABLE_AUDIO_PLAYER,   "gnome-dev-ipod"},
+-
+-	{HAL_STORAGE_ICON_DISC_CDROM,                     "gnome-dev-cdrom"},
+-	{HAL_STORAGE_ICON_DISC_CDR,                       "gnome-dev-cdrom"},
+-	{HAL_STORAGE_ICON_DISC_CDRW,                      "gnome-dev-cdrom"},
+-	{HAL_STORAGE_ICON_DISC_DVDROM,                    "gnome-dev-dvd"},
+-	{HAL_STORAGE_ICON_DISC_DVDRAM,                    "gnome-dev-dvd"},
+-	{HAL_STORAGE_ICON_DISC_DVDR,                      "gnome-dev-dvd"},
+-	{HAL_STORAGE_ICON_DISC_DVDRW,                     "gnome-dev-dvd"},
+-	{HAL_STORAGE_ICON_DISC_DVDPLUSR,                  "gnome-dev-dvd"},
+-	{HAL_STORAGE_ICON_DISC_DVDPLUSRW,                 "gnome-dev-dvd"},
++static LibHalStoragePolicyIconPair icon_mapping[] = {
++	{LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK,           "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_IDE,       "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_SCSI,      "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_USB,       "gnome-dev-removable-usb"},
++	{LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_IEEE1394,  "gnome-dev-removable-1394"},
++	{LIBHAL_STORAGE_ICON_DRIVE_DISK,                     "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_DISK_IDE,                 "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_DISK_SCSI,                "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_DISK_USB,                 "gnome-dev-removable-usb"},
++	{LIBHAL_STORAGE_ICON_DRIVE_DISK_IEEE1394,            "gnome-dev-removable-1394"},
++	{LIBHAL_STORAGE_ICON_DRIVE_CDROM,                    "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_CDROM_IDE,                "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_CDROM_SCSI,               "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_CDROM_USB,                "gnome-dev-removable-usb"},
++	{LIBHAL_STORAGE_ICON_DRIVE_CDROM_IEEE1394,           "gnome-dev-removable-1394"},
++	{LIBHAL_STORAGE_ICON_DRIVE_FLOPPY,                   "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_FLOPPY_IDE,               "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_FLOPPY_SCSI,              "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_FLOPPY_USB,               "gnome-dev-removable-usb"},
++	{LIBHAL_STORAGE_ICON_DRIVE_FLOPPY_IEEE1394,          "gnome-dev-removable-1394"},
++	{LIBHAL_STORAGE_ICON_DRIVE_TAPE,                     "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_COMPACT_FLASH,            "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_MEMORY_STICK,             "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_SMART_MEDIA,              "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_SD_MMC,                   "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_CAMERA,                   "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_PORTABLE_AUDIO_PLAYER,    "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_ZIP,                      "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_JAZ,                      "gnome-dev-removable"},
++	{LIBHAL_STORAGE_ICON_DRIVE_FLASH_KEY,                "gnome-dev-removable"},
++
++	{LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK,          "gnome-dev-harddisk"},
++	{LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_IDE,      "gnome-dev-harddisk"},
++	{LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_SCSI,     "gnome-dev-harddisk"},
++	{LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_USB,      "gnome-dev-harddisk-usb"},
++	{LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_IEEE1394, "gnome-dev-harddisk-1394"},
++	{LIBHAL_STORAGE_ICON_VOLUME_DISK,                    "gnome-dev-harddisk"},
++	{LIBHAL_STORAGE_ICON_VOLUME_DISK_IDE,                "gnome-dev-harddisk"},
++	{LIBHAL_STORAGE_ICON_VOLUME_DISK_SCSI,               "gnome-dev-harddisk"},
++	{LIBHAL_STORAGE_ICON_VOLUME_DISK_USB,                "gnome-dev-harddisk-usb"},
++	{LIBHAL_STORAGE_ICON_VOLUME_DISK_IEEE1394,           "gnome-dev-harddisk-1394"},
++	{LIBHAL_STORAGE_ICON_VOLUME_CDROM,                   "gnome-dev-cdrom"},
++	{LIBHAL_STORAGE_ICON_VOLUME_CDROM_IDE,               "gnome-dev-cdrom"},
++	{LIBHAL_STORAGE_ICON_VOLUME_CDROM_SCSI,              "gnome-dev-cdrom"},
++	{LIBHAL_STORAGE_ICON_VOLUME_CDROM_USB,               "gnome-dev-cdrom"},
++	{LIBHAL_STORAGE_ICON_VOLUME_CDROM_IEEE1394,          "gnome-dev-cdrom"},
++	{LIBHAL_STORAGE_ICON_VOLUME_FLOPPY,                  "gnome-dev-floppy"},
++	{LIBHAL_STORAGE_ICON_VOLUME_FLOPPY_IDE,              "gnome-dev-floppy"},
++	{LIBHAL_STORAGE_ICON_VOLUME_FLOPPY_SCSI,             "gnome-dev-floppy"},
++	{LIBHAL_STORAGE_ICON_VOLUME_FLOPPY_USB,              "gnome-dev-floppy"},
++	{LIBHAL_STORAGE_ICON_VOLUME_FLOPPY_IEEE1394,         "gnome-dev-floppy"},
++	{LIBHAL_STORAGE_ICON_VOLUME_TAPE,                    "gnome-dev-harddisk"},
++	{LIBHAL_STORAGE_ICON_VOLUME_COMPACT_FLASH,           "gnome-dev-media-cf"},
++	{LIBHAL_STORAGE_ICON_VOLUME_MEMORY_STICK,            "gnome-dev-media-ms"},
++	{LIBHAL_STORAGE_ICON_VOLUME_SMART_MEDIA,             "gnome-dev-media-sm"},
++	{LIBHAL_STORAGE_ICON_VOLUME_SD_MMC,                  "gnome-dev-media-sdmmc"},
++	{LIBHAL_STORAGE_ICON_VOLUME_CAMERA,                  "camera"},
++	{LIBHAL_STORAGE_ICON_VOLUME_PORTABLE_AUDIO_PLAYER,   "gnome-dev-ipod"},
++	{LIBHAL_STORAGE_ICON_VOLUME_ZIP,                     "gnome-dev-zipdisk"},
++	{LIBHAL_STORAGE_ICON_VOLUME_JAZ,                     "gnome-dev-jazdisk"},
++	{LIBHAL_STORAGE_ICON_VOLUME_FLASH_KEY,               "gnome-dev-harddisk"},
+ 
+ /*
+-	{HAL_STORAGE_ICON_DISC_CDROM,                     "gnome-dev-disc-cdrom"},
+-	{HAL_STORAGE_ICON_DISC_CDR,                       "gnome-dev-disc-cdr"},
+-	{HAL_STORAGE_ICON_DISC_CDRW,                      "gnome-dev-disc-cdrw"},
+-	{HAL_STORAGE_ICON_DISC_DVDROM,                    "gnome-dev-disc-dvdrom"},
+-	{HAL_STORAGE_ICON_DISC_DVDRAM,                    "gnome-dev-disc-dvdram"},
+-	{HAL_STORAGE_ICON_DISC_DVDR,                      "gnome-dev-disc-dvdr"},
+-	{HAL_STORAGE_ICON_DISC_DVDRW,                     "gnome-dev-disc-dvdrw"},
+-	{HAL_STORAGE_ICON_DISC_DVDPLUSR,                  "gnome-dev-disc-dvdr-plus"},
+-	{HAL_STORAGE_ICON_DISC_DVDPLUSRW,                 "gnome-dev-disc-dvdrw-plus"},
++	{LIBHAL_STORAGE_ICON_DISC_CDROM,                     "gnome-dev-cdrom"},
++	{LIBHAL_STORAGE_ICON_DISC_CDR,                       "gnome-dev-cdrom"},
++	{LIBHAL_STORAGE_ICON_DISC_CDRW,                      "gnome-dev-cdrom"},
++	{LIBHAL_STORAGE_ICON_DISC_DVDROM,                    "gnome-dev-dvd"},
++	{LIBHAL_STORAGE_ICON_DISC_DVDRAM,                    "gnome-dev-dvd"},
++	{LIBHAL_STORAGE_ICON_DISC_DVDR,                      "gnome-dev-dvd"},
++	{LIBHAL_STORAGE_ICON_DISC_DVDRW,                     "gnome-dev-dvd"},
++	{LIBHAL_STORAGE_ICON_DISC_DVDPLUSR,                  "gnome-dev-dvd"},
++	{LIBHAL_STORAGE_ICON_DISC_DVDPLUSRW,                 "gnome-dev-dvd"},
+ */
+ 
++	{LIBHAL_STORAGE_ICON_DISC_CDROM,                     "gnome-dev-cdrom"},
++	{LIBHAL_STORAGE_ICON_DISC_CDR,                       "gnome-dev-disc-cdr"},
++	{LIBHAL_STORAGE_ICON_DISC_CDRW,                      "gnome-dev-disc-cdrw"},
++	{LIBHAL_STORAGE_ICON_DISC_DVDROM,                    "gnome-dev-disc-dvdrom"},
++	{LIBHAL_STORAGE_ICON_DISC_DVDRAM,                    "gnome-dev-disc-dvdram"},
++	{LIBHAL_STORAGE_ICON_DISC_DVDR,                      "gnome-dev-disc-dvdr"},
++	{LIBHAL_STORAGE_ICON_DISC_DVDRW,                     "gnome-dev-disc-dvdrw"},
++	{LIBHAL_STORAGE_ICON_DISC_DVDPLUSR,                  "gnome-dev-disc-dvdr-plus"},
++	{LIBHAL_STORAGE_ICON_DISC_DVDPLUSRW,                 "gnome-dev-disc-dvdrw"}, /* missing -plus icon here! */
++
+ 	{0x00, NULL}
+ };
+ 
+@@ -276,26 +209,52 @@
+ gboolean
+ _gnome_vfs_hal_mounts_init (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon)
+ {
++	DBusError error;
++	DBusConnection *dbus_connection;
+ 	GnomeVFSHalUserData *hal_userdata;
+-	HalStoragePolicy *hal_storage_policy;
++	LibHalStoragePolicy *hal_storage_policy;
+ 
+ 	/* Initialise the connection to the hal daemon */
+ 	if ((volume_monitor_daemon->hal_ctx = 
+-	     hal_initialize (&hal_functions, FALSE)) == NULL) {
+-		g_warning ("hal_initialize failed\n");
++	     libhal_ctx_new ()) == NULL) {
++		g_warning ("libhal_ctx_new failed\n");
++		return FALSE;
++	}
++
++	dbus_error_init (&error);
++	dbus_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
++	if (dbus_error_is_set (&error)) {
++		g_warning ("Error connecting to D-BUS system bus: %s\n",
++			   error.message);
++		dbus_error_free (&error);
++		return FALSE;
++	}	
++        dbus_connection_setup_with_g_main (dbus_connection, NULL);
++
++	libhal_ctx_set_dbus_connection (volume_monitor_daemon->hal_ctx, 
++					dbus_connection);
++
++	libhal_ctx_set_device_added (volume_monitor_daemon->hal_ctx,
++				     _hal_device_added);
++	libhal_ctx_set_device_removed (volume_monitor_daemon->hal_ctx,
++		  		       _hal_device_removed);
++	
++	if (!libhal_ctx_init (volume_monitor_daemon->hal_ctx, &error)) {
++		g_warning ("libhal_ctx_init failed: %s\n", error.message);
++		dbus_error_free (&error);
+ 		return FALSE;
+ 	}
+ 
+ 
+ 	/* Setup GNOME specific policy - right now this is only icons */
+-	hal_storage_policy = hal_storage_policy_new ();
+-	hal_storage_policy_set_icon_mapping (hal_storage_policy, icon_mapping);
++	hal_storage_policy = libhal_storage_policy_new ();
++	libhal_storage_policy_set_icon_mapping (hal_storage_policy, icon_mapping);
+ 
+ 	/* Tie some data with the libhal context */
+ 	hal_userdata = g_new0 (GnomeVFSHalUserData, 1);
+ 	hal_userdata->volume_monitor_daemon = volume_monitor_daemon;
+ 	hal_userdata->hal_storage_policy = hal_storage_policy;
+-	hal_ctx_set_user_data (volume_monitor_daemon->hal_ctx,
++	libhal_ctx_set_user_data (volume_monitor_daemon->hal_ctx,
+ 			       hal_userdata);
+ 	return TRUE;
+ }
+@@ -304,13 +263,22 @@
+ _gnome_vfs_hal_mounts_shutdown (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon)
+ {
+ 	GnomeVFSHalUserData *hal_userdata;
++	DBusError error;
++
++	hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (volume_monitor_daemon->hal_ctx);
++	libhal_storage_policy_free (hal_userdata->hal_storage_policy);
+ 
+-	hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (volume_monitor_daemon->hal_ctx);
+-	hal_storage_policy_free (hal_userdata->hal_storage_policy);
++	dbus_error_init (&error);
++	if (!libhal_ctx_shutdown (volume_monitor_daemon->hal_ctx, &error)) {
++		g_warning ("hal_shutdown failed: %s\n", error.message);
++		dbus_error_free (&error);
++		return;
++	}
+ 
+-	if (hal_shutdown (volume_monitor_daemon->hal_ctx) != 0) {
+-		g_warning ("hal_shutdown failed\n");
++	if (!libhal_ctx_free (volume_monitor_daemon->hal_ctx)) {
++		g_warning ("hal_shutdown failed - unable to free hal context\n");
+ 	}
++
+ }
+ 
+ /**************************************************************************/
+@@ -330,10 +298,10 @@
+ 	char *drive_icon;
+ 	char *unique_drive_name;
+ 	LibHalContext *hal_ctx; 
+-	HalDrive *hal_drive;
+-	HalVolume *hal_volume;
++	LibHalDrive *hal_drive;
++	LibHalVolume *hal_volume;
+ 	GnomeVFSHalUserData *hal_userdata;
+-	HalStoragePolicy *hal_storage_policy;
++	LibHalStoragePolicy *hal_storage_policy;
+ 	char *target_mount_point;
+ 
+ 	hal_drive = NULL;
+@@ -342,7 +310,7 @@
+ 	if ((hal_ctx = volume_monitor_daemon->hal_ctx) == NULL)
+ 		goto out;
+ 
+-	hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
++	hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (hal_ctx);
+ 	hal_storage_policy = hal_userdata->hal_storage_policy;
+ 
+ 	if (drive == NULL || drive->priv == NULL || drive->priv->device_path == NULL)
+@@ -352,21 +320,21 @@
+ 	 * /dev/sda1 etc, however we get the Drive object for the parent if
+ 	 * that is the case. This is a feature of libhal-storage.
+ 	 */
+-	if ((hal_drive = hal_drive_from_device_file (hal_ctx, drive->priv->device_path)) == NULL) {
++	if ((hal_drive = libhal_drive_from_device_file (hal_ctx, drive->priv->device_path)) == NULL) {
+ 		g_warning ("%s: no hal drive for device=%s", __FUNCTION__, drive->priv->device_path);
+ 		goto out;
+ 	}
+ 
+ 	/* There may not be a volume object associated, so hal_volume may be NULL */
+-	hal_volume = hal_volume_from_device_file (hal_ctx, drive->priv->device_path);
++	hal_volume = libhal_volume_from_device_file (hal_ctx, drive->priv->device_path);
+ 
+ 	/* For optical discs, we manually add/remove GnomeVFSVolume optical discs without 
+ 	 * data (e.g. blank and pure audio) since these don't appear in the mounted filesystems
+ 	 * file /etc/mtab
+ 	 */
+ 	if (hal_volume != NULL && 
+-	    hal_drive_get_type (hal_drive) == HAL_DRIVE_TYPE_CDROM && 
+-	    hal_volume_is_disc (hal_volume) && !hal_volume_disc_has_data (hal_volume)) {
++	    libhal_drive_get_type (hal_drive) == LIBHAL_DRIVE_TYPE_CDROM && 
++	    libhal_volume_is_disc (hal_volume) && !libhal_volume_disc_has_data (hal_volume)) {
+ 		GnomeVFSVolume *volume;
+ 		char *volume_name;
+ 		char *volume_icon;
+@@ -377,35 +345,35 @@
+ 			gnome_vfs_volume_unref (volume);
+ 		} else {
+ 			
+-			volume_name = hal_volume_policy_compute_display_name (
++			volume_name = libhal_volume_policy_compute_display_name (
+ 				hal_drive, hal_volume, hal_storage_policy);
+ 
+ 			/* set icon name; try dedicated icon name first... */
+-			if (hal_drive_get_dedicated_icon_volume (hal_drive) != NULL)
+-				volume_icon = strdup (hal_drive_get_dedicated_icon_volume (hal_drive));
++			if (libhal_drive_get_dedicated_icon_volume (hal_drive) != NULL)
++				volume_icon = strdup (libhal_drive_get_dedicated_icon_volume (hal_drive));
+ 			else
+-				volume_icon = hal_volume_policy_compute_icon_name (
++				volume_icon = libhal_volume_policy_compute_icon_name (
+ 					hal_drive, hal_volume, hal_storage_policy);
+ 
+ 			volume = g_object_new (GNOME_VFS_TYPE_VOLUME, NULL);
+-			volume->priv->hal_udi = g_strdup (hal_volume_get_udi (hal_volume));
++			volume->priv->hal_udi = g_strdup (libhal_volume_get_udi (hal_volume));
+ 			volume->priv->volume_type = GNOME_VFS_VOLUME_TYPE_MOUNTPOINT;
+ 			
+-			if (hal_volume_disc_is_blank (hal_volume)) {
++			if (libhal_volume_disc_is_blank (hal_volume)) {
+ 				/* Blank discs should open the burn:/// location */
+-				volume->priv->device_path = g_strdup (hal_volume_get_device_file (hal_volume));
++				volume->priv->device_path = g_strdup (libhal_volume_get_device_file (hal_volume));
+ 				volume->priv->activation_uri = g_strdup ("burn:///");
+-				volume->priv->unix_device = makedev (hal_volume_get_device_major (hal_volume), 
+-								     hal_volume_get_device_minor (hal_volume));
+-				volume->priv->filesystem_type = g_strdup (hal_volume_get_fstype (hal_volume));
+-			} else if (hal_volume_disc_has_audio (hal_volume)) {
++				volume->priv->unix_device = makedev (libhal_volume_get_device_major (hal_volume), 
++								     libhal_volume_get_device_minor (hal_volume));
++				volume->priv->filesystem_type = g_strdup (libhal_volume_get_fstype (hal_volume));
++			} else if (libhal_volume_disc_has_audio (hal_volume)) {
+ 				/* Audio discs with data should open the cdda:///dev/cdrom location */
+-				volume->priv->device_path = g_strdup (hal_volume_get_device_file (hal_volume));
++				volume->priv->device_path = g_strdup (libhal_volume_get_device_file (hal_volume));
+ 				volume->priv->activation_uri = g_strdup_printf (
+-					"cdda://%s", hal_volume_get_device_file (hal_volume));
+-				volume->priv->unix_device = makedev (hal_volume_get_device_major (hal_volume), 
+-								     hal_volume_get_device_minor (hal_volume));
+-				volume->priv->filesystem_type = g_strdup (hal_volume_get_fstype (hal_volume));
++					"cdda://%s", libhal_volume_get_device_file (hal_volume));
++				volume->priv->unix_device = makedev (libhal_volume_get_device_major (hal_volume), 
++								     libhal_volume_get_device_minor (hal_volume));
++				volume->priv->filesystem_type = g_strdup (libhal_volume_get_fstype (hal_volume));
+ 			}
+ 			
+ 			volume->priv->is_read_only = TRUE;
+@@ -419,6 +387,7 @@
+ 			volume->priv->is_user_visible = TRUE;
+ 			
+ 			volume->priv->drive = drive;
++
+ 			_gnome_vfs_drive_add_mounted_volume (drive, volume);
+ 			
+ 			_gnome_vfs_volume_monitor_mounted (GNOME_VFS_VOLUME_MONITOR (volume_monitor_daemon), volume);
+@@ -427,7 +396,7 @@
+ 			free (volume_name);
+ 			free (volume_icon);
+ 		}
+-	} else if (hal_volume == NULL && hal_drive_get_type (hal_drive) == HAL_DRIVE_TYPE_CDROM) {
++	} else if (hal_volume == NULL && libhal_drive_get_type (hal_drive) == LIBHAL_DRIVE_TYPE_CDROM) {
+ 		GnomeVFSVolume *volume;
+ 
+ 		/* Remove GnomeVFSVolume with same device file */
+@@ -444,10 +413,10 @@
+ 		goto out;
+ 
+ 	/* set whether we need to eject */
+-	drive->priv->must_eject_at_unmount = hal_drive_requires_eject (hal_drive);
++	drive->priv->must_eject_at_unmount = libhal_drive_requires_eject (hal_drive);
+ 
+ 	/* set display name */
+-	drive_name = hal_drive_policy_compute_display_name (hal_drive, hal_volume, hal_storage_policy);
++	drive_name = libhal_drive_policy_compute_display_name (hal_drive, hal_volume, hal_storage_policy);
+ 	unique_drive_name = _gnome_vfs_volume_monitor_uniquify_drive_name (
+ 		GNOME_VFS_VOLUME_MONITOR (volume_monitor_daemon), drive_name);
+ 	if (drive->priv->display_name != NULL)
+@@ -456,10 +425,10 @@
+ 	free (drive_name);
+ 
+ 	/* set icon name; try dedicated icon name first... */
+-	if (hal_drive_get_dedicated_icon_drive (hal_drive) != NULL)
+-		drive_icon = strdup (hal_drive_get_dedicated_icon_drive (hal_drive));
++	if (libhal_drive_get_dedicated_icon_drive (hal_drive) != NULL)
++		drive_icon = strdup (libhal_drive_get_dedicated_icon_drive (hal_drive));
+ 	else
+-		drive_icon = hal_drive_policy_compute_icon_name (hal_drive, hal_volume, hal_storage_policy);
++		drive_icon = libhal_drive_policy_compute_icon_name (hal_drive, hal_volume, hal_storage_policy);
+ 	if (drive->priv->icon != NULL)
+ 		g_free (drive->priv->icon);
+ 	drive->priv->icon = g_strdup (drive_icon);
+@@ -469,7 +438,7 @@
+ 	target_mount_point = NULL;
+ 	if (hal_volume != NULL) {
+ 		const char *str;
+-		str = hal_volume_get_mount_point (hal_volume);
++		str = libhal_volume_get_mount_point (hal_volume);
+ 		if (str != NULL)
+ 			target_mount_point = g_strdup (str);
+ 	}
+@@ -479,18 +448,18 @@
+ 		target_mount_point = gnome_vfs_get_local_path_from_uri (drive->priv->activation_uri);
+ 
+ 	/* if we don't use removable media and the volume shouldn't be visible, then hide the drive */
+-	if(!hal_drive_uses_removable_media (hal_drive) && 
+-	   !hal_volume_policy_should_be_visible (hal_drive, hal_volume, hal_storage_policy, target_mount_point))
++	if(!libhal_drive_uses_removable_media (hal_drive) && 
++	   !libhal_volume_policy_should_be_visible (hal_drive, hal_volume, hal_storage_policy, target_mount_point))
+ 		drive->priv->is_user_visible = FALSE;
+ 
+ 	g_free (target_mount_point);
+ 
+ 	/* set hal udi */
+-	drive->priv->hal_udi = g_strdup (hal_drive_get_udi (hal_drive));
++	drive->priv->hal_udi = g_strdup (libhal_drive_get_udi (hal_drive));
+ 
+ out:
+-	hal_volume_free (hal_volume);
+-	hal_drive_free (hal_drive);
++	libhal_volume_free (hal_volume);
++	libhal_drive_free (hal_drive);
+ }
+ 
+ void 
+@@ -501,10 +470,10 @@
+ 	char *volume_icon;
+ 	char *unique_volume_name;
+ 	LibHalContext *hal_ctx; 
+-	HalDrive *hal_drive;
+-	HalVolume *hal_volume;
++	LibHalDrive *hal_drive;
++	LibHalVolume *hal_volume;
+ 	GnomeVFSHalUserData *hal_userdata;
+-	HalStoragePolicy *hal_storage_policy;
++	LibHalStoragePolicy *hal_storage_policy;
+ 	char *target_mount_point;
+ 
+ 	hal_volume = NULL;
+@@ -515,7 +484,7 @@
+ 	if (volume == NULL || volume->priv == NULL || volume->priv->device_path == NULL)
+ 		goto out;
+ 
+-	hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
++	hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (hal_ctx);
+ 	hal_storage_policy = hal_userdata->hal_storage_policy;
+ 
+ 	/* Now, modify the drive with the hal stuff, unless we've already done so */
+@@ -526,17 +495,17 @@
+ 	 * /dev/sda1 etc, however we get the Drive object for the parent if
+ 	 * that is the case. This is a feature of libhal-storage.
+ 	 */
+-	if ((hal_drive = hal_drive_from_device_file (hal_ctx, volume->priv->device_path)) == NULL) {
++	if ((hal_drive = libhal_drive_from_device_file (hal_ctx, volume->priv->device_path)) == NULL) {
+ 		g_warning ("%s: no hal drive for device=%s", __FUNCTION__, volume->priv->device_path);
+ 		goto out;
+ 	}
+-	if ((hal_volume = hal_volume_from_device_file (hal_ctx, volume->priv->device_path)) == NULL) {
++	if ((hal_volume = libhal_volume_from_device_file (hal_ctx, volume->priv->device_path)) == NULL) {
+ 		g_warning ("%s: no hal volume for device=%s", __FUNCTION__, volume->priv->device_path);
+ 		goto out;
+ 	}
+ 
+ 	/* set display name */
+-	volume_name = hal_volume_policy_compute_display_name (hal_drive, hal_volume, hal_storage_policy);
++	volume_name = libhal_volume_policy_compute_display_name (hal_drive, hal_volume, hal_storage_policy);
+ 	unique_volume_name = _gnome_vfs_volume_monitor_uniquify_volume_name (
+ 		GNOME_VFS_VOLUME_MONITOR (volume_monitor_daemon), volume_name);
+ 	if (volume->priv->display_name != NULL)
+@@ -545,10 +514,10 @@
+ 	free (volume_name);
+ 
+ 	/* set icon name; try dedicated icon name first... */
+-	if (hal_drive_get_dedicated_icon_volume (hal_drive) != NULL)
+-		volume_icon = strdup (hal_drive_get_dedicated_icon_volume (hal_drive));
++	if (libhal_drive_get_dedicated_icon_volume (hal_drive) != NULL)
++		volume_icon = strdup (libhal_drive_get_dedicated_icon_volume (hal_drive));
+ 	else
+-		volume_icon = hal_volume_policy_compute_icon_name (hal_drive, hal_volume, hal_storage_policy);
++		volume_icon = libhal_volume_policy_compute_icon_name (hal_drive, hal_volume, hal_storage_policy);
+ 	if (volume->priv->icon != NULL)
+ 		g_free (volume->priv->icon);
+ 	volume->priv->icon = g_strdup (volume_icon);
+@@ -558,7 +527,7 @@
+ 	target_mount_point = NULL;
+ 	{
+ 		const char *str;
+-		str = hal_volume_get_mount_point (hal_volume);
++		str = libhal_volume_get_mount_point (hal_volume);
+ 		if (str != NULL)
+ 			target_mount_point = g_strdup (str);
+ 	}
+@@ -569,16 +538,16 @@
+ 
+ 	/* set whether it's visible on the desktop */
+ 	volume->priv->is_user_visible = 
+-		hal_volume_policy_should_be_visible (hal_drive, hal_volume, hal_storage_policy, target_mount_point) &&
+-		(hal_drive_is_hotpluggable (hal_drive) || hal_drive_uses_removable_media (hal_drive));
++		libhal_volume_policy_should_be_visible (hal_drive, hal_volume, hal_storage_policy, target_mount_point) &&
++		(libhal_drive_is_hotpluggable (hal_drive) || libhal_drive_uses_removable_media (hal_drive));
+ 
+ 	g_free (target_mount_point);
+ 
+ 	/* set hal udi */
+-	volume->priv->hal_udi = g_strdup (hal_volume_get_udi (hal_volume));
++	volume->priv->hal_udi = g_strdup (libhal_volume_get_udi (hal_volume));
+ out:
+-	hal_drive_free (hal_drive);
+-	hal_volume_free (hal_volume);
++	libhal_drive_free (hal_drive);
++	libhal_volume_free (hal_volume);
+ }
+ 
+ #endif /* USE_HAL */




More information about the patches mailing list