[nautilus/wip/corey/public-share: 26/26] window-slot: Show the sharing infobar when for g-u-s fallback
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/corey/public-share: 26/26] window-slot: Show the sharing infobar when for g-u-s fallback
- Date: Thu, 1 Sep 2022 22:37:48 +0000 (UTC)
commit 1e06525a8d529fc9a29169ca087806bb2e58571f
Author: Corey Berla <corey berla me>
Date: Thu Sep 1 15:18:43 2022 -0700
window-slot: Show the sharing infobar when for g-u-s fallback
Normally we show the Sharing info bar when we are in the
XDG_PUBLICSHARE_DIR (i.e. G_USER_DIRECTORY_PUBLIC_SHARE).
gnome-user-share has a fallback to ~/Public when the PUBLIC_SHARE
folder is set to the user's home directory. Match the behavior
that g-u-s uses.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2459
src/nautilus-window-slot.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 64ab6293d..8cf94d705 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -2664,6 +2664,26 @@ view_is_loading_changed_cb (GObject *object,
nautilus_profile_end (NULL);
}
+static gboolean
+nautilus_file_is_public_share_folder (NautilusFile *file)
+{
+ if (nautilus_file_is_user_special_directory (file, G_USER_DIRECTORY_PUBLIC_SHARE))
+ {
+ return TRUE;
+ }
+ if (g_strcmp0 (g_get_home_dir (), g_get_user_special_dir (G_USER_DIRECTORY_PUBLIC_SHARE)))
+ {
+ /* In order to match the behavior of gnome-user-share the ~/Public folder
+ * is considered to be the public sharing folder when XDG_PUBLICSHARE_DIR
+ * is set to the home folder. */
+ g_autoptr (GFile) public_folder = g_file_new_build_filename (g_get_home_dir (), "Public", NULL);
+ g_autoptr (GFile) location = nautilus_file_get_location (file);
+
+ return g_file_equal (public_folder, location);
+ }
+ return FALSE;
+}
+
static void
nautilus_window_slot_setup_extra_location_widgets (NautilusWindowSlot *self)
{
@@ -2698,8 +2718,7 @@ nautilus_window_slot_setup_extra_location_widgets (NautilusWindowSlot *self)
{
nautilus_window_slot_show_special_location_bar (self, NAUTILUS_SPECIAL_LOCATION_SCRIPTS);
}
- else if (check_schema_available (FILE_SHARING_SCHEMA_ID) &&
- nautilus_file_is_user_special_directory (file, G_USER_DIRECTORY_PUBLIC_SHARE))
+ else if (check_schema_available (FILE_SHARING_SCHEMA_ID) && nautilus_file_is_public_share_folder (file))
{
nautilus_window_slot_show_special_location_bar (self, NAUTILUS_SPECIAL_LOCATION_SHARING);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]