GNOME Bugzilla – Bug 702296
Add GtkListBox support
Last modified: 2013-08-07 22:44:20 UTC
GtkListBox was recently merged in gtk master (https://bugzilla.gnome.org/show_bug.cgi?id=702164). Would be nice to be able to access it from Glade.
Created attachment 248187 [details] [review] Add GtkListBox support
There's some further work needed, but it should be a good start. I've tested it with some gnome-control-center .ui files from bug #702164 and it works nicely for editing existing GtkListBox widgets. I've added two new widgets to the catalog, but only exposing GtkListBox in the Containers group -- this is deliberately so because GtkListBoxRow gets automatically added when inserting new rows and users don't have to deal with it manually. I'm using an internal "position" packing property to keep track of the row positions and sort them properly. The "position" property is also exposed in the user interface to make it easy to reorder rows (the +- buttons make it nice). The right click menu has "Insert After" and "Insert Before" (and stock "Delete") to add/remove new rows. Further work ------------ I am looking into adding a "size" property to make it easier to populate new GtkListBox items with empty rows. It could use icons; Mattias any chance you can convince someone to draw icons for both GtkListBox and GtkListBoxRow ?
Review of attachment 248187 [details] [review]: ::: plugins/gtk+/gtk+.xml.in @@ +4516,3 @@ <glade-widget-class-ref name="GtkFrame"/> <glade-widget-class-ref name="GtkAspectFrame"/> + <glade-widget-class-ref name="GtkListBox"/> What's the order supposed to be here? I've currently added it in the middle of existing containers, should it go to the end of the list instead?
This looks like a good start Kalev ! I'm pretty busy right now, I'll just want to try the patch before giving it an OK, but looks about right from a quick viewing. About the order of GtkListBox in the palette, there is no real standard, we try to group things together in such a way that things are hopefully easy to find for the user (notice that all GtkButton types are listed together, for instance, and GtkLabel is beside GtkAccelLabel). And yes it would be great to add a 'size' property, but I notice that in this case it will be more difficult to manage because of the enforced GtkListBoxRow intermediate child. So incrementing the size will cause new GtkListBoxRow widgets to be added with placeholder children, instead of just placeholder children (placeholders are not considered project data, but adding widgets needs to be recorded by the undo/redo framework). However, an interesting way to proceed, would be to have the size property but not display it in the normal property editor, just display it once when creating the GtkListBox (this is done by the 'query="True"' attribute in the catalog, much like the GtkBox size etc). This way, the user can only modify the size at widget creation time, which is safe (because then the GtkListBox is technically *added* to the project once with a given number of predefined children, this action is safely undoable/redoable). It is possible however to group widget additions / removals in response to "size" property changes, but less important I think (and a bit complicated to do, one needs to listen to the pre-commit / post-commit signals of the actual property editor in order to group size property change commands along with widget creation / deletion commands). Anyway, I think 'size' would be a good thing for the popup when creating the listbox, and the actions for "Insert Before" / "Insert After" are good enough after the listbox is initially created.
Review of attachment 248187 [details] [review]: Hi Kalev. Good start, I was under the impression you could add rows with the context menu but it seems not to be the case (the actions you added are <packing-actions> which make sense to insert before/after an existing row). I don't have any argument against the existing packing actions (context menus), I think they are right, but before merging this we need to at least have a way to add rows to the listbox.
Comment on attachment 248187 [details] [review] Add GtkListBox support We worked this out at GUADEC together. Kalev's patch adds the initial support and we added some code to allow adding of rows.
Awesome!