Resolve warnings in dashboard

This commit is contained in:
Savanni D'Gerinel 2025-01-19 12:58:54 -05:00
parent 35abcfcf28
commit f9e4dcd68a
4 changed files with 12 additions and 1 deletions

View File

@ -31,7 +31,9 @@ impl ApplicationWindow {
let provider = gtk::CssProvider::new(); let provider = gtk::CssProvider::new();
provider.load_from_data(&stylesheet); provider.load_from_data(&stylesheet);
#[allow(deprecated)]
let context = window.style_context(); let context = window.style_context();
#[allow(deprecated)]
context.add_provider(&provider, STYLE_PROVIDER_PRIORITY_USER); context.add_provider(&provider, STYLE_PROVIDER_PRIORITY_USER);
let layout = gtk::Box::builder() let layout = gtk::Box::builder()

View File

@ -36,6 +36,7 @@ impl Default for TransitClock {
s.set_draw_func({ s.set_draw_func({
let s = s.clone(); let s = s.clone();
move |_, context, width, height| { move |_, context, width, height| {
#[allow(deprecated)]
let style_context = WidgetExt::style_context(&s); let style_context = WidgetExt::style_context(&s);
let center_x = width as f64 / 2.; let center_x = width as f64 / 2.;
let center_y = height as f64 / 2.; let center_y = height as f64 / 2.;
@ -45,7 +46,9 @@ impl Default for TransitClock {
let sunrise = info.sunrise - NaiveTime::from_hms_opt(0, 0, 0).unwrap(); 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 sunset = info.sunset - NaiveTime::from_hms_opt(0, 0, 0).unwrap();
#[allow(deprecated)]
let night_color = style_context.lookup_color("dark_5").unwrap(); let night_color = style_context.lookup_color("dark_5").unwrap();
#[allow(deprecated)]
let day_color = style_context.lookup_color("blue_1").unwrap(); let day_color = style_context.lookup_color("blue_1").unwrap();
PieChart::new(&style_context) PieChart::new(&style_context)

View File

@ -1,5 +1,7 @@
use cairo::Context; use cairo::Context;
use gtk::{gdk::RGBA, prelude::*, StyleContext}; use gtk::{gdk::RGBA, prelude::*};
#[allow(deprecated)]
use gtk::StyleContext;
use std::f64::consts::PI; use std::f64::consts::PI;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
@ -27,7 +29,9 @@ pub struct PieChart {
} }
impl PieChart { impl PieChart {
#[allow(deprecated)]
pub fn new(style_context: &StyleContext) -> Self { pub fn new(style_context: &StyleContext) -> Self {
#[allow(deprecated)]
Self { Self {
rotation: 0., rotation: 0.,
wedges: vec![], wedges: vec![],

View File

@ -31,7 +31,9 @@ impl ApplicationWindow {
let provider = gtk::CssProvider::new(); let provider = gtk::CssProvider::new();
provider.load_from_data(&stylesheet); provider.load_from_data(&stylesheet);
#[allow(deprecated)]
let context = window.style_context(); let context = window.style_context();
#[allow(deprecated)]
context.add_provider(&provider, STYLE_PROVIDER_PRIORITY_USER); context.add_provider(&provider, STYLE_PROVIDER_PRIORITY_USER);
let layout = gtk::FlowBox::new(); let layout = gtk::FlowBox::new();