summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2020-01-14 17:39:15 +0200
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2020-01-14 17:39:15 +0200
commit5419c175b8609869b5e8b7d2d26ad854cbeb5598 (patch)
treefebbdbfef8240f5393568d28d2d35c688ea9c609
parent0bffcd8882c6ca52f41b1499bd98ebec38d757fe (diff)
downloadgtk+-wip/muktupavels/issue-1962.tar.gz
placessidebar: present FUSE-reachable network shareswip/muktupavels/issue-1962
Followup for https://gitlab.gnome.org/GNOME/gtk/commit/279b81d20211 https://gitlab.gnome.org/GNOME/gtk/issues/1962
-rw-r--r--gtk/gtkplacessidebar.c55
1 files 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);