diff --git a/Cargo.toml b/Cargo.toml index e246f9c..7c401e6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ readme = "README.md" keywords = ["GUI", "process", "viewer", "gtk"] [dependencies] -gtk = { version = "0.6", package = "gtk4" } +gtk = { version = "0.7", package = "gtk4" } sysinfo = "0.28.2" libc = "0.2" serde = "1.0" diff --git a/src/main.rs b/src/main.rs index 8c1b264..06cd4ec 100755 --- a/src/main.rs +++ b/src/main.rs @@ -230,7 +230,7 @@ pub struct RequiredForSettings { } fn setup_timeout(rfs: &RequiredForSettings) { - let (ready_tx, ready_rx) = glib::MainContext::channel(glib::PRIORITY_DEFAULT); + let (ready_tx, ready_rx) = glib::MainContext::channel(glib::Priority::default()); let sys = &rfs.sys; let process_dialogs = &rfs.process_dialogs; @@ -250,7 +250,7 @@ fn setup_timeout(rfs: &RequiredForSettings) { ); ready_rx.attach(None, - glib::clone!(@weak sys, @weak list_store, @weak process_dialogs => @default-return glib::Continue(true), move |_: bool| { + glib::clone!(@weak sys, @weak list_store, @weak process_dialogs => @default-return glib::ControlFlow::Continue, move |_: bool| { // first part, deactivate sorting let sorted = TreeSortableExtManual::sort_column_id(&list_store); list_store.set_unsorted(); @@ -277,12 +277,12 @@ fn setup_timeout(rfs: &RequiredForSettings) { panic!("failed to lock sys to refresh UI"); } dialogs.retain(|x| !x.need_remove()); - glib::Continue(true) + glib::ControlFlow::Continue })); } fn setup_network_timeout(rfs: &RequiredForSettings) { - let (ready_tx, ready_rx) = glib::MainContext::channel(glib::PRIORITY_DEFAULT); + let (ready_tx, ready_rx) = glib::MainContext::channel(glib::Priority::default()); let network_refresh_timeout = &rfs.network_refresh_timeout; let network_tab = &rfs.network_tab; @@ -303,13 +303,13 @@ fn setup_network_timeout(rfs: &RequiredForSettings) { ready_rx.attach(None, glib::clone!(@weak sys, @weak network_tab => @default-panic, move |_: bool| { network_tab.borrow_mut().update_networks(&sys.lock().expect("failed to lock to update networks")); - glib::Continue(true) + glib::ControlFlow::Continue }) ); } fn setup_system_timeout(rfs: &RequiredForSettings, settings: &Rc>) { - let (ready_tx, ready_rx) = glib::MainContext::channel(glib::PRIORITY_DEFAULT); + let (ready_tx, ready_rx) = glib::MainContext::channel(glib::Priority::default()); let system_refresh_timeout = &rfs.system_refresh_timeout; let sys = &rfs.sys; @@ -336,7 +336,7 @@ fn setup_system_timeout(rfs: &RequiredForSettings, settings: &Rc move |g, _| { let mut is_active = false; @@ -562,7 +562,7 @@ fn build_ui(application: >k::Application) { let temperature = gio::SimpleAction::new_stateful( "temperature", None, - settings.borrow().display_fahrenheit.to_variant(), + &settings.borrow().display_fahrenheit.to_variant(), ); temperature.connect_activate(move |g, _| { let mut is_active = false; @@ -684,7 +684,7 @@ graph_widget { } "#, ); - gtk::StyleContext::add_provider_for_display( + gtk::style_context_add_provider_for_display( &gdk::Display::default().expect("Could not connect to a display."), &provider, gtk::STYLE_PROVIDER_PRIORITY_APPLICATION, diff --git a/src/network_dialog.rs b/src/network_dialog.rs index 9050e61..b87c88a 100644 --- a/src/network_dialog.rs +++ b/src/network_dialog.rs @@ -1,5 +1,5 @@ use gtk::prelude::*; -use gtk::{glib, EventControllerKey, Inhibit}; +use gtk::{glib, EventControllerKey}; use sysinfo::NetworkExt; @@ -422,21 +422,21 @@ pub fn create_network_dialog( popup.close(); })); popup.connect_close_request( - glib::clone!(@weak to_be_removed => @default-return Inhibit(false), move |_| { + glib::clone!(@weak to_be_removed => @default-return glib::Propagation::Proceed, move |_| { to_be_removed.set(true); - Inhibit(false) + glib::Propagation::Proceed }), ); let event_controller = EventControllerKey::new(); event_controller.connect_key_pressed(glib::clone!( @weak popup, @weak to_be_removed - => @default-return Inhibit(false), move |_, key, _, _modifier| { + => @default-return glib::Propagation::Proceed, move |_, key, _, _modifier| { if key == gtk::gdk::Key::Escape { popup.close(); to_be_removed.set(true); } - Inhibit(false) + glib::Propagation::Proceed } )); popup.add_controller(event_controller); diff --git a/src/process_dialog.rs b/src/process_dialog.rs index 3841920..8d7db10 100644 --- a/src/process_dialog.rs +++ b/src/process_dialog.rs @@ -1,5 +1,5 @@ use gtk::prelude::*; -use gtk::{glib, pango, EventControllerKey, Inhibit}; +use gtk::{glib, pango, EventControllerKey}; use sysinfo::{self, Pid, ProcessExt}; use std::cell::{Cell, RefCell}; @@ -393,19 +393,19 @@ pub fn create_process_dialog(process: &sysinfo::Process, total_memory: u64) -> P to_be_removed.set(true); })); popup.connect_close_request( - glib::clone!(@weak to_be_removed => @default-return Inhibit(false), move |_| { + glib::clone!(@weak to_be_removed => @default-return glib::Propagation::Proceed, move |_| { to_be_removed.set(true); - Inhibit(false) + glib::Propagation::Proceed }), ); let event_controller = EventControllerKey::new(); event_controller.connect_key_pressed( - glib::clone!(@weak popup, @weak to_be_removed => @default-return Inhibit(false), move |_, key, _, _modifier| { + glib::clone!(@weak popup, @weak to_be_removed => @default-return glib::Propagation::Proceed, move |_, key, _, _modifier| { if key == gtk::gdk::Key::Escape { popup.close(); to_be_removed.set(true); } - Inhibit(false) + glib::Propagation::Proceed }), ); popup.add_controller(event_controller);