@@ -8,7 +8,6 @@ use crate::config;
8
8
use crate :: config:: CONFIG_VERSION ;
9
9
use crate :: fl;
10
10
use crate :: operator:: Operator ;
11
- use cosmic:: app:: about:: About ;
12
11
use cosmic:: app:: { self , Core , Message as CosmicMessage , Task } ;
13
12
use cosmic:: cosmic_config:: Update ;
14
13
use cosmic:: cosmic_theme:: ThemeMode ;
@@ -18,6 +17,7 @@ use cosmic::iced::{
18
17
keyboard:: { Key , Modifiers } ,
19
18
Alignment , Event , Length , Subscription ,
20
19
} ;
20
+ use cosmic:: widget:: about:: About ;
21
21
use cosmic:: widget:: menu:: Action ;
22
22
use cosmic:: widget:: { self , menu, nav_bar, ToastId } ;
23
23
use cosmic:: { cosmic_config, cosmic_theme, theme, Application , ApplicationExt , Element } ;
@@ -48,7 +48,7 @@ pub enum Message {
48
48
CleanHistory ,
49
49
ShowToast ( String ) ,
50
50
CloseToast ( ToastId ) ,
51
- Cosmic ( cosmic :: app :: cosmic :: Message ) ,
51
+ Open ( String ) ,
52
52
}
53
53
54
54
#[ derive( Copy , Clone , Debug , Default , Eq , PartialEq ) ]
@@ -144,14 +144,22 @@ impl Application for Calculator {
144
144
}
145
145
146
146
let about = About :: default ( )
147
- . set_application_name ( fl ! ( "app-title" ) )
148
- . set_application_icon ( Self :: APP_ID )
149
- . set_developer_name ( "Eduardo Flores" )
150
- . set_license_type ( "GPL-3.0" )
151
- . set_version ( "0.1.1" )
152
- . set_support_url ( "https://github.com/cosmic-utils/calculator/issues" )
153
- . set_repository_url ( "https://github.com/cosmic-utils/calculator" )
154
- . set_developers ( [ ( "Eduardo Flores" . into ( ) , "[email protected] " . into ( ) ) ] ) ;
147
+ . name ( fl ! ( "app-title" ) )
148
+ . icon ( Self :: APP_ID )
149
+ . version ( "0.1.1" )
150
+ . author ( "Eduardo Flores" )
151
+ . license ( "GPL-3.0-only" )
152
+ . links ( [
153
+ (
154
+ fl ! ( "support" ) ,
155
+ "https://github.com/cosmic-utils/calculator/issues" ,
156
+ ) ,
157
+ (
158
+ fl ! ( "repository" ) ,
159
+ "https://github.com/cosmic-utils/calculator" ,
160
+ ) ,
161
+ ] )
162
+ . developers ( [ ( "Eduardo Flores" . into ( ) , "[email protected] " . into ( ) ) ] ) ;
155
163
156
164
let mut app = Calculator {
157
165
core,
@@ -175,10 +183,6 @@ impl Application for Calculator {
175
183
( app, Task :: batch ( tasks) )
176
184
}
177
185
178
- fn about ( & self ) -> Option < & About > {
179
- Some ( & self . about )
180
- }
181
-
182
186
fn header_start ( & self ) -> Vec < Element < Self :: Message > > {
183
187
let menu_bar = menu:: bar ( vec ! [ menu:: Tree :: with_children(
184
188
menu:: root( fl!( "view" ) ) ,
@@ -373,10 +377,10 @@ impl Application for Calculator {
373
377
}
374
378
375
379
match message {
376
- Message :: Cosmic ( message ) => {
377
- commands . push ( cosmic :: app :: command :: message ( cosmic :: app :: message :: cosmic (
378
- message ,
379
- ) ) ) ;
380
+ Message :: Open ( url ) => {
381
+ if let Err ( err ) = open :: that_detached ( url ) {
382
+ log :: error! ( "{err}" )
383
+ }
380
384
}
381
385
Message :: ShowToast ( message) => {
382
386
commands. push (
@@ -453,7 +457,7 @@ impl Application for Calculator {
453
457
}
454
458
455
459
Some ( match self . context_page {
456
- ContextPage :: About => self . about_view ( ) ? . map ( Message :: Cosmic ) ,
460
+ ContextPage :: About => widget :: about ( & self . about , Message :: Open ) ,
457
461
} )
458
462
}
459
463
0 commit comments