diff options
author | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2020-01-14 17:50:25 +0200 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2020-01-14 17:50:25 +0200 |
commit | 6d8199bdc29e6265122624c4eba75eecd0edb8cc (patch) | |
tree | a47ae2dd0baa0ae700443aa07ed6288a303a02e8 | |
parent | a7d72cf69b2a641dc71b944a2e51a5654e33a60d (diff) | |
download | gtk+-wip/muktupavels/issue-1962-master.tar.gz |
placessidebar: present FUSE-reachable network shareswip/muktupavels/issue-1962-master
Followup for https://gitlab.gnome.org/GNOME/gtk/commit/279b81d20211
https://gitlab.gnome.org/GNOME/gtk/issues/1962
-rw-r--r-- | gtk/gtkplacessidebar.c | 59 |
1 files changed, 40 insertions, 19 deletions
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c index 82c6ddad83..d4879bdaa3 100644 --- a/gtk/gtkplacessidebar.c +++ b/gtk/gtkplacessidebar.c @@ -902,6 +902,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) { @@ -1411,7 +1425,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); @@ -1469,28 +1483,35 @@ update_places (GtkPlacesSidebar *sidebar) g_free (tooltip); } } + } - network_mounts = g_list_reverse (network_mounts); - for (l = network_mounts; l != NULL; l = l->next) - { - char *mount_uri; + network_mounts = g_list_reverse (network_mounts); + for (l = network_mounts; l != NULL; l = l->next) + { + char *mount_uri; - 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); + mount = l->data; + root = g_mount_get_default_location (mount); + + if (sidebar->local_only && !is_local (root)) + { 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); |