libadw widgets

This commit is contained in:
Ward from fusion-voyager-3 2024-01-17 16:24:47 +03:00
parent 72d2da4853
commit d0f996fde4
2 changed files with 41 additions and 45 deletions

View File

@ -116,10 +116,6 @@ pub fn keyboard_page(content_stack: &gtk::Stack) {
keyboard_selection_text.add_css_class("medium_sized_text");
let keyboard_selection_expander_row = adw::ExpanderRow::builder()
.margin_top(15)
.margin_bottom(15)
.margin_start(15)
.margin_end(15)
.title("No Keyboard Layout selected")
.build();
@ -135,6 +131,16 @@ pub fn keyboard_page(content_stack: &gtk::Stack) {
.orientation(Orientation::Vertical)
.build();
let keyboard_selection_expander_row_viewport_listbox = gtk::ListBox::builder()
.selection_mode(SelectionMode::None)
.margin_top(15)
.margin_bottom(15)
.margin_start(15)
.margin_end(15)
.build();
keyboard_selection_expander_row_viewport_listbox.add_css_class("boxed-list");
keyboard_selection_expander_row_viewport_listbox.append(&keyboard_selection_expander_row);
keyboard_selection_expander_row_viewport.set_child(Some(&keyboard_selection_expander_row_viewport_box));
keyboard_selection_expander_row.add_row(&keyboard_selection_expander_row_viewport);
@ -184,7 +190,7 @@ pub fn keyboard_page(content_stack: &gtk::Stack) {
// / keyboard_selection_box appends
//// add text and and entry to keyboard page selections
keyboard_selection_box.append(&keyboard_selection_text);
keyboard_selection_box.append(&keyboard_selection_expander_row);
keyboard_selection_box.append(&keyboard_selection_expander_row_viewport_listbox);
// / keyboard_header_box appends
//// Add the keyboard page header text and icon

View File

@ -116,45 +116,50 @@ pub fn language_page(content_stack: &gtk::Stack) {
.build();
language_selection_text.add_css_class("medium_sized_text");
let language_selection_expander_row = gtk::Entry::builder()
.margin_top(15)
.margin_start(15)
.margin_end(15)
let language_selection_expander_row = adw::ExpanderRow::builder()
.title("No locale selected")
.build();
let null_checkbutton = gtk::CheckButton::builder()
.valign(Align::Center)
.can_focus(false)
.label("No locale selected")
.build();
let language_selection_expander_row_viewport = gtk::ScrolledWindow::builder()
.height_request(200)
.margin_bottom(15)
.margin_start(15)
.margin_end(15)
.build();
let language_selection_expander_row_viewport_box = gtk::ListBox::builder()
.selection_mode(SelectionMode::None)
let language_selection_expander_row_viewport_box = gtk::Box::builder()
.orientation(Orientation::Vertical)
.build();
language_selection_expander_row_viewport_box.add_css_class("boxed-list");
language_selection_expander_row_viewport.set_child(Some(&language_selection_expander_row_viewport_box));
language_selection_expander_row.set_placeholder_text(Some("No locale selected"));
let language_selection_expander_row_viewport_listbox = gtk::ListBox::builder()
.selection_mode(SelectionMode::None)
.margin_top(15)
.margin_bottom(15)
.margin_start(15)
.margin_end(15)
.build();
language_selection_expander_row_viewport_listbox.add_css_class("boxed-list");
language_selection_expander_row_viewport_listbox.append(&language_selection_expander_row);
let null_action_row = adw::ActionRow::builder()
.title("No locale selected")
.activatable_widget(&null_checkbutton)
.build();
null_action_row.add_prefix(&null_checkbutton);
language_selection_expander_row.add_row(&language_selection_expander_row_viewport);
language_selection_expander_row_viewport_box.append(&null_action_row);
language_selection_expander_row_viewport_box.append(&null_checkbutton);
let null_checkbutton_clone = null_checkbutton.clone();
let language_selection_expander_row_clone2 = language_selection_expander_row.clone();
let bottom_next_button_clone = bottom_next_button.clone();
null_checkbutton.connect_toggled(move |_| {
if null_checkbutton_clone.is_active() == true {
language_selection_expander_row_clone2.set_title("No locale selected");
bottom_next_button_clone.set_sensitive(false);
}
});
let mut locale_cli = Command::new("locale")
.arg("-a")
.stdin(Stdio::piped())
@ -174,46 +179,31 @@ pub fn language_page(content_stack: &gtk::Stack) {
.stdout(Stdio::piped())
.spawn()
.unwrap();
let locale_reader = BufReader::new(locale_cli_sort.stdout.as_mut().expect("could not get stdout"));
for locale in locale_reader.lines() {
let locale = locale.unwrap();
let locale_checkbutton = gtk::CheckButton::builder()
.valign(Align::Center)
.can_focus(false)
.label(locale.clone())
.build();
locale_checkbutton.set_group(Some(&null_checkbutton));
let locale_action_row = adw::ActionRow::builder()
.title(locale.clone())
.activatable_widget(&locale_checkbutton)
.build();
locale_action_row.add_prefix(&locale_checkbutton);
language_selection_expander_row_viewport_box.append(&locale_action_row);
language_selection_expander_row_viewport_box.append(&locale_checkbutton);
let language_selection_expander_row_clone = language_selection_expander_row.clone();
let locale_checkbutton_clone = locale_checkbutton.clone();
let bottom_next_button_clone2 = bottom_next_button.clone();
locale_checkbutton.connect_toggled(move |_| {
if locale_checkbutton_clone.is_active() == true {
language_selection_expander_row_clone.set_text(&locale);
language_selection_expander_row_clone.set_title(&locale);
bottom_next_button_clone2.set_sensitive(true);
}
});
}
null_checkbutton.connect_toggled(move |_| {
if null_checkbutton_clone.is_active() == true {
language_selection_expander_row_clone2.set_text(" ");
bottom_next_button_clone.set_sensitive(false);
}
});
// / language_selection_box appends
//// add text and and entry to language page selections
language_selection_box.append(&language_selection_text);
language_selection_box.append(&language_selection_expander_row);
language_selection_box.append(&language_selection_expander_row_viewport);
language_selection_box.append(&language_selection_expander_row_viewport_listbox);
// / language_header_box appends
//// Add the language page header text and icon