Totally rewrite dashboard as a GTK application #54

Merged
savanni merged 14 commits from dashboard-gtk into main 2023-08-09 18:14:01 +00:00
1 changed files with 0 additions and 59 deletions
Showing only changes of commit f403b8632f - Show all commits

View File

@ -271,70 +271,11 @@ impl TransitClock {
*s.imp().info.borrow_mut() = Some(sun_moon_info);
/*
s.set_draw_func({
let s = s.clone();
move |_, context, width, height| {
let info = s.imp().info.borrow();
context.set_source_rgba(0., 0., 0., 0.);
let _ = context.paint();
context.set_line_width(2.);
context.set_source_rgb(0.7, 0., 0.9);
context.arc(width as f64 / 2., height as f64 / 2., 200., 0., PI * 2.);
let _ = context.stroke();
if let Some(info) = info.deref() {
context.move_to(width as f64 / 2., height as f64 / 2.);
let full_day = Duration::days(1).num_seconds() as f64;
let sunrise = info.sunrise - NaiveTime::from_hms_opt(0, 0, 0).unwrap();
let sunset = info.sunset - NaiveTime::from_hms_opt(0, 0, 0).unwrap();
let start = (PI * 2.) * sunset.num_seconds() as f64 / full_day - (PI / 2.);
let end = (PI * 2.) * sunrise.num_seconds() as f64 / full_day - (PI / 2.);
context.set_source_rgb(0., 0.7, 0.9);
context.arc(width as f64 / 2., height as f64 / 2., 200., start, end);
let _ = context.fill();
}
(0..24).for_each(|hour| {
context.translate(width as f64 / 2., height as f64 / 2.);
context.rotate(PI / 12. * hour as f64);
context.move_to(185., 0.);
context.line_to(195., 0.);
context.identity_matrix();
let _ = context.stroke();
});
}
});
*/
s
}
}
/*
pub struct AppPrivate {
}
impl AppPrivate {
const NAME: &'static str = "App";
type Type = App;
type ParentType = adw::Application;
}
*/
pub fn main() {
/*
let runtime = Arc::new(
tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()
.unwrap(),
);
*/
let app = gtk::Application::builder()
.application_id("com.luminescent-dreams.dashboard")
.resource_base_path("/com/luminescent-dreams/dashboard")