@@ -30,9 +30,12 @@ use std::time::Duration;
3030pub const WINDOW_WIDTH : f32 = 500. ;
3131pub const DEFAULT_WINDOW_HEIGHT : f32 = 65. ;
3232
33+ pub const RUSTCAST_DESC_NAME : & str = "RustCast" ;
34+
3335#[ derive( Debug , Clone ) ]
3436pub struct App {
3537 pub open_command : Function ,
38+ pub desc : String ,
3639 pub icons : Option < iced:: widget:: image:: Handle > ,
3740 pub name : String ,
3841 pub name_lc : String ,
@@ -43,12 +46,14 @@ impl App {
4346 vec ! [
4447 App {
4548 open_command: Function :: Quit ,
49+ desc: RUSTCAST_DESC_NAME . to_string( ) ,
4650 icons: None ,
4751 name: "Quit RustCast" . to_string( ) ,
4852 name_lc: "quit" . to_string( ) ,
4953 } ,
5054 App {
5155 open_command: Function :: OpenPrefPane ,
56+ desc: RUSTCAST_DESC_NAME . to_string( ) ,
5257 icons: None ,
5358 name: "Open RustCast Preferences" . to_string( ) ,
5459 name_lc: "settings" . to_string( ) ,
@@ -72,26 +77,32 @@ impl App {
7277 }
7378 }
7479
80+ tile = tile. push (
81+ Button :: new (
82+ Text :: new ( & self . name )
83+ . height ( Fill )
84+ . width ( Fill )
85+ . align_y ( Vertical :: Center ) ,
86+ )
87+ . on_press ( Message :: RunFunction ( self . open_command . clone ( ) ) )
88+ . style ( |_, _| iced:: widget:: button:: Style {
89+ background : Some ( iced:: Background :: Color (
90+ Theme :: KanagawaDragon . palette ( ) . background ,
91+ ) ) ,
92+ text_color : Theme :: KanagawaDragon . palette ( ) . text ,
93+ ..Default :: default ( )
94+ } )
95+ . width ( Fill )
96+ . height ( 55 ) ,
97+ ) ;
98+
7599 tile = tile
76100 . push (
77- Button :: new (
78- Text :: new ( self . name . clone ( ) )
79- . height ( Fill )
80- . width ( Fill )
81- . align_y ( Vertical :: Center ) ,
82- )
83- . on_press ( Message :: RunFunction ( self . open_command . clone ( ) ) )
84- . style ( |_, _| iced:: widget:: button:: Style {
85- background : Some ( iced:: Background :: Color (
86- Theme :: KanagawaDragon . palette ( ) . background ,
87- ) ) ,
88- text_color : Theme :: KanagawaDragon . palette ( ) . text ,
89- ..Default :: default ( )
90- } )
91- . width ( Fill )
92- . height ( 55 ) ,
101+ container ( Text :: new ( & self . desc ) )
102+ . padding ( 15 ) ,
93103 )
94104 . width ( Fill ) ;
105+
95106 container ( tile)
96107 . style ( |_| iced:: widget:: container:: Style {
97108 text_color : Some ( Theme :: KanagawaDragon . palette ( ) . text ) ,
@@ -228,6 +239,7 @@ impl Tile {
228239 let rand_num = rand:: random_range ( 0 ..100 ) ;
229240 self . results = vec ! [ App {
230241 open_command: Function :: RandomVar ( rand_num) ,
242+ desc: "Easter egg" . to_string( ) ,
231243 icons: None ,
232244 name: rand_num. to_string( ) ,
233245 name_lc: String :: new( ) ,
@@ -243,6 +255,7 @@ impl Tile {
243255 self . results = vec ! [ App {
244256 open_command: Function :: GoogleSearch ( self . query. clone( ) ) ,
245257 icons: None ,
258+ desc: "Search" . to_string( ) ,
246259 name: format!( "Search for: {}" , self . query) ,
247260 name_lc: String :: new( ) ,
248261 } ] ;
0 commit comments