Re: Sharing the places sidebar between Nautilus and GTK+

On Tue, 2011-09-06 at 17:44 -0500, Federico Mena Quintero wrote:
> 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).

NautilusBookmarks is a horrible API that should be taken out in the
backyard and be put down quitely.

> 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.

Sounds cool

> 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));

I did a sweep through it and it seems that the sidebar isn't doing much
actual I/O and thus does not really touch the nautilus async I/O
machinery. That means it should be quite doable to untangle it from
nautilus like this. I might have missed something though.

> 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));

These are availible via dbus on org.gnome.Nautilus.FileOperations, so
could potentially be used from Gtk+ too. That sort of places a
dependency on nautilus from Gtk+ though, and it will only work under

> 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?

Hmm, cosimo would know this best.

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