Author: benny
Date: 2007-01-06 18:32:10 +0000 (Sat, 06 Jan 2007)
New Revision: 24277

Modified:
   thunar/trunk/ChangeLog
   thunar/trunk/README
   thunar/trunk/configure.in.in
   thunar/trunk/docs/README.volumes
   thunar/trunk/po/ChangeLog
   thunar/trunk/po/de.po
   thunar/trunk/thunar-vfs/Makefile.am
   thunar/trunk/thunar-vfs/thunar-vfs-exec.c
   thunar/trunk/thunar-vfs/thunar-vfs-volume-freebsd.c
   thunar/trunk/thunar-vfs/thunar-vfs-volume-hal.c
Log:
2007-01-06      Benedikt Meurer <[EMAIL PROTECTED]>

        * README, configure.in.in: Requires libexo 0.3.1.13svn.
        * thunar-vfs/thunar-vfs-exec.c(thunar_vfs_exec_sync): Strip trailing
          dots from the error message.
        * thunar-vfs/thunar-vfs-volume-freebsd.c, docs/README.volumes,
          thunar-vfs/thunar-vfs-volume-hal.c: Use exo-mount to mount, eject
          and unmount volumes instead of relying on external utilities that
          don't always behave properly. Bug #2715.
        * thunar-vfs/thunar-vfs-volume-hal.c: Add ability to mount floppy
          drives using exo-mount. Bug #2075.
        * thunar-vfs/Makefile.am: Fix distcheck.
        * po/de.po: Some german translation love.




Modified: thunar/trunk/ChangeLog
===================================================================
--- thunar/trunk/ChangeLog      2007-01-06 18:24:32 UTC (rev 24276)
+++ thunar/trunk/ChangeLog      2007-01-06 18:32:10 UTC (rev 24277)
@@ -1,3 +1,17 @@
+2007-01-06     Benedikt Meurer <[EMAIL PROTECTED]>
+
+       * README, configure.in.in: Requires libexo 0.3.1.13svn.
+       * thunar-vfs/thunar-vfs-exec.c(thunar_vfs_exec_sync): Strip trailing
+         dots from the error message.
+       * thunar-vfs/thunar-vfs-volume-freebsd.c, docs/README.volumes,
+         thunar-vfs/thunar-vfs-volume-hal.c: Use exo-mount to mount, eject
+         and unmount volumes instead of relying on external utilities that
+         don't always behave properly. Bug #2715.
+       * thunar-vfs/thunar-vfs-volume-hal.c: Add ability to mount floppy
+         drives using exo-mount. Bug #2075.
+       * thunar-vfs/Makefile.am: Fix distcheck.
+       * po/de.po: Some german translation love.
+
 2007-01-03     Benedikt Meurer <[EMAIL PROTECTED]>
 
        * configure.in.in, docs/manual/, thunar/main.c, thunar/thunar-dialogs.c:

Modified: thunar/trunk/README
===================================================================
--- thunar/trunk/README 2007-01-06 18:24:32 UTC (rev 24276)
+++ thunar/trunk/README 2007-01-06 18:32:10 UTC (rev 24277)
@@ -12,7 +12,7 @@
 
  - perl 5.6 or above
  - GTK+ 2.6.0 or above
- - libexo 0.3.1.12rc2 or above
+ - libexo 0.3.1.13svn or above
  - intltool 0.30 or above
  - libpng12 1.2.0 or above
  - shared-mime-info 0.15 or above

Modified: thunar/trunk/configure.in.in
===================================================================
--- thunar/trunk/configure.in.in        2007-01-06 18:24:32 UTC (rev 24276)
+++ thunar/trunk/configure.in.in        2007-01-06 18:32:10 UTC (rev 24277)
@@ -144,7 +144,7 @@
 dnl ***********************************
 dnl *** Check for required packages ***
 dnl ***********************************
-XDT_CHECK_PACKAGE([EXO], [exo-0.3], [0.3.1.12])
+XDT_CHECK_PACKAGE([EXO], [exo-0.3], [0.3.1.13])
 XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.6.4])
 XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.6.4])
 XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.6.0])

Modified: thunar/trunk/docs/README.volumes
===================================================================
--- thunar/trunk/docs/README.volumes    2007-01-06 18:24:32 UTC (rev 24276)
+++ thunar/trunk/docs/README.volumes    2007-01-06 18:32:10 UTC (rev 24277)
@@ -49,8 +49,4 @@
   On Linux platforms, Thunar requires HAL 0.5 or better to provide information
   about volumes.
 
