diff --git a/nautilus-3.4.3-unmount-notification.patch b/nautilus-3.4.3-unmount-notification.patch index b2e1ef7..23a3cf1 100644 --- a/nautilus-3.4.3-unmount-notification.patch +++ b/nautilus-3.4.3-unmount-notification.patch @@ -1,4 +1,4 @@ -From 669ea0ece8c30442e1703730d260f8e140bd96ea Mon Sep 17 00:00:00 2001 +From cf9d3778748c701d115c9a1c213a13e16b50c4c5 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 15 May 2012 16:12:37 -0400 Subject: [PATCH] places-sidebar: add a notification while ejecting volumes @@ -17,11 +17,11 @@ Based on an initial patch by Tomáš Bžatek 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(-) + src/nautilus-places-sidebar.c | 194 ++++++++++++++++++++++++++++++++++++----- + 1 file changed, 172 insertions(+), 22 deletions(-) diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c -index 26dd93e..8015abb 100644 +index 26dd93e..ddcaeae 100644 --- a/src/nautilus-places-sidebar.c +++ b/src/nautilus-places-sidebar.c @@ -53,6 +53,8 @@ @@ -33,7 +33,7 @@ index 26dd93e..8015abb 100644 #define DEBUG_FLAG NAUTILUS_DEBUG_PLACES #include -@@ -2128,22 +2130,100 @@ unmount_shortcut_cb (GtkMenuItem *item, +@@ -2128,22 +2130,107 @@ unmount_shortcut_cb (GtkMenuItem *item, do_unmount_selection (sidebar); } @@ -43,6 +43,7 @@ index 26dd93e..8015abb 100644 + guint timeout_id; + NotifyNotification *notify; + gchar *device_name; ++ gboolean should_display; +} EjectOpData; + +static void @@ -71,12 +72,14 @@ index 26dd93e..8015abb 100644 + if (data->notify != NULL) { + eject_notification_pop_down (data); + -+ /* 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"); ++ if (data->should_display) { ++ /* 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); ++ notify_notification_show (unplug, NULL); ++ g_object_unref (unplug); ++ } + } + + g_free (data->device_name); @@ -91,6 +94,10 @@ index 26dd93e..8015abb 100644 +{ + gchar *header; + ++ if (!data->should_display) { ++ return; ++ } ++ + header = g_strdup_printf (_("Writing data to %s"), data->device_name); + data->notify = notify_notification_new (header, _("Don't unplug until finished"), + "media-removable"); @@ -138,7 +145,7 @@ index 26dd93e..8015abb 100644 name = g_drive_get_name (G_DRIVE (source_object)); primary = g_strdup_printf (_("Unable to eject %s"), name); g_free (name); -@@ -2154,6 +2234,8 @@ drive_eject_cb (GObject *source_object, +@@ -2154,6 +2241,8 @@ drive_eject_cb (GObject *source_object, } g_error_free (error); } @@ -147,7 +154,7 @@ index 26dd93e..8015abb 100644 } static void -@@ -2161,17 +2243,16 @@ volume_eject_cb (GObject *source_object, +@@ -2161,17 +2250,16 @@ volume_eject_cb (GObject *source_object, GAsyncResult *res, gpointer user_data) { @@ -168,7 +175,7 @@ index 26dd93e..8015abb 100644 name = g_volume_get_name (G_VOLUME (source_object)); primary = g_strdup_printf (_("Unable to eject %s"), name); g_free (name); -@@ -2182,6 +2263,8 @@ volume_eject_cb (GObject *source_object, +@@ -2182,6 +2270,8 @@ volume_eject_cb (GObject *source_object, } g_error_free (error); } @@ -177,7 +184,7 @@ index 26dd93e..8015abb 100644 } static void -@@ -2189,17 +2272,16 @@ mount_eject_cb (GObject *source_object, +@@ -2189,17 +2279,16 @@ mount_eject_cb (GObject *source_object, GAsyncResult *res, gpointer user_data) { @@ -198,7 +205,7 @@ index 26dd93e..8015abb 100644 name = g_mount_get_name (G_MOUNT (source_object)); primary = g_strdup_printf (_("Unable to eject %s"), name); g_free (name); -@@ -2210,6 +2292,19 @@ mount_eject_cb (GObject *source_object, +@@ -2210,6 +2299,51 @@ mount_eject_cb (GObject *source_object, } g_error_free (error); } @@ -215,10 +222,42 @@ index 26dd93e..8015abb 100644 + eject_notification_pop_up (data); + + return FALSE; ++} ++ ++static gboolean ++eject_notification_should_display (GMount *mount, ++ GVolume *volume, ++ GDrive *drive) ++{ ++ gchar *device_id = NULL; ++ gboolean retval = TRUE; ++ ++ if (mount != NULL) { ++ volume = g_mount_get_volume (mount); ++ } else if (volume != NULL) { ++ volume = g_object_ref (volume); ++ } ++ ++ if (volume != NULL) { ++ device_id = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE); ++ } else if (drive != NULL) { ++ device_id = g_drive_get_identifier (drive, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE); ++ } ++ ++ if (device_id != NULL) { ++ retval = !g_str_has_prefix (device_id, "/dev/sr"); ++ g_free (device_id); ++ } ++ ++ if (volume != NULL) { ++ g_object_unref (volume); ++ } ++ ++ return retval; } static void -@@ -2218,20 +2313,35 @@ do_eject (GMount *mount, +@@ -2218,20 +2352,36 @@ do_eject (GMount *mount, GDrive *drive, NautilusPlacesSidebar *sidebar) { @@ -232,6 +271,7 @@ index 26dd93e..8015abb 100644 + 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)))); ++ data->should_display = eject_notification_should_display (mount, volume, drive); - mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar)))); if (mount != NULL) { @@ -266,3 +306,4 @@ index 26dd93e..8015abb 100644 static void -- 1.7.10.2 + diff --git a/nautilus.spec b/nautilus.spec index 788e02b..54124cc 100644 --- a/nautilus.spec +++ b/nautilus.spec @@ -13,7 +13,7 @@ Name: nautilus Summary: File manager for GNOME Version: 3.4.2 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv2+ Group: User Interface/Desktops Source: http://download.gnome.org/sources/%{name}/3.4/%{name}-%{version}.tar.xz @@ -192,6 +192,10 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas >&/dev/null || : %doc %{_datadir}/gtk-doc/html/libnautilus-extension/* %changelog +* Wed May 16 2012 Cosimo Cecchi - 3.4.2-5 +- Update the unmount notification patch with an heuristic to exclude + optical media + * Tue May 15 2012 Adel Gadllah - 3.4.2-4 - Use updated unmount notofication patch from GNOME #619665