gvfs r1144 - in trunk: . hal



Author: alexl
Date: Thu Jan 17 12:23:22 2008
New Revision: 1144
URL: http://svn.gnome.org/viewvc/gvfs?rev=1144&view=rev

Log:
2008-01-17  Alexander Larsson  <alexl redhat com>

        * hal/ghalvolume.c:
        * hal/ghalvolumemonitor.c:
	Initial work on LUKS, from david.




Modified:
   trunk/ChangeLog
   trunk/hal/ghalvolume.c
   trunk/hal/ghalvolumemonitor.c

Modified: trunk/hal/ghalvolume.c
==============================================================================
--- trunk/hal/ghalvolume.c	(original)
+++ trunk/hal/ghalvolume.c	Thu Jan 17 12:23:22 2008
@@ -186,17 +186,17 @@
   if (size < MEGABYTE_FACTOR)
     {
       displayed_size = (double) size / KILOBYTE_FACTOR;
-      str = g_strdup_printf (_("%.1f kB Media"), displayed_size);
+      str = g_strdup_printf (_("%.1f kB"), displayed_size);
     } 
   else if (size < GIGABYTE_FACTOR)
     {
       displayed_size = (double) size / MEGABYTE_FACTOR;
-      str = g_strdup_printf (_("%.1f MB Media"), displayed_size);
+      str = g_strdup_printf (_("%.1f MB"), displayed_size);
     } 
   else 
     {
       displayed_size = (double) size / GIGABYTE_FACTOR;
-      str = g_strdup_printf (_("%.1f GB Media"), displayed_size);
+      str = g_strdup_printf (_("%.1f GB"), displayed_size);
     }
   
   return str;
@@ -215,9 +215,12 @@
   gboolean volume_disc_has_data;
   const char *volume_disc_type;
   gboolean volume_disc_is_blank;
+  const char *volume_fsusage;
+  const char *volume_fstype;
   HalDevice *volume;
   HalDevice *drive;
   char *name;
+  char *size;
 
   volume = mv->device;
   drive = mv->drive_device;
@@ -232,6 +235,8 @@
   volume_disc_has_data = hal_device_get_property_bool (volume, "volume.disc.has_data");
   volume_disc_is_blank = hal_device_get_property_bool (volume, "volume.disc.is_blank");
   volume_disc_type = hal_device_get_property_string (volume, "volume.disc.type");
+  volume_fsusage = hal_device_get_property_string (volume, "volume.fsusage");
+  volume_fstype = hal_device_get_property_string (volume, "volume.fstype");
 
   if (volume_is_disc && volume_disc_has_audio && mv->foreign_mount_root != NULL)
     {
@@ -239,19 +244,27 @@
     }
   else
     {
-      if (volume_fs_label != NULL && strlen (volume_fs_label) > 0) {
-        name = g_strdup (volume_fs_label);
-      } else if (volume_is_disc) {
-        if (volume_disc_has_audio) {
-          if (volume_disc_has_data)
-            name = g_strdup (_("Mixed Audio/Data Disc"));
-          else
-            name = g_strdup (_("Audio Disc"));
+      if (strcmp (volume_fsusage, "crypto") == 0 && strcmp (volume_fstype, "crypto_LUKS") == 0) {
+        size = format_size_for_display (volume_size);
+        name = g_strdup_printf (_("%s Encrypted Data"), size);
+        g_free (size);
+      } else {
+        if (volume_fs_label != NULL && strlen (volume_fs_label) > 0) {
+          name = g_strdup (volume_fs_label);
+        } else if (volume_is_disc) {
+          if (volume_disc_has_audio) {
+            if (volume_disc_has_data)
+              name = g_strdup (_("Mixed Audio/Data Disc"));
+            else
+              name = g_strdup (_("Audio Disc"));
+          } else {
+            name = g_strdup (get_disc_name (volume_disc_type, volume_disc_is_blank));
+          }
         } else {
-          name = g_strdup (get_disc_name (volume_disc_type, volume_disc_is_blank));
+          size = format_size_for_display (volume_size);
+          name = g_strdup_printf (_("%s Media"), size);
+          g_free (size);
         }
-      } else {
-        name = format_size_for_display (volume_size);
       }
     }
 
@@ -262,6 +275,18 @@
     mv->mount_path = g_strdup (hal_device_get_property_string (volume, "volume.mount_point"));
   else
     mv->mount_path = NULL;
+
+  g_object_set_data_full (G_OBJECT (mv), 
+                          "hal-storage-device-capabilities",
+                          g_strdupv (hal_device_get_property_strlist (mv->drive_device, "info.capabilities")),
+                          (GDestroyNotify) g_strfreev);
+
+  if (volume_disc_type != NULL && strlen (volume_disc_type) == 0)
+    volume_disc_type = NULL;
+  g_object_set_data_full (G_OBJECT (mv), 
+                          "hal-volume.disc.type",
+                          g_strdup (volume_disc_type),
+                          (GDestroyNotify) g_free);
 }
 
 static void

Modified: trunk/hal/ghalvolumemonitor.c
==============================================================================
--- trunk/hal/ghalvolumemonitor.c	(original)
+++ trunk/hal/ghalvolumemonitor.c	Thu Jan 17 12:23:22 2008
@@ -658,7 +658,7 @@
 }
 
 static gboolean
-_should_volume_be_ignored (HalDevice *d)
+_should_volume_be_ignored (HalPool *pool, HalDevice *d)
 {
   gboolean volume_ignore;
   const char *volume_fsusage;
@@ -678,6 +678,19 @@
   if (strcmp (volume_fsusage, "filesystem") != 0)
     {
       /* no file system on the volume... blank and audio discs are handled in update_discs() */
+
+      /* TODO: davidz: LUKS stuff needs more work; turn off for now */
+#if 0
+      /* check if it's a LUKS crypto volume */
+      if (strcmp (volume_fsusage, "crypto") == 0)
+        {
+          if (strcmp (hal_device_get_property_string (d, "volume.fstype"), "crypto_LUKS") == 0)
+            {
+              return FALSE;
+            }
+        }
+#endif
+      
       return TRUE;
     }
 
@@ -763,7 +776,7 @@
     {
       ll = l->next;
       HalDevice *d = l->data;
-      if (_should_volume_be_ignored (d))
+      if (_should_volume_be_ignored (monitor->pool, d))
         new_volume_devices = g_list_delete_link (new_volume_devices, l);
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]