nautilus r13811 - in trunk: . libnautilus-private src



Author: alexl
Date: Mon Feb 25 11:58:02 2008
New Revision: 13811
URL: http://svn.gnome.org/viewvc/nautilus?rev=13811&view=rev

Log:
2008-02-25  Alexander Larsson  <alexl redhat com>

	* libnautilus-private/nautilus-mime-actions.c (activation_mountable_mounted):
	Don't display error on G_IO_ERROR_FAILED_HANDLED.

2008-02-22  David Zeuthen  <davidz redhat com>

	* libnautilus-private/nautilus-autorun.c:
	(autorun_dialog_response), (do_autorun_for_content_type):
	Actually handle when the user presses the Eject or Unmount button.

	* src/nautilus-window-manage-views.c: (found_mount_cb),
	(update_for_new_location):
	* src/nautilus-window-private.h:
	* src/nautilus-window.c: (nautilus_window_finalize):
	Find the mount for the window, used for determining if a x-content
	clue bar should be shown, async.




Modified:
   trunk/ChangeLog
   trunk/libnautilus-private/nautilus-autorun.c
   trunk/libnautilus-private/nautilus-mime-actions.c
   trunk/src/nautilus-window-manage-views.c
   trunk/src/nautilus-window-private.h
   trunk/src/nautilus-window.c

Modified: trunk/libnautilus-private/nautilus-autorun.c
==============================================================================
--- trunk/libnautilus-private/nautilus-autorun.c	(original)
+++ trunk/libnautilus-private/nautilus-autorun.c	Mon Feb 25 11:58:02 2008
@@ -848,6 +848,10 @@
 
 /*- END MOVE TO GIO ---*/
 
