nautilus r13626 - in trunk: . libnautilus-private



Author: alexl
Date: Mon Jan 21 12:27:54 2008
New Revision: 13626
URL: http://svn.gnome.org/viewvc/nautilus?rev=13626&view=rev

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

        * libnautilus-private/nautilus-desktop-icon-file.c:
	Fix up indentation
	
        * libnautilus-private/nautilus-file.c:
	Allow umount and eject for NautilusFiles that have
	a GMount. (e.g. unix mountpoints)




Modified:
   trunk/ChangeLog
   trunk/libnautilus-private/nautilus-desktop-icon-file.c
   trunk/libnautilus-private/nautilus-file.c

Modified: trunk/libnautilus-private/nautilus-desktop-icon-file.c
==============================================================================
--- trunk/libnautilus-private/nautilus-desktop-icon-file.c	(original)
+++ trunk/libnautilus-private/nautilus-desktop-icon-file.c	Mon Jan 21 12:27:54 2008
@@ -308,15 +308,15 @@
 nautilus_desktop_icon_file_unmount (NautilusFile *file)
 {
 	NautilusDesktopIconFile *desktop_file;
-    GMount *mount;
-    
-    desktop_file = NAUTILUS_DESKTOP_ICON_FILE (file);
-    if (desktop_file) {
-    	mount = nautilus_desktop_link_get_mount (desktop_file->details->link);
-       	if (mount != NULL) {
-       		nautilus_file_operations_unmount_mount (NULL, mount, FALSE, TRUE);
-       	}
-    }
+	GMount *mount;
+	
+	desktop_file = NAUTILUS_DESKTOP_ICON_FILE (file);
+	if (desktop_file) {
+		mount = nautilus_desktop_link_get_mount (desktop_file->details->link);
+		if (mount != NULL) {
+			nautilus_file_operations_unmount_mount (NULL, mount, FALSE, TRUE);
+		}
+	}
 	
 }
 
@@ -324,15 +324,15 @@
 nautilus_desktop_icon_file_eject (NautilusFile *file)
 {
 	NautilusDesktopIconFile *desktop_file;
-    GMount *mount;
-    
-    desktop_file = NAUTILUS_DESKTOP_ICON_FILE (file);
-    if (desktop_file) {
-    	mount = nautilus_desktop_link_get_mount (desktop_file->details->link);
-       	if (mount != NULL) {
-       		nautilus_file_operations_unmount_mount (NULL, mount, TRUE, TRUE);
-       	}
-    }
+	GMount *mount;
+	
+	desktop_file = NAUTILUS_DESKTOP_ICON_FILE (file);
+	if (desktop_file) {
+		mount = nautilus_desktop_link_get_mount (desktop_file->details->link);
+		if (mount != NULL) {
+			nautilus_file_operations_unmount_mount (NULL, mount, TRUE, TRUE);
+		}
+	}
 }
 
 

Modified: trunk/libnautilus-private/nautilus-file.c
==============================================================================
--- trunk/libnautilus-private/nautilus-file.c	(original)
+++ trunk/libnautilus-private/nautilus-file.c	Mon Jan 21 12:27:54 2008
@@ -34,6 +34,7 @@
 #include "nautilus-desktop-icon-file.h"
 #include "nautilus-file-attributes.h"
 #include "nautilus-file-private.h"
+#include "nautilus-file-operations.h"
 #include "nautilus-file-utilities.h"
 #include "nautilus-global-preferences.h"
 #include "nautilus-lib-self-check-functions.h"
@@ -843,7 +844,9 @@
 {
 	g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
 
-	return file->details->can_unmount;
+	return file->details->can_unmount ||
+		(file->details->mount != NULL &&
+		 g_mount_can_unmount (file->details->mount));
 }
 	
 gboolean
@@ -851,7 +854,9 @@
 {
 	g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
 
-	return file->details->can_eject;
+	return file->details->can_eject ||
+		(file->details->mount != NULL &&
+		 g_mount_can_eject (file->details->mount));
 }
 
 void
@@ -879,16 +884,26 @@
 void
 nautilus_file_unmount (NautilusFile *file)
 {
-	if (NAUTILUS_FILE_GET_CLASS (file)->unmount != NULL) {
-		NAUTILUS_FILE_GET_CLASS (file)->unmount (file);
+	if (file->details->can_unmount) {
+		if (NAUTILUS_FILE_GET_CLASS (file)->unmount != NULL) {
+			NAUTILUS_FILE_GET_CLASS (file)->unmount (file);
+		}
+	} else if (file->details->mount != NULL &&
+		   g_mount_can_unmount (file->details->mount)) {
+		nautilus_file_operations_unmount_mount (NULL, file->details->mount, FALSE, TRUE);
 	}
 }
 
 void
 nautilus_file_eject (NautilusFile *file)
 {
-	if (NAUTILUS_FILE_GET_CLASS (file)->eject != NULL) {
-		NAUTILUS_FILE_GET_CLASS (file)->eject (file);
+	if (file->details->can_eject) {
+		if (NAUTILUS_FILE_GET_CLASS (file)->eject != NULL) {
+			NAUTILUS_FILE_GET_CLASS (file)->eject (file);
+		}
+	} else if (file->details->mount != NULL &&
+		   g_mount_can_eject (file->details->mount)) {
+		nautilus_file_operations_unmount_mount (NULL, file->details->mount, TRUE, TRUE);
 	}
 }
 



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