mirror of
https://gitlab.gnome.org/World/Authenticator.git
synced 2025-03-04 00:34:40 +01:00
update per latest gtk-rs updates
mostly simplifies imports, renamed macros, simplifed gobject instance creation
This commit is contained in:
parent
f127ae1f91
commit
e6710aea82
33 changed files with 210 additions and 299 deletions
89
Cargo.lock
generated
89
Cargo.lock
generated
|
@ -239,11 +239,7 @@ dependencies = [
|
|||
"diesel",
|
||||
"diesel_migrations",
|
||||
"futures",
|
||||
"gdk-pixbuf",
|
||||
"gdk4",
|
||||
"gettext-rs",
|
||||
"gio",
|
||||
"glib",
|
||||
"gtk-macros",
|
||||
"gtk4",
|
||||
"hex",
|
||||
|
@ -374,7 +370,7 @@ checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba"
|
|||
[[package]]
|
||||
name = "cairo-rs"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f316f4025cde40953f2e47bcd58c8f400ca92bc7"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f9714995940f334a712f5bfcccd558f600007e9f"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cairo-sys-rs",
|
||||
|
@ -387,7 +383,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cairo-sys-rs"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f316f4025cde40953f2e47bcd58c8f400ca92bc7"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f9714995940f334a712f5bfcccd558f600007e9f"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"libc",
|
||||
|
@ -875,16 +871,16 @@ checksum = "611834ce18aaa1bd13c4b374f5d653e1027cf99b6b502584ff8c9a64413b30bb"
|
|||
|
||||
[[package]]
|
||||
name = "futures-lite"
|
||||
version = "1.11.2"
|
||||
version = "1.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e6c079abfac3ab269e2927ec048dabc89d009ebfdda6b8ee86624f30c689658"
|
||||
checksum = "b4481d0cd0de1d204a4fa55e7d45f07b1d958abcb06714b3446438e2eff695fb"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"memchr",
|
||||
"parking",
|
||||
"pin-project-lite 0.1.11",
|
||||
"pin-project-lite 0.2.0",
|
||||
"waker-fn",
|
||||
]
|
||||
|
||||
|
@ -938,7 +934,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gdk-pixbuf"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f316f4025cde40953f2e47bcd58c8f400ca92bc7"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f9714995940f334a712f5bfcccd558f600007e9f"
|
||||
dependencies = [
|
||||
"gdk-pixbuf-sys",
|
||||
"gio",
|
||||
|
@ -949,7 +945,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gdk-pixbuf-sys"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f316f4025cde40953f2e47bcd58c8f400ca92bc7"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f9714995940f334a712f5bfcccd558f600007e9f"
|
||||
dependencies = [
|
||||
"gio-sys",
|
||||
"glib-sys",
|
||||
|
@ -961,7 +957,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gdk4"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#e643e460730f486b819aaa0213b984f96f38e406"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#d393f59dbf97518add962d250de9e3b69339f251"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cairo-rs",
|
||||
|
@ -976,7 +972,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gdk4-sys"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#e643e460730f486b819aaa0213b984f96f38e406"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#d393f59dbf97518add962d250de9e3b69339f251"
|
||||
dependencies = [
|
||||
"cairo-sys-rs",
|
||||
"gdk-pixbuf-sys",
|
||||
|
@ -991,7 +987,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gdk4-wayland"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#e643e460730f486b819aaa0213b984f96f38e406"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#d393f59dbf97518add962d250de9e3b69339f251"
|
||||
dependencies = [
|
||||
"gdk4",
|
||||
"gdk4-wayland-sys",
|
||||
|
@ -1004,7 +1000,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gdk4-wayland-sys"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#e643e460730f486b819aaa0213b984f96f38e406"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#d393f59dbf97518add962d250de9e3b69339f251"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"libc",
|
||||
|
@ -1014,7 +1010,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gdk4-x11"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#e643e460730f486b819aaa0213b984f96f38e406"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#d393f59dbf97518add962d250de9e3b69339f251"
|
||||
dependencies = [
|
||||
"gdk4",
|
||||
"gdk4-x11-sys",
|
||||
|
@ -1027,7 +1023,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gdk4-x11-sys"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#e643e460730f486b819aaa0213b984f96f38e406"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#d393f59dbf97518add962d250de9e3b69339f251"
|
||||
dependencies = [
|
||||
"gdk4-sys",
|
||||
"glib-sys",
|
||||
|
@ -1098,7 +1094,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gio"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f316f4025cde40953f2e47bcd58c8f400ca92bc7"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f9714995940f334a712f5bfcccd558f600007e9f"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"futures",
|
||||
|
@ -1116,7 +1112,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gio-sys"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f316f4025cde40953f2e47bcd58c8f400ca92bc7"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f9714995940f334a712f5bfcccd558f600007e9f"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
|
@ -1128,7 +1124,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "glib"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f316f4025cde40953f2e47bcd58c8f400ca92bc7"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f9714995940f334a712f5bfcccd558f600007e9f"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"futures-channel",
|
||||
|
@ -1147,7 +1143,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "glib-macros"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f316f4025cde40953f2e47bcd58c8f400ca92bc7"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f9714995940f334a712f5bfcccd558f600007e9f"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"heck",
|
||||
|
@ -1162,7 +1158,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "glib-sys"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f316f4025cde40953f2e47bcd58c8f400ca92bc7"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f9714995940f334a712f5bfcccd558f600007e9f"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"system-deps",
|
||||
|
@ -1184,7 +1180,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gobject-sys"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f316f4025cde40953f2e47bcd58c8f400ca92bc7"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f9714995940f334a712f5bfcccd558f600007e9f"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"libc",
|
||||
|
@ -1194,7 +1190,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "graphene-rs"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f316f4025cde40953f2e47bcd58c8f400ca92bc7"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f9714995940f334a712f5bfcccd558f600007e9f"
|
||||
dependencies = [
|
||||
"glib",
|
||||
"graphene-sys",
|
||||
|
@ -1204,7 +1200,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "graphene-sys"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f316f4025cde40953f2e47bcd58c8f400ca92bc7"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f9714995940f334a712f5bfcccd558f600007e9f"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"libc",
|
||||
|
@ -1215,7 +1211,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gsk4"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#e643e460730f486b819aaa0213b984f96f38e406"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#d393f59dbf97518add962d250de9e3b69339f251"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cairo-rs",
|
||||
|
@ -1230,7 +1226,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gsk4-sys"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#e643e460730f486b819aaa0213b984f96f38e406"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#d393f59dbf97518add962d250de9e3b69339f251"
|
||||
dependencies = [
|
||||
"cairo-sys-rs",
|
||||
"gdk4-sys",
|
||||
|
@ -1251,7 +1247,7 @@ checksum = "1874c48e670519ce192093ac906c08a6dde7cb2d18b28722ef237726a39c3a63"
|
|||
[[package]]
|
||||
name = "gtk4"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#e643e460730f486b819aaa0213b984f96f38e406"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#d393f59dbf97518add962d250de9e3b69339f251"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cairo-rs",
|
||||
|
@ -1272,7 +1268,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gtk4-macros"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#e643e460730f486b819aaa0213b984f96f38e406"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#d393f59dbf97518add962d250de9e3b69339f251"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"heck",
|
||||
|
@ -1287,7 +1283,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gtk4-sys"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#e643e460730f486b819aaa0213b984f96f38e406"
|
||||
source = "git+https://github.com/gtk-rs/gtk4-rs#d393f59dbf97518add962d250de9e3b69339f251"
|
||||
dependencies = [
|
||||
"cairo-sys-rs",
|
||||
"gdk-pixbuf-sys",
|
||||
|
@ -1348,9 +1344,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9"
|
||||
checksum = "84129d298a6d57d246960ff8eb831ca4af3f96d29e2e28848dae275408658e26"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
|
@ -1527,7 +1523,7 @@ checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"
|
|||
[[package]]
|
||||
name = "libhandy4"
|
||||
version = "0.1.0"
|
||||
source = "git+https://gitlab.gnome.org/bilelmoussaoui/libhandy4-rs#d9f277bd4612b1040830b36beb8a5ccf01e3d2dc"
|
||||
source = "git+https://gitlab.gnome.org/bilelmoussaoui/libhandy4-rs#511b3e4a398aacb9ffa30ccff9926955e135b7bc"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"gdk-pixbuf",
|
||||
|
@ -1544,7 +1540,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "libhandy4-sys"
|
||||
version = "0.1.0"
|
||||
source = "git+https://gitlab.gnome.org/bilelmoussaoui/libhandy4-rs#d9f277bd4612b1040830b36beb8a5ccf01e3d2dc"
|
||||
source = "git+https://gitlab.gnome.org/bilelmoussaoui/libhandy4-rs#511b3e4a398aacb9ffa30ccff9926955e135b7bc"
|
||||
dependencies = [
|
||||
"gdk-pixbuf-sys",
|
||||
"gdk4-sys",
|
||||
|
@ -1909,7 +1905,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pango"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f316f4025cde40953f2e47bcd58c8f400ca92bc7"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f9714995940f334a712f5bfcccd558f600007e9f"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"glib",
|
||||
|
@ -1921,7 +1917,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pango-sys"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f316f4025cde40953f2e47bcd58c8f400ca92bc7"
|
||||
source = "git+https://github.com/gtk-rs/gtk-rs#f9714995940f334a712f5bfcccd558f600007e9f"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
|
@ -2478,13 +2474,12 @@ checksum = "ae524f056d7d770e174287294f562e95044c68e88dec909a00d2094805db9d75"
|
|||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.3.17"
|
||||
version = "0.3.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2c29947abdee2a218277abeca306f25789c938e500ea5a9d4b12a5a504466902"
|
||||
checksum = "97e0e9fd577458a4f61fb91fcb559ea2afecc54c934119421f9f5d3d5b1a1057"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
|
@ -2581,9 +2576,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
version = "2.3.0"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd"
|
||||
checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2"
|
||||
|
||||
[[package]]
|
||||
name = "surf"
|
||||
|
@ -2737,9 +2732,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
|||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.7"
|
||||
version = "0.5.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645"
|
||||
checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
@ -3134,9 +3129,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zvariant"
|
||||
version = "2.3.0"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc8bb578d9efd69a950d6061d12a9359ea5b2e961ad4dee10f25ccd4bc2201a4"
|
||||
checksum = "4bfdc513511335faee7b18d6e8b6086de555d6e8b0a598415571bb0f0b446519"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"enumflags2",
|
||||
|
@ -3146,9 +3141,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zvariant_derive"
|
||||
version = "2.3.0"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f327c66f7a22695719b1cf26ae671081a9c47f1c7fa6d79209039f6ad0f6acd"
|
||||
checksum = "6651d08772eefc17d36ef4da3a521b2e5f87c10ef730125b83eb500512073c92"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
|
|
25
Cargo.toml
25
Cargo.toml
|
@ -29,27 +29,6 @@ ring = "0.16"
|
|||
serde = "1.0"
|
||||
serde_json = "1.0"
|
||||
qrcode = {version ="0.12",features=["image"]}
|
||||
gtk = { git = "https://github.com/gtk-rs/gtk4-rs", package = "gtk4"}
|
||||
libhandy = { git = "https://gitlab.gnome.org/bilelmoussaoui/libhandy4-rs", package = "libhandy4"}
|
||||
|
||||
[dependencies.gtk]
|
||||
git = "https://github.com/gtk-rs/gtk4-rs"
|
||||
package = "gtk4"
|
||||
|
||||
[dependencies.glib]
|
||||
git = "https://github.com/gtk-rs/gtk-rs"
|
||||
features = ["v2_66"]
|
||||
|
||||
[dependencies.gio]
|
||||
git = "https://github.com/gtk-rs/gtk-rs"
|
||||
features = ["v2_66"]
|
||||
|
||||
[dependencies.gdk]
|
||||
git = "https://github.com/gtk-rs/gtk4-rs"
|
||||
package = "gdk4"
|
||||
|
||||
[dependencies.libhandy]
|
||||
git = "https://gitlab.gnome.org/bilelmoussaoui/libhandy4-rs"
|
||||
package = "libhandy4"
|
||||
|
||||
[dependencies.gdk-pixbuf]
|
||||
git = "https://github.com/gtk-rs/gtk-rs"
|
||||
features = ["v2_32"]
|
||||
|
|
|
@ -5,9 +5,9 @@ use crate::{
|
|||
widgets::{PreferencesWindow, ProvidersDialog, Window},
|
||||
};
|
||||
use gettextrs::gettext;
|
||||
use gio::{prelude::*, subclass::ObjectSubclass};
|
||||
use glib::{clone, glib_object_subclass, glib_wrapper};
|
||||
use gtk::prelude::*;
|
||||
use gio::subclass::ObjectSubclass;
|
||||
use glib::clone;
|
||||
use gtk::{gio, glib, prelude::*};
|
||||
use gtk_macros::{action, get_action};
|
||||
use std::env;
|
||||
|
||||
|
@ -45,7 +45,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
klass.install_properties(&PROPERTIES);
|
||||
|
@ -105,7 +105,7 @@ mod imp {
|
|||
libhandy::functions::init();
|
||||
|
||||
let app = app.downcast_ref::<super::Application>().unwrap();
|
||||
if let Some(ref display) = gdk::Display::get_default() {
|
||||
if let Some(ref display) = gtk::gdk::Display::get_default() {
|
||||
let p = gtk::CssProvider::new();
|
||||
gtk::CssProvider::load_from_resource(
|
||||
&p,
|
||||
|
@ -220,7 +220,7 @@ mod imp {
|
|||
}
|
||||
}
|
||||
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct Application(ObjectSubclass<imp::Application>)
|
||||
@extends gio::Application, gtk::Application, gio::ActionMap;
|
||||
}
|
||||
|
@ -231,15 +231,10 @@ impl Application {
|
|||
info!("Version: {} ({})", config::VERSION, config::PROFILE);
|
||||
info!("Datadir: {}", config::PKGDATADIR);
|
||||
|
||||
let app = glib::Object::new(
|
||||
Application::static_type(),
|
||||
&[
|
||||
("application-id", &Some(config::APP_ID)),
|
||||
("flags", &gio::ApplicationFlags::empty()),
|
||||
],
|
||||
)
|
||||
.unwrap()
|
||||
.downcast::<Application>()
|
||||
let app = glib::Object::new::<Application>(&[
|
||||
("application-id", &Some(config::APP_ID)),
|
||||
("flags", &gio::ApplicationFlags::empty()),
|
||||
])
|
||||
.unwrap();
|
||||
|
||||
let args: Vec<String> = env::args().collect();
|
||||
|
|
|
@ -2,8 +2,7 @@ use super::{Backupable, Restorable};
|
|||
use crate::models::{Account, Algorithm, OTPMethod, Provider, ProvidersModel};
|
||||
use anyhow::Result;
|
||||
use gettextrs::gettext;
|
||||
use gio::prelude::*;
|
||||
use glib::Cast;
|
||||
use gtk::{glib::Cast, prelude::*};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
|
@ -36,7 +35,7 @@ impl Backupable for AndOTP {
|
|||
gettext("Into a plain-text JSON file")
|
||||
}
|
||||
|
||||
fn backup(model: ProvidersModel, into: gio::File) -> Result<()> {
|
||||
fn backup(model: ProvidersModel, into: gtk::gio::File) -> Result<()> {
|
||||
let mut items = Vec::new();
|
||||
|
||||
for i in 0..model.get_n_items() {
|
||||
|
@ -74,8 +73,8 @@ impl Backupable for AndOTP {
|
|||
content.as_bytes(),
|
||||
None,
|
||||
false,
|
||||
gio::FileCreateFlags::REPLACE_DESTINATION,
|
||||
gio::NONE_CANCELLABLE,
|
||||
gtk::gio::FileCreateFlags::REPLACE_DESTINATION,
|
||||
gtk::gio::NONE_CANCELLABLE,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
|
@ -95,8 +94,8 @@ impl Restorable for AndOTP {
|
|||
gettext("From a plain-text JSON file")
|
||||
}
|
||||
|
||||
fn restore(model: ProvidersModel, from: gio::File) -> Result<()> {
|
||||
let (data, _) = from.load_contents(gio::NONE_CANCELLABLE)?;
|
||||
fn restore(model: ProvidersModel, from: gtk::gio::File) -> Result<()> {
|
||||
let (data, _) = from.load_contents(gtk::gio::NONE_CANCELLABLE)?;
|
||||
|
||||
let items: Vec<AndOTP> = serde_json::de::from_slice(&data)?;
|
||||
items.iter().try_for_each(|item| -> anyhow::Result<()> {
|
||||
|
|
|
@ -20,7 +20,7 @@ impl Restorable for Bitwarden {
|
|||
gettext("From a plain-text JSON file")
|
||||
}
|
||||
|
||||
fn restore(model: ProvidersModel, from: gio::File) -> Result<()> {
|
||||
fn restore(model: ProvidersModel, from: gtk::gio::File) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ use super::{Backupable, Restorable};
|
|||
use crate::models::{Account, OTPUri, Provider, ProvidersModel};
|
||||
use anyhow::Result;
|
||||
use gettextrs::gettext;
|
||||
use gio::prelude::*;
|
||||
use gtk::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::str::FromStr;
|
||||
|
||||
|
@ -22,7 +22,7 @@ impl Backupable for FreeOTP {
|
|||
gettext("Into a plain-text file, compatible with FreeOTP+")
|
||||
}
|
||||
|
||||
fn backup(model: ProvidersModel, into: gio::File) -> Result<()> {
|
||||
fn backup(model: ProvidersModel, into: gtk::gio::File) -> Result<()> {
|
||||
let mut items: Vec<String> = Vec::new();
|
||||
|
||||
for i in 0..model.get_n_items() {
|
||||
|
@ -46,8 +46,8 @@ impl Backupable for FreeOTP {
|
|||
content.as_bytes(),
|
||||
None,
|
||||
false,
|
||||
gio::FileCreateFlags::REPLACE_DESTINATION,
|
||||
gio::NONE_CANCELLABLE,
|
||||
gtk::gio::FileCreateFlags::REPLACE_DESTINATION,
|
||||
gtk::gio::NONE_CANCELLABLE,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
|
@ -67,8 +67,8 @@ impl Restorable for FreeOTP {
|
|||
gettext("From a plain-text file, compatible with FreeOTP+")
|
||||
}
|
||||
|
||||
fn restore(model: ProvidersModel, from: gio::File) -> Result<()> {
|
||||
let (data, _) = from.load_contents(gio::NONE_CANCELLABLE)?;
|
||||
fn restore(model: ProvidersModel, from: gtk::gio::File) -> Result<()> {
|
||||
let (data, _) = from.load_contents(gtk::gio::NONE_CANCELLABLE)?;
|
||||
let uris = String::from_utf8(data)?;
|
||||
|
||||
uris.split('\n')
|
||||
|
|
|
@ -2,7 +2,7 @@ use super::Restorable;
|
|||
use crate::models::{Account, Algorithm, OTPMethod, ProvidersModel};
|
||||
use anyhow::Result;
|
||||
use gettextrs::gettext;
|
||||
use gio::prelude::*;
|
||||
use gtk::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
// Same as andOTP except uses the first tag for the issuer
|
||||
|
@ -33,8 +33,8 @@ impl Restorable for LegacyAuthenticator {
|
|||
gettext("From a plain-text JSON file")
|
||||
}
|
||||
|
||||
fn restore(model: ProvidersModel, from: gio::File) -> Result<()> {
|
||||
let (data, _) = from.load_contents(gio::NONE_CANCELLABLE)?;
|
||||
fn restore(model: ProvidersModel, from: gtk::gio::File) -> Result<()> {
|
||||
let (data, _) = from.load_contents(gtk::gio::NONE_CANCELLABLE)?;
|
||||
|
||||
let items: Vec<LegacyAuthenticator> = serde_json::de::from_slice(&data)?;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ pub trait Restorable {
|
|||
fn subtitle() -> String;
|
||||
// Used to define the `restore.$identifier` action
|
||||
fn identifier() -> String;
|
||||
fn restore(model: ProvidersModel, from: gio::File) -> Result<()>;
|
||||
fn restore(model: ProvidersModel, from: gtk::gio::File) -> Result<()>;
|
||||
}
|
||||
|
||||
pub trait Backupable {
|
||||
|
@ -20,7 +20,7 @@ pub trait Backupable {
|
|||
fn subtitle() -> String;
|
||||
// Used to define the `backup.$identifier` action
|
||||
fn identifier() -> String;
|
||||
fn backup(model: ProvidersModel, into: gio::File) -> Result<()>;
|
||||
fn backup(model: ProvidersModel, into: gtk::gio::File) -> Result<()>;
|
||||
}
|
||||
|
||||
mod andotp;
|
||||
|
|
|
@ -4,7 +4,7 @@ use ashpd::{
|
|||
desktop::screenshot::{Screenshot, ScreenshotOptions, ScreenshotProxy},
|
||||
zbus, RequestProxy, Response, WindowIdentifier,
|
||||
};
|
||||
use gio::FileExt;
|
||||
use gtk::{gio, prelude::*};
|
||||
use image::GenericImageView;
|
||||
use std::str::FromStr;
|
||||
use zbar_rust::ZBarImageScanner;
|
||||
|
|
|
@ -27,8 +27,8 @@ fn main() {
|
|||
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
|
||||
textdomain(GETTEXT_PACKAGE);
|
||||
|
||||
glib::set_application_name("Authenticator");
|
||||
glib::set_prgname(Some(config::APP_ID));
|
||||
gtk::glib::set_application_name("Authenticator");
|
||||
gtk::glib::set_prgname(Some(config::APP_ID));
|
||||
|
||||
static_resources::init().expect("Failed to initialize the resource file.");
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@ use byteorder::{BigEndian, ReadBytesExt};
|
|||
use core::cmp::Ordering;
|
||||
use diesel::{BelongingToDsl, ExpressionMethods, QueryDsl, RunQueryDsl};
|
||||
use gio::{subclass::ObjectSubclass, FileExt};
|
||||
use glib::{clone, glib_object_subclass, glib_wrapper, Cast, ObjectExt, StaticType, ToValue};
|
||||
use glib::{clone, Cast, ObjectExt, StaticType, ToValue};
|
||||
use gtk::{gio, glib};
|
||||
use once_cell::sync::OnceCell;
|
||||
use qrcode::QrCode;
|
||||
use ring::hmac;
|
||||
|
@ -114,7 +115,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
klass.install_properties(&PROPERTIES);
|
||||
|
@ -181,7 +182,7 @@ mod imp {
|
|||
}
|
||||
}
|
||||
}
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct Account(ObjectSubclass<imp::Account>);
|
||||
}
|
||||
|
||||
|
@ -246,19 +247,14 @@ impl Account {
|
|||
}
|
||||
|
||||
pub fn new(id: i32, name: &str, token_id: &str, counter: i32, provider: Provider) -> Account {
|
||||
let account = glib::Object::new(
|
||||
Account::static_type(),
|
||||
&[
|
||||
("id", &id),
|
||||
("name", &name),
|
||||
("token-id", &token_id),
|
||||
("provider", &provider),
|
||||
("counter", &counter),
|
||||
],
|
||||
)
|
||||
.expect("Failed to create account")
|
||||
.downcast::<Account>()
|
||||
.expect("Created account is of wrong type");
|
||||
let account = glib::Object::new(&[
|
||||
("id", &id),
|
||||
("name", &name),
|
||||
("token-id", &token_id),
|
||||
("provider", &provider),
|
||||
("counter", &counter),
|
||||
])
|
||||
.expect("Failed to create account");
|
||||
|
||||
let token = Keyring::token(token_id).unwrap().unwrap();
|
||||
let self_ = imp::Account::from_instance(&account);
|
||||
|
@ -316,7 +312,7 @@ impl Account {
|
|||
}
|
||||
|
||||
pub fn copy_otp(&self) {
|
||||
let display = gdk::Display::get_default().unwrap();
|
||||
let display = gtk::gdk::Display::get_default().unwrap();
|
||||
let clipboard = display.get_clipboard();
|
||||
let self_ = imp::Account::from_instance(self);
|
||||
clipboard.set_text(&self_.otp.borrow());
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use super::account::Account;
|
||||
use gio::{prelude::*, subclass::ObjectSubclass};
|
||||
use glib::{glib_object_subclass, glib_wrapper, StaticType};
|
||||
use gtk::glib;
|
||||
|
||||
mod imp {
|
||||
use super::*;
|
||||
|
@ -17,7 +16,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
Self {}
|
||||
|
@ -40,16 +39,13 @@ mod imp {
|
|||
}
|
||||
}
|
||||
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct AccountSorter(ObjectSubclass<imp::AccountSorter>) @extends gtk::Sorter;
|
||||
}
|
||||
|
||||
impl AccountSorter {
|
||||
#[allow(clippy::new_without_default)]
|
||||
pub fn new() -> Self {
|
||||
glib::Object::new(Self::static_type(), &[])
|
||||
.expect("Failed to create AccountSorter")
|
||||
.downcast()
|
||||
.expect("Created AccountSorter is of wrong type")
|
||||
glib::Object::new(&[]).expect("Failed to create AccountSorter")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use super::account::Account;
|
||||
use gio::{prelude::*, subclass::ObjectSubclass};
|
||||
use glib::{glib_object_subclass, glib_wrapper, StaticType};
|
||||
use gio::subclass::ObjectSubclass;
|
||||
use glib::StaticType;
|
||||
use gtk::{gio, glib, prelude::*};
|
||||
|
||||
mod imp {
|
||||
use super::*;
|
||||
|
@ -18,7 +19,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn type_init(type_: &mut subclass::InitializingType<Self>) {
|
||||
type_.add_interface::<gio::ListModel>();
|
||||
|
@ -45,17 +46,14 @@ mod imp {
|
|||
}
|
||||
}
|
||||
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct AccountsModel(ObjectSubclass<imp::AccountsModel>) @implements gio::ListModel;
|
||||
}
|
||||
|
||||
impl AccountsModel {
|
||||
#[allow(clippy::new_without_default)]
|
||||
pub fn new() -> Self {
|
||||
glib::Object::new(Self::static_type(), &[])
|
||||
.expect("Failed to create AccountsModel")
|
||||
.downcast()
|
||||
.expect("Created AccountsModel is of wrong type")
|
||||
glib::Object::new(&[]).expect("Failed to create AccountsModel")
|
||||
}
|
||||
|
||||
pub fn insert(&self, account: &Account) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use gettextrs::gettext;
|
||||
use glib::GEnum;
|
||||
use gtk::{glib, glib::GEnum};
|
||||
use ring::hmac;
|
||||
use serde::{de::Deserializer, ser::Serializer, Deserialize, Serialize};
|
||||
use std::{str::FromStr, string::ToString};
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::{fs, fs::File, path::PathBuf};
|
|||
|
||||
type Pool = r2d2::Pool<ConnectionManager<SqliteConnection>>;
|
||||
|
||||
static DB_PATH: Lazy<PathBuf> = Lazy::new(|| glib::get_user_data_dir().join("authenticator"));
|
||||
static DB_PATH: Lazy<PathBuf> = Lazy::new(|| gtk::glib::get_user_data_dir().join("authenticator"));
|
||||
static POOL: Lazy<Pool> = Lazy::new(|| init_pool().expect("Failed to create a pool"));
|
||||
|
||||
embed_migrations!("migrations/");
|
||||
|
|
|
@ -15,7 +15,7 @@ const SUPPORTED_RELS: [&[u8]; 7] = [
|
|||
pub enum FaviconError {
|
||||
Surf(surf::Error),
|
||||
Url(url::ParseError),
|
||||
GLib(glib::Error),
|
||||
GLib(gtk::glib::Error),
|
||||
NoResults,
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,8 @@ impl From<surf::Error> for FaviconError {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<glib::Error> for FaviconError {
|
||||
fn from(e: glib::Error) -> Self {
|
||||
impl From<gtk::glib::Error> for FaviconError {
|
||||
fn from(e: gtk::glib::Error) -> Self {
|
||||
Self::GLib(e)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,9 @@ use crate::{
|
|||
use anyhow::Result;
|
||||
use core::cmp::Ordering;
|
||||
use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl};
|
||||
use gio::{prelude::*, subclass::ObjectSubclass};
|
||||
use glib::{glib_object_subclass, glib_wrapper, Cast, StaticType, ToValue};
|
||||
use gio::subclass::ObjectSubclass;
|
||||
use glib::{Cast, StaticType, ToValue};
|
||||
use gtk::{gio, glib, prelude::*};
|
||||
use std::{
|
||||
cell::{Cell, RefCell},
|
||||
str::FromStr,
|
||||
|
@ -173,7 +174,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
klass.install_properties(&PROPERTIES);
|
||||
|
@ -268,7 +269,7 @@ mod imp {
|
|||
}
|
||||
}
|
||||
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct Provider(ObjectSubclass<imp::Provider>);
|
||||
}
|
||||
|
||||
|
@ -343,24 +344,19 @@ impl Provider {
|
|||
help_url: Option<String>,
|
||||
image_uri: Option<String>,
|
||||
) -> Provider {
|
||||
glib::Object::new(
|
||||
Provider::static_type(),
|
||||
&[
|
||||
("id", &id),
|
||||
("name", &name),
|
||||
("website", &website),
|
||||
("help-url", &help_url),
|
||||
("image-uri", &image_uri),
|
||||
("period", &period),
|
||||
("method", &method.to_string()),
|
||||
("algorithm", &algorithm.to_string()),
|
||||
("digits", &digits),
|
||||
("default-counter", &default_counter),
|
||||
],
|
||||
)
|
||||
glib::Object::new(&[
|
||||
("id", &id),
|
||||
("name", &name),
|
||||
("website", &website),
|
||||
("help-url", &help_url),
|
||||
("image-uri", &image_uri),
|
||||
("period", &period),
|
||||
("method", &method.to_string()),
|
||||
("algorithm", &algorithm.to_string()),
|
||||
("digits", &digits),
|
||||
("default-counter", &default_counter),
|
||||
])
|
||||
.expect("Failed to create provider")
|
||||
.downcast()
|
||||
.expect("Created provider is of wrong type")
|
||||
}
|
||||
|
||||
pub async fn favicon(&self) -> Result<gio::File, FaviconError> {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use super::provider::Provider;
|
||||
use gio::{prelude::*, subclass::ObjectSubclass};
|
||||
use glib::{glib_object_subclass, glib_wrapper, StaticType};
|
||||
use gtk::glib;
|
||||
|
||||
mod imp {
|
||||
use super::*;
|
||||
|
@ -17,7 +16,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
Self {}
|
||||
|
@ -40,16 +39,13 @@ mod imp {
|
|||
}
|
||||
}
|
||||
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct ProviderSorter(ObjectSubclass<imp::ProviderSorter>) @extends gtk::Sorter;
|
||||
}
|
||||
|
||||
impl ProviderSorter {
|
||||
#[allow(clippy::new_without_default)]
|
||||
pub fn new() -> Self {
|
||||
glib::Object::new(Self::static_type(), &[])
|
||||
.expect("Failed to create ProviderSorter")
|
||||
.downcast()
|
||||
.expect("Created ProviderSorter is of wrong type")
|
||||
glib::Object::new(&[]).expect("Failed to create ProviderSorter")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use super::{Account, Algorithm, OTPMethod, Provider};
|
||||
use anyhow::Result;
|
||||
use gio::{prelude::*, subclass::ObjectSubclass};
|
||||
use glib::{glib_object_subclass, glib_wrapper, StaticType};
|
||||
use gtk::prelude::*;
|
||||
use gio::subclass::ObjectSubclass;
|
||||
use glib::StaticType;
|
||||
use gtk::{gio, glib, prelude::*};
|
||||
|
||||
mod imp {
|
||||
use super::*;
|
||||
|
@ -20,7 +20,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn type_init(type_: &mut subclass::InitializingType<Self>) {
|
||||
type_.add_interface::<gio::ListModel>();
|
||||
|
@ -47,17 +47,14 @@ mod imp {
|
|||
}
|
||||
}
|
||||
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct ProvidersModel(ObjectSubclass<imp::ProvidersModel>) @implements gio::ListModel;
|
||||
}
|
||||
|
||||
impl ProvidersModel {
|
||||
#[allow(clippy::new_without_default)]
|
||||
pub fn new() -> Self {
|
||||
let model: ProvidersModel = glib::Object::new(Self::static_type(), &[])
|
||||
.expect("Failed to create Model")
|
||||
.downcast()
|
||||
.expect("Created Model is of wrong type");
|
||||
let model: ProvidersModel = glib::Object::new(&[]).expect("Failed to create Model");
|
||||
model.init();
|
||||
model
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Source: https://gitlab.gnome.org/World/podcasts/blob/master/podcasts-gtk/src/static_resource.rs
|
||||
|
||||
use gio::{resources_register, Resource};
|
||||
use glib::{Bytes, Error};
|
||||
use gtk::gio::{resources_register, Resource};
|
||||
use gtk::glib::{Bytes, Error};
|
||||
|
||||
pub(crate) fn init() -> Result<(), Error> {
|
||||
// load the gresource binary at build time and include/link it into the final
|
||||
|
|
|
@ -4,9 +4,9 @@ use crate::{
|
|||
widgets::{ProviderImage, UrlRow},
|
||||
};
|
||||
use anyhow::Result;
|
||||
use gio::{prelude::*, subclass::ObjectSubclass, ActionMapExt};
|
||||
use glib::{clone, glib_object_subclass, glib_wrapper, signal::Inhibit, subclass::prelude::*};
|
||||
use gtk::{prelude::*, CompositeTemplate};
|
||||
use gio::{subclass::ObjectSubclass, ActionMapExt};
|
||||
use glib::{clone, signal::Inhibit};
|
||||
use gtk::{gio, glib, prelude::*, CompositeTemplate};
|
||||
use gtk_macros::{action, get_action};
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
|
@ -58,7 +58,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
let actions = gio::SimpleActionGroup::new();
|
||||
|
@ -103,16 +103,13 @@ mod imp {
|
|||
impl WindowImpl for AccountAddDialog {}
|
||||
impl libhandy::subclass::window::WindowImpl for AccountAddDialog {}
|
||||
}
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct AccountAddDialog(ObjectSubclass<imp::AccountAddDialog>) @extends gtk::Widget, gtk::Window, libhandy::Window;
|
||||
}
|
||||
|
||||
impl AccountAddDialog {
|
||||
pub fn new(model: ProvidersModel) -> Self {
|
||||
let dialog = glib::Object::new(Self::static_type(), &[])
|
||||
.expect("Failed to create AccountAddDialog")
|
||||
.downcast::<AccountAddDialog>()
|
||||
.expect("Created object is of wrong type");
|
||||
let dialog = glib::Object::new(&[]).expect("Failed to create AccountAddDialog");
|
||||
|
||||
let self_ = imp::AccountAddDialog::from_instance(&dialog);
|
||||
self_.model.set(model).unwrap();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use crate::{models::Account, widgets::UrlRow};
|
||||
use gio::{subclass::ObjectSubclass, FileExt};
|
||||
use glib::{glib_object_subclass, glib_wrapper, subclass::prelude::*};
|
||||
use gtk::{prelude::*, CompositeTemplate};
|
||||
use gtk::{gio, glib, prelude::*, CompositeTemplate};
|
||||
|
||||
mod imp {
|
||||
use super::*;
|
||||
|
@ -29,7 +28,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
|
@ -60,16 +59,13 @@ mod imp {
|
|||
impl BoxImpl for QRCodePage {}
|
||||
}
|
||||
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct QRCodePage(ObjectSubclass<imp::QRCodePage>) @extends gtk::Widget, gtk::Box;
|
||||
}
|
||||
impl QRCodePage {
|
||||
#[allow(clippy::new_without_default)]
|
||||
pub fn new() -> Self {
|
||||
glib::Object::new(Self::static_type(), &[])
|
||||
.expect("Failed to create QRCodePage")
|
||||
.downcast::<QRCodePage>()
|
||||
.expect("Created object is of wrong type")
|
||||
glib::Object::new(&[]).expect("Failed to create QRCodePage")
|
||||
}
|
||||
|
||||
pub fn set_account(&self, account: &Account) {
|
||||
|
@ -79,7 +75,7 @@ impl QRCodePage {
|
|||
.get_property_gtk_application_prefer_dark_theme();
|
||||
let qr_code = account.qr_code(is_dark).unwrap();
|
||||
|
||||
let pixbuf = gdk_pixbuf::Pixbuf::from_file(qr_code.get_path().unwrap()).unwrap();
|
||||
let pixbuf = gtk::gdk_pixbuf::Pixbuf::from_file(qr_code.get_path().unwrap()).unwrap();
|
||||
self_.image.get().set_from_pixbuf(Some(&pixbuf));
|
||||
|
||||
self_.account_label.get().set_text(&account.name());
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::models::Account;
|
||||
use gio::{prelude::*, subclass::ObjectSubclass, ActionMapExt};
|
||||
use glib::{clone, glib_object_subclass, glib_wrapper, subclass::prelude::*};
|
||||
use gtk::{prelude::*, CompositeTemplate};
|
||||
use gio::{subclass::ObjectSubclass, ActionMapExt};
|
||||
use glib::clone;
|
||||
use gtk::{gio, glib, prelude::*, CompositeTemplate};
|
||||
use gtk_macros::{action, get_action};
|
||||
use std::cell::RefCell;
|
||||
|
||||
|
@ -43,7 +43,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
let actions = gio::SimpleActionGroup::new();
|
||||
|
@ -100,16 +100,13 @@ mod imp {
|
|||
impl ListBoxRowImpl for AccountRow {}
|
||||
}
|
||||
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct AccountRow(ObjectSubclass<imp::AccountRow>) @extends gtk::Widget, gtk::ListBoxRow;
|
||||
}
|
||||
|
||||
impl AccountRow {
|
||||
pub fn new(account: Account) -> Self {
|
||||
glib::Object::new(Self::static_type(), &[("account", &account)])
|
||||
.expect("Failed to create AccountRow")
|
||||
.downcast::<AccountRow>()
|
||||
.expect("Created object is of wrong type")
|
||||
glib::Object::new(&[("account", &account)]).expect("Failed to create AccountRow")
|
||||
}
|
||||
|
||||
fn account(&self) -> Account {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{config, helpers::Keyring};
|
||||
use gio::{prelude::*, subclass::ObjectSubclass};
|
||||
use glib::{clone, glib_object_subclass, glib_wrapper, subclass::prelude::*};
|
||||
use gtk::{prelude::*, CompositeTemplate};
|
||||
use gio::subclass::ObjectSubclass;
|
||||
use glib::clone;
|
||||
use gtk::{gio, glib, prelude::*, CompositeTemplate};
|
||||
use gtk_macros::{action, get_action};
|
||||
use once_cell::sync::OnceCell;
|
||||
use std::cell::Cell;
|
||||
|
@ -34,7 +34,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
let has_set_password = Keyring::has_set_password().unwrap_or(false);
|
||||
|
@ -69,16 +69,13 @@ mod imp {
|
|||
impl BoxImpl for PasswordPage {}
|
||||
}
|
||||
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct PasswordPage(ObjectSubclass<imp::PasswordPage>) @extends gtk::Widget, gtk::Box;
|
||||
}
|
||||
|
||||
impl PasswordPage {
|
||||
pub fn new(actions: gio::SimpleActionGroup) -> Self {
|
||||
let page = glib::Object::new(Self::static_type(), &[])
|
||||
.expect("Failed to create PasswordPage")
|
||||
.downcast::<PasswordPage>()
|
||||
.expect("Created object is of wrong type");
|
||||
let page = glib::Object::new(&[]).expect("Failed to create PasswordPage");
|
||||
let self_ = imp::PasswordPage::from_instance(&page);
|
||||
self_.actions.set(actions).unwrap();
|
||||
page.setup_widgets();
|
||||
|
|
|
@ -5,9 +5,9 @@ use crate::{
|
|||
models::ProvidersModel,
|
||||
};
|
||||
use gettextrs::gettext;
|
||||
use gio::{prelude::*, subclass::ObjectSubclass, ActionMapExt};
|
||||
use glib::{clone, glib_object_subclass, glib_wrapper, subclass::prelude::*};
|
||||
use gtk::{prelude::*, CompositeTemplate};
|
||||
use gio::{subclass::ObjectSubclass, ActionMapExt};
|
||||
use glib::clone;
|
||||
use gtk::{gio, glib, prelude::*, CompositeTemplate};
|
||||
use libhandy::prelude::*;
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
|
@ -48,7 +48,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
let settings = gio::Settings::new(config::APP_ID);
|
||||
|
@ -95,17 +95,14 @@ mod imp {
|
|||
impl PreferencesWindowImpl for PreferencesWindow {}
|
||||
}
|
||||
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct PreferencesWindow(ObjectSubclass<imp::PreferencesWindow>)
|
||||
@extends gtk::Widget, gtk::Window, libhandy::Window, libhandy::PreferencesWindow;
|
||||
}
|
||||
|
||||
impl PreferencesWindow {
|
||||
pub fn new(model: ProvidersModel) -> Self {
|
||||
let window = glib::Object::new(Self::static_type(), &[])
|
||||
.expect("Failed to create PreferencesWindow")
|
||||
.downcast::<PreferencesWindow>()
|
||||
.expect("Created object is of wrong type");
|
||||
let window = glib::Object::new(&[]).expect("Failed to create PreferencesWindow");
|
||||
let self_ = imp::PreferencesWindow::from_instance(&window);
|
||||
self_.model.set(model).unwrap();
|
||||
window.setup_widgets();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use super::{ProviderPage, ProviderPageMode};
|
||||
use crate::models::{Provider, ProviderSorter, ProvidersModel};
|
||||
use gio::{prelude::*, subclass::ObjectSubclass, ListModelExt};
|
||||
use glib::{clone, glib_object_subclass, glib_wrapper, subclass::prelude::*};
|
||||
use gtk::{prelude::*, CompositeTemplate};
|
||||
use gio::{subclass::ObjectSubclass, ListModelExt};
|
||||
use glib::clone;
|
||||
use gtk::{gio, glib, prelude::*, CompositeTemplate};
|
||||
use row::ProviderActionRow;
|
||||
|
||||
mod imp {
|
||||
|
@ -35,7 +35,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
let filter_model = gtk::FilterListModel::new(gio::NONE_LIST_MODEL, gtk::NONE_FILTER);
|
||||
|
@ -67,16 +67,14 @@ mod imp {
|
|||
impl WindowImpl for ProvidersDialog {}
|
||||
impl HdyWindowImpl for ProvidersDialog {}
|
||||
}
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct ProvidersDialog(ObjectSubclass<imp::ProvidersDialog>) @extends gtk::Widget, gtk::Window, libhandy::Window;
|
||||
}
|
||||
|
||||
impl ProvidersDialog {
|
||||
pub fn new(model: ProvidersModel) -> Self {
|
||||
let dialog = glib::Object::new(Self::static_type(), &[])
|
||||
.expect("Failed to create ProvidersDialog")
|
||||
.downcast::<ProvidersDialog>()
|
||||
.expect("Created object is of wrong type");
|
||||
let dialog =
|
||||
glib::Object::new::<ProvidersDialog>(&[]).expect("Failed to create ProvidersDialog");
|
||||
|
||||
dialog.setup_widgets(model);
|
||||
dialog.setup_actions();
|
||||
|
@ -236,7 +234,7 @@ mod row {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
let actions = gio::SimpleActionGroup::new();
|
||||
|
@ -286,17 +284,14 @@ mod row {
|
|||
impl ListBoxRowImpl for ProviderActionRow {}
|
||||
}
|
||||
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct ProviderActionRow(ObjectSubclass<imp::ProviderActionRow>) @extends gtk::Widget, gtk::ListBoxRow;
|
||||
}
|
||||
|
||||
impl ProviderActionRow {
|
||||
#[allow(clippy::new_without_default)]
|
||||
pub fn new() -> Self {
|
||||
glib::Object::new(Self::static_type(), &[])
|
||||
.expect("Failed to create ProviderActionRow")
|
||||
.downcast::<ProviderActionRow>()
|
||||
.expect("Created object is of wrong type")
|
||||
glib::Object::new(&[]).expect("Failed to create ProviderActionRow")
|
||||
}
|
||||
|
||||
fn setup_widgets(&self) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::models::Provider;
|
||||
use gio::{subclass::ObjectSubclass, FileExt};
|
||||
use glib::{clone, glib_object_subclass, glib_wrapper, subclass::prelude::*, Receiver, Sender};
|
||||
use gtk::{prelude::*, CompositeTemplate};
|
||||
use glib::{clone, Receiver, Sender};
|
||||
use gtk::{gio, glib, prelude::*, CompositeTemplate};
|
||||
|
||||
pub enum ImageAction {
|
||||
Ready(gio::File),
|
||||
|
@ -58,7 +58,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
let (sender, r) = glib::MainContext::channel(glib::PRIORITY_DEFAULT);
|
||||
|
@ -117,16 +117,13 @@ mod imp {
|
|||
impl BoxImpl for ProviderImage {}
|
||||
}
|
||||
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct ProviderImage(ObjectSubclass<imp::ProviderImage>) @extends gtk::Widget, gtk::Box;
|
||||
}
|
||||
impl ProviderImage {
|
||||
#[allow(clippy::new_without_default)]
|
||||
pub fn new() -> Self {
|
||||
glib::Object::new(Self::static_type(), &[])
|
||||
.expect("Failed to create ProviderImage")
|
||||
.downcast::<ProviderImage>()
|
||||
.expect("Created ProviderImage is of wrong type")
|
||||
glib::Object::new(&[]).expect("Failed to create ProviderImage")
|
||||
}
|
||||
|
||||
pub fn set_provider(&self, provider: &Provider) {
|
||||
|
|
|
@ -4,8 +4,8 @@ use crate::{
|
|||
widgets::providers::ProviderRow,
|
||||
};
|
||||
use gio::{subclass::ObjectSubclass, ListModelExt};
|
||||
use glib::{clone, glib_object_subclass, glib_wrapper, subclass::prelude::*};
|
||||
use gtk::{prelude::*, CompositeTemplate};
|
||||
use glib::clone;
|
||||
use gtk::{gio, glib, prelude::*, CompositeTemplate};
|
||||
|
||||
mod imp {
|
||||
use super::*;
|
||||
|
@ -29,7 +29,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
let filter_model = gtk::FilterListModel::new(gio::NONE_LIST_MODEL, gtk::NONE_FILTER);
|
||||
|
@ -64,16 +64,13 @@ mod imp {
|
|||
impl BoxImpl for ProvidersList {}
|
||||
}
|
||||
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct ProvidersList(ObjectSubclass<imp::ProvidersList>) @extends gtk::Widget, gtk::Box;
|
||||
}
|
||||
impl ProvidersList {
|
||||
#[allow(clippy::new_without_default)]
|
||||
pub fn new() -> Self {
|
||||
glib::Object::new(Self::static_type(), &[])
|
||||
.expect("Failed to create ProvidersList")
|
||||
.downcast::<ProvidersList>()
|
||||
.expect("Created object is of wrong type")
|
||||
glib::Object::new(&[]).expect("Failed to create ProvidersList")
|
||||
}
|
||||
|
||||
pub fn set_model(&self, model: ProvidersModel) {
|
||||
|
|
|
@ -3,8 +3,8 @@ use crate::{
|
|||
widgets::ProviderImage,
|
||||
};
|
||||
use gio::subclass::ObjectSubclass;
|
||||
use glib::{clone, glib_object_subclass, glib_wrapper, subclass::prelude::*, translate::ToGlib};
|
||||
use gtk::{prelude::*, CompositeTemplate};
|
||||
use glib::{clone, translate::ToGlib};
|
||||
use gtk::{gio, glib, prelude::*, CompositeTemplate};
|
||||
use libhandy::ComboRowExt;
|
||||
|
||||
pub enum ProviderPageMode {
|
||||
|
@ -58,7 +58,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
let methods_model = libhandy::EnumListModel::new(OTPMethod::static_type());
|
||||
|
@ -101,16 +101,13 @@ mod imp {
|
|||
impl BoxImpl for ProviderPage {}
|
||||
}
|
||||
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct ProviderPage(ObjectSubclass<imp::ProviderPage>) @extends gtk::Widget, gtk::Box;
|
||||
}
|
||||
impl ProviderPage {
|
||||
#[allow(clippy::new_without_default)]
|
||||
pub fn new() -> Self {
|
||||
glib::Object::new(Self::static_type(), &[])
|
||||
.expect("Failed to create ProviderPage")
|
||||
.downcast::<ProviderPage>()
|
||||
.expect("Created object is of wrong type")
|
||||
glib::Object::new(&[]).expect("Failed to create ProviderPage")
|
||||
}
|
||||
|
||||
pub fn set_provider(&self, provider: Provider) {
|
||||
|
|
|
@ -2,9 +2,13 @@ use crate::{
|
|||
models::{Account, AccountSorter, OTPMethod, Provider},
|
||||
widgets::{accounts::AccountRow, ProviderImage},
|
||||
};
|
||||
use gio::{prelude::*, subclass::ObjectSubclass};
|
||||
use glib::{clone, glib_object_subclass, glib_wrapper, subclass::prelude::*};
|
||||
use gtk::{prelude::*, CompositeTemplate};
|
||||
use gio::subclass::ObjectSubclass;
|
||||
use gtk::{
|
||||
gio, glib,
|
||||
glib::{clone, subclass::prelude::*},
|
||||
prelude::*,
|
||||
CompositeTemplate,
|
||||
};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
mod imp {
|
||||
|
@ -58,7 +62,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
|
@ -123,16 +127,13 @@ mod imp {
|
|||
impl ListBoxRowImpl for ProviderRow {}
|
||||
}
|
||||
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct ProviderRow(ObjectSubclass<imp::ProviderRow>) @extends gtk::Widget, gtk::ListBoxRow;
|
||||
}
|
||||
|
||||
impl ProviderRow {
|
||||
pub fn new(provider: Provider) -> Self {
|
||||
glib::Object::new(Self::static_type(), &[("provider", &provider)])
|
||||
.expect("Failed to create ProviderRow")
|
||||
.downcast::<ProviderRow>()
|
||||
.expect("Created object is of wrong type")
|
||||
glib::Object::new(&[("provider", &provider)]).expect("Failed to create ProviderRow")
|
||||
}
|
||||
|
||||
fn provider(&self) -> Provider {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use gio::subclass::ObjectSubclass;
|
||||
use glib::{clone, glib_wrapper, Cast, ObjectExt, StaticType, ToValue};
|
||||
use gtk::WidgetExt;
|
||||
use glib::{clone, ObjectExt, ToValue};
|
||||
use gtk::{gio, glib, WidgetExt};
|
||||
use libhandy::ActionRowExt;
|
||||
|
||||
mod imp {
|
||||
use super::*;
|
||||
use glib::{glib_object_subclass, subclass};
|
||||
use glib::subclass;
|
||||
use gtk::subclass::prelude::*;
|
||||
use libhandy::subclass::action_row::ActionRowImpl;
|
||||
use std::cell::RefCell;
|
||||
|
@ -43,7 +43,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
|
@ -93,17 +93,14 @@ mod imp {
|
|||
impl ActionRowImpl for UrlRow {}
|
||||
}
|
||||
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct UrlRow(ObjectSubclass<imp::UrlRow>) @extends gtk::Widget, gtk::ListBoxRow, libhandy::ActionRow;
|
||||
}
|
||||
|
||||
impl UrlRow {
|
||||
#[allow(clippy::new_without_default)]
|
||||
pub fn new() -> Self {
|
||||
glib::Object::new(Self::static_type(), &[])
|
||||
.expect("Failed to create UrlRow")
|
||||
.downcast::<UrlRow>()
|
||||
.expect("Created object is of wrong type")
|
||||
glib::Object::new(&[]).expect("Failed to create UrlRow")
|
||||
}
|
||||
|
||||
fn setup_widgets(&self) {
|
||||
|
|
|
@ -6,9 +6,9 @@ use crate::{
|
|||
widgets::{accounts::QRCodePage, providers::ProvidersList, AccountAddDialog},
|
||||
window_state,
|
||||
};
|
||||
use gio::{prelude::*, subclass::ObjectSubclass};
|
||||
use glib::{clone, glib_object_subclass, glib_wrapper, signal::Inhibit, subclass::prelude::*};
|
||||
use gtk::{prelude::*, CompositeTemplate};
|
||||
use gio::subclass::ObjectSubclass;
|
||||
use glib::{clone, signal::Inhibit, subclass::prelude::*};
|
||||
use gtk::{gio, glib, prelude::*, CompositeTemplate};
|
||||
use gtk_macros::{action, get_action};
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
|
@ -54,7 +54,7 @@ mod imp {
|
|||
type Instance = subclass::simple::InstanceStruct<Self>;
|
||||
type Class = subclass::simple::ClassStruct<Self>;
|
||||
|
||||
glib_object_subclass!();
|
||||
glib::object_subclass!();
|
||||
|
||||
fn new() -> Self {
|
||||
let settings = gio::Settings::new(config::APP_ID);
|
||||
|
@ -92,17 +92,14 @@ mod imp {
|
|||
impl HdyApplicationWindowImpl for Window {}
|
||||
}
|
||||
|
||||
glib_wrapper! {
|
||||
glib::wrapper! {
|
||||
pub struct Window(ObjectSubclass<imp::Window>)
|
||||
@extends gtk::Widget, gtk::Window, gtk::ApplicationWindow, libhandy::ApplicationWindow, gio::ActionMap, gio::ActionGroup;
|
||||
}
|
||||
|
||||
impl Window {
|
||||
pub fn new(model: ProvidersModel, app: &Application) -> Self {
|
||||
let window = glib::Object::new(Window::static_type(), &[("application", app)])
|
||||
.unwrap()
|
||||
.downcast::<Window>()
|
||||
.unwrap();
|
||||
let window = glib::Object::new::<Window>(&[("application", app)]).unwrap();
|
||||
app.add_window(&window);
|
||||
|
||||
if config::PROFILE == "Devel" {
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
use crate::widgets::Window;
|
||||
use anyhow::Result;
|
||||
use gio::prelude::SettingsExt;
|
||||
use gtk::prelude::*;
|
||||
|
||||
pub fn load(window: &Window, settings: &gio::Settings) {
|
||||
pub fn load(window: &Window, settings: >k::gio::Settings) {
|
||||
let width = settings.get_int("window-width");
|
||||
let height = settings.get_int("window-height");
|
||||
|
||||
|
@ -17,7 +16,7 @@ pub fn load(window: &Window, settings: &gio::Settings) {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn save(window: &Window, settings: &gio::Settings) -> Result<()> {
|
||||
pub fn save(window: &Window, settings: >k::gio::Settings) -> Result<()> {
|
||||
let size = window.get_default_size();
|
||||
settings.set_int("window-width", size.0)?;
|
||||
settings.set_int("window-height", size.1)?;
|
||||
|
|
Loading…
Add table
Reference in a new issue