Replace deprecated functions with updated ones, except for FileChooserNative

This commit is contained in:
Ward from fusion-voyager-3 2024-01-19 14:37:40 +03:00
parent ebbd61e84f
commit ffaaac84ce
7 changed files with 20 additions and 21 deletions

View File

@ -127,5 +127,5 @@ pub fn build_ui(app: &adw::Application) {
//let content_stack_clone2 = content_stack.clone(); //let content_stack_clone2 = content_stack.clone();
//bottom_next_button.connect_clicked(move |_| content_stack_clone.set_visible_child(&content_stack_clone.visible_child().expect("null").next_sibling().unwrap())); //bottom_next_button.connect_clicked(move |_| content_stack_clone.set_visible_child(&content_stack_clone.visible_child().expect("null").next_sibling().unwrap()));
//bottom_back_button.connect_clicked(move |_| content_stack_clone2.set_visible_child(&content_stack_clone2.visible_child().expect("null").prev_sibling().unwrap())); //bottom_back_button.connect_clicked(move |_| content_stack_clone2.set_visible_child(&content_stack_clone2.visible_child().expect("null").prev_sibling().unwrap()));
window.show(); window.present();
} }

View File

@ -146,19 +146,19 @@ pub fn keyboard_page(content_stack: &gtk::Stack) {
keyboard_selection_expander_row.add_row(&keyboard_selection_expander_row_viewport); keyboard_selection_expander_row.add_row(&keyboard_selection_expander_row_viewport);
let mut current_keyboard_cli = Command::new("localectl") let current_keyboard_cli = Command::new("localectl")
.arg("status") .arg("status")
.stdin(Stdio::piped()) .stdin(Stdio::piped())
.stdout(Stdio::piped()) .stdout(Stdio::piped())
.spawn() .spawn()
.unwrap_or_else(|e| panic!("failed {}", e)); .unwrap_or_else(|e| panic!("failed {}", e));
let mut current_keyboard_grep = Command::new("grep") let current_keyboard_grep = Command::new("grep")
.arg("X11 Layout") .arg("X11 Layout")
.stdin(Stdio::from(current_keyboard_cli.stdout.unwrap())) // Pipe through. .stdin(Stdio::from(current_keyboard_cli.stdout.unwrap())) // Pipe through.
.stdout(Stdio::piped()) .stdout(Stdio::piped())
.spawn() .spawn()
.unwrap(); .unwrap();
let mut current_keyboard_cut = Command::new("cut") let current_keyboard_cut = Command::new("cut")
.arg("-d:") .arg("-d:")
.arg("-f2") .arg("-f2")
.stdin(Stdio::from(current_keyboard_grep.stdout.unwrap())) .stdin(Stdio::from(current_keyboard_grep.stdout.unwrap()))
@ -169,14 +169,14 @@ pub fn keyboard_page(content_stack: &gtk::Stack) {
let current_keyboard_output = current_keyboard_cut.wait_with_output().unwrap(); let current_keyboard_output = current_keyboard_cut.wait_with_output().unwrap();
let current_keyboard = str::from_utf8(&current_keyboard_output.stdout).unwrap().trim(); let current_keyboard = str::from_utf8(&current_keyboard_output.stdout).unwrap().trim();
let mut keyboard_layout_cli = Command::new("localectl") let keyboard_layout_cli = Command::new("localectl")
.arg("list-x11-keymap-layouts") .arg("list-x11-keymap-layouts")
.stdin(Stdio::piped()) .stdin(Stdio::piped())
.stdout(Stdio::piped()) .stdout(Stdio::piped())
.spawn() .spawn()
.unwrap_or_else(|e| panic!("failed {}", e)); .unwrap_or_else(|e| panic!("failed {}", e));
let keyboard_layout_stdout = keyboard_layout_cli.stdout.as_mut().expect("could not get stdout"); let keyboard_layout_stdout = keyboard_layout_cli.stdout.expect("could not get stdout");
let keyboard_layout_reader = BufReader::new(keyboard_layout_stdout); let keyboard_layout_reader = BufReader::new(keyboard_layout_stdout);
for keyboard_layout in keyboard_layout_reader.lines() { for keyboard_layout in keyboard_layout_reader.lines() {

View File

@ -152,27 +152,27 @@ pub fn language_page(content_stack: &gtk::Stack) {
None => panic!("$LANG is not set") None => panic!("$LANG is not set")
}; };
let mut locale_cli = Command::new("locale") let locale_cli = Command::new("locale")
.arg("-a") .arg("-a")
.stdin(Stdio::piped()) .stdin(Stdio::piped())
.stdout(Stdio::piped()) .stdout(Stdio::piped())
.spawn() .spawn()
.unwrap_or_else(|e| panic!("failed {}", e)); .unwrap_or_else(|e| panic!("failed {}", e));
let mut locale_cli_cut = Command::new("cut") let locale_cli_cut = Command::new("cut")
.arg("-d.") .arg("-d.")
.arg("-f1") .arg("-f1")
.stdin(Stdio::from(locale_cli.stdout.unwrap())) // Pipe through. .stdin(Stdio::from(locale_cli.stdout.unwrap())) // Pipe through.
.stdout(Stdio::piped()) .stdout(Stdio::piped())
.spawn() .spawn()
.unwrap(); .unwrap();
let mut locale_cli_sort = Command::new("sort") let locale_cli_sort = Command::new("sort")
.arg("-u") .arg("-u")
.stdin(Stdio::from(locale_cli_cut.stdout.unwrap())) .stdin(Stdio::from(locale_cli_cut.stdout.unwrap()))
.stdout(Stdio::piped()) .stdout(Stdio::piped())
.spawn() .spawn()
.unwrap(); .unwrap();
let locale_reader = BufReader::new(locale_cli_sort.stdout.as_mut().expect("could not get stdout")); let locale_reader = BufReader::new(locale_cli_sort.stdout.expect("could not get stdout"));
for locale in locale_reader.lines() { for locale in locale_reader.lines() {
let locale = locale.unwrap(); let locale = locale.unwrap();

View File

@ -30,7 +30,7 @@ fn main() {
application.connect_startup(|app| { application.connect_startup(|app| {
// The CSS "magic" happens here. // The CSS "magic" happens here.
let provider = CssProvider::new(); let provider = CssProvider::new();
provider.load_from_data(include_str!("style.css")); provider.load_from_string(include_str!("style.css"));
// We give the CssProvided to the default screen so the CSS rules we added // We give the CssProvided to the default screen so the CSS rules we added
// can be applied to our window. // can be applied to our window.
gtk::style_context_add_provider_for_display( gtk::style_context_add_provider_for_display(

View File

@ -278,14 +278,14 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: &gtk::S
devices_selection_expander_row.add_row(&devices_selection_expander_row_viewport); devices_selection_expander_row.add_row(&devices_selection_expander_row_viewport);
let mut partition_method_automatic_get_devices_cli = Command::new("pkexec") let partition_method_automatic_get_devices_cli = Command::new("pkexec")
.arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh") .arg("/usr/lib/pika/pika-installer-gtk4/scripts/partition-utility.sh")
.arg("get_block_devices") .arg("get_block_devices")
.stdin(Stdio::piped()) .stdin(Stdio::piped())
.stdout(Stdio::piped()) .stdout(Stdio::piped())
.spawn() .spawn()
.unwrap_or_else(|e| panic!("failed {}", e)); .unwrap_or_else(|e| panic!("failed {}", e));
let partition_method_automatic_get_devices_reader = BufReader::new(partition_method_automatic_get_devices_cli.stdout.as_mut().expect("could not get stdout")); let partition_method_automatic_get_devices_reader = BufReader::new(partition_method_automatic_get_devices_cli.stdout.expect("could not get stdout"));
let partition_method_automatic_status_label = gtk::Label::builder() let partition_method_automatic_status_label = gtk::Label::builder()
.label("No Disk specified") .label("No Disk specified")
@ -320,10 +320,10 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: &gtk::S
if device_button.is_active() == true { if device_button.is_active() == true {
devices_selection_expander_row.set_title(&device); devices_selection_expander_row.set_title(&device);
if device_size > 39000000000.0 { if device_size > 39000000000.0 {
partition_method_automatic_status_label.hide(); partition_method_automatic_status_label.set_visible(false);
bottom_next_button.set_sensitive(true); bottom_next_button.set_sensitive(true);
} else { } else {
partition_method_automatic_status_label.show(); partition_method_automatic_status_label.set_visible(true);
partition_method_automatic_status_label.set_label("Disk Size too small, PikaOS needs 40GB Disk"); partition_method_automatic_status_label.set_label("Disk Size too small, PikaOS needs 40GB Disk");
bottom_next_button.set_sensitive(false); bottom_next_button.set_sensitive(false);
} }
@ -519,7 +519,7 @@ pub fn partitioning_page(window: &adw::ApplicationWindow, content_stack: &gtk::S
// clone partition_method_manual_chroot_dir_file_dialog as rust becuase glib breaks it show function for some reason // clone partition_method_manual_chroot_dir_file_dialog as rust becuase glib breaks it show function for some reason
let partition_method_manual_chroot_dir_file_dialog_clone = partition_method_manual_chroot_dir_file_dialog.clone(); let partition_method_manual_chroot_dir_file_dialog_clone = partition_method_manual_chroot_dir_file_dialog.clone();
partition_method_manual_chroot_dir_button.connect_clicked(move |_| { partition_method_manual_chroot_dir_button.connect_clicked(move |_| {
partition_method_manual_chroot_dir_file_dialog_clone.show(); partition_method_manual_chroot_dir_file_dialog_clone.set_visible(true);
}); });
partition_method_manual_chroot_dir_file_dialog.connect_response(clone!(@weak partition_method_manual_chroot_dir_file_dialog => move |_, response| { partition_method_manual_chroot_dir_file_dialog.connect_response(clone!(@weak partition_method_manual_chroot_dir_file_dialog => move |_, response| {

View File

@ -13,7 +13,7 @@ pub fn save_window_size(window: &adw::ApplicationWindow, glib_settings: &gio::Se
let size = window.default_size(); let size = window.default_size();
glib_settings.set_int("window-width", size.0); let _ = glib_settings.set_int("window-width", size.0);
glib_settings.set_int("window-height", size.1); let _ = glib_settings.set_int("window-height", size.1);
glib_settings.set_boolean("is-maximized", window.is_maximized()); let _ = glib_settings.set_boolean("is-maximized", window.is_maximized());
} }

View File

@ -165,6 +165,5 @@ pub fn welcome_page(window: &adw::ApplicationWindow, content_stack: &gtk::Stack)
content_stack.add_titled(&welcome_main_box, Some("welcome_page"), "Welcome"); content_stack.add_titled(&welcome_main_box, Some("welcome_page"), "Welcome");
install_media_button.connect_clicked(clone!(@weak content_stack => move |_| content_stack.set_visible_child_name("language_page"))); install_media_button.connect_clicked(clone!(@weak content_stack => move |_| content_stack.set_visible_child_name("language_page")));
live_media_button.connect_clicked(clone!(@weak window => move |_| window.hide())); live_media_button.connect_clicked(clone!(@weak window => move |_| window.close()));
} }