Skip to content

Commit 5f0d4ec

Browse files
authored
Merge pull request #70 from linux-credentials/webext-install
Add web extension files to install directory
2 parents f88eb0c + 7a7f93a commit 5f0d4ec

File tree

20 files changed

+216
-111
lines changed

20 files changed

+216
-111
lines changed

contrib/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
install_data(
2+
'xyz.iinuwa.credentialsd.Credentials.xml',
3+
install_dir: datadir / 'credentialsd',
4+
)

credentialsd-ui/data/resources/ui/window.ui

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,11 @@
1010
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
1111
<attribute name="action">win.show-help-overlay</attribute>
1212
</item>
13-
<item>
14-
<attribute name="label" translatable="yes">_About Credential Manager</attribute>
15-
<attribute name="action">app.about</attribute>
16-
</item>
1713
</section>
1814
</menu>
19-
<template class="ExampleApplicationWindow" parent="GtkApplicationWindow">
15+
<template class="CredentialsUiWindow" parent="GtkApplicationWindow">
2016
<child type="titlebar">
2117
<object class="GtkHeaderBar" id="headerbar">
22-
<child type="end">
23-
<object class="GtkMenuButton" id="appmenu_button">
24-
<property name="icon-name">open-menu-symbolic</property>
25-
<property name="menu-model">primary_menu</property>
26-
<property name="primary">True</property>
27-
<property name="tooltip-text" translatable="yes">Main Menu</property>
28-
</object>
29-
</child>
3018
</object>
3119
</child>
3220
<child>
@@ -37,7 +25,7 @@
3725
<binding name="label">
3826
<lookup name="title">
3927
<lookup name="view-model">
40-
ExampleApplicationWindow
28+
CredentialsUiWindow
4129
</lookup>
4230
</lookup>
4331
</binding>
@@ -67,7 +55,7 @@
6755
<binding name="child">
6856
<lookup name="devices">
6957
<lookup name="view-model">
70-
ExampleApplicationWindow
58+
CredentialsUiWindow
7159
</lookup>
7260
</lookup>
7361
</binding>
@@ -95,7 +83,7 @@
9583
<binding name="label">
9684
<lookup name="prompt">
9785
<lookup name="view-model">
98-
ExampleApplicationWindow
86+
CredentialsUiWindow
9987
</lookup>
10088
</lookup>
10189
</binding>
@@ -107,7 +95,7 @@
10795
<binding name="visible">
10896
<lookup name="usb_pin_entry_visible">
10997
<lookup name="view-model">
110-
ExampleApplicationWindow
98+
CredentialsUiWindow
11199
</lookup>
112100
</lookup>
113101
</binding>
@@ -131,7 +119,7 @@
131119
<binding name="visible">
132120
<lookup name="qr_spinner_visible">
133121
<lookup name="view-model">
134-
ExampleApplicationWindow
122+
CredentialsUiWindow
135123
</lookup>
136124
</lookup>
137125
</binding>
@@ -142,7 +130,7 @@
142130
<binding name="visible">
143131
<lookup name="qr_code_visible">
144132
<lookup name="view-model">
145-
ExampleApplicationWindow
133+
CredentialsUiWindow
146134
</lookup>
147135
</lookup>
148136
</binding>
@@ -153,7 +141,7 @@
153141
<binding name="label">
154142
<lookup name="prompt">
155143
<lookup name="view-model">
156-
ExampleApplicationWindow
144+
CredentialsUiWindow
157145
</lookup>
158146
</lookup>
159147
</binding>
@@ -182,7 +170,7 @@
182170
<binding name="child">
183171
<lookup name="credentials">
184172
<lookup name="view-model">
185-
ExampleApplicationWindow
173+
CredentialsUiWindow
186174
</lookup>
187175
</lookup>
188176
</binding>
@@ -222,7 +210,7 @@
222210
<binding name="label">
223211
<lookup name="prompt">
224212
<lookup name="view-model">
225-
ExampleApplicationWindow
213+
CredentialsUiWindow
226214
</lookup>
227215
</lookup>
228216
</binding>

credentialsd-ui/src/gui/view_model/gtk/application.rs

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
use async_std::channel::{Receiver, Sender};
2-
use gettextrs::gettext;
32
use tracing::{debug, info};
43

54
use gtk::prelude::*;
65
use gtk::subclass::prelude::*;
76
use gtk::{gdk, gio, glib};
87

9-
use super::{ViewModel, window::ExampleApplicationWindow};
8+
use super::{ViewModel, window::CredentialsUiWindow};
109
use crate::config::{APP_ID, PKGDATADIR, PROFILE, VERSION};
1110
use 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

110109
glib::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 <isaiah.inuwa@gmail.com>"])
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);

credentialsd-ui/src/gui/view_model/gtk/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use qrcode::QrCode;
1616
use tracing::debug;
1717

1818
use crate::config::{GETTEXT_PACKAGE, LOCALEDIR, RESOURCES_FILE};
19-
use application::ExampleApplication;
19+
use application::CredentialsUi;
2020

2121
use super::Transport;
2222
use super::{Credential, Device};
@@ -365,7 +365,7 @@ pub fn start_gtk_app(
365365
let res = gio::Resource::load(RESOURCES_FILE).expect("Could not load gresource file");
366366
gio::resources_register(&res);
367367

368-
let app = ExampleApplication::new(tx_event, rx_update);
368+
let app = CredentialsUi::new(tx_event, rx_update);
369369
app.run();
370370
}
371371

