Use px size instead of w+h reqs for poster images
The old method worked only by accident on older GTK4 versions.
This commit is contained in:
parent
96ea810ace
commit
6df7530b33
3 changed files with 36 additions and 7 deletions
|
|
@ -7,6 +7,10 @@
|
|||
opacity : 0 ;
|
||||
}
|
||||
|
||||
.collatable-container flowboxchild {
|
||||
padding : 0 ;
|
||||
}
|
||||
|
||||
.open-collection-item-button {
|
||||
font-weight : normal ; /* No bold text by default for this kind of button */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ impl < A : MediaAdapter > CollatedMediaGrid <A> {
|
|||
let grid_widget = flow_box ! (
|
||||
@ orientation : Horizontal ;
|
||||
@ homogeneous : true ;
|
||||
@ css_classes : & [ "collatable-container" ] ;
|
||||
@ selection_mode : SelectionMode :: None ;
|
||||
) ;
|
||||
let media_widget_pairs = RefCell :: new ( Vec :: new () ) ;
|
||||
|
|
@ -60,6 +61,7 @@ impl < A : MediaAdapter > CollatedMediaGrid <A> {
|
|||
& g_box ! (
|
||||
@ option_children ;
|
||||
@ orientation : Vertical ;
|
||||
@ valign : Center ; // I.e. do not fill parent vertically
|
||||
@ margin_top : 20 ;
|
||||
@ margin_bottom : 20 ;
|
||||
|
||||
|
|
@ -80,10 +82,9 @@ impl < A : MediaAdapter > CollatedMediaGrid <A> {
|
|||
|
||||
match poster_texture {
|
||||
Ok (poster_texture) => Some ( image ! (
|
||||
@ paintable : & poster_texture ;
|
||||
@ width_request : 300 ;
|
||||
@ height_request : 300 ;
|
||||
@ margin_bottom : 10 ;
|
||||
@ pixel_size : 300 ;
|
||||
@ paintable : & poster_texture ;
|
||||
) ) ,
|
||||
Err (error) => {
|
||||
if error . matches ( IOErrorEnum :: NotFound ) {
|
||||
|
|
|
|||
|
|
@ -7,11 +7,19 @@ macro_rules ! bin { ( $ ( @ vexpand : $ vexpand : expr ; ) ? ) => { {
|
|||
} } }
|
||||
|
||||
macro_rules ! button { (
|
||||
$ ( @ halign : $ halign : expr ; ) ?
|
||||
$ ( @ valign : $ valign : expr ; ) ?
|
||||
$ ( @ hexpand : $ hexpand : expr ; ) ?
|
||||
$ ( @ vexpand : $ vexpand : expr ; ) ?
|
||||
$ ( @ css_classes : $ css_classes : expr ; ) ?
|
||||
$ ( @ connect_clicked : $ connect_clicked : expr ; ) ?
|
||||
$ ( $ child : expr ) ? $ (,) ?
|
||||
) => { {
|
||||
let button = gtk4 :: Button :: new () ;
|
||||
$ ( button . set_halign ( $ halign ) ; ) ?
|
||||
$ ( button . set_valign ( $ valign ) ; ) ?
|
||||
$ ( button . set_hexpand ( $ hexpand ) ; ) ?
|
||||
$ ( button . set_vexpand ( $ vexpand ) ; ) ?
|
||||
$ ( button . set_css_classes ( $ css_classes ) ; ) ?
|
||||
$ ( button . connect_clicked ( $ connect_clicked ) ; ) ?
|
||||
$ ( button . set_child ( Some ( $ child ) ) ; ) ?
|
||||
|
|
@ -31,11 +39,13 @@ macro_rules ! dialog { (
|
|||
macro_rules ! flow_box { (
|
||||
$ ( @ orientation : $ orientation : expr ; ) ?
|
||||
$ ( @ homogeneous : $ homogeneous : expr ; ) ?
|
||||
$ ( @ css_classes : $ css_classes : expr ; ) ?
|
||||
$ ( @ selection_mode : $ selection_mode : expr ; ) ?
|
||||
) => { {
|
||||
let widget = gtk4 :: FlowBox :: new () ;
|
||||
$ ( widget . set_orientation ( $ orientation ) ; ) ?
|
||||
$ ( widget . set_homogeneous ( $ homogeneous ) ; ) ?
|
||||
$ ( widget . set_css_classes ( $ css_classes ) ; ) ?
|
||||
$ ( widget . set_selection_mode ( $ selection_mode ) ; ) ?
|
||||
widget
|
||||
} } }
|
||||
|
|
@ -48,6 +58,8 @@ macro_rules ! g_box {
|
|||
$ ( @ spacing : $ spacing : expr ; ) ?
|
||||
$ ( @ margin_top : $ margin_top : expr ; ) ?
|
||||
$ ( @ margin_bottom : $ margin_bottom : expr ; ) ?
|
||||
$ ( @ hexpand : $ hexpand : expr ; ) ?
|
||||
$ ( @ vexpand : $ vexpand : expr ; ) ?
|
||||
$ ( @ widget_name : $ widget_name : expr ; ) ?
|
||||
$ ( @ css_classes : $ css_classes : expr ; ) ?
|
||||
$ ( $ child : expr ) , * $ (,) ?
|
||||
|
|
@ -59,6 +71,8 @@ macro_rules ! g_box {
|
|||
$ ( container . set_spacing ( $ spacing ) ; ) ?
|
||||
$ ( container . set_margin_top ( $ margin_top ) ; ) ?
|
||||
$ ( container . set_margin_bottom ( $ margin_bottom ) ; ) ?
|
||||
$ ( container . set_hexpand ( $ hexpand ) ; ) ?
|
||||
$ ( container . set_vexpand ( $ vexpand ) ; ) ?
|
||||
$ ( container . set_widget_name ( $ widget_name ) ; ) ?
|
||||
$ ( container . set_css_classes ( $ css_classes ) ; ) ?
|
||||
$ ( container . append ( $ child ) ; ) *
|
||||
|
|
@ -72,6 +86,8 @@ macro_rules ! g_box {
|
|||
$ ( @ spacing : $ spacing : expr ; ) ?
|
||||
$ ( @ margin_top : $ margin_top : expr ; ) ?
|
||||
$ ( @ margin_bottom : $ margin_bottom : expr ; ) ?
|
||||
$ ( @ hexpand : $ hexpand : expr ; ) ?
|
||||
$ ( @ vexpand : $ vexpand : expr ; ) ?
|
||||
$ ( @ widget_name : $ widget_name : expr ; ) ?
|
||||
$ ( @ css_classes : $ css_classes : expr ; ) ?
|
||||
$ ( $ child : expr ) , * $ (,) ?
|
||||
|
|
@ -83,6 +99,8 @@ macro_rules ! g_box {
|
|||
$ ( container . set_spacing ( $ spacing ) ; ) ?
|
||||
$ ( container . set_margin_top ( $ margin_top ) ; ) ?
|
||||
$ ( container . set_margin_bottom ( $ margin_bottom ) ; ) ?
|
||||
$ ( container . set_hexpand ( $ hexpand ) ; ) ?
|
||||
$ ( container . set_vexpand ( $ vexpand ) ; ) ?
|
||||
$ ( container . set_widget_name ( $ widget_name ) ; ) ?
|
||||
$ ( container . set_css_classes ( $ css_classes ) ; ) ?
|
||||
$ ( if let Some (child) = $ child { container . append (child) ; } ) *
|
||||
|
|
@ -97,20 +115,26 @@ macro_rules ! header_bar { ( $ title_widget : expr $ (,) ? ) => { {
|
|||
} } }
|
||||
|
||||
macro_rules ! image { (
|
||||
$ ( @ icon_name : $ icon_name : expr ; ) ?
|
||||
$ ( @ paintable : $ paintable : expr ; ) ?
|
||||
$ ( @ halign : $ halign : expr ; ) ?
|
||||
$ ( @ valign : $ valign : expr ; ) ?
|
||||
$ ( @ width_request : $ width_request : expr ; ) ?
|
||||
$ ( @ height_request : $ height_request : expr ; ) ?
|
||||
$ ( @ margin_top : $ margin_top : expr ; ) ?
|
||||
$ ( @ margin_bottom : $ margin_bottom : expr ; ) ?
|
||||
$ ( @ pixel_size : $ pixel_size : expr ; ) ?
|
||||
$ ( @ icon_name : $ icon_name : expr ; ) ?
|
||||
$ ( @ paintable : $ paintable : expr ; ) ?
|
||||
) => { {
|
||||
let image = gtk4 :: Image :: new () ;
|
||||
$ ( image . set_icon_name ( Some ( $ icon_name ) ) ; ) ?
|
||||
$ ( image . set_paintable ( Some ( $ paintable ) ) ; ) ?
|
||||
$ ( image . set_halign ( $ halign ) ; ) ?
|
||||
$ ( image . set_valign ( $ valign ) ; ) ?
|
||||
$ ( image . set_width_request ( $ width_request ) ; ) ?
|
||||
$ ( image . set_height_request ( $ height_request ) ; ) ?
|
||||
$ ( image . set_margin_top ( $ margin_top ) ; ) ?
|
||||
$ ( image . set_margin_bottom ( $ margin_bottom ) ; ) ?
|
||||
$ ( image . set_pixel_size ( $ pixel_size ) ; ) ?
|
||||
$ ( image . set_icon_name ( Some ( $ icon_name ) ) ; ) ?
|
||||
$ ( image . set_paintable ( Some ( $ paintable ) ) ; ) ?
|
||||
image
|
||||
} } }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue