GNOME Bugzilla – Bug 307044
Sidebar widget
Last modified: 2013-10-06 06:31:03 UTC
Totem, nautilus and evince (at least) are using a sidebar. It would be nice to have a GTK+ sidebar widget.
Do you have an API proposal?
I'll check what Nautilus and Evince are using, and propose something.
Created attachment 48278 [details] gtk-sidebar.h Here's a possible API for the sidebar widget. I think it would easily replace the current sidebars in Evince, nautilus (and the least needy of them, Totem).
The only API that doesn't really have a match in nautilus would be the nautilus_side_pane_set_panel_image() function. I'm not too sure what it's supposed to do (add an icon for the menu item?). Alex?
I seem to remember Galeon/Epiphany has some special needs, for the case when the sidebar content is provided by the mozilla backend. I dont remember the details, and I'm not sure if extending this widget would be enough... Though I'm sure chpe and crispin can provide input on this.
The only special need Galeon/Epiphany have is that the sidebar pages can be removed by the user (we show a little rubbish bin icon next to the sidebar close button). This emits a signal, allowing the application to remove the page. Only some of the pages are user-removable. For pages that aren't user-removable, the rubbish bin icon is insensitive. This could be optimised in to not be visible if none if the pages can be removed. The Galeon sidebar impl is in: http://cvs.gnome.org/viewcvs/galeon/utils/galeon-sidebar.h?view=markup
Just because I'm a lazy bastard to look it up myself, could you please attach a screenshot or mockup of how this is supposed to look, more or less? Also, you specify char *page_title. I assume that some things will want to have an icon as well. GtkNotebook lets you set a "label widget" rather than a string; that widget can of course be anything.
nautilus_side_pane_set_panel_image() is used to add an icon to the tab bar which works as a shortcut to the page. Its main use is to add a note icon when there is a note for the currently displayed location.
For both of Galeon and Nautilus, it looks like the APIs are only to get a button next to the close button. Updated header below. The API looks a bit too full to me. Do we want to identify the pages by their main widget, or using a page_id, or both?
Created attachment 48459 [details] gtk-sidebar.h Updated API with the possibility to add an arbitrary widget next to the close button which seems to fit both Galeon and Nautilus' requirements.
If the implementation is intended to have a dropdown list, the API should probably be closer to GtkEntryCompletion - to use GtkTreeModel and thus enable one to include icons in the dropdown.
I don't think we need to use that kind of API. I still need to change the API to use an arbitrary widget for the drop-down menu item, but we do not need the whole lot of features that using a GtkTreeModel would give us. The API should probably resemble that of GtkNotebook with a lot trimmed.
Created attachment 59083 [details] [review] gtk-sidebar-draft.patch
This is the first draft of the sidebar. The button isn't implemented at all, some functions aren't implemented either, and there's something funny about the append page in which it will get a different page shown than the one it should be. The API is closer to what we would need though. Comments from the other users of sidebars?
From a quick overlook of the API, I'm missing the ability to use stock identifiers and, more importantly, any icons. My use case is a panel with a text and an icon for each page. And why are you using page_id in the form of a string? Following in the foot steps of GtkNotebook with page numbers would seem intuitive to me, and that's what I did in code for a sidepanel that I implemented. A demo program would be nice..
There are more and more applications using a sidebar, so I would like to revive this bug. There's still one thing I don't like about the current implementations, the drop-down menu makes the sidebar options hard to discover. In evince, for instance, we use the sidebar for several document features (thumbnails, index, attachments, layers), since the sidebar shows only the active page, it's imposible to know what other features it contains, unless you explicitly look at the drop-down menu. See bug #510686 where I posted some attachments with possible solutions. What do you guys think? any other idea?
(In reply to comment #16) > There are more and more applications using a sidebar, so I would like to revive > this bug. Agreed. This is something that we talked about at the Usability Hackfest in London. > There's still one thing I don't like about the current > implementations, the drop-down menu makes the sidebar options hard to discover. I agree with this too - it's a big problem with the sidebar that is used in Nautilus. Anything that isn't Places rarely gets used (if ever).
Comment on attachment 59083 [details] [review] gtk-sidebar-draft.patch Patch uses API deprecated in 2.24 and removed in 3.x, e.g. GTK_WIDGET_NO_WINDOW => marking as "needs-work"