credentialsd-ui/src/gui/view_model/gtk/window.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use gtk::{
99
glib::{self, clone},
1010
};
1111

12-
use super::application::ExampleApplication;
12+
use super::application::CredentialsUi;
1313
use super::{ViewModel, device::DeviceObject};
1414
use crate::config::{APP_ID, PROFILE};
1515
use crate::gui::view_model::Transport;
@@ -22,9 +22,9 @@ mod imp {
2222
use super::*;
2323

2424
#[derive(Debug, Properties, gtk::CompositeTemplate)]
25-
#[properties(wrapper_type = super::ExampleApplicationWindow)]
25+
#[properties(wrapper_type = super::CredentialsUiWindow)]
2626
#[template(resource = "/xyz/iinuwa/credentialsd/CredentialsUi/ui/window.ui")]
27-
pub struct ExampleApplicationWindow {
27+
pub struct CredentialsUiWindow {
2828
#[template_child]
2929
pub headerbar: TemplateChild<gtk::HeaderBar>,
3030
pub settings: gio::Settings,
@@ -42,7 +42,7 @@ mod imp {
4242
}
4343

4444
#[gtk::template_callbacks]
45-
impl ExampleApplicationWindow {
45+
impl CredentialsUiWindow {
4646
#[template_callback]
4747
fn handle_usb_pin_entered(&self, entry: &gtk::PasswordEntry) {
4848
let view_model = &self.view_model.borrow();
@@ -58,7 +58,7 @@ mod imp {
5858
}
5959
}
6060

61-
impl Default for ExampleApplicationWindow {
61+
impl Default for CredentialsUiWindow {
6262
fn default() -> Self {
6363
Self {
6464
headerbar: TemplateChild::default(),
@@ -72,9 +72,9 @@ mod imp {
7272
}
7373

7474
#[glib::object_subclass]
75-
impl ObjectSubclass for ExampleApplicationWindow {
76-
const NAME: &'static str = "ExampleApplicationWindow";
77-
type Type = super::ExampleApplicationWindow;
75+
impl ObjectSubclass for CredentialsUiWindow {
76+
const NAME: &'static str = "CredentialsUiWindow";
77+
type Type = super::CredentialsUiWindow;
7878
type ParentType = gtk::ApplicationWindow;
7979

8080
fn class_init(klass: &mut Self::Class) {
@@ -89,7 +89,7 @@ mod imp {
8989
}
9090

9191
#[glib::derived_properties]
92-
impl ObjectImpl for ExampleApplicationWindow {
92+
impl ObjectImpl for CredentialsUiWindow {
9393
fn constructed(&self) {
9494
self.parent_constructed();
9595
let obj = self.obj();
@@ -104,8 +104,8 @@ mod imp {
104104
}
105105
}
106106

107-
impl WidgetImpl for ExampleApplicationWindow {}
108-
impl WindowImpl for ExampleApplicationWindow {
107+
impl WidgetImpl for CredentialsUiWindow {}
108+
impl WindowImpl for CredentialsUiWindow {
109109
// Save window state on delete event
110110
fn close_request(&self) -> glib::Propagation {
111111
if let Some(vm) = self.view_model.borrow().as_ref() {
@@ -128,19 +128,19 @@ mod imp {
128128
}
129129
}
130130

131-
impl ApplicationWindowImpl for ExampleApplicationWindow {}
131+
impl ApplicationWindowImpl for CredentialsUiWindow {}
132132
}
133133

134134
glib::wrapper! {
135-
pub struct ExampleApplicationWindow(ObjectSubclass<imp::ExampleApplicationWindow>)
135+
pub struct CredentialsUiWindow(ObjectSubclass<imp::CredentialsUiWindow>)
136136
@extends gtk::Widget, gtk::Window, gtk::ApplicationWindow,
137137
@implements gio::ActionMap, gio::ActionGroup, gtk::Root;
138138

139139
}
140140

141-
impl ExampleApplicationWindow {
142-
pub fn new(app: &ExampleApplication, view_model: ViewModel) -> Self {
143-
let window: ExampleApplicationWindow = glib::Object::builder()
141+
impl CredentialsUiWindow {
142+
pub fn new(app: &CredentialsUi, view_model: ViewModel) -> Self {
143+
let window: CredentialsUiWindow = glib::Object::builder()
144144
.property("application", app)
145145
.property("view-model", view_model)
146146
.build();

meson.build

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ version = meson.project_version()
1010

1111
prefix = get_option('prefix')
1212
bindir = prefix / get_option('bindir')
13+
libdir = prefix / get_option('libdir')
1314
localedir = prefix / get_option('localedir')
1415

1516
cargo_home = get_option('cargo_home')
@@ -29,4 +30,6 @@ subdir('credentialsd-common')
2930
subdir('credentialsd')
3031
subdir('credentialsd-ui')
3132
subdir('dbus')
32-
subdir('systemd')
33+
subdir('systemd')
34+
subdir('webext')
35+
subdir('contrib')

systemd/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ configure_file(
2424
install_dir: systemd_user_service_dir,
2525
output: 'xyz.iinuwa.credentialsd.UiControl.service',
2626
configuration: systemd_config,
27-
)
27+
)

0 commit comments

Comments
 (0)