gvfs r1177 - in trunk: . hal programs
- From: alexl svn gnome org
- To: svn-commits-list gnome org
- Subject: gvfs r1177 - in trunk: . hal programs
- Date: Thu, 24 Jan 2008 16:07:24 +0000 (GMT)
Author: alexl
Date: Thu Jan 24 16:07:23 2008
New Revision: 1177
URL: http://svn.gnome.org/viewvc/gvfs?rev=1177&view=rev
Log:
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
Modified:
trunk/ChangeLog
trunk/hal/ghaldrive.c
trunk/hal/ghalvolume.c
trunk/hal/ghalvolumemonitor.c
trunk/programs/gvfs-mount.c
Modified: trunk/hal/ghaldrive.c
==============================================================================
--- trunk/hal/ghaldrive.c (original)
+++ trunk/hal/ghaldrive.c Thu Jan 24 16:07:23 2008
@@ -843,6 +843,42 @@
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 @@
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
Modified: trunk/hal/ghalvolume.c
==============================================================================
--- trunk/hal/ghalvolume.c (original)
+++ trunk/hal/ghalvolume.c Thu Jan 24 16:07:23 2008
@@ -908,6 +908,59 @@
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 @@
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
Modified: trunk/hal/ghalvolumemonitor.c
==============================================================================
--- trunk/hal/ghalvolumemonitor.c (original)
+++ trunk/hal/ghalvolumemonitor.c Thu Jan 24 16:07:23 2008
@@ -727,7 +727,6 @@
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 @@
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 @@
}
}
- g_print ("got_volumes: %d, all_ignored: %d\n",
- got_volumes, all_volumes_ignored);
-
return got_volumes && all_volumes_ignored;
}
Modified: trunk/programs/gvfs-mount.c
==============================================================================
--- trunk/programs/gvfs-mount.c (original)
+++ trunk/programs/gvfs-mount.c Thu Jan 24 16:07:23 2008
@@ -325,12 +325,13 @@
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 @@
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 @@
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 @@
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));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]