nautilus r13591 - in trunk: . libnautilus-private



Author: alexl
Date: Fri Jan 11 11:26:00 2008
New Revision: 13591
URL: http://svn.gnome.org/viewvc/nautilus?rev=13591&view=rev

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

        * libnautilus-private/nautilus-file.[ch]:
	Add nautilus_file_has_activation_uri.
	Don't show can't write emblems if you can't
	write in the parent either.
	
        * libnautilus-private/nautilus-mime-actions.c:
	Don't launch mountables that have no activation uri.




Modified:
   trunk/ChangeLog
   trunk/libnautilus-private/nautilus-file.c
   trunk/libnautilus-private/nautilus-file.h
   trunk/libnautilus-private/nautilus-mime-actions.c

Modified: trunk/libnautilus-private/nautilus-file.c
==============================================================================
--- trunk/libnautilus-private/nautilus-file.c	(original)
+++ trunk/libnautilus-private/nautilus-file.c	Fri Jan 11 11:26:00 2008
@@ -2176,6 +2176,9 @@
 			    GList *names)
 {
 	/* Prepend in reverse order. */
+	NautilusFile *parent;
+
+	parent = nautilus_file_get_parent (file);
 
 #ifdef TRASH_IS_FAST_ENOUGH
 	if (nautilus_file_is_in_trash (file)) {
@@ -2191,7 +2194,8 @@
 		names = g_list_prepend
 			(names, g_strdup (NAUTILUS_FILE_EMBLEM_NAME_NOTE));
 	}
-	if (!nautilus_file_can_write (file)) {
+	if (!nautilus_file_can_write (file) &&
+	    (parent == NULL || nautilus_file_can_write (parent))) {
 		names = g_list_prepend
 			(names, g_strdup (NAUTILUS_FILE_EMBLEM_NAME_CANT_WRITE));
 	}
@@ -2204,6 +2208,11 @@
 			(names, g_strdup (NAUTILUS_FILE_EMBLEM_NAME_SYMBOLIC_LINK));
 	}
 
+	if (parent) {
+		nautilus_file_unref (parent);
+	}
+		
+	
 	return names;
 }
 
@@ -2954,6 +2963,12 @@
 		 monitor_remove, (file, client));
 }			      
 
+gboolean
+nautilus_file_has_activation_uri (NautilusFile *file)
+{
+	return file->details->activation_location != NULL;
+}
+
 
 /* Return the uri associated with the passed-in file, which may not be
  * the actual uri if the file is an desktop file or a nautilus

Modified: trunk/libnautilus-private/nautilus-file.h
==============================================================================
--- trunk/libnautilus-private/nautilus-file.h	(original)
+++ trunk/libnautilus-private/nautilus-file.h	Fri Jan 11 11:26:00 2008
@@ -366,6 +366,7 @@
 /* Get the URI that's used when activating the file.
  * Getting this can require reading the contents of the file.
  */
+gboolean                nautilus_file_has_activation_uri                (NautilusFile                   *file);
 char *                  nautilus_file_get_activation_uri                (NautilusFile                   *file);
 
 char *                  nautilus_file_get_drop_target_uri               (NautilusFile                   *file);

Modified: trunk/libnautilus-private/nautilus-mime-actions.c
==============================================================================
--- trunk/libnautilus-private/nautilus-mime-actions.c	(original)
+++ trunk/libnautilus-private/nautilus-mime-actions.c	Fri Jan 11 11:26:00 2008
@@ -1346,6 +1346,16 @@
 			report_broken_symbolic_link (parameters->parent_window, file);
 			continue;
 		}
+
+		if (nautilus_file_get_file_type (file) == G_FILE_TYPE_MOUNTABLE &&
+		    !nautilus_file_has_activation_uri (file)) {
+			/* Don't launch these... There is nothing we
+			   can do */
+			nautilus_file_unref (file);
+			parameters->files = g_list_delete_link (parameters->files, l);
+			continue;
+		}
+		
 	}
 
 	if (parameters->files == NULL) {



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