Author: benny
Date: 2007-04-27 15:37:58 +0000 (Fri, 27 Apr 2007)
New Revision: 25647

Modified:
   thunar/trunk/ChangeLog
   thunar/trunk/thunar-vfs/thunar-vfs-volume-freebsd.c
   thunar/trunk/thunar-vfs/thunar-vfs-volume-hal.c
   thunar/trunk/thunar-vfs/thunar-vfs-volume-private.h
   thunar/trunk/thunar-vfs/thunar-vfs-volume.c
Log:
2007-04-27      Benedikt Meurer <[EMAIL PROTECTED]>

        * thunar-vfs/thunar-vfs-volume-freebsd.c,
          thunar-vfs/thunar-vfs-volume-hal.c,
          thunar-vfs/thunar-vfs-volume-private.h,
          thunar-vfs/thunar-vfs-volume.c: Use the requires_eject HAL
          property to determine whether a given volume is ejectable.
          Bug #3119.




Modified: thunar/trunk/ChangeLog
===================================================================
--- thunar/trunk/ChangeLog      2007-04-27 15:02:24 UTC (rev 25646)
+++ thunar/trunk/ChangeLog      2007-04-27 15:37:58 UTC (rev 25647)
@@ -1,5 +1,14 @@
 2007-04-27     Benedikt Meurer <[EMAIL PROTECTED]>
 
+       * thunar-vfs/thunar-vfs-volume-freebsd.c,
+         thunar-vfs/thunar-vfs-volume-hal.c,
+         thunar-vfs/thunar-vfs-volume-private.h,
+         thunar-vfs/thunar-vfs-volume.c: Use the requires_eject HAL
+         property to determine whether a given volume is ejectable.
+         Bug #3119.
+
+2007-04-27     Benedikt Meurer <[EMAIL PROTECTED]>
+
        * thunar/thunar-util.c(thunar_util_humanize_file_time): Use larger
          date buffer. Bug #3127.
 

Modified: thunar/trunk/thunar-vfs/thunar-vfs-volume-freebsd.c
===================================================================
--- thunar/trunk/thunar-vfs/thunar-vfs-volume-freebsd.c 2007-04-27 15:02:24 UTC 
(rev 25646)
+++ thunar/trunk/thunar-vfs/thunar-vfs-volume-freebsd.c 2007-04-27 15:37:58 UTC 
(rev 25647)
@@ -59,6 +59,7 @@
 static const gchar             *thunar_vfs_volume_freebsd_get_name         
(ThunarVfsVolume             *volume);
 static ThunarVfsVolumeStatus    thunar_vfs_volume_freebsd_get_status       
(ThunarVfsVolume             *volume);
 static ThunarVfsPath           *thunar_vfs_volume_freebsd_get_mount_point  
(ThunarVfsVolume             *volume);
+static gboolean                 thunar_vfs_volume_freebsd_is_ejectable     
(ThunarVfsVolume             *volume);
 static gboolean                 thunar_vfs_volume_freebsd_eject            
(ThunarVfsVolume             *volume,
                                                                             
GtkWidget                   *window,
                                                                             
GError                     **error);
@@ -142,6 +143,7 @@
   thunarvfs_volume_class->get_name = thunar_vfs_volume_freebsd_get_name;
   thunarvfs_volume_class->get_status = thunar_vfs_volume_freebsd_get_status;
   thunarvfs_volume_class->get_mount_point = 
thunar_vfs_volume_freebsd_get_mount_point;
+  thunarvfs_volume_class->is_ejectable = 
thunar_vfs_volume_freebsd_is_ejectable;
   thunarvfs_volume_class->eject = thunar_vfs_volume_freebsd_eject;
   thunarvfs_volume_class->mount = thunar_vfs_volume_freebsd_mount;
   thunarvfs_volume_class->unmount = thunar_vfs_volume_freebsd_unmount;
@@ -202,6 +204,15 @@
 
 
 static gboolean
