diff options
author | Alexander Larsson <alexl@redhat.com> | 2008-01-24 16:07:23 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2008-01-24 16:07:23 +0000 |
commit | 876cf18ab4935ab405ad428fbe59154038210004 (patch) | |
tree | 1345101277a4921da00ef8024d4a7195a666e734 | |
parent | 0f9b71ba714a05209baba3cad437431530feda06 (diff) | |
download | gvfs-876cf18ab4935ab405ad428fbe59154038210004.tar.gz |
Remove debug spew.
2008-01-24 Alexander Larsson <alexl@redhat.com>
* hal/ghalvolumemonitor.c:
Remove debug spew.
* hal/ghaldrive.c:
* hal/ghalvolume.c:
Implement identifier getters
* programs/gvfs-mount.c:
Show identifiers
svn path=/trunk/; revision=1177
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | hal/ghaldrive.c | 38 | ||||
-rw-r--r-- | hal/ghalvolume.c | 55 | ||||
-rw-r--r-- | hal/ghalvolumemonitor.c | 5 | ||||
-rw-r--r-- | programs/gvfs-mount.c | 36 |
5 files changed, 138 insertions, 8 deletions
@@ -1,5 +1,17 @@ 2008-01-24 Alexander Larsson <alexl@redhat.com> + * hal/ghalvolumemonitor.c: + Remove debug spew. + + * hal/ghaldrive.c: + * hal/ghalvolume.c: + Implement identifier getters + + * programs/gvfs-mount.c: + Show identifiers + +2008-01-24 Alexander Larsson <alexl@redhat.com> + * daemon/gvfsdaemon.c: Indentation fix diff --git a/hal/ghaldrive.c b/hal/ghaldrive.c index a43aadcd..74a02f14 100644 --- a/hal/ghaldrive.c +++ b/hal/ghaldrive.c @@ -843,6 +843,42 @@ g_hal_drive_poll_for_media_finish (GDrive *drive, return TRUE; } +static char * +g_hal_drive_get_identifier (GDrive *drive, + const char *kind) +{ + GHalDrive *hal_drive = G_HAL_DRIVE (drive); + + if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_HAL_UDI) == 0) + return g_strdup (hal_device_get_udi (hal_drive->device)); + + if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE) == 0) + return g_strdup (hal_drive->device_path); + + return NULL; +} + +static char ** +g_hal_drive_enumerate_identifiers (GDrive *drive) +{ + GHalDrive *hal_drive = G_HAL_DRIVE (drive); + GPtrArray *res; + + res = g_ptr_array_new (); + + g_ptr_array_add (res, + g_strdup (G_VOLUME_IDENTIFIER_KIND_HAL_UDI)); + + if (hal_drive->device_path && *hal_drive->device_path != 0) + g_ptr_array_add (res, + g_strdup (G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE)); + + + /* Null-terminate */ + g_ptr_array_add (res, NULL); + + return g_ptr_array_free (res, FALSE); +} static void g_hal_drive_drive_iface_init (GDriveIface *iface) @@ -860,6 +896,8 @@ g_hal_drive_drive_iface_init (GDriveIface *iface) iface->eject_finish = g_hal_drive_eject_finish; iface->poll_for_media = g_hal_drive_poll_for_media; iface->poll_for_media_finish = g_hal_drive_poll_for_media_finish; + iface->get_identifier = g_hal_drive_get_identifier; + iface->enumerate_identifiers = g_hal_drive_enumerate_identifiers; } void diff --git a/hal/ghalvolume.c b/hal/ghalvolume.c index 25604b39..b6b3873b 100644 --- a/hal/ghalvolume.c +++ b/hal/ghalvolume.c @@ -908,6 +908,59 @@ g_hal_volume_eject_finish (GVolume *volume, return TRUE; } +static char * +g_hal_volume_get_identifier (GVolume *volume, + const char *kind) +{ + GHalVolume *hal_volume = G_HAL_VOLUME (volume); + + if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_HAL_UDI) == 0) + return g_strdup (hal_device_get_udi (hal_volume->device)); + + if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE) == 0) + return g_strdup (hal_volume->device_path); + + if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_LABEL) == 0) + return g_strdup (hal_device_get_property_string (hal_volume->device, "volume.label")); + + if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_UUID) == 0) + return g_strdup (hal_device_get_property_string (hal_volume->device, "volume.uuid")); + + return NULL; +} + +static char ** +g_hal_volume_enumerate_identifiers (GVolume *volume) +{ + GHalVolume *hal_volume = G_HAL_VOLUME (volume); + GPtrArray *res; + const char *label, *uuid; + + res = g_ptr_array_new (); + + g_ptr_array_add (res, + g_strdup (G_VOLUME_IDENTIFIER_KIND_HAL_UDI)); + + if (hal_volume->device_path && *hal_volume->device_path != 0) + g_ptr_array_add (res, + g_strdup (G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE)); + + label = hal_device_get_property_string (hal_volume->device, "volume.label"); + uuid = hal_device_get_property_string (hal_volume->device, "volume.uuid"); + + if (label && *label != 0) + g_ptr_array_add (res, + g_strdup (G_VOLUME_IDENTIFIER_KIND_LABEL)); + + if (uuid && *uuid != 0) + g_ptr_array_add (res, + g_strdup (G_VOLUME_IDENTIFIER_KIND_UUID)); + + /* Null-terminate */ + g_ptr_array_add (res, NULL); + + return g_ptr_array_free (res, FALSE); +} static void g_hal_volume_volume_iface_init (GVolumeIface *iface) @@ -923,6 +976,8 @@ g_hal_volume_volume_iface_init (GVolumeIface *iface) iface->mount_finish = g_hal_volume_mount_finish; iface->eject = g_hal_volume_eject; iface->eject_finish = g_hal_volume_eject_finish; + iface->get_identifier = g_hal_volume_get_identifier; + iface->enumerate_identifiers = g_hal_volume_enumerate_identifiers; } void diff --git a/hal/ghalvolumemonitor.c b/hal/ghalvolumemonitor.c index 97ede2b5..889491d2 100644 --- a/hal/ghalvolumemonitor.c +++ b/hal/ghalvolumemonitor.c @@ -727,7 +727,6 @@ should_drive_be_ignored (HalPool *pool, HalDevice *d) gboolean all_volumes_ignored, got_volumes; drive_udi = hal_device_get_udi (d); - g_print ("should_drive_be_ignored %s\n", drive_udi); volumes = hal_pool_find_by_capability (pool, "volume"); @@ -736,7 +735,6 @@ should_drive_be_ignored (HalPool *pool, HalDevice *d) for (l = volumes; l != NULL; l = l->next) { HalDevice *volume_dev = l->data; - g_print ("volume udi: %s\n", hal_device_get_udi (volume_dev)); if (strcmp (drive_udi, hal_device_get_property_string (volume_dev, "block.storage_device")) == 0) { got_volumes = TRUE; @@ -748,9 +746,6 @@ should_drive_be_ignored (HalPool *pool, HalDevice *d) } } - g_print ("got_volumes: %d, all_ignored: %d\n", - got_volumes, all_volumes_ignored); - return got_volumes && all_volumes_ignored; } diff --git a/programs/gvfs-mount.c b/programs/gvfs-mount.c index b6114b8a..ea07b0d9 100644 --- a/programs/gvfs-mount.c +++ b/programs/gvfs-mount.c @@ -325,12 +325,13 @@ list_volumes (GList *volumes, gboolean only_with_no_drive) { GList *l, *mounts; - int c; + int c, i; GMount *mount; GVolume *volume; GDrive *drive; char *name; char *uuid; + char **ids; for (c = 0, l = volumes; l != NULL; l = l->next, c++) { @@ -353,6 +354,20 @@ list_volumes (GList *volumes, if (mount_list_info) { + ids = g_volume_enumerate_identifiers (volume); + if (ids && ids[0] != NULL) + { + g_print ("%*sids:\n", indent+2, ""); + for (i = 0; ids[i] != NULL; i++) + { + char *id = g_volume_get_identifier (volume, + ids[i]); + g_print ("%*s %s: '%s'\n", indent+2, "", ids[i], id); + g_free (id); + } + } + g_strfreev (ids); + uuid = g_volume_get_uuid (volume); if (uuid) g_print ("%*suuid=%s\n", indent + 2, "", uuid); @@ -377,9 +392,10 @@ list_drives (GList *drives, int indent) { GList *volumes, *l; - int c; + int c, i; GDrive *drive; char *name; + char **ids; for (c = 0, l = drives; l != NULL; l = l->next, c++) { @@ -388,9 +404,23 @@ list_drives (GList *drives, g_print ("%*sDrive(%d): %s\n", indent, "", c, name); g_free (name); - + if (mount_list_info) { + ids = g_drive_enumerate_identifiers (drive); + if (ids && ids[0] != NULL) + { + g_print ("%*sids:\n", indent+2, ""); + for (i = 0; ids[i] != NULL; i++) + { + char *id = g_drive_get_identifier (drive, + ids[i]); + g_print ("%*s %s: '%s'\n", indent+2, "", ids[i], id); + g_free (id); + } + } + g_strfreev (ids); + g_print ("%*sis_media_removable=%d\n", indent + 2, "", g_drive_is_media_removable (drive)); g_print ("%*shas_media=%d\n", indent + 2, "", g_drive_has_media (drive)); g_print ("%*sis_media_check_automatic=%d\n", indent + 2, "", g_drive_is_media_check_automatic (drive)); |