1
1
use async_std:: channel:: { Receiver , Sender } ;
2
- use gettextrs:: gettext;
3
2
use tracing:: { debug, info} ;
4
3
5
4
use gtk:: prelude:: * ;
6
5
use gtk:: subclass:: prelude:: * ;
7
6
use gtk:: { gdk, gio, glib} ;
8
7
9
- use super :: { ViewModel , window:: ExampleApplicationWindow } ;
8
+ use super :: { ViewModel , window:: CredentialsUiWindow } ;
10
9
use crate :: config:: { APP_ID , PKGDATADIR , PROFILE , VERSION } ;
11
10
use crate :: gui:: view_model:: { ViewEvent , ViewUpdate } ;
12
11
@@ -21,25 +20,25 @@ mod imp {
21
20
} ;
22
21
23
22
#[ derive( Debug , Default ) ]
24
- pub struct ExampleApplication {
25
- pub window : OnceCell < WeakRef < ExampleApplicationWindow > > ,
23
+ pub struct CredentialsUi {
24
+ pub window : OnceCell < WeakRef < CredentialsUiWindow > > ,
26
25
27
26
pub ( super ) tx : RefCell < Option < Sender < ViewEvent > > > ,
28
27
pub ( super ) rx : RefCell < Option < Receiver < ViewUpdate > > > ,
29
28
}
30
29
31
30
#[ 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 ;
35
34
type ParentType = gtk:: Application ;
36
35
}
37
36
38
- impl ObjectImpl for ExampleApplication { }
37
+ impl ObjectImpl for CredentialsUi { }
39
38
40
- impl ApplicationImpl for ExampleApplication {
39
+ impl ApplicationImpl for CredentialsUi {
41
40
fn activate ( & self ) {
42
- debug ! ( "GtkApplication<ExampleApplication >::activate" ) ;
41
+ debug ! ( "GtkApplication<CredentialsUi >::activate" ) ;
43
42
self . parent_activate ( ) ;
44
43
let app = self . obj ( ) ;
45
44
@@ -53,7 +52,7 @@ mod imp {
53
52
let rx = self . rx . take ( ) . expect ( "receiver to be initiated" ) ;
54
53
let view_model = ViewModel :: new ( tx, rx) ;
55
54
let vm2 = view_model. clone ( ) ;
56
- let window = ExampleApplicationWindow :: new ( & app, view_model) ;
55
+ let window = CredentialsUiWindow :: new ( & app, view_model) ;
57
56
let window2 = window. clone ( ) ;
58
57
vm2. clone ( ) . connect_completed_notify ( move |vm| {
59
58
if vm. completed ( ) {
@@ -91,7 +90,7 @@ mod imp {
91
90
}
92
91
93
92
fn startup ( & self ) {
94
- debug ! ( "GtkApplication<ExampleApplication >::startup" ) ;
93
+ debug ! ( "GtkApplication<CredentialsUi >::startup" ) ;
95
94
self . parent_startup ( ) ;
96
95
let app = self . obj ( ) ;
97
96
@@ -104,17 +103,17 @@ mod imp {
104
103
}
105
104
}
106
105
107
- impl GtkApplicationImpl for ExampleApplication { }
106
+ impl GtkApplicationImpl for CredentialsUi { }
108
107
}
109
108
110
109
glib:: wrapper! {
111
- pub struct ExampleApplication ( ObjectSubclass <imp:: ExampleApplication >)
110
+ pub struct CredentialsUi ( ObjectSubclass <imp:: CredentialsUi >)
112
111
@extends gio:: Application , gtk:: Application ,
113
112
@implements gio:: ActionMap , gio:: ActionGroup ;
114
113
}
115
114
116
- impl ExampleApplication {
117
- fn main_window ( & self ) -> ExampleApplicationWindow {
115
+ impl CredentialsUi {
116
+ fn main_window ( & self ) -> CredentialsUiWindow {
118
117
self . imp ( ) . window . get ( ) . unwrap ( ) . upgrade ( ) . unwrap ( )
119
118
}
120
119
@@ -128,13 +127,7 @@ impl ExampleApplication {
128
127
} )
129
128
. build ( ) ;
130
129
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] ) ;
138
131
}
139
132
140
133
// Sets up keyboard shortcuts
@@ -155,21 +148,6 @@ impl ExampleApplication {
155
148
}
156
149
}
157
150
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 <isaiah.inuwa@gmail.com>" ] )
168
- . build ( ) ;
169
-
170
- dialog. present ( ) ;
171
- }
172
-
173
151
pub fn run ( & self ) -> glib:: ExitCode {
174
152
info ! ( "Credentials UI ({})" , APP_ID ) ;
175
153
info ! ( "Version: {} ({})" , VERSION , PROFILE ) ;
0 commit comments