diff --git a/data/com.github.pikaos-linux.pikawelcome.gschema.xml b/data/com.github.pikaos-linux.pikawelcome.gschema.xml index ae07e9d..1f73318 100644 --- a/data/com.github.pikaos-linux.pikawelcome.gschema.xml +++ b/data/com.github.pikaos-linux.pikawelcome.gschema.xml @@ -2,11 +2,11 @@ - 700 + 1400 Default window width - 500 + 700 Default window height diff --git a/src/welcome_content_page/mod.rs b/src/welcome_content_page/mod.rs index 9ba1c57..1e31228 100644 --- a/src/welcome_content_page/mod.rs +++ b/src/welcome_content_page/mod.rs @@ -11,9 +11,10 @@ use std::rc::Rc; mod welcome_page; use welcome_page::welcome_page; -use crate::config::{APP_GITHUB, APP_ICON, VERSION}; +use crate::config::{APP_GITHUB, APP_ICON, APP_ID, VERSION}; pub fn welcome_content_page(window: &adw::ApplicationWindow, content_box: >k::Box) { + let glib_settings = gio::Settings::new(APP_ID); let internet_connected = Rc::new(RefCell::new(false)); let (internet_loop_sender, internet_loop_receiver) = async_channel::unbounded(); @@ -88,6 +89,12 @@ pub fn welcome_content_page(window: &adw::ApplicationWindow, content_box: >k:: let sidebar_toggle_button = gtk::ToggleButton::builder() .icon_name("view-right-pane-symbolic") + .visible(false) + .build(); + + let startup_switch = gtk::CheckButton::builder() + .label(t!("startup_switch_label")) + .active(glib_settings.boolean("startup-show")) .build(); let _sidebar_toggle_button_binding = welcome_content_page_split_view @@ -98,16 +105,23 @@ pub fn welcome_content_page(window: &adw::ApplicationWindow, content_box: >k:: let welcome_content_page_split_view_breakpoint = adw::Breakpoint::new(BreakpointCondition::new_length(BreakpointConditionLengthType::MaxWidth, 600.0, LengthUnit::Px)); welcome_content_page_split_view_breakpoint.add_setter(&welcome_content_page_split_view, "collapsed", &true.to_value()); + welcome_content_page_split_view_breakpoint.add_setter(&startup_switch, "visible", &false.to_value()); + welcome_content_page_split_view_breakpoint.add_setter(&sidebar_toggle_button, "visible", &true.to_value()); window.add_breakpoint(welcome_content_page_split_view_breakpoint); window_title_bar.pack_end(&credits_button); window_title_bar.pack_start(&sidebar_toggle_button); + window_title_bar.pack_start(&startup_switch); content_box.append(&welcome_content_page_split_view); credits_button .connect_clicked(clone!(@weak credits_button => move |_| credits_window.present())); + startup_switch.connect_toggled(clone!(@weak startup_switch => move |_| { + let _ = glib_settings.set_boolean("startup-show", startup_switch.is_active()); + })); + let internet_connected_status = internet_connected.clone(); let internet_loop_context = MainContext::default(); diff --git a/src/welcome_content_page/welcome_page/mod.rs b/src/welcome_content_page/welcome_page/mod.rs index b26f917..8bdfb59 100644 --- a/src/welcome_content_page/welcome_page/mod.rs +++ b/src/welcome_content_page/welcome_page/mod.rs @@ -12,14 +12,6 @@ pub fn welcome_page( welcome_content_page_stack: >k::Stack, internet_connected: &Rc> ) { - let welcome_page_box = gtk::Box::builder() - // that puts items vertically - .orientation(Orientation::Vertical) - .valign(gtk::Align::Center) - .hexpand(true) - .vexpand(true) - .build(); - let welcome_page_text = adw::StatusPage::builder() .icon_name(DISTRO_ICON) .title(t!("welcome_page_text_title")) @@ -27,7 +19,15 @@ pub fn welcome_page( .build(); welcome_page_text.add_css_class("compact"); - welcome_page_box.append(&welcome_page_text); + let welcome_page_scroll = gtk::ScrolledWindow::builder() + // that puts items vertically + .valign(gtk::Align::Center) + .hexpand(true) + .vexpand(true) + .child(&welcome_page_text) + .propagate_natural_width(true) + .propagate_natural_height(true) + .build(); - welcome_content_page_stack.add_titled(&welcome_page_box, Some("welcome_page"), &t!("welcome_page_title").to_string()); + welcome_content_page_stack.add_titled(&welcome_page_scroll, Some("welcome_page"), &t!("welcome_page_title").to_string()); } \ No newline at end of file