+thunar_vfs_volume_freebsd_is_ejectable (ThunarVfsVolume *volume)
+{
+  /* 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_freebsd_eject (ThunarVfsVolume *volume,
                                  GtkWidget       *window,
                                  GError         **error)

Modified: thunar/trunk/thunar-vfs/thunar-vfs-volume-hal.c
===================================================================
--- thunar/trunk/thunar-vfs/thunar-vfs-volume-hal.c     2007-04-27 15:02:24 UTC 
(rev 25646)
+++ thunar/trunk/thunar-vfs/thunar-vfs-volume-hal.c     2007-04-27 15:37:58 UTC 
(rev 25647)
@@ -53,6 +53,7 @@
 static const gchar          *thunar_vfs_volume_hal_get_name                 
(ThunarVfsVolume          *volume);
 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 const gchar          *thunar_vfs_volume_hal_lookup_icon_name         
(ThunarVfsVolume          *volume,
                                                                              
GtkIconTheme             *icon_theme);
 static gboolean              thunar_vfs_volume_hal_eject                    
(ThunarVfsVolume          *volume,
@@ -90,6 +91,7 @@
   /* list of possible icons */
   GList                *icon_list;
 
+  gboolean              requires_eject;
   ThunarVfsPath        *mount_point;
   ThunarVfsVolumeKind   kind;
   ThunarVfsVolumeStatus status;
@@ -139,6 +141,7 @@
   thunarvfs_volume_class->get_name = thunar_vfs_volume_hal_get_name;
   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->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;
@@ -201,6 +204,19 @@
 
 
 
+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;
+
+  /* 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 const gchar*
 thunar_vfs_volume_hal_lookup_icon_name (ThunarVfsVolume *volume,
                                         GtkIconTheme    *icon_theme)
@@ -521,6 +537,9 @@
    */
   volume_hal->status |= THUNAR_VFS_VOLUME_STATUS_PRESENT;
 
+  /* check if the drive requires eject */
+  volume_hal->requires_eject = libhal_drive_requires_eject (hd);
+
   /* check if the volume is currently mounted */
   if (hv != NULL && libhal_volume_is_mounted (hv))
     {

Modified: thunar/trunk/thunar-vfs/thunar-vfs-volume-private.h
===================================================================
--- thunar/trunk/thunar-vfs/thunar-vfs-volume-private.h 2007-04-27 15:02:24 UTC 
(rev 25646)
+++ thunar/trunk/thunar-vfs/thunar-vfs-volume-private.h 2007-04-27 15:37:58 UTC 
(rev 25647)
@@ -37,6 +37,7 @@
   const gchar          *(*get_name)         (ThunarVfsVolume   *volume);
   ThunarVfsVolumeStatus (*get_status)       (ThunarVfsVolume   *volume);
   ThunarVfsPath        *(*get_mount_point)  (ThunarVfsVolume   *volume);
+  gboolean              (*is_ejectable)     (ThunarVfsVolume   *volume);
   const gchar          *(*lookup_icon_name) (ThunarVfsVolume   *volume,
                                              GtkIconTheme      *icon_theme);
 

Modified: thunar/trunk/thunar-vfs/thunar-vfs-volume.c
===================================================================
--- thunar/trunk/thunar-vfs/thunar-vfs-volume.c 2007-04-27 15:02:24 UTC (rev 
25646)
+++ thunar/trunk/thunar-vfs/thunar-vfs-volume.c 2007-04-27 15:37:58 UTC (rev 
25647)
@@ -296,9 +296,7 @@
 thunar_vfs_volume_is_ejectable (ThunarVfsVolume *volume)
 {
   g_return_val_if_fail (THUNAR_VFS_IS_VOLUME (volume), FALSE);
-
-  /* we can only eject removable media, that are present (surprise, surprise) 
*/
-  return (thunar_vfs_volume_is_present (volume) && 
thunar_vfs_volume_is_removable (volume));
+  return (*THUNAR_VFS_VOLUME_GET_CLASS (volume)->is_ejectable) (volume);
 }
 
 

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

Reply via email to