Sharing the places sidebar between Nautilus and GTK+



Hi, everyone,

There is a patch in [1], by Jon McCann, to make the shortcuts bar in
GtkFileChooser be pretty much the same as the one in Nautilus.

Rather than patch the wobbly edifice that is gtkfilechooserdefault.c,
this sounds like the perfect time to actually pull out the shortcuts bar
as a public class of its own, that is shared by both the file chooser
and Nautilus.

My plan is this:

1. Copy nautilus-places-sidebar.[ch] into the GTK+ sources.

2. s/nautilus/gtk

3. Remove obvious nautilus-isms like the use of nautilus_bookmark, which
should be easy enough to replicate in GTK+ (or with things which already
happen through the file chooser's code).

4. See what common, public interfaces we need.  For example,

  nautilus_window_set_initiated_unmount (sidebar->window, TRUE);

seems like it could be replaced with a signal on the GtkPlacesSidebar
class, and then Nautilus can start a spinner or whatever when an unmount
operation starts.  Another common interface would be something like
gtk_places_sidebar_select_path (sidebar, "file:///foo/selected") to
highlight a particular item.

5. See what nautilus-isms *should* be doable with plain GIO, and see if
there is anything else that Nautilus needs to do about them via signals;
maybe for something like

  nautilus_file_operations_mount_volume_full (NULL, volume,
                                              volume_mounted_cb,
                                              G_OBJECT (sidebar));

6. See what things should be available or not in the file chooser...
when dropping files on the shortcuts bar, Nautilus can do

  nautilus_file_operations_copy_move (uris, NULL, drop_uri,
                                      real_action, GTK_WIDGET (tree_view),
                                      NULL, NULL);


Same thing for

  nautilus_file_operations_empty_trash (GTK_WIDGET (sidebar->window));

I'm starting a branch in GTK+, "places-sidebar" to do this.  Comments
are appreciated, especially from Nautilus hackers who may know dark
places in this code well.

One little caveat: that part of Nautilus is GPL, and GTK+ is LGPL,
although it *seems* that the places sidebar code may initially have come
from GTK+ and then reworked heavily.  I haven't checked the history
closely.  What do we do about this?

[1] https://bugzilla.gnome.org/show_bug.cgi?id=642712#c4

  Federico



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]