placesview: Always open default location after mounting
authorOndrej Holy <oholy@redhat.com>
Thu, 19 Dec 2019 15:49:07 +0000 (16:49 +0100)
committerOndrej Holy <oholy@redhat.com>
Thu, 19 Dec 2019 16:28:35 +0000 (17:28 +0100)
The default location (obtained over g_mount_get_default_location) is
opened after mounting volume, or when opening mounts from sidebar, but
not after mounting over "Connect to Server". Let's unify the behavior
and always open the default location.

https://gitlab.gnome.org/GNOME/nautilus/issues/1319

gtk/gtkplacesview.c

index 3a0ae97ec0493d905d46ad62e2f69b13969f3834..235c5bd816679be288c6fe2d8250f85e1f238986 100644 (file)
@@ -1243,7 +1243,21 @@ server_mount_ready_cb (GObject      *source_file,
       gtk_editable_set_text (GTK_EDITABLE (priv->address_entry), "");
 
       if (priv->should_open_location)
-        emit_open_location (view, location, priv->open_flags);
+        {
+          GMount *mount;
+          GFile *root;
+
+          mount = g_file_find_enclosing_mount (location, priv->cancellable, NULL);
+          if (mount)
+            {
+              root = g_mount_get_default_location (mount);
+
+              emit_open_location (view, root, priv->open_flags);
+
+              g_object_unref (root);
+              g_object_unref (mount);
+            }
+        }
     }
 
   update_places (view);