[Pkg-xfce-commits] r2112 - in desktop/trunk/thunar/debian: . patches

corsac at alioth.debian.org corsac at alioth.debian.org
Mon Jun 9 12:57:52 UTC 2008


Author: corsac
Date: 2008-06-09 12:57:52 +0000 (Mon, 09 Jun 2008)
New Revision: 2112

Added:
   desktop/trunk/thunar/debian/patches/06_support-encrypted-volumes.patch
Modified:
   desktop/trunk/thunar/debian/changelog
Log:
* debian/patches:
  - 06_support-encrypted-volumes added, by Colin Leroy. Handle encrypted
    volumes and enable mounting them from thunar.

Modified: desktop/trunk/thunar/debian/changelog
===================================================================
--- desktop/trunk/thunar/debian/changelog	2008-06-09 12:53:36 UTC (rev 2111)
+++ desktop/trunk/thunar/debian/changelog	2008-06-09 12:57:52 UTC (rev 2112)
@@ -1,3 +1,11 @@
+thunar (0.9.0-11) UNRELEASED; urgency=low
+
+  * debian/patches:
+    - 06_support-encrypted-volumes added, by Colin Leroy. Handle encrypted
+      volumes and enable mounting them from thunar.
+
+ -- Yves-Alexis Perez <corsac at debian.org>  Mon, 09 Jun 2008 14:57:11 +0200
+
 thunar (0.9.0-10) unstable; urgency=low
 
   * -dev package doesn't need to depend on exo-utils, thunar does.