-  To be able to mount and unmount volumes, you will also need either the 
pmount,
-  the gnome-mount or the halmount (from ivman package) utility or HAL with 
-  fstab-sync. 
-
   To be able to eject dics, you will need the eject utility program.

Modified: thunar/trunk/po/ChangeLog
===================================================================
--- thunar/trunk/po/ChangeLog   2007-01-06 18:24:32 UTC (rev 24276)
+++ thunar/trunk/po/ChangeLog   2007-01-06 18:32:10 UTC (rev 24277)
@@ -1,3 +1,7 @@
+2007-01-06  Benedikt Meurer <[EMAIL PROTECTED]>
+
+       * de.po: Some german translation love.
+
 2007-01-05  Maximilian Schleiss <[EMAIL PROTECTED]>
 
        * de.po: Updated the German translation by

Modified: thunar/trunk/po/de.po
===================================================================
--- thunar/trunk/po/de.po       2007-01-06 18:24:32 UTC (rev 24276)
+++ thunar/trunk/po/de.po       2007-01-06 18:32:10 UTC (rev 24277)
@@ -9,7 +9,7 @@
 msgstr ""
 "Project-Id-Version: Thunar 0.5.1svn\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-01-03 12:54+0100\n"
+"POT-Creation-Date: 2007-01-06 18:50+0100\n"
 "PO-Revision-Date: 2007-01-05 11:16+0100\n"
 "Last-Translator: Fabian Nowak <[EMAIL PROTECTED]>\n"
 "Language-Team: German <[EMAIL PROTECTED]>\n"
@@ -23,7 +23,7 @@
 msgid "Failed to read folder contents"
 msgstr "Konnte Ordnerinhalt nicht lesen"
 
-#: ../thunar-vfs/thunar-vfs-exec.c:512
+#: ../thunar-vfs/thunar-vfs-exec.c:516
 msgid "Unknown error"
 msgstr "Unbekannter Fehler"
 
@@ -341,13 +341,13 @@
 
 #. something went wrong, for sure
 #. display an error dialog to inform the user
-#: ../thunar-vfs/thunar-vfs-volume-hal.c:352
+#: ../thunar-vfs/thunar-vfs-volume-hal.c:281
 #: ../thunar/thunar-location-entry.c:650
 #, c-format
 msgid "Failed to determine the mount point for %s"
 msgstr "Der Einhängepunkt für %s konnte nicht bestimmt werden"
 
-#: ../thunar-vfs/thunar-vfs-volume-hal.c:933
+#: ../thunar-vfs/thunar-vfs-volume-hal.c:825
 #, c-format
 msgid "Failed to connect to the HAL daemon: %s"
 msgstr "Konnte keine Verbindung zum HAL Dienst aufbauen: %s"
@@ -1338,7 +1338,7 @@
 #: ../thunar/thunar-tree-view.c:1598
 #, c-format
 msgid "Failed to mount \"%s\""
-msgstr "Das Medium »%s« konnte nicht eingebunden werden"
+msgstr "Der Datenträger »%s« konnte nicht eingebunden werden"
 
 #: ../thunar/thunar-path-entry.c:259
 msgid "Icon size"
@@ -1800,7 +1800,7 @@
 
 #: ../thunar/thunar-properties-dialog.c:446
 msgid "Volume:"
-msgstr "Gerät:"
+msgstr "Datenträger:"
 
 #: ../thunar/thunar-properties-dialog.c:470
 msgid "Free Space:"
@@ -2021,17 +2021,17 @@
 #. append the "Mount Volume" menu action
 #: ../thunar/thunar-shortcuts-view.c:820 ../thunar/thunar-tree-view.c:1038
 msgid "_Mount Volume"
-msgstr "Gerät _einbinden"
+msgstr "Datenträger _Einbinden"
 
 #. append the "Eject Volume" menu action
 #: ../thunar/thunar-shortcuts-view.c:830 ../thunar/thunar-tree-view.c:1048
 msgid "E_ject Volume"
-msgstr "Medium _auswerfen"
+msgstr "Datenträger _Auswerfen"
 
 #. append the "Unmount Volume" menu item
 #: ../thunar/thunar-shortcuts-view.c:839 ../thunar/thunar-tree-view.c:1057
 msgid "_Unmount Volume"
-msgstr "Gerät _aushängen"
+msgstr "Datenträger _Auslösen"
 
 #. append the remove menu item
 #: ../thunar/thunar-shortcuts-view.c:867
