11use async_std:: channel:: { Receiver , Sender } ;
2- use gettextrs:: gettext;
32use tracing:: { debug, info} ;
43
54use gtk:: prelude:: * ;
65use gtk:: subclass:: prelude:: * ;
76use gtk:: { gdk, gio, glib} ;
87
9- use super :: { ViewModel , window:: ExampleApplicationWindow } ;
8+ use super :: { ViewModel , window:: CredentialsUiWindow } ;
109use crate :: config:: { APP_ID , PKGDATADIR , PROFILE , VERSION } ;
1110use crate :: gui:: view_model:: { ViewEvent , ViewUpdate } ;
1211
@@ -21,25 +20,25 @@ mod imp {
2120 } ;
2221
2322 #[ derive( Debug , Default ) ]
24- pub struct ExampleApplication {
25- pub window : OnceCell < WeakRef < ExampleApplicationWindow > > ,
23+ pub struct CredentialsUi {
24+ pub window : OnceCell < WeakRef < CredentialsUiWindow > > ,
2625
2726 pub ( super ) tx : RefCell < Option < Sender < ViewEvent > > > ,
2827 pub ( super ) rx : RefCell < Option < Receiver < ViewUpdate > > > ,
2928 }
3029
3130 #[ glib:: object_subclass]
32- impl ObjectSubclass for ExampleApplication {
33- const NAME : & ' static str = "ExampleApplication " ;
34- type Type = super :: ExampleApplication ;
31+ impl ObjectSubclass for CredentialsUi {
32+ const NAME : & ' static str = "CredentialsUi " ;
33+ type Type = super :: CredentialsUi ;
3534 type ParentType = gtk:: Application ;
3635 }
3736
38- impl ObjectImpl for ExampleApplication { }
37+ impl ObjectImpl for CredentialsUi { }
3938
40- impl ApplicationImpl for ExampleApplication {
39+ impl ApplicationImpl for CredentialsUi {
4140 fn activate ( & self ) {
42- debug ! ( "GtkApplication<ExampleApplication >::activate" ) ;
41+ debug ! ( "GtkApplication<CredentialsUi >::activate" ) ;
4342 self . parent_activate ( ) ;
4443 let app = self . obj ( ) ;
4544
@@ -53,7 +52,7 @@ mod imp {
5352 let rx = self . rx . take ( ) . expect ( "receiver to be initiated" ) ;
5453 let view_model = ViewModel :: new ( tx, rx) ;
5554 let vm2 = view_model. clone ( ) ;
56- let window = ExampleApplicationWindow :: new ( & app, view_model) ;
55+ let window = CredentialsUiWindow :: new ( & app, view_model) ;
5756 let window2 = window. clone ( ) ;
5857 vm2. clone ( ) . connect_completed_notify ( move |vm| {
5958 if vm. completed ( ) {
@@ -91,7 +90,7 @@ mod imp {
9190 }
9291
9392 fn startup ( & self ) {
94- debug ! ( "GtkApplication<ExampleApplication >::startup" ) ;
93+ debug ! ( "GtkApplication<CredentialsUi >::startup" ) ;
9594 self . parent_startup ( ) ;
9695 let app = self . obj ( ) ;
9796
@@ -104,17 +103,17 @@ mod imp {
104103 }
105104 }
106105
107- impl GtkApplicationImpl for ExampleApplication { }
106+ impl GtkApplicationImpl for CredentialsUi { }
108107}
109108
110109glib:: wrapper! {
111- pub struct ExampleApplication ( ObjectSubclass <imp:: ExampleApplication >)
110+ pub struct CredentialsUi ( ObjectSubclass <imp:: CredentialsUi >)
112111 @extends gio:: Application , gtk:: Application ,
113112 @implements gio:: ActionMap , gio:: ActionGroup ;
114113}
115114
116- impl ExampleApplication {
117- fn main_window ( & self ) -> ExampleApplicationWindow {
115+ impl CredentialsUi {
116+ fn main_window ( & self ) -> CredentialsUiWindow {
118117 self . imp ( ) . window . get ( ) . unwrap ( ) . upgrade ( ) . unwrap ( )
119118 }
120119
@@ -128,13 +127,7 @@ impl ExampleApplication {
128127 } )
129128 . build ( ) ;
130129
131- // About
132- let action_about = gio:: ActionEntry :: builder ( "about" )
133- . activate ( |app : & Self , _, _| {
134- app. show_about_dialog ( ) ;
135- } )
136- . build ( ) ;
137- self . add_action_entries ( [ action_quit, action_about] ) ;
130+ self . add_action_entries ( [ action_quit] ) ;
138131 }
139132
140133 // Sets up keyboard shortcuts
@@ -155,21 +148,6 @@ impl ExampleApplication {
155148 }
156149 }
157150
158- fn show_about_dialog ( & self ) {
159- let dialog = gtk:: AboutDialog :: builder ( )
160- . logo_icon_name ( APP_ID )
161- . license_type ( gtk:: License :: Lgpl30Only )
162- . website ( "https://github.com/linux-credentials/linux-webauthn-portal-api" )
163- . version ( VERSION )
164- . transient_for ( & self . main_window ( ) )
165- . translator_credits ( gettext ( "translator-credits" ) )
166- . modal ( true )
167- . authors ( vec ! [ "Isaiah Inuwa <[email protected] >" ] ) 168- . build ( ) ;
169-
170- dialog. present ( ) ;
171- }
172-
173151 pub fn run ( & self ) -> glib:: ExitCode {
174152 info ! ( "Credentials UI ({})" , APP_ID ) ;
175153 info ! ( "Version: {} ({})" , VERSION , PROFILE ) ;
0 commit comments