fix scroll rounding

This commit is contained in:
Ward from fusion-voyager-3 2024-08-08 00:53:45 +03:00
parent 9a37dcccb9
commit ceac6592bd
5 changed files with 71 additions and 62 deletions

View File

@ -26,21 +26,17 @@ pub fn eula_page(
let eula_selection_text_view = gtk::TextView::builder() let eula_selection_text_view = gtk::TextView::builder()
.hexpand(true) .hexpand(true)
.vexpand(true) .vexpand(true)
.margin_top(15)
.margin_bottom(15)
.margin_start(15)
.margin_end(15)
.editable(false) .editable(false)
.buffer(&eula_buffer) .buffer(&eula_buffer)
.build(); .build();
eula_selection_text_view.add_css_class("rounded-all-25-with-padding");
let eula_selection_text_scroll = gtk::ScrolledWindow::builder() let eula_selection_text_scroll = gtk::ScrolledWindow::builder()
.vexpand(true) .vexpand(true)
.hexpand(true) .hexpand(true)
.has_frame(true)
.child(&eula_selection_text_view) .child(&eula_selection_text_view)
.build(); .build();
eula_selection_text_scroll.add_css_class("round-all-scroll");
let eula_accept_checkbutton = gtk::CheckButton::builder() let eula_accept_checkbutton = gtk::CheckButton::builder()
.margin_top(15) .margin_top(15)

View File

@ -25,26 +25,21 @@ pub fn keyboard_page(
let null_checkbutton = gtk::CheckButton::builder() let null_checkbutton = gtk::CheckButton::builder()
.build(); .build();
let keyboard_selection_row_viewport_listbox = gtk::ListBox::builder()
.selection_mode(gtk::SelectionMode::None)
.build();
keyboard_selection_row_viewport_listbox.add_css_class("boxed-list");
keyboard_selection_row_viewport_listbox.add_css_class("round-border-only");
let keyboard_selection_row_viewport = let keyboard_selection_row_viewport =
gtk::ScrolledWindow::builder() gtk::ScrolledWindow::builder()
.vexpand(true) .vexpand(true)
.hexpand(true) .hexpand(true)
.has_frame(true)
.child(&keyboard_selection_row_viewport_listbox)
.build(); .build();
let keyboard_selection_row_viewport_box = gtk::ListBox::builder().build(); keyboard_selection_row_viewport.add_css_class("round-border-only-top-with-padding");
keyboard_selection_row_viewport_box.add_css_class("boxed-list");
keyboard_selection_row_viewport
.set_child(Some(&keyboard_selection_row_viewport_box));
let keyboard_selection_row_viewport_listbox = gtk::ListBox::builder()
.selection_mode(gtk::SelectionMode::None)
.margin_top(15)
.margin_bottom(15)
.margin_start(15)
.margin_end(15)
.build();
keyboard_selection_row_viewport_listbox.add_css_class("boxed-list");
let keyboard_search_bar = gtk::SearchEntry::builder() let keyboard_search_bar = gtk::SearchEntry::builder()
.hexpand(true) .hexpand(true)
@ -109,7 +104,7 @@ pub fn keyboard_page(
.build(); .build();
keymap_row.add_prefix(&keymap_checkbutton); keymap_row.add_prefix(&keymap_checkbutton);
keymap_checkbutton.set_group(Some(&null_checkbutton)); keymap_checkbutton.set_group(Some(&null_checkbutton));
keyboard_selection_row_viewport_box.append(&keymap_row); keyboard_selection_row_viewport_listbox.append(&keymap_row);
keymap_checkbutton.connect_toggled(clone!( keymap_checkbutton.connect_toggled(clone!(
#[weak] #[weak]
keymap_checkbutton, keymap_checkbutton,
@ -159,10 +154,10 @@ pub fn keyboard_page(
#[weak] #[weak]
keyboard_search_bar, keyboard_search_bar,
#[weak] #[weak]
keyboard_selection_row_viewport_box, keyboard_selection_row_viewport_listbox,
move |_| move |_|
{ {
let mut counter = keyboard_selection_row_viewport_box.first_child(); let mut counter = keyboard_selection_row_viewport_listbox.first_child();
while let Some(row) = counter { while let Some(row) = counter {
if row.widget_name() == "AdwActionRow" { if row.widget_name() == "AdwActionRow" {
if !keyboard_search_bar.text().is_empty() { if !keyboard_search_bar.text().is_empty() {

View File

@ -28,26 +28,21 @@ pub fn language_page(
let null_checkbutton = gtk::CheckButton::builder() let null_checkbutton = gtk::CheckButton::builder()
.build(); .build();
let language_selection_row_viewport_listbox = gtk::ListBox::builder()
.selection_mode(gtk::SelectionMode::None)
.build();
language_selection_row_viewport_listbox.add_css_class("boxed-list");
language_selection_row_viewport_listbox.add_css_class("round-all-scroll");
let language_selection_row_viewport = let language_selection_row_viewport =
gtk::ScrolledWindow::builder() gtk::ScrolledWindow::builder()
.vexpand(true) .vexpand(true)
.hexpand(true) .hexpand(true)
.has_frame(true)
.child(&language_selection_row_viewport_listbox)
.build(); .build();
let language_selection_row_viewport_box = gtk::ListBox::builder().build(); language_selection_row_viewport.add_css_class("round-all-scroll");
language_selection_row_viewport_box.add_css_class("boxed-list");
language_selection_row_viewport
.set_child(Some(&language_selection_row_viewport_box));
let language_selection_row_viewport_listbox = gtk::ListBox::builder()
.selection_mode(gtk::SelectionMode::None)
.margin_top(15)
.margin_bottom(15)
.margin_start(15)
.margin_end(15)
.build();
language_selection_row_viewport_listbox.add_css_class("boxed-list");
let language_search_bar = gtk::SearchEntry::builder() let language_search_bar = gtk::SearchEntry::builder()
.hexpand(true) .hexpand(true)
@ -246,7 +241,7 @@ pub fn language_page(
.build(); .build();
locale_row.add_prefix(&locale_checkbutton); locale_row.add_prefix(&locale_checkbutton);
locale_checkbutton.set_group(Some(&null_checkbutton)); locale_checkbutton.set_group(Some(&null_checkbutton));
language_selection_row_viewport_box.append(&locale_row); language_selection_row_viewport_listbox.append(&locale_row);
locale_checkbutton.connect_toggled(clone!( locale_checkbutton.connect_toggled(clone!(
#[weak] #[weak]
locale_checkbutton, locale_checkbutton,
@ -281,10 +276,10 @@ pub fn language_page(
#[weak] #[weak]
language_search_bar, language_search_bar,
#[weak] #[weak]
language_selection_row_viewport_box, language_selection_row_viewport_listbox,
move |_| move |_|
{ {
let mut counter = language_selection_row_viewport_box.first_child(); let mut counter = language_selection_row_viewport_listbox.first_child();
while let Some(row) = counter { while let Some(row) = counter {
if row.widget_name() == "AdwActionRow" { if row.widget_name() == "AdwActionRow" {
if !language_search_bar.text().is_empty() { if !language_search_bar.text().is_empty() {

View File

@ -51,9 +51,37 @@
border-bottom-left-radius: 0px; border-bottom-left-radius: 0px;
} }
.round-border-only-top-with-padding {
border-top-right-radius: 15px;
border-top-left-radius: 15px;
border-bottom-right-radius: 0px;
border-bottom-left-radius: 0px;
padding-top: 3px;
padding-right: 3px;
padding-left: 3px;
}
.round-all-scroll {
border-top-right-radius: 15px;
border-top-left-radius: 15px;
border-bottom-right-radius: 15px;
border-bottom-left-radius: 15px;
padding-top: 3px;
padding-right: 3px;
padding-left: 3px;
padding-bottom: 3px;
}
.round-border-only-bottom { .round-border-only-bottom {
border-top-right-radius: 0px; border-top-right-radius: 0px;
border-top-left-radius: 0px; border-top-left-radius: 0px;
border-bottom-right-radius: 15px; border-bottom-right-radius: 15px;
border-bottom-left-radius: 15px; border-bottom-left-radius: 15px;
} }
.no-round-borders {
border-top-right-radius: 0px;
border-top-left-radius: 0px;
border-bottom-right-radius: 0px;
border-bottom-left-radius: 0px;
}

View File

@ -25,26 +25,21 @@ pub fn timezone_page(
let null_checkbutton = gtk::CheckButton::builder() let null_checkbutton = gtk::CheckButton::builder()
.build(); .build();
let timezone_selection_row_viewport_listbox = gtk::ListBox::builder()
.selection_mode(gtk::SelectionMode::None)
.build();
timezone_selection_row_viewport_listbox.add_css_class("boxed-list");
timezone_selection_row_viewport_listbox.add_css_class("round-all-scroll");
let timezone_selection_row_viewport = let timezone_selection_row_viewport =
gtk::ScrolledWindow::builder() gtk::ScrolledWindow::builder()
.vexpand(true) .vexpand(true)
.hexpand(true) .hexpand(true)
.has_frame(true)
.child(&timezone_selection_row_viewport_listbox)
.build(); .build();
let timezone_selection_row_viewport_box = gtk::ListBox::builder().build(); timezone_selection_row_viewport.add_css_class("round-all-scroll");
timezone_selection_row_viewport_box.add_css_class("boxed-list");
timezone_selection_row_viewport
.set_child(Some(&timezone_selection_row_viewport_box));
let timezone_selection_row_viewport_listbox = gtk::ListBox::builder()
.selection_mode(gtk::SelectionMode::None)
.margin_top(15)
.margin_bottom(15)
.margin_start(15)
.margin_end(15)
.build();
timezone_selection_row_viewport_listbox.add_css_class("boxed-list");
let timezone_search_bar = gtk::SearchEntry::builder() let timezone_search_bar = gtk::SearchEntry::builder()
.hexpand(true) .hexpand(true)
@ -94,7 +89,7 @@ pub fn timezone_page(
.build(); .build();
timezone_row.add_prefix(&timezone_checkbutton); timezone_row.add_prefix(&timezone_checkbutton);
timezone_checkbutton.set_group(Some(&null_checkbutton)); timezone_checkbutton.set_group(Some(&null_checkbutton));
timezone_selection_row_viewport_box.append(&timezone_row); timezone_selection_row_viewport_listbox.append(&timezone_row);
timezone_checkbutton.connect_toggled( timezone_checkbutton.connect_toggled(
clone!( clone!(
#[weak] #[weak]
@ -126,10 +121,10 @@ pub fn timezone_page(
#[weak] #[weak]
timezone_search_bar, timezone_search_bar,
#[weak] #[weak]
timezone_selection_row_viewport_box, timezone_selection_row_viewport_listbox,
move |_| move |_|
{ {
let mut counter = timezone_selection_row_viewport_box.first_child(); let mut counter = timezone_selection_row_viewport_listbox.first_child();
while let Some(row) = counter { while let Some(row) = counter {
if row.widget_name() == "AdwActionRow" { if row.widget_name() == "AdwActionRow" {
if !timezone_search_bar.text().is_empty() { if !timezone_search_bar.text().is_empty() {