From d9212b22853418014d974949655605759451a562 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Wed, 10 Aug 2022 10:48:20 -0400 Subject: [PATCH] feat: init adwaita --- Cargo.lock | 42 +++++++++++++++++++ applets/cosmic-app-list/Cargo.toml | 1 + applets/cosmic-app-list/src/main.rs | 3 ++ applets/cosmic-applet-audio/Cargo.toml | 1 + applets/cosmic-applet-audio/src/main.rs | 2 + applets/cosmic-applet-battery/Cargo.toml | 1 + applets/cosmic-applet-battery/src/main.rs | 3 ++ applets/cosmic-applet-graphics/Cargo.toml | 1 + applets/cosmic-applet-graphics/src/main.rs | 5 ++- applets/cosmic-applet-network/Cargo.toml | 1 + applets/cosmic-applet-network/src/main.rs | 5 ++- .../cosmic-applet-notifications/Cargo.toml | 1 + .../cosmic-applet-notifications/src/main.rs | 5 ++- applets/cosmic-applet-power/Cargo.toml | 1 + applets/cosmic-applet-power/src/main.rs | 3 ++ applets/cosmic-applet-status-area/Cargo.toml | 1 + applets/cosmic-applet-status-area/src/main.rs | 5 ++- applets/cosmic-applet-time/Cargo.toml | 1 + applets/cosmic-applet-time/src/main.rs | 5 ++- applets/cosmic-applet-workspaces/Cargo.toml | 1 + applets/cosmic-applet-workspaces/src/main.rs | 3 ++ applets/cosmic-panel-button/Cargo.toml | 1 + applets/cosmic-panel-button/src/main.rs | 3 ++ 23 files changed, 85 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 466aa980..88b1060e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -288,6 +288,7 @@ dependencies = [ "gtk4", "i18n-embed", "i18n-embed-fl", + "libadwaita", "libcosmic", "log", "nix 0.24.2", @@ -312,6 +313,7 @@ dependencies = [ "futures", "futures-util", "gtk4", + "libadwaita", "libcosmic-applet", "libcosmic-widgets", "libpulse-binding", @@ -331,6 +333,7 @@ version = "0.1.0" dependencies = [ "futures", "gtk4", + "libadwaita", "libcosmic-applet", "relm4", "zbus", @@ -341,6 +344,7 @@ name = "cosmic-applet-graphics" version = "0.1.0" dependencies = [ "gtk4", + "libadwaita", "libcosmic-applet", "once_cell", "relm4-macros", @@ -356,6 +360,7 @@ dependencies = [ "futures-util", "gtk4", "itertools", + "libadwaita", "libcosmic-applet", "libcosmic-widgets", "once_cell", @@ -372,6 +377,7 @@ dependencies = [ "cascade", "futures", "gtk4", + "libadwaita", "libcosmic-applet", "once_cell", "relm4-macros", @@ -387,6 +393,7 @@ version = "0.1.0" dependencies = [ "futures-util", "gtk4", + "libadwaita", "libcosmic-applet", "logind-zbus", "nix 0.24.2", @@ -403,6 +410,7 @@ dependencies = [ "cascade", "futures", "gtk4", + "libadwaita", "libcosmic-applet", "once_cell", "serde", @@ -419,6 +427,7 @@ dependencies = [ "chrono", "futures", "gtk4", + "libadwaita", "libcosmic-applet", "once_cell", "serde", @@ -440,6 +449,7 @@ dependencies = [ "gtk4", "i18n-embed", "i18n-embed-fl", + "libadwaita", "log", "nix 0.24.2", "once_cell", @@ -473,6 +483,7 @@ dependencies = [ "gtk4", "i18n-embed", "i18n-embed-fl", + "libadwaita", "once_cell", "pretty_env_logger", "rust-embed", @@ -1490,6 +1501,37 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "libadwaita" +version = "0.2.0" +source = "git+https://gitlab.gnome.org/World/Rust/libadwaita-rs#01881b0c9f67ed5a351b78fcd9b172fee246fdd4" +dependencies = [ + "futures-channel", + "gdk-pixbuf", + "gdk4", + "gio 0.16.0", + "glib 0.16.0", + "gtk4", + "libadwaita-sys", + "libc", + "once_cell", + "pango", +] + +[[package]] +name = "libadwaita-sys" +version = "0.2.0" +source = "git+https://gitlab.gnome.org/World/Rust/libadwaita-rs#01881b0c9f67ed5a351b78fcd9b172fee246fdd4" +dependencies = [ + "gdk4-sys", + "gio-sys 0.16.0", + "glib-sys 0.16.0", + "gobject-sys 0.16.0", + "gtk4-sys", + "libc", + "system-deps", +] + [[package]] name = "libc" version = "0.2.126" diff --git a/applets/cosmic-app-list/Cargo.toml b/applets/cosmic-app-list/Cargo.toml index 80ef2052..8e1a0d2e 100644 --- a/applets/cosmic-app-list/Cargo.toml +++ b/applets/cosmic-app-list/Cargo.toml @@ -9,6 +9,7 @@ cosmic-panel-config = {git = "https://github.com/pop-os/cosmic-panel", features cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", default-features = false, features = ["client"] } cascade = "1.0.0" gtk4 = { git = "https://github.com/gtk-rs/gtk4-rs", features = ["v4_4"] } +adw = { git = "https://gitlab.gnome.org/World/Rust/libadwaita-rs", package = "libadwaita"} gio = { git = "https://github.com/gtk-rs/gtk-rs-core" } libcosmic = { git = "https://github.com/pop-os/libcosmic", branch = "relm4-next" } relm4-macros = { git = "https://github.com/Relm4/Relm4.git", branch = "next" } diff --git a/applets/cosmic-app-list/src/main.rs b/applets/cosmic-app-list/src/main.rs index 40e96138..1b9da460 100644 --- a/applets/cosmic-app-list/src/main.rs +++ b/applets/cosmic-app-list/src/main.rs @@ -49,6 +49,9 @@ fn load_css() { } fn main() { + let _ = gtk4::init(); + adw::init(); + // Initialize logger pretty_env_logger::init(); glib::set_application_name("Cosmic Dock App List"); diff --git a/applets/cosmic-applet-audio/Cargo.toml b/applets/cosmic-applet-audio/Cargo.toml index 700b69ab..f43ad86e 100644 --- a/applets/cosmic-applet-audio/Cargo.toml +++ b/applets/cosmic-applet-audio/Cargo.toml @@ -20,6 +20,7 @@ relm4 = { git = "https://github.com/relm4/relm4", branch = "next", features = [" relm4-macros = { git = "https://github.com/relm4/relm4", branch = "next" } once_cell = "1.10.0" gtk4 = { git = "https://github.com/gtk-rs/gtk4-rs", features = ["v4_2"] } +adw = { git = "https://gitlab.gnome.org/World/Rust/libadwaita-rs", package = "libadwaita"} async-io = "1.6.0" [features] diff --git a/applets/cosmic-applet-audio/src/main.rs b/applets/cosmic-applet-audio/src/main.rs index d0f58052..a5dccf8e 100644 --- a/applets/cosmic-applet-audio/src/main.rs +++ b/applets/cosmic-applet-audio/src/main.rs @@ -36,6 +36,8 @@ use tokio::runtime::Runtime; static RT: Lazy = Lazy::new(|| Runtime::new().expect("failed to build tokio runtime")); fn main() { + let _ = gtk4::init(); + adw::init(); let application = Application::new( None, ApplicationFlags::default(), diff --git a/applets/cosmic-applet-battery/Cargo.toml b/applets/cosmic-applet-battery/Cargo.toml index e987efa7..6d2cc3c1 100644 --- a/applets/cosmic-applet-battery/Cargo.toml +++ b/applets/cosmic-applet-battery/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [dependencies] futures = "0.3" gtk4 = { git = "https://github.com/gtk-rs/gtk4-rs" } +adw = { git = "https://gitlab.gnome.org/World/Rust/libadwaita-rs", package = "libadwaita"} libcosmic-applet = { path = "../../libcosmic-applet" } relm4 = { git = "https://github.com/relm4/relm4", branch = "next", features = ["macros"] } zbus = { version = "2", no-default-features = true } diff --git a/applets/cosmic-applet-battery/src/main.rs b/applets/cosmic-applet-battery/src/main.rs index 78966b5f..8c7876ab 100644 --- a/applets/cosmic-applet-battery/src/main.rs +++ b/applets/cosmic-applet-battery/src/main.rs @@ -357,6 +357,9 @@ impl SimpleComponent for AppModel { } fn main() { + let _ = gtk4::init(); + adw::init(); + let app = RelmApp::with_app(Application::new( None, ApplicationFlags::default(), diff --git a/applets/cosmic-applet-graphics/Cargo.toml b/applets/cosmic-applet-graphics/Cargo.toml index 9fa48c03..129a83dd 100644 --- a/applets/cosmic-applet-graphics/Cargo.toml +++ b/applets/cosmic-applet-graphics/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" [dependencies] gtk4 = { git = "https://github.com/gtk-rs/gtk4-rs", features = ["v4_2"] } +adw = { git = "https://gitlab.gnome.org/World/Rust/libadwaita-rs", package = "libadwaita"} libcosmic-applet = { path = "../../libcosmic-applet" } once_cell = "1.9.0" relm4-macros = { git = "https://github.com/Relm4/Relm4.git", branch = "next" } diff --git a/applets/cosmic-applet-graphics/src/main.rs b/applets/cosmic-applet-graphics/src/main.rs index f29ce638..7985b077 100644 --- a/applets/cosmic-applet-graphics/src/main.rs +++ b/applets/cosmic-applet-graphics/src/main.rs @@ -41,8 +41,9 @@ fn row_clicked(_: &ListBox, row: &ListBoxRow) { } fn main() { - gtk4::init().unwrap(); - + let _ = gtk4::init(); + adw::init(); + let provider = gtk4::CssProvider::new(); provider.load_from_data(include_bytes!("style.css")); gtk4::StyleContext::add_provider_for_display( diff --git a/applets/cosmic-applet-network/Cargo.toml b/applets/cosmic-applet-network/Cargo.toml index f7b83b82..eec0ccf4 100644 --- a/applets/cosmic-applet-network/Cargo.toml +++ b/applets/cosmic-applet-network/Cargo.toml @@ -8,6 +8,7 @@ license = "GPL-3.0-or-later" cosmic-dbus-networkmanager = { git = "https://github.com/pop-os/dbus-settings-bindings" } futures-util = "0.3.21" gtk4 = { git = "https://github.com/gtk-rs/gtk4-rs" } +adw = { git = "https://gitlab.gnome.org/World/Rust/libadwaita-rs", package = "libadwaita"} itertools = "0.10.3" once_cell = "1.9.0" relm4-macros = { git = "https://github.com/Relm4/Relm4.git", branch = "next" } diff --git a/applets/cosmic-applet-network/src/main.rs b/applets/cosmic-applet-network/src/main.rs index 20ca0bf6..90b61464 100644 --- a/applets/cosmic-applet-network/src/main.rs +++ b/applets/cosmic-applet-network/src/main.rs @@ -14,8 +14,9 @@ use tokio::runtime::Runtime; static RT: Lazy = Lazy::new(|| Runtime::new().expect("failed to build tokio runtime")); fn main() { - gtk4::init().unwrap(); - + let _ = gtk4::init(); + adw::init(); + view! { window = libcosmic_applet::AppletWindow { set_title: Some("COSMIC Network Applet"), diff --git a/applets/cosmic-applet-notifications/Cargo.toml b/applets/cosmic-applet-notifications/Cargo.toml index a6c752a4..24b4317c 100644 --- a/applets/cosmic-applet-notifications/Cargo.toml +++ b/applets/cosmic-applet-notifications/Cargo.toml @@ -8,6 +8,7 @@ license = "GPL-3.0-or-later" cascade = "1" futures = "0.3" gtk4 = { git = "https://github.com/gtk-rs/gtk4-rs" } +adw = { git = "https://gitlab.gnome.org/World/Rust/libadwaita-rs", package = "libadwaita"} libcosmic-applet = { path = "../../libcosmic-applet" } once_cell = "1.12" relm4-macros = { git = "https://github.com/Relm4/Relm4.git", branch = "next" } diff --git a/applets/cosmic-applet-notifications/src/main.rs b/applets/cosmic-applet-notifications/src/main.rs index e31923ed..116d8542 100644 --- a/applets/cosmic-applet-notifications/src/main.rs +++ b/applets/cosmic-applet-notifications/src/main.rs @@ -12,8 +12,9 @@ mod notifications; use notifications::Notifications; fn main() { - gtk4::init().unwrap(); - + let _ = gtk4::init(); + adw::init(); + // XXX Implement DBus service somewhere other than applet? let notifications = Notifications::new(); diff --git a/applets/cosmic-applet-power/Cargo.toml b/applets/cosmic-applet-power/Cargo.toml index 78e434d4..030259ec 100644 --- a/applets/cosmic-applet-power/Cargo.toml +++ b/applets/cosmic-applet-power/Cargo.toml @@ -7,6 +7,7 @@ license = "GPL-3.0-or-later" [dependencies] futures-util = "0.3.21" gtk4 = { git = "https://github.com/gtk-rs/gtk4-rs" } +adw = { git = "https://gitlab.gnome.org/World/Rust/libadwaita-rs", package = "libadwaita"} libcosmic-applet = { path = "../../libcosmic-applet" } logind-zbus = "3.0.1" nix = "0.24.1" diff --git a/applets/cosmic-applet-power/src/main.rs b/applets/cosmic-applet-power/src/main.rs index a4241d72..6316637e 100644 --- a/applets/cosmic-applet-power/src/main.rs +++ b/applets/cosmic-applet-power/src/main.rs @@ -15,6 +15,9 @@ use tokio::runtime::Runtime; static RT: Lazy = Lazy::new(|| Runtime::new().expect("failed to build tokio runtime")); fn main() { + let _ = gtk4::init(); + adw::init(); + let application = gtk4::Application::new( None, ApplicationFlags::default(), diff --git a/applets/cosmic-applet-status-area/Cargo.toml b/applets/cosmic-applet-status-area/Cargo.toml index e61daf1a..317b043f 100644 --- a/applets/cosmic-applet-status-area/Cargo.toml +++ b/applets/cosmic-applet-status-area/Cargo.toml @@ -8,6 +8,7 @@ license = "GPL-3.0-or-later" cascade = "1" futures = "0.3" gtk4 = { git = "https://github.com/gtk-rs/gtk4-rs" } +adw = { git = "https://gitlab.gnome.org/World/Rust/libadwaita-rs", package = "libadwaita"} libcosmic-applet = { path = "../../libcosmic-applet" } once_cell = "1.12" serde = "1" diff --git a/applets/cosmic-applet-status-area/src/main.rs b/applets/cosmic-applet-status-area/src/main.rs index 29cfa29e..d3f55b93 100644 --- a/applets/cosmic-applet-status-area/src/main.rs +++ b/applets/cosmic-applet-status-area/src/main.rs @@ -10,8 +10,9 @@ mod status_notifier_watcher; use status_area::StatusArea; fn main() { - gtk4::init().unwrap(); - + let _ = gtk4::init(); + adw::init(); + // XXX Implement DBus service somewhere other than applet? glib::MainContext::default().spawn_local(status_notifier_watcher::start()); diff --git a/applets/cosmic-applet-time/Cargo.toml b/applets/cosmic-applet-time/Cargo.toml index 3f869646..4e9edf20 100644 --- a/applets/cosmic-applet-time/Cargo.toml +++ b/applets/cosmic-applet-time/Cargo.toml @@ -9,6 +9,7 @@ cascade = "1" chrono = "0.4" futures = "0.3" gtk4 = { git = "https://github.com/gtk-rs/gtk4-rs", features = [ "v4_6" ] } +adw = { git = "https://gitlab.gnome.org/World/Rust/libadwaita-rs", package = "libadwaita"} libcosmic-applet = { path = "../../libcosmic-applet" } once_cell = "1.12" serde = "1" diff --git a/applets/cosmic-applet-time/src/main.rs b/applets/cosmic-applet-time/src/main.rs index bbb29413..1cf5b4c7 100644 --- a/applets/cosmic-applet-time/src/main.rs +++ b/applets/cosmic-applet-time/src/main.rs @@ -6,8 +6,9 @@ mod time_button; use time_button::TimeButton; fn main() { - gtk4::init().unwrap(); - + let _ = gtk4::init(); + adw::init(); + cascade! { libcosmic_applet::AppletWindow::new(); ..set_child(Some(&TimeButton::new())); diff --git a/applets/cosmic-applet-workspaces/Cargo.toml b/applets/cosmic-applet-workspaces/Cargo.toml index 29715148..a3928e9a 100644 --- a/applets/cosmic-applet-workspaces/Cargo.toml +++ b/applets/cosmic-applet-workspaces/Cargo.toml @@ -11,6 +11,7 @@ cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", default cosmic-panel-config = { git = "https://github.com/pop-os/cosmic-panel", features = ["gtk4"] } cascade = "1.0.0" gtk4 = { git = "https://github.com/gtk-rs/gtk4-rs", features = ["v4_4"] } +adw = { git = "https://gitlab.gnome.org/World/Rust/libadwaita-rs", package = "libadwaita"} once_cell = "1.9.0" pretty_env_logger = "0.4" anyhow = "1.0.50" diff --git a/applets/cosmic-applet-workspaces/src/main.rs b/applets/cosmic-applet-workspaces/src/main.rs index 7a415e52..a1e457f0 100644 --- a/applets/cosmic-applet-workspaces/src/main.rs +++ b/applets/cosmic-applet-workspaces/src/main.rs @@ -45,6 +45,9 @@ fn load_css() { } fn main() { + let _ = gtk4::init(); + adw::init(); + // Initialize logger pretty_env_logger::init(); glib::set_application_name(ID); diff --git a/applets/cosmic-panel-button/Cargo.toml b/applets/cosmic-panel-button/Cargo.toml index 4c8f05b0..8655f509 100644 --- a/applets/cosmic-panel-button/Cargo.toml +++ b/applets/cosmic-panel-button/Cargo.toml @@ -8,6 +8,7 @@ edition = "2021" cosmic-panel-config = {git = "https://github.com/pop-os/cosmic-panel", features = ["gtk4"] } cascade = "1.0.0" gtk4 = { git = "https://github.com/gtk-rs/gtk4-rs", features = ["v4_4"] } +adw = { git = "https://gitlab.gnome.org/World/Rust/libadwaita-rs", package = "libadwaita"} once_cell = "1.9.0" pretty_env_logger = "0.4" anyhow = "1.0.50" diff --git a/applets/cosmic-panel-button/src/main.rs b/applets/cosmic-panel-button/src/main.rs index eb2b243e..a678b401 100644 --- a/applets/cosmic-panel-button/src/main.rs +++ b/applets/cosmic-panel-button/src/main.rs @@ -37,6 +37,9 @@ fn load_css() { } fn main() { + let _ = gtk4::init(); + adw::init(); + // Initialize logger pretty_env_logger::init(); glib::set_application_name("Cosmic Panel App Button");