After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 753871 - Other locations for nautilus
Other locations for nautilus
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-08-20 11:58 UTC by Carlos Soriano
Modified: 2015-08-20 20:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
view: add interface (74.16 KB, patch)
2015-08-20 11:58 UTC, Carlos Soriano
none Details | Review
places-view: implement a view for Other Locations (153.15 KB, patch)
2015-08-20 11:58 UTC, Carlos Soriano
none Details | Review
connect-server: remove legacy code (35.41 KB, patch)
2015-08-20 11:58 UTC, Carlos Soriano
none Details | Review
application: don't block UI if not necesary (1.31 KB, patch)
2015-08-20 20:21 UTC, Carlos Soriano
accepted-commit_now Details | Review
view: add interface (87.41 KB, patch)
2015-08-20 20:21 UTC, Carlos Soriano
accepted-commit_now Details | Review
places-view: implement a view for Other Locations (150.23 KB, patch)
2015-08-20 20:21 UTC, Carlos Soriano
accepted-commit_now Details | Review
connect-server: remove legacy code (35.36 KB, patch)
2015-08-20 20:22 UTC, Carlos Soriano
accepted-commit_now Details | Review
window-slot: use g_error_matches (1002 bytes, patch)
2015-08-20 20:22 UTC, Carlos Soriano
accepted-commit_now Details | Review

Description Carlos Soriano 2015-08-20 11:58:22 UTC
Posting patches so I can use Splinter to review
Comment 1 Carlos Soriano 2015-08-20 11:58:28 UTC
Created attachment 309707 [details] [review]
view: add interface

Nautilus is in the proccess of receiving a places view,
based on GtkFileChooser's one.

To be able to handle that, an abstraction layer is needed
between NautilusFilesView and NautilusWindowSlot, so we factor
out the common data between views.

Add the NautilusView interface, and make NautilusFilesView a
NautilusView implementation. Because of the new way we handle
search on the view side, the search logic is rewritten to match
the new expected behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=753777
Comment 2 Carlos Soriano 2015-08-20 11:58:34 UTC
Created attachment 309708 [details] [review]
places-view: implement a view for Other Locations

GtkFileChooser received a Other Locations view that lists
persistent devices, as well as networks and the root location
for the computer's hard drive.

Since Nautilus is a file management tool too, it should keep
consistency between Gtk+ file chooser, something that doesn't
happen since it doesn't display Other Locations.

To fix that, add NautilusPlacesView, a NautilusView implementation
that displays the GtkPlacesView widget. In order to implement that,
update window-slot to correctly display the places-view whenever
Other Locations is clicked.

https://bugzilla.gnome.org/show_bug.cgi?id=753777
Comment 3 Carlos Soriano 2015-08-20 11:58:40 UTC
Created attachment 309709 [details] [review]
connect-server: remove legacy code

nautilus-connect-server is a legacy application from
GNOME 2 era, where we had no consistent way to manage
servers.

With the introduction of NautilusPlacesView, this code
becomes obsolete, as the network management logic is
moved to the places view.

Remove the legacy code.

https://bugzilla.gnome.org/show_bug.cgi?id=753778
Comment 4 Carlos Soriano 2015-08-20 14:24:31 UTC
Review of attachment 309708 [details] [review]:

So two little changes here and I think it will look fine!

