[nautilus] Set parent for all mount/eject error dialogs



commit f78939848ea3c3ee444111bc3e24f0610873ae80
Author: William Jon McCann <jmccann redhat com>
Date:   Tue Aug 21 10:48:06 2012 -0400

    Set parent for all mount/eject error dialogs
    
    https://bugzilla.gnome.org/show_bug.cgi?id=590513

 src/nautilus-view.c |   43 ++++++++++++++++++++++++++++---------------
 1 files changed, 28 insertions(+), 15 deletions(-)
---
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 9d36315..9426e69 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -6626,6 +6626,10 @@ file_mount_callback (NautilusFile  *file,
 		     GError        *error,
 		     gpointer       callback_data)
 {
+	NautilusView *view;
+
+	view = NAUTILUS_VIEW (callback_data);
+
 	if (error != NULL &&
 	    (error->domain != G_IO_ERROR ||
 	     (error->code != G_IO_ERROR_CANCELLED &&
@@ -6636,7 +6640,7 @@ file_mount_callback (NautilusFile  *file,
 		name = nautilus_file_get_display_name (file);
 		/* Translators: %s is a file name formatted for display */
 		text = g_strdup_printf (_("Unable to access â%sâ"), name);
-		eel_show_error_dialog (text, error->message, NULL);
+		eel_show_error_dialog (text, error->message, GTK_WINDOW (view->details->window));
 		g_free (text);
 		g_free (name);
 	}
@@ -6662,7 +6666,7 @@ file_unmount_callback (NautilusFile  *file,
 		name = nautilus_file_get_display_name (file);
 		/* Translators: %s is a file name formatted for display */
 		text = g_strdup_printf (_("Unable to remove â%sâ"), name);
-		eel_show_error_dialog (text, error->message, NULL);
+		eel_show_error_dialog (text, error->message, GTK_WINDOW (view->details->window));
 		g_free (text);
 		g_free (name);
 	}
@@ -6688,7 +6692,7 @@ file_eject_callback (NautilusFile  *file,
 		name = nautilus_file_get_display_name (file);
 		/* Translators: %s is a file name formatted for display */
 		text = g_strdup_printf (_("Unable to eject â%sâ"), name);
-		eel_show_error_dialog (text, error->message, NULL);
+		eel_show_error_dialog (text, error->message, GTK_WINDOW (view->details->window));
 		g_free (text);
 		g_free (name);
 	}
@@ -6700,12 +6704,16 @@ file_stop_callback (NautilusFile  *file,
 		    GError        *error,
 		    gpointer       callback_data)
 {
+	NautilusView *view;
+
+	view = NAUTILUS_VIEW (callback_data);
+
 	if (error != NULL &&
 	    (error->domain != G_IO_ERROR ||
 	     (error->code != G_IO_ERROR_CANCELLED &&
 	      error->code != G_IO_ERROR_FAILED_HANDLED))) {
 		eel_show_error_dialog (_("Unable to stop drive"),
-				       error->message, NULL);
+				       error->message, GTK_WINDOW (view->details->window));
 	}
 }
 
@@ -6728,7 +6736,8 @@ action_mount_volume_callback (GtkAction *action,
 			mount_op = gtk_mount_operation_new (nautilus_view_get_containing_window (view));
 			g_mount_operation_set_password_save (mount_op, G_PASSWORD_SAVE_FOR_SESSION);
 			nautilus_file_mount (file, mount_op, NULL,
-					     file_mount_callback, NULL);
+					     file_mount_callback,
+					     view);
 			g_object_unref (mount_op);
 		}
 	}
@@ -6791,6 +6800,10 @@ file_start_callback (NautilusFile  *file,
 		     GError        *error,
 		     gpointer       callback_data)
 {
+	NautilusView *view;
+
+	view = NAUTILUS_VIEW (callback_data);
+
 	if (error != NULL &&
 	    (error->domain != G_IO_ERROR ||
 	     (error->code != G_IO_ERROR_CANCELLED &&
@@ -6801,7 +6814,7 @@ file_start_callback (NautilusFile  *file,
 		name = nautilus_file_get_display_name (file);
 		/* Translators: %s is a file name formatted for display */
 		text = g_strdup_printf (_("Unable to start â%sâ"), name);
-		eel_show_error_dialog (text, error->message, NULL);
+		eel_show_error_dialog (text, error->message, GTK_WINDOW (view->details->window));
 		g_free (text);
 		g_free (name);
 	}
@@ -6816,7 +6829,7 @@ action_start_volume_callback (GtkAction *action,
 	NautilusView *view;
 	GMountOperation *mount_op;
 
-        view = NAUTILUS_VIEW (data);
+	view = NAUTILUS_VIEW (data);
 
 	selection = nautilus_view_get_selection (view);
 	for (l = selection; l != NULL; l = l->next) {
@@ -6825,7 +6838,7 @@ action_start_volume_callback (GtkAction *action,
 		if (nautilus_file_can_start (file) || nautilus_file_can_start_degraded (file)) {
 			mount_op = gtk_mount_operation_new (nautilus_view_get_containing_window (view));
 			nautilus_file_start (file, mount_op, NULL,
-					     file_start_callback, NULL);
+					     file_start_callback, view);
 			g_object_unref (mount_op);
 		}
 	}
@@ -6850,7 +6863,7 @@ action_stop_volume_callback (GtkAction *action,
 			GMountOperation *mount_op;
 			mount_op = gtk_mount_operation_new (nautilus_view_get_containing_window (view));
 			nautilus_file_stop (file, mount_op, NULL,
-					    file_stop_callback, NULL);
+					    file_stop_callback, view);
 			g_object_unref (mount_op);
 		}
 	}
@@ -6895,7 +6908,7 @@ action_self_mount_volume_callback (GtkAction *action,
 
 	mount_op = gtk_mount_operation_new (nautilus_view_get_containing_window (view));
 	g_mount_operation_set_password_save (mount_op, G_PASSWORD_SAVE_FOR_SESSION);
-	nautilus_file_mount (file, mount_op, NULL, file_mount_callback, NULL);
+	nautilus_file_mount (file, mount_op, NULL, file_mount_callback, view);
 	g_object_unref (mount_op);
 }
 
@@ -6955,7 +6968,7 @@ action_self_start_volume_callback (GtkAction *action,
 	}
 
 	mount_op = gtk_mount_operation_new (nautilus_view_get_containing_window (view));
-	nautilus_file_start (file, mount_op, NULL, file_start_callback, NULL);
+	nautilus_file_start (file, mount_op, NULL, file_start_callback, view);
 	g_object_unref (mount_op);
 }
 
@@ -6976,7 +6989,7 @@ action_self_stop_volume_callback (GtkAction *action,
 
 	mount_op = gtk_mount_operation_new (nautilus_view_get_containing_window (view));
 	nautilus_file_stop (file, mount_op, NULL,
-			    file_stop_callback, NULL);
+			    file_stop_callback, view);
 	g_object_unref (mount_op);
 }
 
@@ -7014,7 +7027,7 @@ action_location_mount_volume_callback (GtkAction *action,
 
 	mount_op = gtk_mount_operation_new (nautilus_view_get_containing_window (view));
 	g_mount_operation_set_password_save (mount_op, G_PASSWORD_SAVE_FOR_SESSION);
-	nautilus_file_mount (file, mount_op, NULL, file_mount_callback, NULL);
+	nautilus_file_mount (file, mount_op, NULL, file_mount_callback, view);
 	g_object_unref (mount_op);
 }
 
@@ -7076,7 +7089,7 @@ action_location_start_volume_callback (GtkAction *action,
 	}
 
 	mount_op = gtk_mount_operation_new (nautilus_view_get_containing_window (view));
-	nautilus_file_start (file, mount_op, NULL, file_start_callback, NULL);
+	nautilus_file_start (file, mount_op, NULL, file_start_callback, view);
 	g_object_unref (mount_op);
 }
 
@@ -7097,7 +7110,7 @@ action_location_stop_volume_callback (GtkAction *action,
 
 	mount_op = gtk_mount_operation_new (nautilus_view_get_containing_window (view));
 	nautilus_file_stop (file, mount_op, NULL,
-			    file_stop_callback, NULL);
+			    file_stop_callback, view);
 	g_object_unref (mount_op);
 }
 



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