On Mon, Jun 24, 2013 at 05:23:25PM +0530, Shivani Poddar wrote: > Hi! > I am working on the bug ->https://bugzilla.gnome.org/show_bug.cgi?id=699832 > I want to pre-compute the size of the scrollbar to indicate the total items > in the collection (which are more than the ones we load in the application > at one instance ) > Need some ideas as to how do I tackle it.
Hello Shivani, I believe a way would be to ask for the size_request of a widget to be laid out in the underlying grid, and for the total containing grid's width. At least for the grid, this should be done while drawing, so that it is realised and you know the real size (which is needed also on resizing). You can then easily determine how many widgets per row you would end up in total, and thus how many total rows you have. Multiply by a child's height, and you have the total viewport height. I believe you can then force the height of the viewport view's window to your computed size, or just add invisible Gtk.Spinners of the same size of the other childrens (which is nice for async loads in the future, see below). This works under the (fair?) assumption that all children are of the same size. For Music, it should hold. You would have to be a bit careful to do the math by using the right padding, asking the grid about the internal spacing of children and the likes. In the long run, you might want to create a separate widget for this, as it would be useful also for other applications. libgd could be a good staging ground to commit it into. It should probably be written in Vala/JavaScript at this stage. That way, you could load results asynchronously by emitting widget signals. Providers of items can then just subscribe to some "do-load (range_start, range_end)" signal and be happy: when the scrollbar enters a range not yet loaded of items, observers are notified to provide them. Cheers, Matteo > > Thankyou, > Shivani Poddar _______________________________________________ desktop-devel-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/desktop-devel-list