+enum {
+	AUTORUN_DIALOG_RESPONSE_EJECT = 0
+};
+
 typedef struct
 {
 	GtkWidget *dialog;
@@ -915,6 +919,13 @@
 autorun_dialog_response (GtkDialog *dialog, gint response, AutorunDialogData *data)
 {
 	switch (response) {
+	case AUTORUN_DIALOG_RESPONSE_EJECT:
+		nautilus_file_operations_unmount_mount (GTK_WINDOW (dialog),
+							data->mount,
+							data->should_eject,
+							FALSE);
+		break;
+
 	case GTK_RESPONSE_NONE:
 		/* window was closed */
 		break;
@@ -1154,7 +1165,7 @@
 		eject_button = gtk_button_new_with_mnemonic (_("_Unmount"));
 		data->should_eject = FALSE;
 	}
-	gtk_dialog_add_action_widget (GTK_DIALOG (dialog), eject_button, 0);
+	gtk_dialog_add_action_widget (GTK_DIALOG (dialog), eject_button, AUTORUN_DIALOG_RESPONSE_EJECT);
 	gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (GTK_DIALOG (dialog)->action_area), eject_button, TRUE);
 
 	/* show the dialog */

Modified: trunk/libnautilus-private/nautilus-mime-actions.c
==============================================================================
--- trunk/libnautilus-private/nautilus-mime-actions.c	(original)
+++ trunk/libnautilus-private/nautilus-mime-actions.c	Mon Feb 25 11:58:02 2008
@@ -1242,6 +1242,7 @@
 	if (!g_file_mount_enclosing_volume_finish (G_FILE (source_object), res, &error)) {
 		if (error->domain != G_IO_ERROR ||
 		    (error->code != G_IO_ERROR_CANCELLED &&
+		     error->code != G_IO_ERROR_FAILED_HANDLED &&
 		     error->code != G_IO_ERROR_ALREADY_MOUNTED)) {
 			eel_show_error_dialog (_("Unable to mount location"),
 					       error->message, NULL);
@@ -1474,13 +1475,15 @@
 		/* Remove failed file */
 		
 		if (error->domain != G_IO_ERROR ||
-		    error->code != G_IO_ERROR_ALREADY_MOUNTED) {
+		    (error->code != G_IO_ERROR_FAILED_HANDLED &&
+		     error->code != G_IO_ERROR_ALREADY_MOUNTED)) {
 			parameters->files = g_list_remove (parameters->files, file); 
 			nautilus_file_unref (file);
 		}
 		
 		if (error->domain != G_IO_ERROR ||
 		    (error->code != G_IO_ERROR_CANCELLED &&
+		     error->code != G_IO_ERROR_FAILED_HANDLED &&
 		     error->code != G_IO_ERROR_ALREADY_MOUNTED)) {
 			eel_show_error_dialog (_("Unable to mount location"),
 					       error->message, NULL);

Modified: trunk/src/nautilus-window-manage-views.c
==============================================================================
--- trunk/src/nautilus-window-manage-views.c	(original)
+++ trunk/src/nautilus-window-manage-views.c	Mon Feb 25 11:58:02 2008
@@ -1334,6 +1334,48 @@
 	nautilus_window_add_extra_location_widget (window, bar);
 }
 
+typedef struct {
+	NautilusWindow *window;
+	GCancellable *cancellable;
+} FindMountData;
+
+static void
+found_mount_cb (GObject *source_object,
+		GAsyncResult *res,
+		gpointer user_data)
+{
+	FindMountData *data = user_data;
+	GMount *mount;
+	NautilusWindow *window;	
+	char **x_content_types;
+
+	if (g_cancellable_is_cancelled (data->cancellable)) {
+		goto out;
+	}
+	
+	window = data->window;
+	
+	mount = g_file_find_enclosing_mount_finish (G_FILE (source_object),
+						    res,
+						    NULL);
+	if (mount != NULL) {
+		x_content_types = nautilus_autorun_get_x_content_types_for_mount (mount, FALSE);
+		if (x_content_types != NULL && x_content_types[0] != NULL) {
+			nautilus_window_show_x_content_bar (window, mount, x_content_types);
+			update_extra_location_widgets_visibility (window);
+		}
+		g_strfreev (x_content_types);
+		
+		g_object_unref (mount);
+	}
+	
+	window->details->find_mount_cancellable = NULL;
+
+ out:
+	g_object_unref (data->cancellable);
+	g_free (data);
+}
+
 /* Handle the changes for the NautilusWindow itself. */
 static void
 update_for_new_location (NautilusWindow *window)
@@ -1343,8 +1385,7 @@
 	NautilusDirectory *directory;
 	gboolean location_really_changed;
 	char *uri;
-	char **x_content_types;
-	GMount *mount;
+	FindMountData *data;
         
         new_location = window->details->pending_location;
         window->details->pending_location = NULL;
@@ -1403,15 +1444,22 @@
 			nautilus_window_show_trash_bar (window);
 		}
 
-		mount = nautilus_file_get_mount (file);
-		if (mount != NULL) {
-			x_content_types = nautilus_autorun_get_x_content_types_for_mount (mount, FALSE);
-			if (x_content_types != NULL && x_content_types[0] != NULL) {
-				nautilus_window_show_x_content_bar (window, mount, x_content_types);
-			}
-			g_strfreev (x_content_types);
-			g_object_unref (mount);
+		/* need the mount to determine if we should put up the x-content cluebar */
+		if (window->details->find_mount_cancellable != NULL) {
+			g_cancellable_cancel (window->details->find_mount_cancellable);
+			window->details->find_mount_cancellable = NULL;
 		}
+		
+		data = g_new (FindMountData, 1);
+		data->window = window;
+		data->cancellable = g_cancellable_new ();
+		
+		window->details->find_mount_cancellable = data->cancellable;
+		g_file_find_enclosing_mount_async (window->details->location, 
+						   G_PRIORITY_DEFAULT, 
+						   data->cancellable,
+						   found_mount_cb,
+						   data);
 
 		nautilus_directory_unref (directory);
 

Modified: trunk/src/nautilus-window-private.h
==============================================================================
--- trunk/src/nautilus-window-private.h	(original)
+++ trunk/src/nautilus-window-private.h	Mon Feb 25 11:58:02 2008
@@ -101,6 +101,8 @@
 
         NautilusWindowShowHiddenFilesMode show_hidden_files_mode;
         gboolean search_mode;
+
+        GCancellable *find_mount_cancellable;
 };
 
 struct _NautilusNavigationWindowDetails {

Modified: trunk/src/nautilus-window.c
==============================================================================
--- trunk/src/nautilus-window.c	(original)
+++ trunk/src/nautilus-window.c	Mon Feb 25 11:58:02 2008
@@ -639,6 +639,11 @@
 
 	g_free (window->details->title);
 
+	if (window->details->find_mount_cancellable != NULL) {
+		g_cancellable_cancel (window->details->find_mount_cancellable);
+		window->details->find_mount_cancellable = NULL;
+	}
+
 	G_OBJECT_CLASS (nautilus_window_parent_class)->finalize (object);
 }
 



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