Commit 043a073f authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Don't display error on G_IO_ERROR_FAILED_HANDLED.

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.



svn path=/trunk/; revision=13811
parent 9f308b4f
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.
2008-02-22 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-mime-actions.c:
......
......@@ -848,6 +848,10 @@ _g_mount_guess_content_type_finish (GMount *mount,
/*- END MOVE TO GIO ---*/
enum {
AUTORUN_DIALOG_RESPONSE_EJECT = 0
};
typedef struct
{
GtkWidget *dialog;
......@@ -915,6 +919,13 @@ static void
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 @@ show_dialog:
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 */
......
......@@ -1242,6 +1242,7 @@ activation_mount_not_mounted_callback (GObject *source_object,
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 @@ activation_mountable_mounted (NautilusFile *file,
/* 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);
......
......@@ -1334,6 +1334,48 @@ nautilus_window_show_trash_bar (NautilusWindow *window)
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 @@ update_for_new_location (NautilusWindow *window)
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 @@ update_for_new_location (NautilusWindow *window)
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);
......
......@@ -101,6 +101,8 @@ struct NautilusWindowDetails
NautilusWindowShowHiddenFilesMode show_hidden_files_mode;
gboolean search_mode;
GCancellable *find_mount_cancellable;
};
struct _NautilusNavigationWindowDetails {
......
......@@ -639,6 +639,11 @@ nautilus_window_finalize (GObject *object)
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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment