RR: Get rid of unused stuff

This commit is contained in:
Ward from fusion-voyager-3 2024-02-10 01:09:54 +03:00
parent 84fbf4f747
commit 7b23d64a51
5 changed files with 48 additions and 32 deletions

48
Cargo.lock generated
View File

@ -2,6 +2,16 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 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]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "1.1.2" version = "1.1.2"
@ -326,7 +336,7 @@ dependencies = [
"gobject-sys", "gobject-sys",
"libc", "libc",
"system-deps", "system-deps",
"winapi", "winapi 0.3.9",
] ]
[[package]] [[package]]
@ -571,7 +581,7 @@ dependencies = [
"objc", "objc",
"objc-foundation", "objc-foundation",
"regex", "regex",
"winapi", "winapi 0.3.9",
] ]
[[package]] [[package]]
@ -685,6 +695,7 @@ dependencies = [
"libadwaita", "libadwaita",
"os_pipe", "os_pipe",
"regex", "regex",
"user",
] ]
[[package]] [[package]]
@ -847,7 +858,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef" checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef"
dependencies = [ dependencies = [
"libc", "libc",
"winapi", "winapi 0.3.9",
] ]
[[package]] [[package]]
@ -983,6 +994,16 @@ version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 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]] [[package]]
name = "version-compare" name = "version-compare"
version = "0.1.1" version = "0.1.1"
@ -995,6 +1016,21 @@ version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 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]] [[package]]
name = "winapi" name = "winapi"
version = "0.3.9" version = "0.3.9"
@ -1005,6 +1041,12 @@ dependencies = [
"winapi-x86_64-pc-windows-gnu", "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]] [[package]]
name = "winapi-i686-pc-windows-gnu" name = "winapi-i686-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"

View File

@ -13,3 +13,4 @@ regex = "1.10.3"
gettext-rs = { version = "0.7", features = ["gettext-system"] } gettext-rs = { version = "0.7", features = ["gettext-system"] }
duct = "0.13.7" duct = "0.13.7"
os_pipe = "1.1.5" os_pipe = "1.1.5"
user = "0.1.1"

View File

@ -1,18 +1,17 @@
// GTK crates // GTK crates
use adw::prelude::*; use adw::prelude::*;
use adw::*; use adw::*;
use glib::*; /// Use all gtk4 libraries (gtk4 -> gtk because cargo)
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
// application crates // application crates
/// first setup crates /// first setup crates
use crate::first_setup::first_setup::first_setup; use crate::first_setup::first_setup::first_setup;
use crate::save_window_size;
pub fn build_ui(app: &adw::Application) { pub fn build_ui(app: &adw::Application) {
// setup glib // setup glib
gtk::glib::set_prgname(Some("PikaOS First Setup")); gtk::glib::set_prgname(Some("PikaOS First Setup"));
glib::set_application_name("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 // create the main Application window
let window = adw::ApplicationWindow::builder() let window = adw::ApplicationWindow::builder()
@ -23,9 +22,6 @@ pub fn build_ui(app: &adw::Application) {
// Add the box called "window_box" to it // Add the box called "window_box" to it
// Application icon // Application icon
.icon_name("com.github.pikaos-linux.pikafirstsetup") .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 // Minimum Size/Default
.width_request(700) .width_request(700)
.height_request(500) .height_request(500)
@ -37,15 +33,6 @@ pub fn build_ui(app: &adw::Application) {
// build the window // build the window
.build(); .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); first_setup(&window);
// show the window // show the window

View File

@ -14,8 +14,6 @@ use config::{GETTEXT_PACKAGE, LOCALEDIR, APP_ID};
// application crates // application crates
mod build_ui; mod build_ui;
use crate::build_ui::build_ui; use crate::build_ui::build_ui;
mod save_window_size;
use crate::save_window_size::save_window_size;
/// first setup crates /// first setup crates
mod first_setup; mod first_setup;

View File

@ -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());
}