@@ -2057,14 +2057,14 @@
 #: ../thunar/thunar-shortcuts-view.c:1287 ../thunar/thunar-tree-view.c:1547
 #, c-format
 msgid "Failed to eject \"%s\""
-msgstr "Das Medium in »%s« konnte nicht ausgeworfen werden"
+msgstr "Der Datenträger »%s« konnte nicht ausgeworfen werden"
 
 #. display an error dialog to inform the user
 #. display an error dialog
 #: ../thunar/thunar-shortcuts-view.c:1377 ../thunar/thunar-tree-view.c:1738
 #, c-format
 msgid "Failed to unmount \"%s\""
-msgstr "Das Medium »%s« konnte nicht ausgelöst werden"
+msgstr "Der Datenträger »%s« konnte nicht ausgelöst werden"
 
 #: ../thunar/thunar-size-label.c:177
 msgid "Click here to stop calculating the total size of the folder."
@@ -3349,5 +3349,9 @@
 msgid "Open the specified folders in Thunar"
 msgstr "Angegebene Ordner mit Thunar öffnen"
 
+#, fuzzy
+#~ msgid "Failed to open display"
+#~ msgstr "%d Datei konnte nicht geöffnet werden"
+
 #~ msgid "Failed to open home directory"
 #~ msgstr "Der persönliche Ordner konnte nicht geöffnet werden"

Modified: thunar/trunk/thunar-vfs/Makefile.am
===================================================================
--- thunar/trunk/thunar-vfs/Makefile.am 2007-01-06 18:24:32 UTC (rev 24276)
+++ thunar/trunk/thunar-vfs/Makefile.am 2007-01-06 18:32:10 UTC (rev 24277)
@@ -238,6 +238,15 @@
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = thunar-vfs-1.pc
 
+CLEANFILES =                                                           \
+       actual-abi                                                      \
+       expected-abi                                                    \
+       xgen-tvetc                                                      \
+       xgen-tveth                                                      \
+       xgen-tvmc                                                       \
+       xgen-tvmh                                                       \
+       $(desktop_DATA)
+
 EXTRA_DIST =                                                           \
        abicheck.sh                                                     \
        make-thunar-vfs-alias.pl                                        \
@@ -279,7 +288,6 @@
        thunar-vfs-volume-none.h
 endif
 
-
 ##
 ## Rules to auto-generate built sources
 ##
@@ -290,18 +298,10 @@
 ## files as part of the dist tarball.
 ##
 if MAINTAINER_MODE
-CLEANFILES =                                                           \
-       actual-abi                                                      \
-       expected-abi                                                    \
-       xgen-tvetc                                                      \
-       xgen-tveth                                                      \
-       xgen-tvmc                                                       \
-       xgen-tvmh                                                       \
-       $(desktop_DATA)
-
 DISTCLEANFILES =                                                       \
        stamp-thunar-vfs-enum-types.h                                   \
        stamp-thunar-vfs-marshal.h                                      \
+       thunar-vfs-font-thumbnailer-1.desktop                           \
        $(libthunar_vfs_built_sources)
 
 BUILT_SOURCES =                                                                
\

Modified: thunar/trunk/thunar-vfs/thunar-vfs-exec.c
===================================================================
--- thunar/trunk/thunar-vfs/thunar-vfs-exec.c   2007-01-06 18:24:32 UTC (rev 
24276)
+++ thunar/trunk/thunar-vfs/thunar-vfs-exec.c   2007-01-06 18:32:10 UTC (rev 
24277)
@@ -1,6 +1,6 @@
 /* $Id$ */
 /*-
- * Copyright (c) 2005-2006 Benedikt Meurer <[EMAIL PROTECTED]>
+ * Copyright (c) 2005-2007 Benedikt Meurer <[EMAIL PROTECTED]>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -505,6 +505,10 @@
           /* drop additional whitespace from the stderr output */
           g_strstrip (standard_error);
 
+          /* strip all trailing dots from the stderr output */
+          while (*standard_error != '\0' && standard_error[strlen 
(standard_error) - 1] == '.')
+            standard_error[strlen (standard_error) - 1] = '\0';
+
           /* generate an error from the stderr output */
           if (G_LIKELY (*standard_error != '\0'))
             g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, "%s", 
standard_error);

Modified: thunar/trunk/thunar-vfs/thunar-vfs-volume-freebsd.c
===================================================================
--- thunar/trunk/thunar-vfs/thunar-vfs-volume-freebsd.c 2007-01-06 18:24:32 UTC 
(rev 24276)
+++ thunar/trunk/thunar-vfs/thunar-vfs-volume-freebsd.c 2007-01-06 18:32:10 UTC 
(rev 24277)
@@ -1,6 +1,6 @@
 /* $Id$ */
 /*-
- * Copyright (c) 2005-2006 Benedikt Meurer <[EMAIL PROTECTED]>
+ * Copyright (c) 2005-2007 Benedikt Meurer <[EMAIL PROTECTED]>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -212,7 +212,7 @@
 
   /* execute the eject command */
   quoted = g_shell_quote (volume_freebsd->device_path);
-  result = thunar_vfs_exec_sync ("eject %s", error, quoted);
+  result = thunar_vfs_exec_sync ("exo-eject -n -d %s", error, quoted);
   g_free (quoted);
 
   /* update volume state if successfull */
@@ -231,16 +231,11 @@
 {
   ThunarVfsVolumeFreeBSD *volume_freebsd = THUNAR_VFS_VOLUME_FREEBSD (volume);
   gboolean                result;
-  gchar                   mount_point[THUNAR_VFS_PATH_MAXSTRLEN];
   gchar                  *quoted;
 
-  /* determine the absolute path to the mount point */
-  if (thunar_vfs_path_to_string (volume_freebsd->mount_point, mount_point, 
sizeof (mount_point), error) < 0)
-    return FALSE;
-
   /* execute the mount command */
-  quoted = g_shell_quote (mount_point);
-  result = thunar_vfs_exec_sync ("mount %s", error, quoted);
+  quoted = g_shell_quote (volume_freebsd->device_path);
+  result = thunar_vfs_exec_sync ("exo-mount -n -d %s", error, quoted);
   g_free (quoted);
 
   /* update volume state if successfull */
@@ -259,16 +254,11 @@
 {
   ThunarVfsVolumeFreeBSD *volume_freebsd = THUNAR_VFS_VOLUME_FREEBSD (volume);
   gboolean                result;
-  gchar                   mount_point[THUNAR_VFS_PATH_MAXSTRLEN];
   gchar                  *quoted;
 
-  /* determine the absolute path to the mount point */
-  if (thunar_vfs_path_to_string (volume_freebsd->mount_point, mount_point, 
sizeof (mount_point), error) < 0)
-    return FALSE;
-
   /* execute the umount command */
-  quoted = g_shell_quote (mount_point);
-  result = thunar_vfs_exec_sync ("umount %s", error, quoted);
+  quoted = g_shell_quote (volume_freebsd->device_path);
+  result = thunar_vfs_exec_sync ("exo-unmount -n -d %s", error, quoted);
   g_free (quoted);
 
   /* update volume state if successfull */

Modified: thunar/trunk/thunar-vfs/thunar-vfs-volume-hal.c
===================================================================
--- thunar/trunk/thunar-vfs/thunar-vfs-volume-hal.c     2007-01-06 18:24:32 UTC 
(rev 24276)
+++ thunar/trunk/thunar-vfs/thunar-vfs-volume-hal.c     2007-01-06 18:32:10 UTC 
(rev 24277)
@@ -1,6 +1,6 @@
 /* $Id$ */
 /*-
- * Copyright (c) 2005-2006 Benedikt Meurer <[EMAIL PROTECTED]>
+ * Copyright (c) 2005-2007 Benedikt Meurer <[EMAIL PROTECTED]>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -93,7 +93,6 @@
   ThunarVfsVolume       __parent__;
 
   gchar                *udi;
-  gchar                *drive_udi;
 
   gchar                *device_file;
   gchar                *device_label;
@@ -159,7 +158,6 @@
   ThunarVfsVolumeHal *volume_hal = THUNAR_VFS_VOLUME_HAL (object);
 
   g_free (volume_hal->udi);
-  g_free (volume_hal->drive_udi);
 
   g_free (volume_hal->device_file);
   g_free (volume_hal->device_label);
@@ -211,12 +209,11 @@
                              GError         **error)
 {
   ThunarVfsVolumeHal *volume_hal = THUNAR_VFS_VOLUME_HAL (volume);
-  ThunarVfsPath      *path;
   gboolean            result = TRUE;
-  gchar              *program;
   gchar              *quoted;
 
-  /* check if the volume is currently mounted */
+  /* check if the volume is currently mounted (FIXME: Why? Just confusing!) */
+#if 0 
   path = thunar_vfs_volume_hal_find_active_mount_point (volume_hal);
   if (G_LIKELY (path != NULL))
     {
@@ -224,39 +221,21 @@
       result = thunar_vfs_volume_hal_unmount (volume, window, error);
       thunar_vfs_path_unref (path);
     }
+#endif
 
-  /* check the unmount was successfull */
+  /* use exo-eject to eject the device */
+  quoted = g_shell_quote (volume_hal->udi);
+  result = thunar_vfs_exec_sync ("exo-eject -n -h %s", error, quoted);
+  g_free (quoted);
+
+  /* check if we were successfull */
   if (G_LIKELY (result))
     {
-      /* check if gnome-eject is present */
-      program = g_find_program_in_path ("gnome-eject");
-      if (G_LIKELY (program != NULL))
-        {
-          /* try to use gnome-eject then */
-          quoted = g_shell_quote (volume_hal->udi);
-          result = thunar_vfs_exec_sync ("%s -t -h %s", error, program, 
quoted);
-          g_free (quoted);
+      /* reset the status */
+      volume_hal->status &= ~(THUNAR_VFS_VOLUME_STATUS_MOUNTED | 
THUNAR_VFS_VOLUME_STATUS_PRESENT);
 
-          /* cleanup */
-          g_free (program);
-        }
-      else
-        {
-          /* use eject */
-          quoted = g_path_get_basename (volume_hal->device_file);
-          result = thunar_vfs_exec_sync ("eject %s", error, quoted);
-          g_free (quoted);
-        }
-
-      /* check if we were successfull */
-      if (G_LIKELY (result))
-        {
-          /* reset the status */
-          volume_hal->status &= ~(THUNAR_VFS_VOLUME_STATUS_MOUNTED | 
THUNAR_VFS_VOLUME_STATUS_PRESENT);
-
-          /* emit "changed" on the volume */
-          thunar_vfs_volume_changed (THUNAR_VFS_VOLUME (volume_hal));
-        }
+      /* emit "changed" on the volume */
+      thunar_vfs_volume_changed (THUNAR_VFS_VOLUME (volume_hal));
     }
 
   return result;
@@ -272,63 +251,13 @@
   ThunarVfsVolumeHal *volume_hal = THUNAR_VFS_VOLUME_HAL (volume);
   ThunarVfsPath      *path;
   gboolean            result;
-  gchar              *mount_point;
-  gchar              *program;
   gchar              *quoted;
 
-  /* check if pmount-hal is present */
-  program = g_find_program_in_path ("pmount-hal");
-  if (G_LIKELY (program != NULL))
-    {
-      /* try to use pmount-hal then */
-      quoted = g_shell_quote (volume_hal->udi);
-      thunar_vfs_exec_sync ("%s %s", NULL, program, quoted);
-      g_free (program);
-      g_free (quoted);
+  /* use exo-mount to mount the device */
+  quoted = g_shell_quote (volume_hal->udi);
+  result = thunar_vfs_exec_sync ("exo-mount -n -h %s", error, quoted);
+  g_free (quoted);
 
-      /* pmount-hal returns error if already mounted, so
-       * we set result to TRUE, which means it will always
-       * be looked up in /proc/mounts below.
-       * See http://bugzilla.xfce.org/show_bug.cgi?id=1833.
-       */
-      result = TRUE;
-    }
-  else
-    {
-      /* check if gnome-mount is present */
-      program = g_find_program_in_path ("gnome-mount");
-      if (G_LIKELY (program != NULL))
-        {
-          /* try to use gnome-mount then */
-          quoted = g_shell_quote (volume_hal->udi);
-          result = thunar_vfs_exec_sync ("%s -t -h %s", error, program, 
quoted);
-          g_free (program);
-          g_free (quoted);
-        }
-      else
-        {
-          /* check if hal-mount (from ivman) is present */
-          program = g_find_program_in_path ("halmount");
-          if (G_LIKELY (program != NULL))
-            {
-              /* try to use halmount then */
-              quoted = g_shell_quote (volume_hal->device_file);
-              result = thunar_vfs_exec_sync ("%s %s", error, program, quoted);
-              g_free (program);
-              g_free (quoted);
-            }
-          else
-            {
-              /* fallback to plain mount */
-              mount_point = thunar_vfs_path_dup_string 
(volume_hal->mount_point);
-              quoted = g_shell_quote (mount_point);
-              result = thunar_vfs_exec_sync ("mount %s", error, quoted);
-              g_free (mount_point);
-              g_free (quoted);
-            }
-        }
-    }
-
   /* check if we were successfull */
   if (G_LIKELY (result))
     {
@@ -366,57 +295,12 @@
 {
   ThunarVfsVolumeHal *volume_hal = THUNAR_VFS_VOLUME_HAL (volume);
   gboolean            result;
-  gchar              *mount_point;
-  gchar              *program;
   gchar              *quoted;
 
-  /* check if pumount is present */
-  program = g_find_program_in_path ("pumount");
-  if (G_LIKELY (program != NULL))
-    {
-      /* try to use pumount then */
-      mount_point = thunar_vfs_path_dup_string (volume_hal->mount_point);
-      quoted = g_shell_quote (mount_point);
-      result = thunar_vfs_exec_sync ("%s %s", error, program, quoted);
-      g_free (mount_point);
-      g_free (program);
-      g_free (quoted);
-    }
-  else
-    {
-      /* check if gnome-umount is present */
-      program = g_find_program_in_path ("gnome-umount");
-      if (G_LIKELY (program != NULL))
-        {
-          /* try to use gnome-umount then */
-          quoted = g_shell_quote (volume_hal->udi);
-          result = thunar_vfs_exec_sync ("%s -t -h %s", error, program, 
quoted);
-          g_free (program);
-          g_free (quoted);
-        }
-      else
-        {
-          /* check if halmount is present */
-          program = g_find_program_in_path ("halmount");
-          if (G_LIKELY (program != NULL))
-            {
-              /* try to use halmount then */
-              quoted = g_shell_quote (volume_hal->device_file);
-              result = thunar_vfs_exec_sync ("%s -u %s", error, program, 
quoted);
-              g_free (program);
-              g_free (quoted);
-            }
-          else
-            {
-              /* fallback to plain umount */
-              mount_point = thunar_vfs_path_dup_string 
(volume_hal->mount_point);
-              quoted = g_shell_quote (mount_point);
-              result = thunar_vfs_exec_sync ("umount %s", error, quoted);
-              g_free (mount_point);
-              g_free (quoted);
-            }
-        }
-    }
+  /* unmount using exo-unmount */
+  quoted = g_shell_quote (volume_hal->udi);
+  result = thunar_vfs_exec_sync ("exo-unmount -n -h %s", error, quoted);
+  g_free (quoted);
 
   /* check if we were successfull */
   if (G_LIKELY (result))
@@ -515,7 +399,7 @@
   FILE          *fp;
 
   /* try to open the /etc/fstab file */
-  fp = setmntent ("/proc/fstab", "r");
+  fp = setmntent ("/etc/fstab", "r");
   if (G_LIKELY (fp != NULL))
     {
       /* process all mnt entries */
@@ -570,7 +454,6 @@
   gchar       *filename;
 
   _thunar_vfs_return_if_fail (THUNAR_VFS_IS_VOLUME_HAL (volume_hal));
-  _thunar_vfs_return_if_fail (hv != NULL);
   _thunar_vfs_return_if_fail (hd != NULL);
 
   /* reset the volume status */
@@ -578,11 +461,11 @@
 
   /* determine the new device file */
   g_free (volume_hal->device_file);
-  volume_hal->device_file = g_strdup (libhal_volume_get_device_file (hv));
+  volume_hal->device_file = g_strdup ((hv != NULL) ? 
libhal_volume_get_device_file (hv) : libhal_drive_get_device_file (hd));
 
   /* determine the new label */
   g_free (volume_hal->device_label);
-  volume_label = libhal_volume_get_label (hv);
+  volume_label = (hv != NULL) ? libhal_volume_get_label (hv) : 
libhal_drive_get_model (hd);
   if (G_LIKELY (volume_label != NULL && *volume_label != '\0'))
     {
       /* just use the label provided by HAL */
@@ -675,11 +558,11 @@
     }
 
   /* non-disc drives are always present, otherwise it must be a data disc to 
be usable */
-  if (!libhal_volume_is_disc (hv) || libhal_volume_disc_has_data (hv))
+  if (hv == NULL || !libhal_volume_is_disc (hv) || libhal_volume_disc_has_data 
(hv))
     volume_hal->status |= THUNAR_VFS_VOLUME_STATUS_PRESENT;
 
   /* check if the volume is currently mounted */
-  if (libhal_volume_is_mounted (hv))
+  if (hv != NULL && libhal_volume_is_mounted (hv))
     {
       /* try to determine the new mount point */
       volume_hal->mount_point = thunar_vfs_path_new 
(libhal_volume_get_mount_point (hv), NULL);
@@ -887,22 +770,31 @@
           if (G_UNLIKELY (hd == NULL))
             continue;
 
-          /* determine all volumes for the given drive */
-          udis = libhal_drive_find_all_volumes (manager_hal->context, hd, 
&n_udis);
-          if (G_LIKELY (udis != NULL))
+          /* check if we have a floppy disk here */
+          if (libhal_drive_get_type (hd) == LIBHAL_DRIVE_TYPE_FLOPPY)
             {
-              /* add volumes for all given UDIs */
-              for (n = 0; n < n_udis; ++n)
+              /* add the drive based on the UDI */
+              thunar_vfs_volume_manager_hal_device_added 
(manager_hal->context, drive_udis[m]);
+            }
+          else
+            {
+              /* determine all volumes for the given drive */
+              udis = libhal_drive_find_all_volumes (manager_hal->context, hd, 
&n_udis);
+              if (G_LIKELY (udis != NULL))
                 {
-                  /* add the volume based on the UDI */
-                  thunar_vfs_volume_manager_hal_device_added 
(manager_hal->context, udis[n]);
-                  
-                  /* release the UDI (HAL bug #5279) */
-                  free (udis[n]);
-                }
+                  /* add volumes for all given UDIs */
+                  for (n = 0; n < n_udis; ++n)
+                    {
+                      /* add the volume based on the UDI */
+                      thunar_vfs_volume_manager_hal_device_added 
(manager_hal->context, udis[n]);
+                      
+                      /* release the UDI (HAL bug #5279) */
+                      free (udis[n]);
+                    }
 
-              /* release the UDIs array (HAL bug #5279) */
-              free (udis);
+                  /* release the UDIs array (HAL bug #5279) */
+                  free (udis);
+                }
             }
 
           /* release the hal drive */
@@ -997,36 +889,49 @@
   hv = libhal_volume_from_udi (manager_hal->context, udi);
   if (G_UNLIKELY (hv == NULL))
     {
-      /* the device is no longer a volume, so drop it */
-      thunar_vfs_volume_manager_hal_device_removed (manager_hal->context, udi);
-      return;
-    }
+      /* check if we have a drive here */
+      hd = libhal_drive_from_udi (manager_hal->context, udi);
+      if (G_UNLIKELY (hd == NULL))
+        {
+          /* the device is no longer a drive or volume, so drop it */
+          thunar_vfs_volume_manager_hal_device_removed (manager_hal->context, 
udi);
+          return;
+        }
 
-  /* determine the UDI of the drive to which this volume belongs */
-  drive_udi = libhal_volume_get_storage_device_udi (hv);
-  if (G_LIKELY (drive_udi != NULL))
-    {
-      /* determine the drive for the volume */
-      hd = libhal_drive_from_udi (manager_hal->context, drive_udi);
-    }
+      /* update the drive with the new HAL drive/volume */
+      thunar_vfs_volume_hal_update (volume_hal, manager_hal->context, NULL, 
hd);
 
-  /* check if we have the drive for the volume */
-  if (G_LIKELY (hd != NULL))
-    {
-      /* update the volume with the new HAL drive/volume */
-      thunar_vfs_volume_hal_update (volume_hal, manager_hal->context, hv, hd);
-
       /* release the drive */
       libhal_drive_free (hd);
     }
   else
     {
-      /* unable to determine the drive, volume gone? */
-      thunar_vfs_volume_manager_hal_device_removed (manager_hal->context, udi);
-    }
+      /* determine the UDI of the drive to which this volume belongs */
+      drive_udi = libhal_volume_get_storage_device_udi (hv);
+      if (G_LIKELY (drive_udi != NULL))
+        {
+          /* determine the drive for the volume */
+          hd = libhal_drive_from_udi (manager_hal->context, drive_udi);
+        }
 
-  /* release the volume */
-  libhal_volume_free (hv);
+      /* check if we have the drive for the volume */
+      if (G_LIKELY (hd != NULL))
+        {
+          /* update the volume with the new HAL drive/volume */
+          thunar_vfs_volume_hal_update (volume_hal, manager_hal->context, hv, 
hd);
+
+          /* release the drive */
+          libhal_drive_free (hd);
+        }
+      else
+        {
+          /* unable to determine the drive, volume gone? */
+          thunar_vfs_volume_manager_hal_device_removed (manager_hal->context, 
udi);
+        }
+
+      /* release the volume */
+      libhal_volume_free (hv);
+    }
 }
 
 
@@ -1046,23 +951,62 @@
 
   /* check if we have a volume here */
   hv = libhal_volume_from_udi (context, udi);
-  if (G_UNLIKELY (hv == NULL))
-    return;
-
-  /* we don't care for anything other than mountable filesystems */
-  if (G_UNLIKELY (libhal_volume_get_fsusage (hv) != 
LIBHAL_VOLUME_USAGE_MOUNTABLE_FILESYSTEM))
+  if (G_LIKELY (hv != NULL))
     {
+      /* we don't care for anything other than mountable filesystems */
+      if (G_UNLIKELY (libhal_volume_get_fsusage (hv) != 
LIBHAL_VOLUME_USAGE_MOUNTABLE_FILESYSTEM))
+        {
+          libhal_volume_free (hv);
+          return;
+        }
+
+      /* determine the UDI of the drive to which this volume belongs */
+      drive_udi = libhal_volume_get_storage_device_udi (hv);
+      if (G_LIKELY (drive_udi != NULL))
+        {
+          /* determine the drive for the volume */
+          hd = libhal_drive_from_udi (context, drive_udi);
+          if (G_LIKELY (hd != NULL))
+            {
+              /* check if we already have a volume object for the UDI */
+              volume_hal = thunar_vfs_volume_manager_hal_get_volume_by_udi 
(manager_hal, udi);
+              if (G_LIKELY (volume_hal == NULL))
+                {
+                  /* otherwise, we allocate a new volume object */
+                  volume_hal = g_object_new (THUNAR_VFS_TYPE_VOLUME_HAL, NULL);
+                  volume_hal->udi = g_strdup (udi);
+                }
+
+              /* update the volume object with the new data from the HAL 
volume/drive */
+              thunar_vfs_volume_hal_update (volume_hal, context, hv, hd);
+
+              /* add the volume object to our list if we allocated a new one */
+              if (g_list_find (THUNAR_VFS_VOLUME_MANAGER 
(manager_hal)->volumes, volume_hal) == NULL)
+                {
+                  /* add the volume to the volume manager */
+                  thunar_vfs_volume_manager_add (THUNAR_VFS_VOLUME_MANAGER 
(manager_hal), THUNAR_VFS_VOLUME (volume_hal));
+
+                  /* release the reference on the volume */
+                  g_object_unref (G_OBJECT (volume_hal));
+                }
+
+              /* release the HAL drive */
+              libhal_drive_free (hd);
+            }
+        }
+
+      /* release the HAL volume */
       libhal_volume_free (hv);
-      return;
     }
-
-  /* determine the UDI of the drive to which this volume belongs */
-  drive_udi = libhal_volume_get_storage_device_udi (hv);
-  if (G_LIKELY (drive_udi != NULL))
+  else
     {
-      /* determine the drive for the volume */
-      hd = libhal_drive_from_udi (context, drive_udi);
-      if (G_LIKELY (hd != NULL))
+      /* but maybe we have a floppy disk drive here */
+      hd = libhal_drive_from_udi (context, udi);
+      if (G_UNLIKELY (hd == NULL))
+        return;
+
+      /* check if we have a floppy disk drive */
+      if (G_LIKELY (libhal_drive_get_type (hd) == LIBHAL_DRIVE_TYPE_FLOPPY))
         {
           /* check if we already have a volume object for the UDI */
           volume_hal = thunar_vfs_volume_manager_hal_get_volume_by_udi 
(manager_hal, udi);
@@ -1071,11 +1015,10 @@
               /* otherwise, we allocate a new volume object */
               volume_hal = g_object_new (THUNAR_VFS_TYPE_VOLUME_HAL, NULL);
               volume_hal->udi = g_strdup (udi);
-              volume_hal->drive_udi = g_strdup (drive_udi);
             }
 
           /* update the volume object with the new data from the HAL 
volume/drive */
-          thunar_vfs_volume_hal_update (volume_hal, context, hv, hd);
+          thunar_vfs_volume_hal_update (volume_hal, context, NULL, hd);
 
           /* add the volume object to our list if we allocated a new one */
           if (g_list_find (THUNAR_VFS_VOLUME_MANAGER (manager_hal)->volumes, 
volume_hal) == NULL)
@@ -1086,14 +1029,11 @@
               /* release the reference on the volume */
               g_object_unref (G_OBJECT (volume_hal));
             }
-
-          /* release the HAL drive */
-          libhal_drive_free (hd);
         }
-    }
 
-  /* release the HAL volume */
-  libhal_volume_free (hv);
+      /* release the HAL drive */
+      libhal_drive_free (hd);
+    }
 }
 
 

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to