On Mon, 2008-07-28 at 15:35 +0200, Tian wrote:
Hello, As I already answered (by mistake) only to Muppet, I'll open a bug to Gtk+. I just first need to create the C version. But in the meantime, I'd really appreciate a workaround.I worked around it by using a simple DrawingArea instead of a ScrolledWindow. You just need to add the scrollbars yourself, and then draw on the DrawingArea according to the position of the scrollbars.That ones seems to be a little complicated. And I will need 2 scrollbars.I had to subclass a VBox so that it could be added directly to a ScrolledWindow (and not via a Viewport) : package ViewVBox; use Glib::Object::Subclass Gtk2::VBox::, signals => { set_scroll_adjustments => { class_closure => sub {}, flags => [qw(run-last action)], return_type => undef, param_types => [Gtk2::Adjustment::,Gtk2::Adjustment::], }, },This solution seems to be a really interesting one. But unfortunately, I didn't manage to make it works with the simple example I sent. I even had a look to gmusicbrowser source code to check if I missed something. Could you please try to change the sample program I sent to include this workaround and make it working as expected. Thanks in advance.
Well the 2 solutions are the same, it's just that you need a small additional trick to be able to use the ScrolledWindow without a ViewPort, but you can probably just use a Table and 2 scrollbars anyway. Actually, I didn't looked at your code before for my first reply, I thought you were drawing everything yourself instead of using packed GtkImages, so my solution is more different from your code than I thought. My solution is a bit more involved, so I don't know if it will interest you, but it scales much better. Packing lots of GtkImages seems like a waste. Also it gives you much more control. Instead of changing your sample program, I've made a small example based on a sightly modified Mosaic class I use in my program. The attached example display thumbnails of pictures in the current folder or folder passed as first parameter. Use in in a folder with lots of pictures. Pictures are only loaded as needed, with a simple cache system that keeps the last ~100 pixbufs. You can select multiple pictures with shift and control. You can have callbacks for selected, activated and menu (right-click). It would be cleaner to create signals rather than passing the callbacks to new(). I've commented out the code that creates tooltips. I think you should be able to use this in your program, simply by changing the way pixbufs are made and a few other small changes. Ask me if you are having trouble using it. Quentin
Attachment:
standalone_mosaic.pl
Description: Perl program