RR: Restructure dir
This commit is contained in:
parent
7b23d64a51
commit
a906b99632
@ -6,7 +6,7 @@ use adw::*;
|
|||||||
|
|
||||||
// application crates
|
// application crates
|
||||||
/// first setup crates
|
/// first setup crates
|
||||||
use crate::first_setup::first_setup::first_setup;
|
use crate::first_setup::*;
|
||||||
|
|
||||||
pub fn build_ui(app: &adw::Application) {
|
pub fn build_ui(app: &adw::Application) {
|
||||||
// setup glib
|
// setup glib
|
||||||
|
@ -1,74 +0,0 @@
|
|||||||
// 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)
|
|
||||||
|
|
||||||
use gettextrs::gettext;
|
|
||||||
|
|
||||||
//
|
|
||||||
use std::cell::RefCell;
|
|
||||||
use std::rc::Rc;
|
|
||||||
|
|
||||||
// carousel crates
|
|
||||||
use crate::first_setup::initial_carousel::initial_carousel;
|
|
||||||
use crate::first_setup::internet_carousel::internet_carousel;
|
|
||||||
use crate::first_setup::update_carousel::update_carousel;
|
|
||||||
use crate::first_setup::user_carousel::user_carousel;
|
|
||||||
use crate::first_setup::driver_carousel::driver_carousel;
|
|
||||||
use crate::first_setup::codec_carousel::codec_carousel;
|
|
||||||
use crate::first_setup::gameutils_carousel::gameutils_carousel;
|
|
||||||
use crate::first_setup::final_carousel::final_carousel;
|
|
||||||
|
|
||||||
pub fn first_setup(window: &adw::ApplicationWindow) {
|
|
||||||
let first_setup_carousel = adw::Carousel::builder()
|
|
||||||
.allow_long_swipes(false)
|
|
||||||
.allow_mouse_drag(false)
|
|
||||||
.allow_scroll_wheel(false)
|
|
||||||
.interactive(false)
|
|
||||||
.vexpand(true)
|
|
||||||
.hexpand(true)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let first_setup_carousel_indicator = adw::CarouselIndicatorDots::builder()
|
|
||||||
.carousel(&first_setup_carousel)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let first_setup_window_headerbar_back_button = gtk::Button::builder().label(gettext("first_setup_window_headerbar_back_button_label")).build();
|
|
||||||
|
|
||||||
let first_setup_window_headerbar = adw::HeaderBar::builder()
|
|
||||||
.show_start_title_buttons(true)
|
|
||||||
.title_widget(&first_setup_carousel_indicator)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let first_setup_window_toolbarview = adw::ToolbarView::builder()
|
|
||||||
.top_bar_style(ToolbarStyle::Flat)
|
|
||||||
.content(&first_setup_carousel)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let internet_connected = Rc::new(RefCell::new(false));
|
|
||||||
|
|
||||||
first_setup_window_headerbar.pack_start(&first_setup_window_headerbar_back_button);
|
|
||||||
first_setup_window_toolbarview.add_top_bar(&first_setup_window_headerbar);
|
|
||||||
|
|
||||||
first_setup_window_headerbar_back_button.connect_clicked(clone!(@weak first_setup_carousel => move |_| {
|
|
||||||
let first_setup_prev_page = first_setup_carousel.position() - 1.0;
|
|
||||||
first_setup_carousel.scroll_to(&first_setup_carousel.nth_page(first_setup_prev_page as u32), true)
|
|
||||||
}));
|
|
||||||
|
|
||||||
// CAROUSELS
|
|
||||||
|
|
||||||
// Initial Carousel
|
|
||||||
initial_carousel(&first_setup_carousel);
|
|
||||||
internet_carousel(&first_setup_carousel, &internet_connected, &window);
|
|
||||||
user_carousel(&first_setup_carousel);
|
|
||||||
update_carousel(&first_setup_carousel, &internet_connected, &window);
|
|
||||||
driver_carousel(&first_setup_carousel, &internet_connected);
|
|
||||||
codec_carousel(&first_setup_carousel, &internet_connected, &window);
|
|
||||||
gameutils_carousel(&first_setup_carousel, &internet_connected, &window);
|
|
||||||
final_carousel(&first_setup_carousel);
|
|
||||||
|
|
||||||
// Add file to window
|
|
||||||
window.set_content(Some(&first_setup_window_toolbarview))
|
|
||||||
}
|
|
@ -1,9 +1,83 @@
|
|||||||
pub mod first_setup;
|
// GTK crates
|
||||||
pub mod initial_carousel;
|
use adw::prelude::*;
|
||||||
pub mod internet_carousel;
|
use adw::*;
|
||||||
pub mod update_carousel;
|
use glib::*;
|
||||||
pub mod user_carousel;
|
/// Use all gtk4 libraries (gtk4 -> gtk because cargo)
|
||||||
pub mod driver_carousel;
|
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
|
||||||
pub mod codec_carousel;
|
|
||||||
pub mod gameutils_carousel;
|
use gettextrs::gettext;
|
||||||
pub mod final_carousel;
|
|
||||||
|
//
|
||||||
|
use std::cell::RefCell;
|
||||||
|
use std::rc::Rc;
|
||||||
|
|
||||||
|
// carousel crates
|
||||||
|
mod initial_carousel;
|
||||||
|
mod internet_carousel;
|
||||||
|
mod user_carousel;
|
||||||
|
mod update_carousel;
|
||||||
|
mod driver_carousel;
|
||||||
|
mod codec_carousel;
|
||||||
|
mod gameutils_carousel;
|
||||||
|
mod final_carousel;
|
||||||
|
|
||||||
|
use initial_carousel::*;
|
||||||
|
use internet_carousel::*;
|
||||||
|
use user_carousel::*;
|
||||||
|
use update_carousel::*;
|
||||||
|
use driver_carousel::*;
|
||||||
|
use codec_carousel::*;
|
||||||
|
use gameutils_carousel::*;
|
||||||
|
use final_carousel::*;
|
||||||
|
|
||||||
|
pub fn first_setup(window: &adw::ApplicationWindow) {
|
||||||
|
let first_setup_carousel = adw::Carousel::builder()
|
||||||
|
.allow_long_swipes(false)
|
||||||
|
.allow_mouse_drag(false)
|
||||||
|
.allow_scroll_wheel(false)
|
||||||
|
.interactive(false)
|
||||||
|
.vexpand(true)
|
||||||
|
.hexpand(true)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let first_setup_carousel_indicator = adw::CarouselIndicatorDots::builder()
|
||||||
|
.carousel(&first_setup_carousel)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let first_setup_window_headerbar_back_button = gtk::Button::builder().label(gettext("first_setup_window_headerbar_back_button_label")).build();
|
||||||
|
|
||||||
|
let first_setup_window_headerbar = adw::HeaderBar::builder()
|
||||||
|
.show_start_title_buttons(true)
|
||||||
|
.title_widget(&first_setup_carousel_indicator)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let first_setup_window_toolbarview = adw::ToolbarView::builder()
|
||||||
|
.top_bar_style(ToolbarStyle::Flat)
|
||||||
|
.content(&first_setup_carousel)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let internet_connected = Rc::new(RefCell::new(false));
|
||||||
|
|
||||||
|
first_setup_window_headerbar.pack_start(&first_setup_window_headerbar_back_button);
|
||||||
|
first_setup_window_toolbarview.add_top_bar(&first_setup_window_headerbar);
|
||||||
|
|
||||||
|
first_setup_window_headerbar_back_button.connect_clicked(clone!(@weak first_setup_carousel => move |_| {
|
||||||
|
let first_setup_prev_page = first_setup_carousel.position() - 1.0;
|
||||||
|
first_setup_carousel.scroll_to(&first_setup_carousel.nth_page(first_setup_prev_page as u32), true)
|
||||||
|
}));
|
||||||
|
|
||||||
|
// CAROUSELS
|
||||||
|
|
||||||
|
// Initial Carousel
|
||||||
|
initial_carousel(&first_setup_carousel);
|
||||||
|
internet_carousel(&first_setup_carousel, &internet_connected, &window);
|
||||||
|
user_carousel(&first_setup_carousel);
|
||||||
|
update_carousel(&first_setup_carousel, &internet_connected, &window);
|
||||||
|
driver_carousel(&first_setup_carousel, &internet_connected);
|
||||||
|
codec_carousel(&first_setup_carousel, &internet_connected, &window);
|
||||||
|
gameutils_carousel(&first_setup_carousel, &internet_connected, &window);
|
||||||
|
final_carousel(&first_setup_carousel);
|
||||||
|
|
||||||
|
// Add file to window
|
||||||
|
window.set_content(Some(&first_setup_window_toolbarview))
|
||||||
|
}
|
||||||
|
@ -203,32 +203,32 @@ pub fn user_carousel(first_setup_carousel: &adw::Carousel) {
|
|||||||
user_info_username.set_position(-1);
|
user_info_username.set_position(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut username_is_root = false;
|
let mut _username_is_root = false;
|
||||||
let mut username_is_pikaos = false;
|
let mut _username_is_pikaos = false;
|
||||||
let mut username_is_special = false;
|
let mut _username_is_special = false;
|
||||||
|
|
||||||
if user_info_username_string != "root" {
|
if user_info_username_string != "root" {
|
||||||
username_is_root=false;
|
_username_is_root=false;
|
||||||
} else {
|
} else {
|
||||||
error_label.set_label(&gettext("error_label_is_root_label"));
|
error_label.set_label(&gettext("error_label_is_root_label"));
|
||||||
username_is_root=true;
|
_username_is_root=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if user_info_username_string != "pikaos" {
|
if user_info_username_string != "pikaos" {
|
||||||
username_is_pikaos=false;
|
_username_is_pikaos=false;
|
||||||
} else {
|
} else {
|
||||||
error_label.set_label(&gettext("error_label_is_pikaos_label"));
|
error_label.set_label(&gettext("error_label_is_pikaos_label"));
|
||||||
username_is_pikaos=true;
|
_username_is_pikaos=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if only_alphanumeric(&user_info_username_string) {
|
if only_alphanumeric(&user_info_username_string) {
|
||||||
username_is_special=false;
|
_username_is_special=false;
|
||||||
} else {
|
} else {
|
||||||
error_label.set_label(&gettext("error_label_is_special_label"));
|
error_label.set_label(&gettext("error_label_is_special_label"));
|
||||||
username_is_special=true;
|
_username_is_special=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if username_is_root == false && username_is_pikaos == false && username_is_special == false {
|
if _username_is_root == false && _username_is_pikaos == false && _username_is_special == false {
|
||||||
error_label.set_visible(false);
|
error_label.set_visible(false);
|
||||||
if !user_info_username.text().is_empty() {
|
if !user_info_username.text().is_empty() {
|
||||||
*user_info_username_valid.borrow_mut()=true;
|
*user_info_username_valid.borrow_mut()=true;
|
Loading…
Reference in New Issue
Block a user