From 39df210e1782b5d0445a2541a327964072ff57ea67e3dfef95de4f0e6a7bab5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Lie?= <zaitor@opensuse.org>
Date: Mon, 16 Nov 2015 12:34:55 +0000
Subject: [PATCH] Accepting request 344701 from home:Zaitor

I forgot to sub this one it seems

OBS-URL: https://build.opensuse.org/request/show/344701
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gtk3?expand=0&rev=208
---
 ...r-improve-heuristics-external-drives.patch | 97 +++++++++++++++++++
 gtk3.changes                                  |  8 ++
 gtk3.spec                                     |  3 +
 3 files changed, 108 insertions(+)
 create mode 100644 gtk3-gtkplacessidebar-improve-heuristics-external-drives.patch

diff --git a/gtk3-gtkplacessidebar-improve-heuristics-external-drives.patch b/gtk3-gtkplacessidebar-improve-heuristics-external-drives.patch
new file mode 100644
index 0000000..a521136
--- /dev/null
+++ b/gtk3-gtkplacessidebar-improve-heuristics-external-drives.patch
@@ -0,0 +1,97 @@
+From 0cd4e7ec43a07ae8dc77231bef25ee792ddda529 Mon Sep 17 00:00:00 2001
+From: Carlos Soriano <csoriano@gnome.org>
+Date: Wed, 14 Oct 2015 21:42:16 +0200
+Subject: gtkplacessidebar: improve heuristics for external drives
+
+Since the change to use GtkPlacesView we don't want to show
+internal storage on the sidebar.
+
+In our case we were checking for drive_can_eject and
+drive_is_media_removable.
+
+However for some external hard drives it's reported that they
+are not ejectable nor the have removable media. So the only
+attribute that they have different from internal drives is that
+they can be stopped.
+So check for if the drive can be stopped to decide if it is
+external or internal.
+
+On the way realized we don't need to check for the mounts associated
+with the volume to know if the volume can be ejected or not. So remove
+that code.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=756589
+---
+ gtk/gtkplacessidebar.c | 27 ++++++++++-----------------
+ 1 file changed, 10 insertions(+), 17 deletions(-)
+
+diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
+index d8a2190..42179c3 100644
+--- a/gtk/gtkplacessidebar.c
++++ b/gtk/gtkplacessidebar.c
+@@ -823,36 +823,29 @@ out:
+ }
+ 
+ static gboolean
+-is_removable_volume (GVolume *volume)
++is_external_volume (GVolume *volume)
+ {
+-  gboolean is_removable;
++  gboolean is_external;
+   GDrive *drive;
+-  GMount *mount;
+   gchar *id;
+ 
+   drive = g_volume_get_drive (volume);
+-  mount = g_volume_get_mount (volume);
+   id = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_CLASS);
+ 
+-  is_removable = g_volume_can_eject (volume);
++  is_external = g_volume_can_eject (volume);
+ 
+   /* NULL volume identifier only happens on removable devices */
+-  is_removable |= !id;
++  is_external |= !id;
+ 
+   if (drive)
+-    {
+-      is_removable |= g_drive_can_eject (drive);
+-      is_removable |= g_drive_is_media_removable (drive);
+-    }
+-
+-  if (mount)
+-    is_removable |= (g_mount_can_eject (mount) && !g_mount_can_unmount (mount));
++    is_external |= g_drive_can_eject (drive) ||
++                   g_drive_is_media_removable (drive) ||
++                   g_drive_can_stop (drive);
+ 
+   g_clear_object (&drive);
+-  g_clear_object (&mount);
+   g_free (id);
+ 
+-  return is_removable;
++  return is_external;
+ }
+ 
+ static void
+@@ -991,7 +984,7 @@ update_places (GtkPlacesSidebar *sidebar)
+                 }
+               g_free (identifier);
+ 
+-              if (sidebar->show_other_locations && !is_removable_volume (volume))
++              if (sidebar->show_other_locations && !is_external_volume (volume))
+                 {
+                   g_object_unref (volume);
+                   continue;
+@@ -1095,7 +1088,7 @@ update_places (GtkPlacesSidebar *sidebar)
+         }
+       g_free (identifier);
+ 
+-      if (sidebar->show_other_locations && !is_removable_volume (volume))
++      if (sidebar->show_other_locations && !is_external_volume (volume))
+         {
+           g_object_unref (volume);
+           continue;
+-- 
+cgit v0.11.2
+
diff --git a/gtk3.changes b/gtk3.changes
index 70d488f..1f230ad 100644
--- a/gtk3.changes
+++ b/gtk3.changes
@@ -1,3 +1,11 @@
+-------------------------------------------------------------------
+Sat Nov 14 20:04:16 UTC 2015 - zaitor@opensuse.org
+
+- Add
+  gtk3-gtkplacessidebar-improve-heuristics-external-drives.patch:
+  Add missed commit for the sidebar refactor, without this external
+  drives are not shown anywhere (bgo#756589).
+
 -------------------------------------------------------------------
 Thu Nov 12 18:32:11 UTC 2015 - zaitor@opensuse.org
 
diff --git a/gtk3.spec b/gtk3.spec
index 60a89e7..21da4f4 100644
--- a/gtk3.spec
+++ b/gtk3.spec
@@ -47,6 +47,8 @@ Patch1:         gtk3-path-local.patch
 ## PATCH-DISABLED gtk3-bnc130159-bgo319483-async-font-selection.patch - Upstream bug was closed as obsolete in 2011, lets see if anyone complains. 
 # PATCH-FIX-UPSTREAM gtk3-bnc130159-bgo319483-async-font-selection.patch bnc130159 bgo319483 federico@novell.com - Load fonts asynchronously in GtkFontSelection to make it appear faster for CJK languages
 Patch3:         gtk3-bnc130159-bgo319483-async-font-selection.patch
+# PATCH-FIX-UPSTREAM gtk3-gtkplacessidebar-improve-heuristics-external-drives.patch bgo#756589 zaitor@opensuse.org -- Add a missed commit for the sidebar refactor
+Patch4:         gtk3-gtkplacessidebar-improve-heuristics-external-drives.patch
 BuildRequires:  cups-devel >= 1.2
 BuildRequires:  docbook-xsl-stylesheets
 BuildRequires:  fdupes
@@ -338,6 +340,7 @@ cp -a %{S:1} .
 %patch1 -p0
 ## PATCH-DISABLED - Upstream bug was closed as obsolete in 2011, as there was a new fontchooser, lets disable the patch and see if anyone complains.
 #%%patch3 -p1
+%patch4 -p1
 
 %build
 # Needed for patch1