::: libnautilus-private/nautilus-file-utilities.c
@@ +271,3 @@
+
+                if (nautilus_file_is_in_other_locations (file)) {
+                        title = g_strdup (_("Other Locations"));

For now this works because you will onyl call this with the actual other locations file.
So either you take into account childrens here (which is not necesary right now) or make clear that what you want to say is: nautilus_file_is_other_locations, so in any case that in the future we add children, at least the code wont confuse the developer that is doing it

::: src/nautilus-application.c
@@ -390,1 @@
-	if (g_file_query_file_type (location, G_FILE_QUERY_INFO_NONE, NULL) != G_FILE_TYPE_DIRECTORY) {

Can't believe we were doing blocking I/O like this.... thanks for the change. this even deserves its own commit =)

::: src/nautilus-places-view.c
@@ +189,3 @@
+static void
+nautilus_places_view_set_location (NautilusView *view,
+                                   GFile        *location)

I think this has to be windows slot enough smart to know it should call the other locations view with a random location. As we said, windows slot is the controller for the views, and the views expects correct locations for them, so the communication is one way, not two ways (what we want is get rid of these ugly two ways communication we had until now, which makes everything confusing and difficult to follow, and is a can of worms for async operations)

@@ +210,3 @@
+                        if (slot) {
+                                nautilus_window_slot_open_location (NAUTILUS_WINDOW_SLOT (slot), location, 0);
+                        }

And if not what? silently fail? I think a warning if this happens, but it shouldn't...

::: src/nautilus-window-slot.c
@@ +219,3 @@
+
+        return g_object_ref (view);
+                                        slot->details->view_mode_before_search = g_strdup (nautilus_files_view_get_view_id (NAUTILUS_FILES_VIEW (slot->details->content_view)));

Seems you are actually doing the right thing here, use this function along the code to get the correct view instead of letting the views to call window slot some times.

@@ +1199,1 @@
+        if (!error || (error && error->domain == G_IO_ERROR && error->code == G_IO_ERROR_NOT_SUPPORTED)) {

g_error_matches

@@ +1326,3 @@
+                selection = NULL;
+
+                if (NAUTILUS_IS_FILES_VIEW (slot->details->content_view)) {

Probably we want this transparent as well... in the iface, since we could want this for other views.
For example, we could want to show the network or a partition selected from a different app. This is done tru dbus with a standrad call to FileManager1.ShowItems. So selection is actually necesary.
Currently gtkplacesview doesnt support it, but probably we will need to do it. So if it is not too much effort (I guess even less than doing the if/elses here) can you add it and do nothing for now for gtkplacesview implementation?

@@ +1394,1 @@
+                g_list_free_full (selection_copy, g_object_unref);

why is a copy needed? if it is needed, why does not set_selection does one?

@@ +1581,3 @@
+                selection = nautilus_files_view_get_selection (NAUTILUS_FILES_VIEW (slot->details->content_view));
+
+                if (g_list_length (selection) == 0) {

In this case is fine special casing, since by design we dont want to select the first item in other-places, but you could special casing here, not when getting the selection.
Comment 5 Carlos Soriano 2015-08-20 20:21:41 UTC
Created attachment 309765 [details] [review]
application: don't block UI if not necesary

we were asking for the file type blocking the UI. Use
nautilus file instead which catch the values.
Comment 6 Carlos Soriano 2015-08-20 20:21:47 UTC
Created attachment 309766 [details] [review]
view: add interface

Nautilus is in the proccess of receiving a places view,
based on GtkFileChooser's one.

To be able to handle that, an abstraction layer is needed
between NautilusFilesView and NautilusWindowSlot, so we factor
out the common data between views.

Add the NautilusView interface, and make NautilusFilesView a
NautilusView implementation. Because of the new way we handle
search on the view side, the search logic is rewritten to match
the new expected behavior.
Comment 7 Carlos Soriano 2015-08-20 20:21:57 UTC
Created attachment 309767 [details] [review]
places-view: implement a view for Other Locations

GtkFileChooser received a Other Locations view that lists
persistent devices, as well as networks and the root location
for the computer's hard drive.

Since Nautilus is a file management tool too, it should keep
consistency between Gtk+ file chooser, something that doesn't
happen since it doesn't display Other Locations.

To fix that, add NautilusPlacesView, a NautilusView implementation
that displays the GtkPlacesView widget. In order to implement that,
update window-slot to correctly display the places-view whenever
Other Locations is clicked.
Comment 8 Carlos Soriano 2015-08-20 20:22:03 UTC
Created attachment 309768 [details] [review]
connect-server: remove legacy code

nautilus-connect-server is a legacy application from
GNOME 2 era, where we had no consistent way to manage
servers.

With the introduction of NautilusPlacesView, this code
becomes obsolete, as the network management logic is
moved to the places view.

Remove the legacy code.
Comment 9 Carlos Soriano 2015-08-20 20:22:13 UTC
Created attachment 309769 [details] [review]
window-slot: use g_error_matches

And add a comment to track this...
Comment 10 Carlos Soriano 2015-08-20 20:22:45 UTC
Review of attachment 309765 [details] [review]:

avanti...
Comment 11 Carlos Soriano 2015-08-20 20:23:05 UTC
Review of attachment 309766 [details] [review]:

a toda...
Comment 12 Carlos Soriano 2015-08-20 20:23:20 UTC
Review of attachment 309767 [details] [review]:

vela!!
Comment 13 Carlos Soriano 2015-08-20 20:23:33 UTC
Review of attachment 309768 [details] [review]:

good
Comment 14 Carlos Soriano 2015-08-20 20:23:48 UTC
Review of attachment 309769 [details] [review]:

job!!! :)
Comment 15 Carlos Soriano 2015-08-20 20:24:37 UTC
and congratulations!
Comment 16 Georges Basile Stavracas Neto 2015-08-20 20:53:42 UTC
It's finally over. Thanks.