[Utopia] [patch] gvm property name changes
- From: David Zeuthen <david fubar dk>
- To: rml ximian com
- Cc: utopia-list gnome org
- Subject: [Utopia] [patch] gvm property name changes
- Date: Wed, 05 May 2004 22:45:05 +0200
Hi Robert,
I've just renamed some properties in hal so here is a patch that updates
gvm to use the new property names. In the patch there's a few fixes and
I've also made one change you might want to consider:
When detecting photos on a volume we add the capability 'camera'. This
is nice, but I think this capability name should be reserved for cameras
that libgphoto can handle so I've renamed the capability to
'content.photos' - makes sense?
Cheers,
David
? hal-property-name-changes.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/ChangeLog,v
retrieving revision 1.57
diff -u -p -r1.57 ChangeLog
--- a/ChangeLog 1 May 2004 17:19:57 -0000 1.57
+++ b/ChangeLog 5 May 2004 20:47:24 -0000
@@ -1,3 +1,15 @@
+2004-05-05 David Zeuthen <david fubar dk>
+
+ * src/manager.c: update the property names as hal has changed
+ (gvm_device_is_writer): properties are bool, not int. also support
+ dvd+r(w)
+ (gvm_cdrom_policy): also mount dvd discs now hal has a separate
+ disc_type for these; also see TODO note..
+ (hal_device_added): use a hal utility to determine whether it's a
+ block device
+ (gvm_check_photos): add capability content.photos instead of
+ capability camera
+
2004-05-01 Adam Weinberger <adamw gnome org>
* configure.in: Added en_CA to ALL_LINGUAS.
Index: src/manager.c
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/src/manager.c,v
retrieving revision 1.19
diff -u -p -r1.19 manager.c
--- a/src/manager.c 13 Apr 2004 05:05:17 -0000 1.19
+++ b/src/manager.c 5 May 2004 20:47:25 -0000
@@ -265,8 +265,8 @@ gvm_check_photos (const char *udi, const
retval = TRUE;
dbg ("Photos detected: %s\n", dcim_path);
- /* add the "camera" capability to this device */
- if (!hal_device_add_capability (hal_ctx, udi, "camera"))
+ /* add the "content.photos" capability to this device */
+ if (!hal_device_add_capability (hal_ctx, udi, "content.photos"))
warn ("failed to add camera capability to %s\n", device);
if (config.autophoto) {
@@ -308,9 +308,9 @@ gvm_device_autorun (const char *udi)
}
mount_point = hal_device_get_property_string (hal_ctx, udi,
- "block.mount_point");
+ "volume.mount_point");
if (!mount_point) {
- warn ("cannot get block.mount_point\n");
+ warn ("cannot get volume.mount_point\n");
goto out;
}
@@ -468,10 +468,12 @@ gvm_run_cdburner (const char *device, co
static gboolean
gvm_device_is_writer (const char *udi)
{
- if ((hal_device_get_property_int (hal_ctx, udi, "storage.cdr") == 1) ||
- (hal_device_get_property_int (hal_ctx, udi, "storage.cdrw") == 1) ||
- (hal_device_get_property_int (hal_ctx, udi, "storage.dvdr") == 1) ||
- (hal_device_get_property_int (hal_ctx, udi, "storage.dvdram") == 1))
+ if ((hal_device_get_property_bool (hal_ctx, udi, "storage.cdrom.cdr")) ||
+ (hal_device_get_property_bool (hal_ctx, udi, "storage.cdrom.cdrw")) ||
+ (hal_device_get_property_bool (hal_ctx, udi, "storage.cdrom.dvdr")) ||
+ (hal_device_get_property_bool (hal_ctx, udi, "storage.cdrom.dvdram")) ||
+ (hal_device_get_property_bool (hal_ctx, udi, "storage.cdrom.dvdplusr")) ||
+ (hal_device_get_property_bool (hal_ctx, udi, "storage.cdrom.dvdplusrw")))
return TRUE;
return FALSE;
@@ -487,9 +489,9 @@ gvm_cdrom_policy (const char *udi)
char *type, *device = NULL;
type = hal_device_get_property_string (hal_ctx, udi,
- "storage.cdrom.media_type");
+ "volume.disc_type");
if (!type) {
- warn ("unable to get storage.cdrom.media_type for %s\n", udi);
+ warn ("unable to get volume.disc_type for %s\n", udi);
goto out;
}
@@ -503,7 +505,10 @@ gvm_cdrom_policy (const char *udi)
gvm_run_cdplayer (device, device);
} else if (!strcmp (type, "mixed")) {
gvm_ask_mixed (udi);
- } else if (!strcmp (type, "data")) {
+ } else if (strcmp (type, "data")==0 ||
+ strncmp (type, "dvd_", 4)==0 ){
+ /** @todo hmm, not sure it's sane to mount all dvd_ disc types;
+ * see hal spec/source for various disc types exported */
if (config.automount_media)
gvm_device_mount (device);
} else if (!strcmp (type, "blank")) {
@@ -511,6 +516,8 @@ gvm_cdrom_policy (const char *udi)
gvm_run_cdburner (device, device);
}
+ /** @todo enforce policy for all the new disc types now supported */
+
out:
hal_free_string (device);
hal_free_string (type);
@@ -533,9 +540,9 @@ gvm_media_changed (const char *udi)
/* get HAL's interpretation of our media type */
media_type = hal_device_get_property_string (hal_ctx, udi,
- "storage.media");
+ "storage.drive_type");
if (!media_type) {
- warn ("cannot get storage.media\n");
+ warn ("cannot get storage.drive_type\n");
return;
}
@@ -556,18 +563,11 @@ static void
hal_device_added (LibHalContext *ctx __attribute__((__unused__)),
const char *udi)
{
- char *bus, *device = NULL, *storage_device = NULL;
-
- bus = hal_device_get_property_string (hal_ctx, udi, "info.bus");
- if (!bus) {
- warn ("cannot get info.bus\n");
- goto out;
- }
+ char *device = NULL, *storage_device = NULL;
dbg ("New Device: %s\n", udi);
- /* is this a block device ? */
- if (g_strcasecmp (bus, "block"))
+ if (!hal_device_query_capability(hal_ctx, udi, "block"))
goto out;
/* is this a mountable volume ? */
@@ -611,7 +611,6 @@ hal_device_added (LibHalContext *ctx __a
gvm_device_mount (device);
out:
- hal_free_string (bus);
hal_free_string (device);
hal_free_string (storage_device);
}
@@ -668,7 +667,7 @@ hal_property_modified (LibHalContext *ct
dbus_bool_t is_removed __attribute__((__unused__)),
dbus_bool_t is_added __attribute__((__unused__)))
{
- if (!g_strcasecmp (key, "block.is_mounted")) {
+ if (!g_strcasecmp (key, "volume.is_mounted")) {
dbus_bool_t val;
val = hal_device_get_property_bool (hal_ctx, udi, key);
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]