From e48a286477d5b8d1d0f9188262e8252d5f77380b Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Tue, 17 Apr 2012 12:21:44 +0100 Subject: Work around for some missing glibmm headers in gtkmm (should be fixed in gtkmm 3.4) (bzr r11261) --- src/ui/previewholder.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'src/ui/previewholder.cpp') diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index d8f1a21a9..ec5d2dc77 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -207,7 +207,12 @@ void PreviewHolder::on_size_allocate( Gtk::Allocation& allocation ) Gtk::VBox::on_size_allocate( allocation ); if ( _insides && !_wrap && (_view != VIEW_TYPE_LIST) && (_anchor == SP_ANCHOR_NORTH || _anchor == SP_ANCHOR_SOUTH) ) { - Gtk::Requisition req = _insides->size_request(); + Gtk::Requisition req; +#if WITH_GTKMM_3_0 + _insides->get_preferred_size(&req, NULL); +#else + req = _insides->size_request(); +#endif gint delta = allocation.get_width() - req.width; if ( (delta > 4) && req.height < allocation.get_height() ) { @@ -233,7 +238,12 @@ void PreviewHolder::calcGridSize( const Gtk::Widget* thing, int itemCount, int& height = 1; if ( _anchor == SP_ANCHOR_SOUTH || _anchor == SP_ANCHOR_NORTH ) { - Gtk::Requisition req = _scroller->size_request(); + Gtk::Requisition req; +#if WITH_GTKMM_3_0 + _scroller->get_preferred_size(&req, NULL); +#else + req = _scroller->size_request(); +#endif int currW = _scroller->get_width(); if ( currW > req.width ) { req.width = currW; @@ -241,13 +251,23 @@ void PreviewHolder::calcGridSize( const Gtk::Widget* thing, int itemCount, int& Gtk::HScrollbar* hs = dynamic_cast(_scroller)->get_hscrollbar(); if ( hs ) { - Gtk::Requisition scrollReq = hs->size_request(); + Gtk::Requisition scrollReq; +#if WITH_GTKMM_3_0 + hs->get_preferred_size(&req, NULL); +#else + req = hs->size_request(); +#endif // the +8 is a temporary hack req.height -= scrollReq.height + 8; } - Gtk::Requisition req2 = const_cast(thing)->size_request(); + Gtk::Requisition req2; +#if WITH_GTKMM_3_0 + const_cast(thing)->get_preferred_size(&req, NULL); +#else + req = const_cast(thing)->size_request(); +#endif int h2 = ((req2.height > 0) && (req.height > req2.height)) ? (req.height / req2.height) : 1; int w2 = ((req2.width > 0) && (req.width > req2.width)) ? (req.width / req2.width) : 1; -- cgit v1.2.3 From 8485b6566d7db0e1e4cef31367f60d5965ecfc0d Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sat, 21 Apr 2012 14:13:40 +0100 Subject: Fix typo in previewholder Fixed bugs: - https://launchpad.net/bugs/986507 (bzr r11274) --- src/ui/previewholder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/previewholder.cpp') diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index ec5d2dc77..cce7da103 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -264,9 +264,9 @@ void PreviewHolder::calcGridSize( const Gtk::Widget* thing, int itemCount, int& Gtk::Requisition req2; #if WITH_GTKMM_3_0 - const_cast(thing)->get_preferred_size(&req, NULL); + const_cast(thing)->get_preferred_size(&req2, NULL); #else - req = const_cast(thing)->size_request(); + req2 = const_cast(thing)->size_request(); #endif int h2 = ((req2.height > 0) && (req.height > req2.height)) ? (req.height / req2.height) : 1; -- cgit v1.2.3