Added: desktop/trunk/thunar/debian/patches/06_support-encrypted-volumes.patch
===================================================================
--- desktop/trunk/thunar/debian/patches/06_support-encrypted-volumes.patch	                        (rev 0)
+++ desktop/trunk/thunar/debian/patches/06_support-encrypted-volumes.patch	2008-06-09 12:57:52 UTC (rev 2112)
@@ -0,0 +1,389 @@
+Index: thunar/thunar-shortcuts-view.c
+===================================================================
+--- thunar/thunar-shortcuts-view.c	(revision 27044)
++++ thunar/thunar-shortcuts-view.c	(working copy)
+@@ -828,14 +828,19 @@
+   if (G_UNLIKELY (volume != NULL))
+     {
+       /* append the "Mount Volume" menu action */
+-      item = gtk_image_menu_item_new_with_mnemonic (_("_Mount Volume"));
+-      gtk_widget_set_sensitive (item, !thunar_vfs_volume_is_mounted (volume));
++      if (G_UNLIKELY(thunar_vfs_volume_is_crypto(volume))) {
++        item = gtk_image_menu_item_new_with_mnemonic (_("_Setup crypto layer"));
++        gtk_widget_set_sensitive (item, !thunar_vfs_volume_is_crypto_setup (volume));
++      } else {
++        item = gtk_image_menu_item_new_with_mnemonic (_("_Mount Volume"));
++        gtk_widget_set_sensitive (item, !thunar_vfs_volume_is_mounted (volume));
++      }
+       g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_mount), view);
+       gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+       gtk_widget_show (item);
+ 
+       /* check if the volume is ejectable */
+-      if (thunar_vfs_volume_is_ejectable (volume))
++      if (thunar_vfs_volume_is_ejectable (volume) && !thunar_vfs_volume_is_crypto(volume))
+         {
+           /* append the "Eject Volume" menu action */
+           item = gtk_image_menu_item_new_with_mnemonic (_("E_ject Volume"));
+@@ -846,8 +851,13 @@
+       else
+         {
+           /* append the "Unmount Volume" menu item */
+-          item = gtk_image_menu_item_new_with_mnemonic (_("_Unmount Volume"));
+-          gtk_widget_set_sensitive (item, thunar_vfs_volume_is_mounted (volume));
++	  if (G_UNLIKELY(thunar_vfs_volume_is_crypto(volume))) {
++            item = gtk_image_menu_item_new_with_mnemonic (_("_Teardown crypto layer"));
++            gtk_widget_set_sensitive (item, thunar_vfs_volume_is_crypto_setup (volume));
++	  } else {
++            item = gtk_image_menu_item_new_with_mnemonic (_("_Unmount Volume"));
++            gtk_widget_set_sensitive (item, thunar_vfs_volume_is_mounted (volume));
++	  }
+           g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_unmount), view);
+           gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+           gtk_widget_show (item);
+Index: thunar/thunar-tree-view.c
+===================================================================
+--- thunar/thunar-tree-view.c	(revision 27044)
++++ thunar/thunar-tree-view.c	(working copy)
+@@ -1035,14 +1035,19 @@
+   if (G_UNLIKELY (volume != NULL))
+     {
+       /* append the "Mount Volume" menu action */
+-      item = gtk_image_menu_item_new_with_mnemonic (_("_Mount Volume"));
+-      gtk_widget_set_sensitive (item, !thunar_vfs_volume_is_mounted (volume));
++      if (G_UNLIKELY(thunar_vfs_volume_is_crypto(volume))) {
++        item = gtk_image_menu_item_new_with_mnemonic (_("_Setup crypto layer"));
++        gtk_widget_set_sensitive (item, !thunar_vfs_volume_is_crypto_setup (volume));
++      } else {
++        item = gtk_image_menu_item_new_with_mnemonic (_("_Mount Volume"));
++        gtk_widget_set_sensitive (item, !thunar_vfs_volume_is_mounted (volume));
++      }
+       g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_tree_view_action_mount), view);
+       gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+       gtk_widget_show (item);
+ 
+       /* check if the volume is ejectable */
+-      if (thunar_vfs_volume_is_ejectable (volume))
++      if (thunar_vfs_volume_is_ejectable (volume) && !thunar_vfs_volume_is_crypto(volume))
+         {
+           /* append the "Eject Volume" menu action */
+           item = gtk_image_menu_item_new_with_mnemonic (_("E_ject Volume"));
+@@ -1053,8 +1058,13 @@
+       else
+         {
+           /* append the "Unmount Volume" menu item */
+-          item = gtk_image_menu_item_new_with_mnemonic (_("_Unmount Volume"));
+-          gtk_widget_set_sensitive (item, thunar_vfs_volume_is_mounted (volume));
++	  if (G_UNLIKELY(thunar_vfs_volume_is_crypto(volume))) {
++            item = gtk_image_menu_item_new_with_mnemonic (_("_Teardown crypto layer"));
++            gtk_widget_set_sensitive (item, thunar_vfs_volume_is_crypto_setup (volume));
++	  } else {
++            item = gtk_image_menu_item_new_with_mnemonic (_("_Unmount Volume"));
++            gtk_widget_set_sensitive (item, thunar_vfs_volume_is_mounted (volume));
++	  }
+           g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_tree_view_action_unmount), view);
+           gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+           gtk_widget_show (item);
+Index: thunar-vfs/thunar-vfs-volume-hal.c
+===================================================================
+--- thunar-vfs/thunar-vfs-volume-hal.c	(revision 27044)
++++ thunar-vfs/thunar-vfs-volume-hal.c	(working copy)
+@@ -54,6 +54,8 @@
+ static ThunarVfsVolumeStatus thunar_vfs_volume_hal_get_status               (ThunarVfsVolume          *volume);
+ static ThunarVfsPath        *thunar_vfs_volume_hal_get_mount_point          (ThunarVfsVolume          *volume);
+ static gboolean              thunar_vfs_volume_hal_is_ejectable             (ThunarVfsVolume          *volume);
++static gboolean              thunar_vfs_volume_hal_is_crypto                (ThunarVfsVolume          *volume);
++static gboolean              thunar_vfs_volume_hal_is_crypto_setup          (ThunarVfsVolume          *volume);
+ static const gchar          *thunar_vfs_volume_hal_lookup_icon_name         (ThunarVfsVolume          *volume,
+                                                                              GtkIconTheme             *icon_theme);
+ static gboolean              thunar_vfs_volume_hal_eject                    (ThunarVfsVolume          *volume,
+@@ -71,9 +73,9 @@
+                                                                              LibHalContext            *context,
+                                                                              LibHalVolume             *hv,
+                                                                              LibHalDrive              *hd);
++static LibHalContext        *thunar_vfs_volume_manager_hal_get_hal_context  (ThunarVfsVolumeManagerHal *manager_hal);
+ 
+ 
+-
+ struct _ThunarVfsVolumeHalClass
+ {
+   ThunarVfsVolumeClass __parent__;
+@@ -142,6 +144,8 @@
+   thunarvfs_volume_class->get_status = thunar_vfs_volume_hal_get_status;
+   thunarvfs_volume_class->get_mount_point = thunar_vfs_volume_hal_get_mount_point;
+   thunarvfs_volume_class->is_ejectable = thunar_vfs_volume_hal_is_ejectable;
++  thunarvfs_volume_class->is_crypto = thunar_vfs_volume_hal_is_crypto;
++  thunarvfs_volume_class->is_crypto_setup = thunar_vfs_volume_hal_is_crypto_setup;
+   thunarvfs_volume_class->lookup_icon_name = thunar_vfs_volume_hal_lookup_icon_name;
+   thunarvfs_volume_class->eject = thunar_vfs_volume_hal_eject;
+   thunarvfs_volume_class->mount = thunar_vfs_volume_hal_mount;
+@@ -207,16 +211,53 @@
+ static gboolean
+ thunar_vfs_volume_hal_is_ejectable (ThunarVfsVolume *volume)
+ {
+-  /* check if HAL drive requires eject */
+-  if (THUNAR_VFS_VOLUME_HAL (volume)->requires_eject)
+-    return TRUE;
++  return THUNAR_VFS_VOLUME_HAL (volume)->requires_eject;
++}
+ 
+-  /* otherwise we can only eject removable media, that are present (surprise, surprise) */
+-  return (thunar_vfs_volume_is_present (volume) && thunar_vfs_volume_is_removable (volume));
++
++static gboolean
++thunar_vfs_volume_hal_is_crypto (ThunarVfsVolume *volume)
++{
++  return THUNAR_VFS_VOLUME_HAL (volume)->kind == THUNAR_VFS_VOLUME_KIND_CRYPTO;
+ }
+ 
++static gboolean
++thunar_vfs_volume_hal_is_crypto_setup (ThunarVfsVolume *volume)
++{
++  ThunarVfsVolumeManager *manager = NULL;
++  LibHalContext *hal_context = NULL;
++  LibHalVolume *hal_volume = NULL;
++  gchar *plain_udi = NULL;
+ 
++  if (THUNAR_VFS_VOLUME_HAL (volume)->kind != THUNAR_VFS_VOLUME_KIND_CRYPTO)
++    return FALSE;
+ 
++  manager = thunar_vfs_volume_manager_get_default();
++  g_return_val_if_fail(manager != NULL, FALSE);
++  
++  if (!THUNAR_VFS_IS_VOLUME_MANAGER_HAL(manager))
++    return FALSE;
++
++  hal_context = thunar_vfs_volume_manager_hal_get_hal_context(THUNAR_VFS_VOLUME_MANAGER_HAL(manager));
++  g_return_val_if_fail(hal_context != NULL, FALSE);
++  
++  hal_volume = libhal_volume_from_udi(hal_context, THUNAR_VFS_VOLUME_HAL (volume)->udi);
++  g_return_val_if_fail(hal_volume != NULL, FALSE);
++
++  plain_udi = libhal_volume_crypto_get_clear_volume_udi(hal_context, hal_volume);
++
++  libhal_volume_free(hal_volume);
++  g_object_unref(manager);
++  if (plain_udi) {
++    g_free(plain_udi);
++    return TRUE;
++  }
++  return FALSE;
++}
++
++
++
++
+ static const gchar*
+ thunar_vfs_volume_hal_lookup_icon_name (ThunarVfsVolume *volume,
+                                         GtkIconTheme    *icon_theme)
+@@ -282,25 +323,28 @@
+   if (G_LIKELY (result))
+     {
+       /* try to figure out where the device was mounted */
+-      path = thunar_vfs_volume_hal_find_active_mount_point (volume_hal);
+-      if (G_LIKELY (path != NULL))
++      if (volume_hal->kind != THUNAR_VFS_VOLUME_KIND_CRYPTO)
+         {
+-          /* we must have been mounted successfully */
+-          volume_hal->status |= THUNAR_VFS_VOLUME_STATUS_MOUNTED | THUNAR_VFS_VOLUME_STATUS_PRESENT;
++	  path = thunar_vfs_volume_hal_find_active_mount_point (volume_hal);
++	  if (G_LIKELY (path != NULL))
++            {
++              /* we must have been mounted successfully */
++              volume_hal->status |= THUNAR_VFS_VOLUME_STATUS_MOUNTED | THUNAR_VFS_VOLUME_STATUS_PRESENT;
+ 
+-          /* replace the existing mount point */
+-          thunar_vfs_path_unref (volume_hal->mount_point);
+-          volume_hal->mount_point = path;
++              /* replace the existing mount point */
++              thunar_vfs_path_unref (volume_hal->mount_point);
++              volume_hal->mount_point = path;
+ 
+-          /* tell everybody that we have a new state */
+-          thunar_vfs_volume_changed (THUNAR_VFS_VOLUME (volume_hal));
+-        }
+-      else
+-        {
+-          /* something went wrong, for sure */
+-          g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Failed to determine the mount point for %s"), volume_hal->device_file);
+-          result = FALSE;
+-        }
++              /* tell everybody that we have a new state */
++              thunar_vfs_volume_changed (THUNAR_VFS_VOLUME (volume_hal));
++            }
++	  else
++            {
++              /* something went wrong, for sure */
++              g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Failed to determine the mount point for %s"), volume_hal->device_file);
++              result = FALSE;
++            }
++	}
+     }
+ 
+   return result;
+@@ -326,7 +370,7 @@
+   if (G_LIKELY (result))
+     {
+       /* reset the status */
+-      volume_hal->status &= ~THUNAR_VFS_VOLUME_STATUS_MOUNTED;
++      volume_hal->status &= ~(THUNAR_VFS_VOLUME_STATUS_MOUNTED);
+ 
+       /* emit "changed" on the volume */
+       thunar_vfs_volume_changed (THUNAR_VFS_VOLUME (volume_hal));
+@@ -359,7 +403,6 @@
+       g_slist_foreach (mount_points, (GFunc) exo_mount_point_free, NULL);
+       g_slist_free (mount_points);
+     }
+-
+   return mount_point;
+ }
+ 
+@@ -541,6 +584,10 @@
+   if(hv != NULL && libhal_volume_get_fsusage (hv) == LIBHAL_VOLUME_USAGE_MOUNTABLE_FILESYSTEM)
+     volume_hal->status |= THUNAR_VFS_VOLUME_STATUS_MOUNTABLE;
+ 
++  /* force the type to CRYPTO if necessary */
++  if (libhal_volume_get_fsusage (hv) == LIBHAL_VOLUME_USAGE_CRYPTO)
++    volume_hal->kind = THUNAR_VFS_VOLUME_KIND_CRYPTO;
++
+   /* check if the drive requires eject */
+   volume_hal->requires_eject = libhal_drive_requires_eject (hd);
+ 
+@@ -686,6 +733,12 @@
+ }
+ 
+ 
++static LibHalContext *
++thunar_vfs_volume_manager_hal_get_hal_context (ThunarVfsVolumeManagerHal *manager)
++{
++  g_return_val_if_fail(manager != NULL, NULL);
++  return manager->context;
++}
+ 
+ static void
+ thunar_vfs_volume_manager_hal_class_init (ThunarVfsVolumeManagerHalClass *klass)
+@@ -1019,7 +1072,8 @@
+   if (G_LIKELY (hv != NULL))
+     {
+       /* check if we have a mountable file system here */
+-      if (libhal_volume_get_fsusage (hv) == LIBHAL_VOLUME_USAGE_MOUNTABLE_FILESYSTEM)
++      if (libhal_volume_get_fsusage (hv) == LIBHAL_VOLUME_USAGE_MOUNTABLE_FILESYSTEM
++       || libhal_volume_get_fsusage (hv) == LIBHAL_VOLUME_USAGE_CRYPTO)
+         {
+           /* determine the UDI of the drive to which this volume belongs */
+           drive_udi = libhal_volume_get_storage_device_udi (hv);
+Index: thunar-vfs/thunar-vfs-volume.c
+===================================================================
+--- thunar-vfs/thunar-vfs-volume.c	(revision 27044)
++++ thunar-vfs/thunar-vfs-volume.c	(working copy)
+@@ -318,8 +318,46 @@
+ }
+ 
+ 
++/**
++ * thunar_vfs_volume_is_crypto:
++ * @volume : a #ThunarVfsVolume instance.
++ *
++ * Determines whether @volume is a crypto container
++ *
++ * Return value: whether @volume can is a crypto container.
++ **/
++gboolean
++thunar_vfs_volume_is_crypto (ThunarVfsVolume *volume)
++{
++  g_return_val_if_fail (THUNAR_VFS_IS_VOLUME (volume), FALSE);
++  if (*THUNAR_VFS_VOLUME_GET_CLASS (volume)->is_crypto)
++    return (*THUNAR_VFS_VOLUME_GET_CLASS (volume)->is_crypto) (volume);
++  else
++    return FALSE;
++}
+ 
++
+ /**
++ * thunar_vfs_volume_is_crypto:
++ * @volume : a #ThunarVfsVolume instance.
++ *
++ * Determines whether @volume is a crypto container
++ *
++ * Return value: whether @volume can is a crypto container.
++ **/
++gboolean
++thunar_vfs_volume_is_crypto_setup (ThunarVfsVolume *volume)
++{
++  g_return_val_if_fail (THUNAR_VFS_IS_VOLUME (volume), FALSE);
++  if (*THUNAR_VFS_VOLUME_GET_CLASS (volume)->is_crypto_setup)
++    return (*THUNAR_VFS_VOLUME_GET_CLASS (volume)->is_crypto_setup) (volume);
++  else
++    return FALSE;
++}
++
++
++
++/**
+  * thunar_vfs_volume_is_removable:
+  * @volume : a #ThunarVfsVolume instance.
+  *
+@@ -354,6 +392,7 @@
+     case THUNAR_VFS_VOLUME_KIND_AUDIO_CD:
+     case THUNAR_VFS_VOLUME_KIND_MEMORY_CARD:
+     case THUNAR_VFS_VOLUME_KIND_REMOVABLE_DISK:
++    case THUNAR_VFS_VOLUME_KIND_CRYPTO:
+       return TRUE;
+ 
+     default:
+Index: thunar-vfs/thunar-vfs-volume.h
+===================================================================
+--- thunar-vfs/thunar-vfs-volume.h	(revision 27044)
++++ thunar-vfs/thunar-vfs-volume.h	(working copy)
+@@ -56,6 +56,7 @@
+  * @THUNAR_VFS_VOLUME_KIND_AUDIO_CD       : Audio CDs.
+  * @THUNAR_VFS_VOLUME_KIND_MEMORY_CARD    : Memory cards.
+  * @THUNAR_VFS_VOLUME_KIND_REMOVABLE_DISK : Other removable disks.
++ * @THUNAR_VFS_VOLUME_KIND_CRYPTO         : Crypto fs container.
+  *
+  * Describes the type of a VFS volume.
+  **/
+@@ -78,6 +79,7 @@
+   THUNAR_VFS_VOLUME_KIND_AUDIO_CD,
+   THUNAR_VFS_VOLUME_KIND_MEMORY_CARD,
+   THUNAR_VFS_VOLUME_KIND_REMOVABLE_DISK,
++  THUNAR_VFS_VOLUME_KIND_CRYPTO,
+ } ThunarVfsVolumeKind;
+ 
+ /**
+@@ -90,9 +92,9 @@
+  **/
+ typedef enum /*< flags >*/
+ {
+-  THUNAR_VFS_VOLUME_STATUS_MOUNTED   = 1 << 0,
+-  THUNAR_VFS_VOLUME_STATUS_PRESENT   = 1 << 1,
+-  THUNAR_VFS_VOLUME_STATUS_MOUNTABLE = 1 << 2,
++  THUNAR_VFS_VOLUME_STATUS_MOUNTED      = 1 << 0,
++  THUNAR_VFS_VOLUME_STATUS_PRESENT      = 1 << 1,
++  THUNAR_VFS_VOLUME_STATUS_MOUNTABLE    = 1 << 2,
+ } ThunarVfsVolumeStatus;
+ 
+ GType                 thunar_vfs_volume_get_type          (void) G_GNUC_CONST;
+@@ -109,6 +111,9 @@
+ gboolean              thunar_vfs_volume_is_ejectable      (ThunarVfsVolume   *volume);
+ gboolean              thunar_vfs_volume_is_removable      (ThunarVfsVolume   *volume);
+ 
++gboolean              thunar_vfs_volume_is_crypto         (ThunarVfsVolume   *volume);
++gboolean              thunar_vfs_volume_is_crypto_setup   (ThunarVfsVolume   *volume);
++
+ const gchar          *thunar_vfs_volume_lookup_icon_name  (ThunarVfsVolume   *volume,
+                                                            GtkIconTheme      *icon_theme);
+ 
+Index: thunar-vfs/thunar-vfs-volume-private.h
+===================================================================
+--- thunar-vfs/thunar-vfs-volume-private.h	(revision 27044)
++++ thunar-vfs/thunar-vfs-volume-private.h	(working copy)
+@@ -56,6 +56,8 @@
+   void                  (*mounted)          (ThunarVfsVolume   *volume);
+   void                  (*pre_unmount)      (ThunarVfsVolume   *volume);
+   void                  (*unmounted)        (ThunarVfsVolume   *volume);
++  gboolean              (*is_crypto)        (ThunarVfsVolume   *volume);
++  gboolean              (*is_crypto_setup)  (ThunarVfsVolume   *volume);
+ };
+ 
+ struct _ThunarVfsVolume




More information about the Pkg-xfce-commits mailing list