[nautilus/f17] Use updated unmount notofication patch from GNOME #619665
drago01
drago01 at fedoraproject.org
Tue May 15 21:02:08 UTC 2012
commit b9ce0fe4bebd6f3ec025369e80324e21237df10c
Author: Adel Gadllah <adel.gadllah at gmail.com>
Date: Tue May 15 23:03:39 2012 +0200
Use updated unmount notofication patch from GNOME #619665
nautilus-3.4.3-unmount-notification.patch | 286 +++++++++++------------------
nautilus.spec | 5 +-
2 files changed, 113 insertions(+), 178 deletions(-)
---
diff --git a/nautilus-3.4.3-unmount-notification.patch b/nautilus-3.4.3-unmount-notification.patch
index d6aefbe..b2e1ef7 100644
--- a/nautilus-3.4.3-unmount-notification.patch
+++ b/nautilus-3.4.3-unmount-notification.patch
@@ -1,123 +1,29 @@
-diff -up nautilus-3.4.2/libnautilus-private/nautilus-file-operations.c.bak nautilus-3.4.2/libnautilus-private/nautilus-file-operations.c
---- nautilus-3.4.2/libnautilus-private/nautilus-file-operations.c.bak 2012-05-14 21:37:55.000000000 +0200
-+++ nautilus-3.4.2/libnautilus-private/nautilus-file-operations.c 2012-05-15 20:10:54.000000000 +0200
-@@ -66,6 +66,8 @@
- #include "nautilus-file-undo-operations.h"
- #include "nautilus-file-undo-manager.h"
-
-+#include <libnotify/notify.h>
-+
- /* TODO: TESTING!!! */
-
- typedef struct {
-@@ -2015,9 +2017,38 @@ typedef struct {
- GtkWindow *parent_window;
- NautilusUnmountCallback callback;
- gpointer callback_data;
-+ guint timeout_id;
-+ NotifyNotification *notify;
- } UnmountData;
-
- static void
-+pop_down_notification (UnmountData *data)
-+{
-+ if (data->timeout_id > 0) {
-+ g_source_remove (data->timeout_id);
-+ data->timeout_id = 0;
-+ }
-+
-+ if (data->notify != NULL) {
-+ notify_notification_close (data->notify, NULL);
-+ g_object_unref (data->notify);
-+ data->notify = NULL;
-+ }
-+}
-+
-+static void
-+mount_op_show_processes (GMountOperation *op,
-+ gchar *message,
-+ GArray *processes,
-+ GStrv choices,
-+ gpointer user_data)
-+{
-+ UnmountData *data = user_data;
-+
-+ pop_down_notification (data);
-+}
-+
-+static void
- unmount_mount_callback (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
-@@ -2038,6 +2069,7 @@ unmount_mount_callback (GObject *source_
-
- if (! unmounted) {
- if (error->code != G_IO_ERROR_FAILED_HANDLED) {
-+ pop_down_notification (data);
- if (data->eject) {
- primary = f (_("Unable to eject %V"), source_object);
- } else {
-@@ -2058,11 +2090,45 @@ unmount_mount_callback (GObject *source_
- g_error_free (error);
- }
-
-+ if (data->timeout_id > 0)
-+ g_source_remove (data->timeout_id);
-+
-+ if (data->notify != NULL) {
-+ /* Notification was shown, let's update it saying we're finished */
-+ notify_notification_update (data->notify,
-+ _("You can now unplug the device"),
-+ NULL,
-+ "media-removable");
-+
-+ notify_notification_set_urgency (data->notify, NOTIFY_URGENCY_LOW);
-+ notify_notification_set_timeout (data->notify, NOTIFY_EXPIRES_DEFAULT);
-+ notify_notification_show (data->notify, NULL);
-+ g_object_unref (data->notify);
-+ }
-+
- eel_remove_weak_pointer (&data->parent_window);
- g_object_unref (data->mount);
- g_free (data);
- }
-
-+static gboolean
-+eject_timeout (gpointer user_data)
-+{
-+ UnmountData *data = user_data;
-+
-+ data->timeout_id = 0;
-+
-+ data->notify = notify_notification_new (_("Writing data to device"),
-+ _("Don't unplug until finished"),
-+ "media-removable");
-+ notify_notification_set_urgency (data->notify, NOTIFY_URGENCY_CRITICAL);
-+ notify_notification_set_timeout (data->notify, NOTIFY_EXPIRES_NEVER);
-+
-+ notify_notification_show (data->notify, NULL);
-+
-+ return FALSE;
-+}
-+
- static void
- do_unmount (UnmountData *data)
- {
-@@ -2084,6 +2150,11 @@ do_unmount (UnmountData *data)
- unmount_mount_callback,
- data);
- }
-+
-+ data->timeout_id = g_timeout_add_seconds (1, (GSourceFunc) eject_timeout, data);
-+ g_signal_connect (G_OBJECT (mount_op), "show-processes",
-+ G_CALLBACK (mount_op_show_processes), data);
-+
- g_object_unref (mount_op);
- }
-
-diff -up nautilus-3.4.2/src/nautilus-places-sidebar.c.bak nautilus-3.4.2/src/nautilus-places-sidebar.c
---- nautilus-3.4.2/src/nautilus-places-sidebar.c.bak 2012-05-14 21:37:55.000000000 +0200
-+++ nautilus-3.4.2/src/nautilus-places-sidebar.c 2012-05-15 20:08:38.000000000 +0200
+From 669ea0ece8c30442e1703730d260f8e140bd96ea Mon Sep 17 00:00:00 2001
+From: Cosimo Cecchi <cosimoc at gnome.org>
+Date: Tue, 15 May 2012 16:12:37 -0400
+Subject: [PATCH] places-sidebar: add a notification while ejecting volumes
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This is a workarond solution until we come up with something better
+designed for GNOME 3.6 (by that time we'll also have a proper API in GIO
+for this, see [1].
+
+Based on an initial patch by Tomáš Bžatek <tbzatek at redhat.com>
+
+[1] https://bugzilla.gnome.org/show_bug.cgi?id=676111
+
+https://bugzilla.redhat.com/show_bug.cgi?id=819492
+https://bugzilla.gnome.org/show_bug.cgi?id=619665
+---
+ src/nautilus-places-sidebar.c | 154 +++++++++++++++++++++++++++++++++++------
+ 1 file changed, 132 insertions(+), 22 deletions(-)
+
+diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
+index 26dd93e..8015abb 100644
+--- a/src/nautilus-places-sidebar.c
++++ b/src/nautilus-places-sidebar.c
@@ -53,6 +53,8 @@
#include "nautilus-window.h"
#include "nautilus-window-slot.h"
@@ -127,7 +33,7 @@ diff -up nautilus-3.4.2/src/nautilus-places-sidebar.c.bak nautilus-3.4.2/src/nau
#define DEBUG_FLAG NAUTILUS_DEBUG_PLACES
#include <libnautilus-private/nautilus-debug.h>
-@@ -2134,22 +2136,79 @@ unmount_shortcut_cb (GtkMenuItem
+@@ -2128,22 +2130,100 @@ unmount_shortcut_cb (GtkMenuItem *item,
do_unmount_selection (sidebar);
}
@@ -136,56 +42,78 @@ diff -up nautilus-3.4.2/src/nautilus-places-sidebar.c.bak nautilus-3.4.2/src/nau
+ GMountOperation *mount_op;
+ guint timeout_id;
+ NotifyNotification *notify;
++ gchar *device_name;
+} EjectOpData;
+
+static void
++eject_notification_pop_down (EjectOpData *data)
++{
++ if (data->timeout_id > 0) {
++ g_source_remove (data->timeout_id);
++ data->timeout_id = 0;
++ }
++
++ if (data->notify != NULL) {
++ notify_notification_close (data->notify, NULL);
++ g_clear_object (&data->notify);
++ }
++}
++
++static void
+free_eject_op_data (EjectOpData *data)
+{
++ gchar *header;
++ NotifyNotification *unplug;
++
+ if (data->timeout_id > 0)
+ g_source_remove (data->timeout_id);
+
+ if (data->notify != NULL) {
-+ /* Notification was shown, let's update it saying we're finished */
-+ notify_notification_update (data->notify,
-+ _("You can now unplug the device"),
-+ NULL,
-+ "media-removable");
++ eject_notification_pop_down (data);
+
-+ notify_notification_set_urgency (data->notify, NOTIFY_URGENCY_LOW);
-+ notify_notification_set_timeout (data->notify, NOTIFY_EXPIRES_DEFAULT);
-+ notify_notification_show (data->notify, NULL);
-+ g_object_unref (data->notify);
++ /* Notification was shown, let's update it we're finished */
++ header = g_strdup_printf (_("You can now unplug %s"), data->device_name);
++ unplug = notify_notification_new (header, NULL, "media-removable");
++
++ notify_notification_show (unplug, NULL);
++ g_object_unref (unplug);
+ }
+
++ g_free (data->device_name);
++ g_clear_object (&data->window);
+ g_object_unref (data->mount_op);
-+ g_free (data);
++
++ g_slice_free (EjectOpData, data);
+}
+
+static void
-+pop_down_notification (EjectOpData *data)
++eject_notification_pop_up (EjectOpData *data)
+{
-+ if (data->timeout_id > 0) {
-+ g_source_remove (data->timeout_id);
-+ data->timeout_id = 0;
-+ }
++ gchar *header;
+
-+ if (data->notify != NULL) {
-+ notify_notification_close (data->notify, NULL);
-+ g_object_unref (data->notify);
-+ data->notify = NULL;
-+ }
++ header = g_strdup_printf (_("Writing data to %s"), data->device_name);
++ data->notify = notify_notification_new (header, _("Don't unplug until finished"),
++ "media-removable");
++ g_free (header);
++
++ notify_notification_set_hint (data->notify, "transient", g_variant_new_boolean (TRUE));
++ notify_notification_set_urgency (data->notify, NOTIFY_URGENCY_CRITICAL);
++
++ notify_notification_show (data->notify, NULL);
+}
+
+static void
-+mount_op_show_processes (GMountOperation *op,
-+ gchar *message,
-+ GArray *processes,
-+ GStrv choices,
-+ gpointer user_data)
++eject_mount_op_reply (GMountOperation *op,
++ GMountOperationResult result,
++ gpointer user_data)
+{
+ EjectOpData *data = user_data;
++ gint choice;
+
-+ pop_down_notification (data);
++ g_object_get (op, "choice", &choice, NULL);
++ if (choice == 0) {
++ eject_notification_pop_up (data);
++ }
+}
+
static void
@@ -201,16 +129,16 @@ diff -up nautilus-3.4.2/src/nautilus-places-sidebar.c.bak nautilus-3.4.2/src/nau
- window = user_data;
- g_object_unref (window);
-+ g_object_unref (data->window);
-
+-
error = NULL;
if (!g_drive_eject_with_operation_finish (G_DRIVE (source_object), res, &error)) {
if (error->code != G_IO_ERROR_FAILED_HANDLED) {
-+ pop_down_notification (data);
++ eject_notification_pop_down (data);
++
name = g_drive_get_name (G_DRIVE (source_object));
primary = g_strdup_printf (_("Unable to eject %s"), name);
g_free (name);
-@@ -2160,6 +2219,8 @@ drive_eject_cb (GObject *source_object,
+@@ -2154,6 +2234,8 @@ drive_eject_cb (GObject *source_object,
}
g_error_free (error);
}
@@ -219,7 +147,7 @@ diff -up nautilus-3.4.2/src/nautilus-places-sidebar.c.bak nautilus-3.4.2/src/nau
}
static void
-@@ -2167,17 +2228,17 @@ volume_eject_cb (GObject *source_object,
+@@ -2161,17 +2243,16 @@ volume_eject_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
@@ -231,16 +159,16 @@ diff -up nautilus-3.4.2/src/nautilus-places-sidebar.c.bak nautilus-3.4.2/src/nau
- window = user_data;
- g_object_unref (window);
-+ g_object_unref (data->window);
-
+-
error = NULL;
if (!g_volume_eject_with_operation_finish (G_VOLUME (source_object), res, &error)) {
if (error->code != G_IO_ERROR_FAILED_HANDLED) {
-+ pop_down_notification (data);
++ eject_notification_pop_down (data);
++
name = g_volume_get_name (G_VOLUME (source_object));
primary = g_strdup_printf (_("Unable to eject %s"), name);
g_free (name);
-@@ -2188,6 +2249,8 @@ volume_eject_cb (GObject *source_object,
+@@ -2182,6 +2263,8 @@ volume_eject_cb (GObject *source_object,
}
g_error_free (error);
}
@@ -249,7 +177,7 @@ diff -up nautilus-3.4.2/src/nautilus-places-sidebar.c.bak nautilus-3.4.2/src/nau
}
static void
-@@ -2195,17 +2258,17 @@ mount_eject_cb (GObject *source_object,
+@@ -2189,17 +2272,16 @@ mount_eject_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
@@ -261,16 +189,16 @@ diff -up nautilus-3.4.2/src/nautilus-places-sidebar.c.bak nautilus-3.4.2/src/nau
- window = user_data;
- g_object_unref (window);
-+ g_object_unref (data->window);
-
+-
error = NULL;
if (!g_mount_eject_with_operation_finish (G_MOUNT (source_object), res, &error)) {
if (error->code != G_IO_ERROR_FAILED_HANDLED) {
-+ pop_down_notification (data);
++ eject_notification_pop_down (data);
++
name = g_mount_get_name (G_MOUNT (source_object));
primary = g_strdup_printf (_("Unable to eject %s"), name);
g_free (name);
-@@ -2216,6 +2279,26 @@ mount_eject_cb (GObject *source_object,
+@@ -2210,6 +2292,19 @@ mount_eject_cb (GObject *source_object,
}
g_error_free (error);
}
@@ -284,28 +212,24 @@ diff -up nautilus-3.4.2/src/nautilus-places-sidebar.c.bak nautilus-3.4.2/src/nau
+ EjectOpData *data = user_data;
+
+ data->timeout_id = 0;
-+
-+ data->notify = notify_notification_new (_("Writing data to device"),
-+ _("Don't unplug until finished"),
-+ "media-removable");
-+ notify_notification_set_urgency (data->notify, NOTIFY_URGENCY_CRITICAL);
-+ notify_notification_set_timeout (data->notify, NOTIFY_EXPIRES_NEVER);
-+
-+ notify_notification_show (data->notify, NULL);
++ eject_notification_pop_up (data);
+
+ return FALSE;
}
static void
-@@ -2224,20 +2307,27 @@ do_eject (GMount *mount,
+@@ -2218,20 +2313,35 @@ do_eject (GMount *mount,
GDrive *drive,
NautilusPlacesSidebar *sidebar)
{
- GMountOperation *mount_op;
+ EjectOpData *data;
+
++ if (mount == NULL && drive == NULL && volume == NULL) {
++ return;
++ }
+
-+ data = g_malloc0 (sizeof (EjectOpData));
++ data = g_slice_new0 (EjectOpData);
+ data->window = g_object_ref (sidebar->window);
+ data->mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar))));
@@ -313,24 +237,32 @@ diff -up nautilus-3.4.2/src/nautilus-places-sidebar.c.bak nautilus-3.4.2/src/nau
if (mount != NULL) {
- g_mount_eject_with_operation (mount, 0, mount_op, NULL, mount_eject_cb,
- g_object_ref (sidebar->window));
++ data->device_name = g_mount_get_name (mount);
+ g_mount_eject_with_operation (mount, 0, data->mount_op, NULL, mount_eject_cb, data);
} else if (volume != NULL) {
- g_volume_eject_with_operation (volume, 0, mount_op, NULL, volume_eject_cb,
- g_object_ref (sidebar->window));
++ data->device_name = g_volume_get_name (volume);
+ g_volume_eject_with_operation (volume, 0, data->mount_op, NULL, volume_eject_cb, data);
} else if (drive != NULL) {
- g_drive_eject_with_operation (drive, 0, mount_op, NULL, drive_eject_cb,
- g_object_ref (sidebar->window));
+- }
+- g_object_unref (mount_op);
++ data->device_name = g_drive_get_name (drive);
+ g_drive_eject_with_operation (drive, 0, data->mount_op, NULL, drive_eject_cb, data);
+ }
+
+ /* Display a notification of ongoing operation after a timeout */
-+ if (mount != NULL || volume != NULL || drive != NULL) {
-+ data->timeout_id = g_timeout_add_seconds (1, (GSourceFunc) eject_timeout, data);
-+ g_signal_connect (G_OBJECT (data->mount_op), "show-processes",
-+ G_CALLBACK (mount_op_show_processes), data);
- }
-- g_object_unref (mount_op);
++ data->timeout_id = g_timeout_add_seconds (1, eject_timeout, data);
++ g_signal_connect_swapped (data->mount_op, "show-processes",
++ G_CALLBACK (eject_notification_pop_down), data);
++ g_signal_connect_swapped (data->mount_op, "aborted",
++ G_CALLBACK (eject_notification_pop_down), data);
++ g_signal_connect (data->mount_op, "reply",
++ G_CALLBACK (eject_mount_op_reply), data);
}
static void
+--
+1.7.10.2
diff --git a/nautilus.spec b/nautilus.spec
index 31205d8..788e02b 100644
--- a/nautilus.spec
+++ b/nautilus.spec
@@ -13,7 +13,7 @@
Name: nautilus
Summary: File manager for GNOME
Version: 3.4.2
-Release: 3%{?dist}
+Release: 4%{?dist}
License: GPLv2+
Group: User Interface/Desktops
Source: http://download.gnome.org/sources/%{name}/3.4/%{name}-%{version}.tar.xz
@@ -192,6 +192,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas >&/dev/null || :
%doc %{_datadir}/gtk-doc/html/libnautilus-extension/*
%changelog
+* Tue May 15 2012 Adel Gadllah <adel.gadllah at gmail.com> - 3.4.2-4
+- Use updated unmount notofication patch from GNOME #619665
+
* Tue May 15 2012 Tomas Bzatek <tbzatek at redhat.com> - 3.4.2-3
- Fix eject notifications
More information about the scm-commits
mailing list