diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c index 037fed9..e63d071 100644 --- a/gtk/gtkplacessidebar.c +++ b/gtk/gtkplacessidebar.c @@ -876,6 +876,31 @@ update_trash_icon (GtkPlacesSidebar *sidebar) } } +static gboolean +is_mount_locally_accessible (GMount *mount) +{ + GFile *base_file; + + if (mount == NULL) + return FALSE; + + base_file = g_mount_get_root (mount); + + if (base_file != NULL) + { + char *path = g_file_get_path (base_file); + g_object_unref (base_file); + + if (path != NULL) + { + g_free(path); + return TRUE; + } + } + + return FALSE; +} + static void update_places (GtkPlacesSidebar *sidebar) { @@ -884,6 +909,7 @@ update_places (GtkPlacesSidebar *sidebar) GList *drives; GDrive *drive; GList *volumes; + gboolean locally_accessible_network_volumes = FALSE; GVolume *volume; GSList *bookmarks, *sl; gint index; @@ -1263,7 +1289,28 @@ update_places (GtkPlacesSidebar *sidebar) g_object_unref (new_bookmark_icon); /* network */ - if (!sidebar->local_only) + + /* network */ + + /* See if some network mounts are locally accessible (FUSE) */ + if (sidebar->local_only) + { + for (l = network_mounts; l != NULL; l = l->next) + { + mount = l->data; + + if (is_mount_locally_accessible(mount)) + { + locally_accessible_network_volumes = TRUE; + break; + } + } + } + + /* Only show network section if !local_only or some mounts are + * locally accessible + */ + if (!sidebar->local_only || locally_accessible_network_volumes) { network_volumes = g_list_reverse (network_volumes); for (l = network_volumes; l != NULL; l = l->next) @@ -1298,6 +1345,10 @@ update_places (GtkPlacesSidebar *sidebar) char *mount_uri; mount = l->data; + + if (sidebar->local_only && !is_mount_locally_accessible(mount)) + continue; + root = g_mount_get_default_location (mount); icon = g_mount_get_symbolic_icon (mount); mount_uri = g_file_get_uri (root);