Fix collection item title Pango syntax
This commit is contained in:
parent
bdce351f0c
commit
ed18e738eb
2 changed files with 20 additions and 5 deletions
|
@ -1,9 +1,9 @@
|
||||||
use {
|
use {
|
||||||
gtk4 :: {
|
gtk4 :: {
|
||||||
* ,
|
* ,
|
||||||
Align :: * ,
|
Align :: * , Orientation :: * ,
|
||||||
Orientation :: * ,
|
gdk :: * ,
|
||||||
gdk :: Texture ,
|
pango :: { * , Weight :: * } ,
|
||||||
prelude :: * ,
|
prelude :: * ,
|
||||||
} ,
|
} ,
|
||||||
std :: { cell :: * , iter :: * , path :: Path } ,
|
std :: { cell :: * , iter :: * , path :: Path } ,
|
||||||
|
@ -177,8 +177,8 @@ fn create_collection_item (
|
||||||
|
|
||||||
container . append (
|
container . append (
|
||||||
& Label :: builder ()
|
& Label :: builder ()
|
||||||
. label ( format ! ( "<span size='large' weight='bold'>{}</span>" , name ) )
|
. label (name)
|
||||||
. use_markup (true)
|
. attributes ( & pango_attributes ! ( @ scale : SCALE_LARGE , @ weight : Bold , ) )
|
||||||
. justify ( Justification :: Center )
|
. justify ( Justification :: Center )
|
||||||
. wrap (true)
|
. wrap (true)
|
||||||
. max_width_chars (1) // Not the actual limit, used instead to wrap more aggressively
|
. max_width_chars (1) // Not the actual limit, used instead to wrap more aggressively
|
||||||
|
|
|
@ -145,6 +145,20 @@ macro_rules ! vertically_filling { ( $ child : expr ) => {
|
||||||
)
|
)
|
||||||
} }
|
} }
|
||||||
|
|
||||||
|
macro_rules ! pango_attributes { (
|
||||||
|
$ ( @ scale : $ scale : expr , ) ?
|
||||||
|
$ ( @ weight : $ weight : expr , ) ?
|
||||||
|
) => { {
|
||||||
|
let attributes = gtk4 :: pango :: AttrList :: new () ;
|
||||||
|
# [ allow (unused_mut) ] let mut font_description = gtk4 :: pango :: FontDescription :: new () ;
|
||||||
|
|
||||||
|
$ ( attributes . insert ( gtk4 :: pango :: AttrFloat :: new_scale ( $ scale ) ) ; ) ?
|
||||||
|
$ ( font_description . set_weight ( $ weight ) ; ) ?
|
||||||
|
|
||||||
|
attributes . insert ( gtk4 :: pango :: AttrFontDesc :: new ( & font_description ) ) ;
|
||||||
|
attributes
|
||||||
|
} } }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pub (crate) use {
|
pub (crate) use {
|
||||||
|
@ -162,4 +176,5 @@ pub (crate) use {
|
||||||
bin ,
|
bin ,
|
||||||
application_window ,
|
application_window ,
|
||||||
vertically_filling ,
|
vertically_filling ,
|
||||||
|
pango_attributes ,
|
||||||
} ;
|
} ;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue