Hi Benny,

I'm testing Thunar on FC5 beta3 and dvd devices icons aren't displayed in side panel.
Icons of other devices are displayed correctly. Fedora has hal 0.5.7.
Look at this screenshot:

http://morgan.fbi.cz/thunar_side_panel.jpg

And I try write simple support for gnome=mount for Thunar, because Fedora it use by default.

Roman


udi = '/org/freedesktop/Hal/devices/volume_label_FC/5_Test3_i386'
  info.hal_mount.mounted_by_uid = 500  (0x1f4)  (int)
  info.hal_mount.created_mount_point = '/media/disk'  (string)
  volume.unmount.valid_options = {'lazy'} (string list)
  volume.mount.valid_options = {'ro', 'sync', 'dirsync', 'noatime', 
'nodiratime', 'noexec', 'quiet', 'utf8', 'uid=', 'mode=', 'iocharset='} (string 
list)
  org.freedesktop.Hal.Device.Volume.method_execpaths = 
{'hal-system-storage-mount', 'hal-system-storage-unmount', 
'hal-system-storage-eject'} (string list)
  org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'} 
(string list)
  org.freedesktop.Hal.Device.Volume.method_names = {'Mount', 'Unmount', 
'Eject'} (string list)
  info.interfaces = {'org.freedesktop.Hal.Device.Volume'} (string list)
  volume.ignore = false  (bool)
  info.udi = '/org/freedesktop/Hal/devices/volume_label_FC/5_Test3_i386'  
(string)
  info.product = 'FC/5-Test3 i386'  (string)
  volume.disc.capacity = 3215818752  (0xbfad8000)  (uint64)
  volume.disc.is_svcd = false  (bool)
  volume.disc.is_vcd = false  (bool)
  volume.disc.is_videodvd = false  (bool)
  volume.disc.is_rewritable = false  (bool)
  volume.disc.is_appendable = false  (bool)
  volume.disc.is_blank = false  (bool)
  volume.disc.has_data = true  (bool)
  volume.disc.has_audio = false  (bool)
  volume.disc.type = 'dvd_rom'  (string)
  volume.size = 3215818752  (0xbfad8000)  (uint64)
  volume.num_blocks = 6280896  (0x5fd6c0)  (int)
  volume.block_size = 2048  (0x800)  (int)
  info.capabilities = {'volume', 'block'} (string list)
  info.category = 'volume'  (string)
  volume.is_partition = true  (bool)
  volume.is_disc = true  (bool)
  volume.is_mounted = true  (bool)
  volume.mount_point = '/media/disk'  (string)
  volume.label = 'FC/5-Test3 i386'  (string)
  volume.uuid = ''  (string)
  volume.fsversion = ''  (string)
  volume.fsusage = 'filesystem'  (string)
  volume.fstype = 'iso9660'  (string)
  storage.model = ''  (string)
  block.storage_device = '/org/freedesktop/Hal/devices/storage_model_DW_224E'  
(string)
  block.is_volume = true  (bool)
  block.minor = 0  (0x0)  (int)
  block.major = 22  (0x16)  (int)
  block.device = '/dev/hdc'  (string)
  linux.hotplug_type = 3  (0x3)  (int)
  info.parent = '/org/freedesktop/Hal/devices/storage_model_DW_224E'  (string)
  linux.sysfs_path_device = '/sys/block/hdc/fakevolume'  (string)
  linux.sysfs_path = '/sys/block/hdc/fakevolume'  (string)
--- thunar-vfs-volume-hal.c	2006-02-26 09:22:32.000000000 +0100
+++ thunar-vfs-volume-hal.c	2006-03-13 18:25:19.000000000 +0100
@@ -194,13 +194,13 @@
   gchar              *quoted;
   gint                exit_status;
 
-  /* generate the mount command */
-  quoted = g_path_get_basename (volume_hal->device_file);
-  command_line = g_strconcat ("eject ", quoted, NULL);
+  /* generate the gnome-eject command */
+  quoted = g_shell_quote (volume_hal->udi);
+  command_line = g_strconcat ("gnome-eject -t -h ", quoted, NULL);
   g_free (quoted);
 
   /* execute the mount command */
-  result = g_spawn_command_line_sync (command_line, NULL, &standard_error, &exit_status, error);
+  result = g_spawn_command_line_sync (command_line, NULL, &standard_error, &exit_status, NULL);
   if (G_LIKELY (result))
     {
       /* check if the command failed */
@@ -228,6 +228,47 @@
       /* release the stderr output */
       g_free (standard_error);
     }
+  else /* gnome-eject is not available, so retry with simple eject */
+    {
+      /* release the previous command line */
+      g_free (command_line);
+      command_line = NULL;
+
+     /* generate the mount command */
+     quoted = g_path_get_basename (volume_hal->device_file);
+     command_line = g_strconcat ("eject ", quoted, NULL);
+     g_free (quoted);
+
+     /* execute the mount command */
+     result = g_spawn_command_line_sync (command_line, NULL, &standard_error, &exit_status, error);
+     if (G_LIKELY (result))
+       {
+         /* check if the command failed */
+         if (G_UNLIKELY (exit_status != 0))
+           {
+              /* drop additional whitespace from the stderr output */
+              g_strstrip (standard_error);
+   
+             /* check if stderr output is usable as error message */
+             if (G_LIKELY (*standard_error != '\0'))
+                {
+                  /* use standard error message if not empty */
+                 g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, standard_error);
+                }
+             else
+               {
+                 /* no useful information, *narf* */
+                 g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Unknown error"));
+               }
+   
+             /* and yes, we failed */
+             result = FALSE;
+           }
+   
+         /* release the stderr output */
+         g_free (standard_error);
+       }
+    }
 
   /* check if we were successfull */
   if (G_LIKELY (result))
