Use libcosmic-applet in time applet

Need to get button height right.
This commit is contained in:
Ian Douglas Scott 2022-07-05 16:52:04 -07:00
parent 765e3af815
commit ee142903bb
10 changed files with 24 additions and 75 deletions

View file

@ -1,3 +1,4 @@
use cascade::cascade;
use gtk4::{glib, prelude::*};
mod deref_cell;
@ -7,25 +8,11 @@ use time_button::TimeButton;
fn main() {
gtk4::init().unwrap();
let provider = gtk4::CssProvider::new();
provider.load_from_data(include_bytes!("style.css"));
gtk4::StyleContext::add_provider_for_display(
&gtk4::gdk::Display::default().expect("Could not connect to a display."),
&provider,
gtk4::STYLE_PROVIDER_PRIORITY_APPLICATION,
);
let time_button = TimeButton::new();
gtk4::Window::builder()
.decorated(false)
.child(&time_button)
.resizable(false)
.width_request(1)
.height_request(1)
.css_classes(vec!["root_window".to_string()])
.build()
.show();
cascade! {
libcosmic_applet::AppletWindow::new();
..set_child(Some(&TimeButton::new()));
..show();
};
let main_loop = glib::MainLoop::new(None, false);
main_loop.run();