Skip to content

Commit

Permalink
Styling
Browse files Browse the repository at this point in the history
Styling
  • Loading branch information
gr211 authored Jun 19, 2020
1 parent 1964c39 commit 71e2dfb
Show file tree
Hide file tree
Showing 8 changed files with 197 additions and 79 deletions.
24 changes: 3 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,6 @@ repository = "https://github.com/grumlimited/authenticator-rs/"
authors = ["Romain Gallet <[email protected]>"]
edition = "2018"

[package.metadata.deb]
maintainer = "Romain Gallet <[email protected]>"
copyright = "Copyright (c) 2020 Grum Limited"
license-file = ["COPYING", "3"]
depends = "$auto"
extended-description = '''
authenticator-rs
'''
section = "GNOME"
priority = "optional"
assets = [
["data/uk.co.grumlimited.authenticator-rs.svg", "usr/share/icons/hicolor/scalable/apps/uk.co.grumlimited.authenticator-rs.svg", "644"],
["data/uk.co.grumlimited.authenticator-rs.64.png", "usr/share/icons/hicolor/64x64/apps/uk.co.grumlimited.authenticator-rs.png", "644"],
["data/uk.co.grumlimited.authenticator-rs.128.png", "usr/share/icons/hicolor/128x128/apps/uk.co.grumlimited.authenticator-rs.png", "644"],
["data/uk.co.grumlimited.authenticator-rs.appdata.xml", "usr/share/metainfo/uk.co.grumlimited.authenticator-rs.appdata.xml", "644"],
["data/uk.co.grumlimited.authenticator-rs.desktop", "usr/share/applications/uk.co.grumlimited.authenticator-rs.desktop", "644"]
]

[dependencies]
base32 = "0.4.0"
chrono = "0.4.11"
Expand All @@ -36,9 +18,9 @@ futures-executor = "0.3.5"
gdk = "0.12.1"
gio = "0.8.1"
rusqlite = "0.23.1"
serde_json = "1.0.53"
serde_json = "1.0.55"
serde = { version = "1.0.111", features = ["derive"] }
totp-rs = "0.2.5"
totp-rs = "0.2.6"

[dependencies.gtk]
version = "0.8.1"
Expand All @@ -48,4 +30,4 @@ features = ["v3_22"]
version = "0.9.3"

[dev-dependencies]
async-std = {version ="1.6.0", features = ["unstable"] }
async-std = {version ="1.6.2", features = ["unstable"] }
38 changes: 32 additions & 6 deletions src/main_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub struct MainWindow {
pub enum State {
DisplayAccounts,
DisplayEditAccount,
DisplayAddAccount,
DisplayAddGroup,
}

Expand Down Expand Up @@ -68,6 +69,23 @@ impl MainWindow {
gui.accounts_window.container.set_visible(false);
gui.add_group.container.set_visible(false);
gui.edit_account_window.container.set_visible(true);
gui.edit_account_window
.add_accounts_container_edit
.set_visible(true);
gui.edit_account_window
.add_accounts_container_add
.set_visible(false);
}
State::DisplayAddAccount => {
gui.accounts_window.container.set_visible(false);
gui.add_group.container.set_visible(false);
gui.edit_account_window.container.set_visible(true);
gui.edit_account_window
.add_accounts_container_edit
.set_visible(false);
gui.edit_account_window
.add_accounts_container_add
.set_visible(true);
}
State::DisplayAddGroup => {
gui.accounts_window.container.set_visible(false);
Expand Down Expand Up @@ -146,10 +164,9 @@ impl MainWindow {

menu.connect_clicked(move |_| {
let widgets = widgets.lock().unwrap();
if widgets.is_empty() {
// can't add account if no groups
add_account_button.set_sensitive(false)
}

// can't add account if no groups
add_account_button.set_sensitive(!widgets.is_empty());

popover.show_all();
});
Expand Down Expand Up @@ -181,10 +198,19 @@ impl MainWindow {

edit_account_window.input_account_id.set_text("0");
edit_account_window.input_name.set_text("");
edit_account_window.input_secret.set_text("");

edit_account_window
.add_accounts_container_edit
.set_visible(false);
edit_account_window
.add_accounts_container_add
.set_visible(true);

let buffer = edit_account_window.input_secret.get_buffer().unwrap();
buffer.set_text("");

let state = state.clone();
state.replace(State::DisplayEditAccount);
state.replace(State::DisplayAddAccount);

popover.hide();
accounts_window.container.set_visible(false);
Expand Down
Loading

0 comments on commit 71e2dfb

Please sign in to comment.