SHA256
1
0
forked from pool/nautilus

Accepting request 146727 from home:Zaitor:branches:GNOME:Factory

Supersede, use correct bug tags... -- This sr fixes missing notifications when mounting usb harddrives

OBS-URL: https://build.opensuse.org/request/show/146727
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/nautilus?expand=0&rev=181
This commit is contained in:
2013-01-04 09:01:36 +00:00
committed by Git OBS Bridge
parent c40616f816
commit e9670224ab
3 changed files with 284 additions and 0 deletions

View File

@@ -0,0 +1,275 @@
From 463e8d1b1922474e4cf591a3029ea813804bd3e7 Mon Sep 17 00:00:00 2001
From: Cosimo Cecchi <cosimoc@gnome.org>
Date: Tue, 11 Dec 2012 16:25:45 +0000
Subject: places-sidebar: make sure to always notify when unmounting
When unmounting from the sidebar with an operation other than eject, we
still need to set up the progress notification, as some drives return
FALSE for can_eject.
https://bugzilla.redhat.com/show_bug.cgi?id=885133
---
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c
index 85d5a6f..d955331 100644
--- a/libnautilus-private/nautilus-file-operations.c
+++ b/libnautilus-private/nautilus-file-operations.c
@@ -2028,12 +2028,26 @@ nautilus_file_operations_delete (GList *files,
typedef struct {
gboolean eject;
GMount *mount;
+ GMountOperation *mount_operation;
GtkWindow *parent_window;
NautilusUnmountCallback callback;
gpointer callback_data;
} UnmountData;
static void
+unmount_data_free (UnmountData *data)
+{
+ if (data->parent_window) {
+ g_object_remove_weak_pointer (G_OBJECT (data->parent_window),
+ (gpointer *) &data->parent_window);
+ }
+
+ g_clear_object (&data->mount_operation);
+ g_object_unref (data->mount);
+ g_free (data);
+}
+
+static void
unmount_mount_callback (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
@@ -2073,14 +2087,8 @@ unmount_mount_callback (GObject *source_object,
if (error != NULL) {
g_error_free (error);
}
-
- if (data->parent_window) {
- g_object_remove_weak_pointer (G_OBJECT (data->parent_window),
- (gpointer *) &data->parent_window);
- }
- g_object_unref (data->mount);
- g_free (data);
+ unmount_data_free (data);
}
static void
@@ -2088,7 +2096,11 @@ do_unmount (UnmountData *data)
{
GMountOperation *mount_op;
- mount_op = gtk_mount_operation_new (data->parent_window);
+ if (data->mount_operation) {
+ mount_op = g_object_ref (data->mount_operation);
+ } else {
+ mount_op = gtk_mount_operation_new (data->parent_window);
+ }
if (data->eject) {
g_mount_eject_with_operation (data->mount,
0,
@@ -2260,6 +2272,7 @@ empty_trash_for_unmount_done (gboolean success,
void
nautilus_file_operations_unmount_mount_full (GtkWindow *parent_window,
GMount *mount,
+ GMountOperation *mount_operation,
gboolean eject,
gboolean check_trash,
NautilusUnmountCallback callback,
@@ -2277,6 +2290,9 @@ nautilus_file_operations_unmount_mount_full (GtkWindow *par
(gpointer *) &data->parent_window);
}
+ if (mount_operation) {
+ data->mount_operation = g_object_ref (mount_operation);
+ }
data->eject = eject;
data->mount = g_object_ref (mount);
@@ -2302,13 +2318,7 @@ nautilus_file_operations_unmount_mount_full (GtkWindow *par
callback (callback_data);
}
- if (data->parent_window) {
- g_object_remove_weak_pointer (G_OBJECT (data->parent_window),
- (gpointer *) &data->parent_window);
- }
-
- g_object_unref (data->mount);
- g_free (data);
+ unmount_data_free (data);
return;
}
}
@@ -2322,7 +2332,7 @@ nautilus_file_operations_unmount_mount (GtkWindow *parent_w
gboolean eject,
gboolean check_trash)
{
- nautilus_file_operations_unmount_mount_full (parent_window, mount, eject,
+ nautilus_file_operations_unmount_mount_full (parent_window, mount, NULL, eject,
check_trash, NULL, NULL);
}
diff --git a/libnautilus-private/nautilus-file-operations.h b/libnautilus-private/nautilus-file-operations.h
index 55f7479..e0af100 100644
--- a/libnautilus-private/nautilus-file-operations.h
+++ b/libnautilus-private/nautilus-file-operations.h
@@ -107,6 +107,7 @@ void nautilus_file_operations_unmount_mount (GtkWindow *par
gboolean check_trash);
void nautilus_file_operations_unmount_mount_full (GtkWindow *parent_window,
GMount *mount,
+ GMountOperation *mount_operation,
gboolean eject,
gboolean check_trash,
NautilusUnmountCallback callback,
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index af42102..84be583 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -1262,7 +1262,7 @@ nautilus_file_unmount (NautilusFile *file,
data->file = nautilus_file_ref (file);
data->callback = callback;
data->callback_data = callback_data;
- nautilus_file_operations_unmount_mount_full (NULL, file->details->mount, FALSE, TRUE, unmount_done, data);
+ nautilus_file_operations_unmount_mount_full (NULL, file->details->mount, NULL, FALSE, TRUE, unmount_done, data);
} else if (callback) {
callback (file, NULL, NULL, callback_data);
}
@@ -1296,7 +1296,7 @@ nautilus_file_eject (NautilusFile *file,
data->file = nautilus_file_ref (file);
data->callback = callback;
data->callback_data = callback_data;
- nautilus_file_operations_unmount_mount_full (NULL, file->details->mount, TRUE, TRUE, unmount_done, data);
+ nautilus_file_operations_unmount_mount_full (NULL, file->details->mount, NULL, TRUE, TRUE, unmount_done, data);
} else if (callback) {
callback (file, NULL, NULL, callback_data);
}
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
index adf07fb..224a2da 100644
--- a/src/nautilus-places-sidebar.c
+++ b/src/nautilus-places-sidebar.c
@@ -1975,13 +1975,55 @@ unmount_done (gpointer data)
}
static void
+show_unmount_progress_cb (GMountOperation *op,
+ const gchar *message,
+ gint64 time_left,
+ gint64 bytes_left,
+ gpointer user_data)
+{
+ NautilusApplication *app = NAUTILUS_APPLICATION (g_application_get_default ());
+
+ if (bytes_left == 0) {
+ nautilus_application_notify_unmount_done (app, message);
+ } else {
+ nautilus_application_notify_unmount_show (app, message);
+ }
+}
+
+static void
+show_unmount_progress_aborted_cb (GMountOperation *op,
+ gpointer user_data)
+{
+ NautilusApplication *app = NAUTILUS_APPLICATION (g_application_get_default ());
+ nautilus_application_notify_unmount_done (app, NULL);
+}
+
+static GMountOperation *
+get_unmount_operation (NautilusPlacesSidebar *sidebar)
+{
+ GMountOperation *mount_op;
+
+ mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar))));
+ g_signal_connect (mount_op, "show-unmount-progress",
+ G_CALLBACK (show_unmount_progress_cb), sidebar);
+ g_signal_connect (mount_op, "aborted",
+ G_CALLBACK (show_unmount_progress_aborted_cb), sidebar);
+
+ return mount_op;
+}
+
+static void
do_unmount (GMount *mount,
NautilusPlacesSidebar *sidebar)
{
+ GMountOperation *mount_op;
+
if (mount != NULL) {
- nautilus_file_operations_unmount_mount_full (NULL, mount, FALSE, TRUE,
+ mount_op = get_unmount_operation (sidebar);
+ nautilus_file_operations_unmount_mount_full (NULL, mount, mount_op, FALSE, TRUE,
unmount_done,
g_object_ref (sidebar->window));
+ g_object_unref (mount_op);
}
}
@@ -2013,30 +2055,6 @@ unmount_shortcut_cb (GtkMenuItem *item,
}
static void
-show_unmount_progress_cb (GMountOperation *op,
- const gchar *message,
- gint64 time_left,
- gint64 bytes_left,
- gpointer user_data)
-{
- NautilusApplication *app = NAUTILUS_APPLICATION (g_application_get_default ());
-
- if (bytes_left == 0) {
- nautilus_application_notify_unmount_done (app, message);
- } else {
- nautilus_application_notify_unmount_show (app, message);
- }
-}
-
-static void
-show_unmount_progress_aborted_cb (GMountOperation *op,
- gpointer user_data)
-{
- NautilusApplication *app = NAUTILUS_APPLICATION (g_application_get_default ());
- nautilus_application_notify_unmount_done (app, NULL);
-}
-
-static void
drive_eject_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
@@ -2126,9 +2144,8 @@ do_eject (GMount *mount,
GDrive *drive,
NautilusPlacesSidebar *sidebar)
{
- GMountOperation *mount_op;
+ GMountOperation *mount_op = get_unmount_operation (sidebar);
- mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar))));
if (mount != NULL) {
g_mount_eject_with_operation (mount, 0, mount_op, NULL, mount_eject_cb,
g_object_ref (sidebar->window));
@@ -2140,10 +2157,6 @@ do_eject (GMount *mount,
g_object_ref (sidebar->window));
}
- g_signal_connect (mount_op, "show-unmount-progress",
- G_CALLBACK (show_unmount_progress_cb), sidebar);
- g_signal_connect (mount_op, "aborted",
- G_CALLBACK (show_unmount_progress_aborted_cb), sidebar);
g_object_unref (mount_op);
}
@@ -2381,9 +2394,7 @@ stop_shortcut_cb (GtkMenuItem *item,
-1);
if (drive != NULL) {
- GMountOperation *mount_op;
-
- mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar))));
+ GMountOperation *mount_op = get_unmount_operation (sidebar);
g_drive_stop (drive, G_MOUNT_UNMOUNT_NONE, mount_op, NULL, drive_stop_cb,
g_object_ref (sidebar->window));
g_object_unref (mount_op);
--
cgit v0.9.0.2

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Dec 20 16:23:26 UTC 2012 - zaitor@opensuse.org
- Add nautilus-make-sure-to-always-notify-when-unmounting.patch,
fixes missing notification when unmounting drives (rh#885133).
-------------------------------------------------------------------
Tue Nov 13 11:44:43 UTC 2012 - dimstar@opensuse.org

View File

@@ -30,6 +30,8 @@ Url: http://www.gnome.org
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# PATCH-NEEDS-REBASE nautilus-drives-and-volumes-on-desktop.diff bnc335411 federico@novell.com
Patch15: nautilus-drives-and-volumes-on-desktop.diff
# PATCH-FIX-UPSTREAM nautilus-make-sure-to-always-notify-when-unmounting.patch rh#885133 zaitor@opensuse.org -- fixes notifications when umounting drives.
Patch16: nautilus-make-sure-to-always-notify-when-unmounting.patch
# needed for directory ownership
BuildRequires: dbus-1
BuildRequires: fdupes
@@ -116,6 +118,7 @@ translation-update-upstream
#gnome-patch-translation-prepare
### %patch15 -p1
#gnome-patch-translation-update
%patch16 -p1
%build
%configure\