[gtk/wip/muktupavels/issue-1962] placessidebar: present FUSE-reachable network shares



commit 5419c175b8609869b5e8b7d2d26ad854cbeb5598
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Jan 14 17:39:15 2020 +0200

    placessidebar: present FUSE-reachable network shares
    
    Followup for https://gitlab.gnome.org/GNOME/gtk/commit/279b81d20211
    
    https://gitlab.gnome.org/GNOME/gtk/issues/1962

 gtk/gtkplacessidebar.c | 55 ++++++++++++++++++++++++++++++++++----------------
 1 file changed, 38 insertions(+), 17 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 87c08a5389..49031a420d 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -922,6 +922,20 @@ is_external_volume (GVolume *volume)
   return is_external;
 }
 
+static gboolean
+is_local (GFile *file)
+{
+  gchar *path;
+
+  path = g_file_get_path (file);
+  if (path == NULL)
+    return FALSE;
+
+  g_free (path);
+
+  return TRUE;
+}
+
 static void
 update_trash_icon (GtkPlacesSidebar *sidebar)
 {
@@ -1430,7 +1444,7 @@ update_places (GtkPlacesSidebar *sidebar)
       if (_gtk_bookmarks_manager_get_is_builtin (sidebar->bookmarks_manager, root))
         continue;
 
-      if (sidebar->local_only && !is_native)
+      if (sidebar->local_only && !is_native && !is_local (root))
         continue;
 
       clos = g_slice_new (BookmarkQueryClosure);
@@ -1499,26 +1513,33 @@ update_places (GtkPlacesSidebar *sidebar)
               g_free (tooltip);
             }
         }
+    }
+
+  network_mounts = g_list_reverse (network_mounts);
+  for (l = network_mounts; l != NULL; l = l->next)
+    {
+      mount = l->data;
+      root = g_mount_get_default_location (mount);
 
-      network_mounts = g_list_reverse (network_mounts);
-      for (l = network_mounts; l != NULL; l = l->next)
+      if (sidebar->local_only && !is_local (root))
         {
-          mount = l->data;
-          root = g_mount_get_default_location (mount);
-          start_icon = g_mount_get_symbolic_icon (mount);
-          mount_uri = g_file_get_uri (root);
-          name = g_mount_get_name (mount);
-          tooltip = g_file_get_parse_name (root);
-          add_place (sidebar, PLACES_MOUNTED_VOLUME,
-                     SECTION_MOUNTS,
-                     name, start_icon, NULL, mount_uri,
-                     NULL, NULL, mount, NULL, 0, tooltip);
           g_object_unref (root);
-          g_object_unref (start_icon);
-          g_free (name);
-          g_free (mount_uri);
-          g_free (tooltip);
+          continue;
         }
+
+      start_icon = g_mount_get_symbolic_icon (mount);
+      mount_uri = g_file_get_uri (root);
+      name = g_mount_get_name (mount);
+      tooltip = g_file_get_parse_name (root);
+      add_place (sidebar, PLACES_MOUNTED_VOLUME,
+                 SECTION_MOUNTS,
+                 name, start_icon, NULL, mount_uri,
+                 NULL, NULL, mount, NULL, 0, tooltip);
+      g_object_unref (root);
+      g_object_unref (start_icon);
+      g_free (name);
+      g_free (mount_uri);
+      g_free (tooltip);
     }
 
   g_list_free_full (network_volumes, g_object_unref);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]