@@ -297,22 +338,19 @@
       /* release the stderr output */
       g_free (standard_error);
     }
-  else /* pmount-hal is not available, so retry with simple "mount <mount-point>" */
+  else /* pmount-hal is not available, so retry with gnome-mount */
     {
       /* release the previous command line */
       g_free (command_line);
       command_line = NULL;
 
-      /* determine the absolute path to the mount point */
-      mount_point = thunar_vfs_path_dup_string (volume_hal->mount_point);
-
-      /* generate the command line for the mount command */
-      quoted = g_shell_quote (mount_point);
-      command_line = g_strconcat ("mount ", quoted, NULL);
+      /* generate the gnome-mount command */
+      quoted = g_shell_quote (volume_hal->udi);
+      command_line = g_strconcat ("gnome-mount -t -h ", quoted, NULL);
       g_free (quoted);
 
       /* execute the mount command */
-      result = g_spawn_command_line_sync (command_line, NULL, &standard_error, &exit_status, error);
+      result = g_spawn_command_line_sync (command_line, NULL, &standard_error, &exit_status, NULL);
       if (G_LIKELY (result))
         {
           /* check if the command failed */
@@ -340,11 +378,54 @@
           /* release the stderr output */
           g_free (standard_error);
         }
+      else /* gnome-mount is not available, so retry with simple "mount <mount-point>" */
+        {
+          /* release the previous command line */
+          g_free (command_line);
+          command_line = NULL;
+
+          /* determine the absolute path to the mount point */
+          mount_point = thunar_vfs_path_dup_string (volume_hal->mount_point);
+
+          /* generate the command line for the mount command */
+          quoted = g_shell_quote (mount_point);
+          command_line = g_strconcat ("mount ", quoted, NULL);
+          g_free (quoted);
+
+          /* execute the mount command */
+          result = g_spawn_command_line_sync (command_line, NULL, &standard_error, &exit_status, error);
+          if (G_LIKELY (result))
+            {
+              /* check if the command failed */
+              if (G_UNLIKELY (exit_status != 0))
+                {
+                  /* drop additional whitespace from the stderr output */
+                  g_strstrip (standard_error);
+    
+                  /* check if stderr output is usable as error message */
+                  if (G_LIKELY (*standard_error != '\0'))
+                    {
+                      /* use standard error message if not empty */
+                      g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, standard_error);
+                    }
+                  else
+                    {
+                      /* no useful information, *narf* */
+                      g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Unknown error"));
+                    }
+    
+                  /* and yes, we failed */
+                  result = FALSE;
+                }
 
-      /* release the absolute path to the mount point */
-      g_free (mount_point);
-    }
+              /* release the stderr output */
+              g_free (standard_error);
+            }
 
+          /* release the absolute path to the mount point */
+          g_free (mount_point);
+        }
+    }
   /* cleanup */
   g_free (command_line);
 
@@ -459,19 +540,19 @@
       /* release the stderr output */
       g_free (standard_error);
     }
-  else /* pumount not available, retry with plain umount */
+  else /* pumount not available, retry with gnome-umount */
     {
       /* release the previous command line */
       g_free (command_line);
       command_line = NULL;
 
-      /* generate the mount command */
-      quoted = g_shell_quote (absolute_path);
-      command_line = g_strconcat ("umount ", quoted, NULL);
+      /* generate the gnome-umount command */
+      quoted = g_shell_quote (volume_hal->udi);
+      command_line = g_strconcat ("gnome-umount -t -h ", quoted, NULL);
       g_free (quoted);
 
-      /* execute the pumount command */
-      result = g_spawn_command_line_sync (command_line, NULL, &standard_error, &exit_status, error);
+      /* execute the mount command */
+      result = g_spawn_command_line_sync (command_line, NULL, &standard_error, &exit_status, NULL);
       if (G_LIKELY (result))
         {
           /* check if the command failed */
@@ -499,6 +580,47 @@
           /* release the stderr output */
           g_free (standard_error);
         }
+      else /* gnome-umount not available, retry with plain umount */
+        {
+          /* release the previous command line */
+          g_free (command_line);
+          command_line = NULL;
+
+          /* generate the mount command */
+          quoted = g_shell_quote (absolute_path);
+          command_line = g_strconcat ("umount ", quoted, NULL);
+          g_free (quoted);
+
+          /* execute the pumount command */
+          result = g_spawn_command_line_sync (command_line, NULL, &standard_error, &exit_status, error);
+          if (G_LIKELY (result))
+            {
+              /* check if the command failed */
+              if (G_UNLIKELY (exit_status != 0))
+                {
+                  /* drop additional whitespace from the stderr output */
+                  g_strstrip (standard_error);
+
+                  /* check if stderr output is usable as error message */
+                  if (G_LIKELY (*standard_error != '\0'))
+                    {
+                      /* use standard error message if not empty */
+                      g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, standard_error);
+                    }
+                  else
+                    {
+                      /* no useful information, *narf* */
+                      g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Unknown error"));
+                    }
+
+                  /* and yes, we failed */
+                  result = FALSE;
+                }
+
+              /* release the stderr output */
+              g_free (standard_error);
+            }
+        }
     }
 
   /* check if we were successfull */
_______________________________________________
Thunar-dev mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/thunar-dev

Reply via email to