From 7b23d64a51a0cf5275d811b1d54fc7e8c7d8f32f Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Sat, 10 Feb 2024 01:09:54 +0300 Subject: [PATCH] RR: Get rid of unused stuff --- Cargo.lock | 48 ++++++++++++++++++++++++++++++++++++++--- Cargo.toml | 1 + src/build_ui.rs | 17 ++------------- src/main.rs | 2 -- src/save_window_size.rs | 12 ----------- 5 files changed, 48 insertions(+), 32 deletions(-) delete mode 100644 src/save_window_size.rs diff --git a/Cargo.lock b/Cargo.lock index 6b25a7b..d99db77 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "advapi32-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + [[package]] name = "aho-corasick" version = "1.1.2" @@ -326,7 +336,7 @@ dependencies = [ "gobject-sys", "libc", "system-deps", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -571,7 +581,7 @@ dependencies = [ "objc", "objc-foundation", "regex", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -685,6 +695,7 @@ dependencies = [ "libadwaita", "os_pipe", "regex", + "user", ] [[package]] @@ -847,7 +858,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef" dependencies = [ "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -983,6 +994,16 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "user" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf6cb419c399f19f09569371dae7484a940923343d59bae4fc83026110813ea5" +dependencies = [ + "advapi32-sys", + "winapi 0.1.23", +] + [[package]] name = "version-compare" version = "0.1.1" @@ -995,6 +1016,21 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "winapi" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120f30006e6853fc574f57905eda83c232ebbf2c8a5690fdff509b7a7e3b88eb" +dependencies = [ + "libc", +] + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + [[package]] name = "winapi" version = "0.3.9" @@ -1005,6 +1041,12 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" diff --git a/Cargo.toml b/Cargo.toml index 7091995..262de08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,3 +13,4 @@ regex = "1.10.3" gettext-rs = { version = "0.7", features = ["gettext-system"] } duct = "0.13.7" os_pipe = "1.1.5" +user = "0.1.1" diff --git a/src/build_ui.rs b/src/build_ui.rs index ea03514..d5a750c 100644 --- a/src/build_ui.rs +++ b/src/build_ui.rs @@ -1,18 +1,17 @@ // GTK crates use adw::prelude::*; use adw::*; -use glib::*; +/// Use all gtk4 libraries (gtk4 -> gtk because cargo) +/// Use all libadwaita libraries (libadwaita -> adw because cargo) // application crates /// first setup crates use crate::first_setup::first_setup::first_setup; -use crate::save_window_size; pub fn build_ui(app: &adw::Application) { // setup glib gtk::glib::set_prgname(Some("PikaOS First Setup")); glib::set_application_name("PikaOS First Setup"); - let glib_settings = gio::Settings::new("com.github.pikaos-linux.pikafirstsetup"); // create the main Application window let window = adw::ApplicationWindow::builder() @@ -23,9 +22,6 @@ pub fn build_ui(app: &adw::Application) { // Add the box called "window_box" to it // Application icon .icon_name("com.github.pikaos-linux.pikafirstsetup") - // Get current size from glib - .default_width(glib_settings.int("window-width")) - .default_height(glib_settings.int("window-height")) // Minimum Size/Default .width_request(700) .height_request(500) @@ -37,15 +33,6 @@ pub fn build_ui(app: &adw::Application) { // build the window .build(); - // glib maximization - if glib_settings.boolean("is-maximized") == true { - window.maximize() - } - - // Connect the hiding of window to the save_window_size function and window destruction - window.connect_hide(clone!(@weak window => move |_| save_window_size(&window, &glib_settings))); - window.connect_hide(clone!(@weak window => move |_| window.destroy())); - first_setup(&window); // show the window diff --git a/src/main.rs b/src/main.rs index bf69686..b5520f6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,8 +14,6 @@ use config::{GETTEXT_PACKAGE, LOCALEDIR, APP_ID}; // application crates mod build_ui; use crate::build_ui::build_ui; -mod save_window_size; -use crate::save_window_size::save_window_size; /// first setup crates mod first_setup; diff --git a/src/save_window_size.rs b/src/save_window_size.rs deleted file mode 100644 index 161df86..0000000 --- a/src/save_window_size.rs +++ /dev/null @@ -1,12 +0,0 @@ -// GTK crates -use adw::prelude::*; -use adw::*; - -// Save current window size to glib -pub fn save_window_size(window: &adw::ApplicationWindow, glib_settings: &gio::Settings) { - let size = window.default_size(); - - let _ = glib_settings.set_int("window-width", size.0); - let _ = glib_settings.set_int("window-height", size.1); - let _ = glib_settings.set_boolean("is-maximized", window.is_maximized()); -}