hal/libhal-storage libhal-storage.c, 1.3, 1.4 libhal-storage.h, 1.2, 1.3

David Zeuthen david at freedesktop.org
Fri Sep 24 15:27:22 PDT 2004


Update of /cvs/hal/hal/libhal-storage
In directory gabe:/tmp/cvs-serv16023/libhal-storage

Modified Files:
	libhal-storage.c libhal-storage.h 
Log Message:
2004-09-25  David Zeuthen  <david at fubar.dk>

	* configure.in: Added fr to ALL_LINGUAS

	* po/fr.op: Added french translations from Jérôme Lodewyck 
	<lodewyck at clipper.ens.fr>

	* libhal-storage/libhal-storage.h: Add prototypes for new functions
	hal_drive_(requires_eject|get_dedication_icon_(drive|volume)).

	* libhal-storage/libhal-storage.c (hal_storage_policy_lookup_icon): 
	Remove printf debug statement.
	(hal_drive_get_dedicated_icon_drive): New function
	(hal_drive_get_dedicated_icon_volume): New function
	(hal_drive_from_udi): Read storage.icon.* and storage.requires_eject
	(hal_drive_requires_eject): New function

	* hald/linux/block_class_device.c (block_class_pre_process): Add
	and set boolean property storage.requires_eject; right now we
	only add it for optical drives. Interestingly enough, my iPod Mini
	requires to be ejected as well (see RH bug #132195 for some
	discussion). 

	* doc/spec/hal-spec.xml.in: Add docs for storage.requires_eject, 
	storage.icon.drive and storage.icon.volume



Index: libhal-storage.c
===================================================================
RCS file: /cvs/hal/hal/libhal-storage/libhal-storage.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- libhal-storage.c	24 Sep 2004 15:26:02 -0000	1.3
+++ libhal-storage.c	24 Sep 2004 22:27:20 -0000	1.4
@@ -146,8 +146,6 @@
 	IconMappingEntry *i;
 	const char *path;
 
-	printf ("looking up 0x%08x\n", icon);
-
 	path = NULL;
 	for (i = policy->icon_mappings; i != NULL; i = i->next) {
 		if (i->icon == icon) {
@@ -633,6 +631,7 @@
 	char *model;              /* may be "", is never NULL */
 	dbus_bool_t is_hotpluggable;
 	dbus_bool_t is_removable;
+	dbus_bool_t requires_eject;
 
 	HalDriveType type;
 	char *type_textual;
@@ -640,6 +639,9 @@
 	char *physical_device;  /* UDI of physical device, e.g. the 
 				 * IDE, USB, IEEE1394 device */
 
+	char *dedicated_icon_drive;
+	char *dedicated_icon_volume;
+
 	char *serial;
 	char *firmware_version;
 	HalDriveCdromCaps cdrom_caps;
@@ -677,6 +679,18 @@
 	unsigned int num_blocks;
 };
 
+const char *
+hal_drive_get_dedicated_icon_drive (HalDrive *drive)
+{
+	return drive->dedicated_icon_drive;
+}
+
+const char *
+hal_drive_get_dedicated_icon_volume (HalDrive *drive)
+{
+	return drive->dedicated_icon_volume;
+}
+
 /** Free all resources used by a HalDrive object.
  *
  *  @param  drive               Object to free
@@ -782,8 +796,12 @@
 		HAL_PROP_EXTRACT_STRING ("storage.model",             drive->model);
 		HAL_PROP_EXTRACT_STRING ("storage.drive_type",        drive->type_textual);
 
+		HAL_PROP_EXTRACT_STRING ("storage.icon.drive",        drive->dedicated_icon_drive);
+		HAL_PROP_EXTRACT_STRING ("storage.icon.volume",       drive->dedicated_icon_volume);
+
 		HAL_PROP_EXTRACT_BOOL   ("storage.hotpluggable",      drive->is_hotpluggable);
 		HAL_PROP_EXTRACT_BOOL   ("storage.removable",         drive->is_removable);
+		HAL_PROP_EXTRACT_BOOL   ("storage.requires_eject",    drive->requires_eject);
 
 		HAL_PROP_EXTRACT_STRING ("storage.physical_device",   drive->physical_device);
 		HAL_PROP_EXTRACT_STRING ("storage.firmware_version",  drive->firmware_version);
@@ -876,6 +894,12 @@
 	return drive->physical_device;
 }
 
+dbus_bool_t
+hal_drive_requires_eject (HalDrive *drive)
+{
+	return drive->requires_eject;
+}
+
 /** Given a UDI for a HAL device of capability 'volume', this
  *  function retrieves all the relevant properties into convenient
  *  in-process data structures.

Index: libhal-storage.h
===================================================================
RCS file: /cvs/hal/hal/libhal-storage/libhal-storage.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- libhal-storage.h	24 Sep 2004 15:23:45 -0000	1.2
+++ libhal-storage.h	24 Sep 2004 22:27:20 -0000	1.3
@@ -171,6 +171,7 @@
 
 dbus_bool_t       hal_drive_is_hotpluggable             (HalDrive      *drive);
 dbus_bool_t       hal_drive_uses_removable_media        (HalDrive      *drive);
+dbus_bool_t       hal_drive_requires_eject              (HalDrive      *drive);
 HalDriveType      hal_drive_get_type                    (HalDrive      *drive);
 HalDriveBus       hal_drive_get_bus                     (HalDrive      *drive);
 HalDriveCdromCaps hal_drive_get_cdrom_caps              (HalDrive      *drive);
@@ -185,11 +186,15 @@
 const char       *hal_drive_get_vendor                  (HalDrive      *drive);
 const char       *hal_drive_get_physical_device_udi     (HalDrive      *drive);
 
+const char       *hal_drive_get_dedicated_icon_drive    (HalDrive      *drive);
+const char       *hal_drive_get_dedicated_icon_volume   (HalDrive      *drive);
+
 char             *hal_drive_policy_compute_display_name (HalDrive      *drive, HalVolume *volume, HalStoragePolicy *policy);
 char             *hal_drive_policy_compute_icon_name    (HalDrive      *drive, HalVolume *volume, HalStoragePolicy *policy);
 
 char            **hal_drive_find_all_volumes            (LibHalContext *hal_ctx, HalDrive *drive, int *num_volumes);
 
+
 typedef enum {
 	HAL_VOLUME_USAGE_MOUNTABLE_FILESYSTEM,
 	HAL_VOLUME_USAGE_PARTITION_TABLE,




More information about the hal-commit mailing list