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 702296 - Add GtkListBox support
Add GtkListBox support
Status: RESOLVED FIXED
Product: glade
Classification: Applications
Component: bindings
git master
Other Linux
: Normal normal
: ---
Assigned To: Glade 3 Maintainers
Glade 3 Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-06-14 22:04 UTC by Mattias Bengtsson
Modified: 2013-08-07 22:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add GtkListBox support (13.60 KB, patch)
2013-07-01 21:42 UTC, Kalev Lember
committed Details | Review

Description Mattias Bengtsson 2013-06-14 22:04:34 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.
Comment 1 Kalev Lember 2013-07-01 21:42:42 UTC
Created attachment 248187 [details] [review]
Add GtkListBox support
Comment 2 Kalev Lember 2013-07-01 22:09:45 UTC
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 ?
Comment 3 Kalev Lember 2013-07-01 22:12:28 UTC
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?
Comment 4 Tristan Van Berkom 2013-07-02 07:18:07 UTC
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.
Comment 5 Tristan Van Berkom 2013-07-10 14:20:18 UTC
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 6 Tristan Van Berkom 2013-08-07 14:13:25 UTC
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.
Comment 7 Mattias Bengtsson 2013-08-07 22:44:20 UTC
Awesome!