From fa65cef03fc5a56d93a69f8f1ffa410c591740ea Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Sat, 10 Aug 2024 13:36:17 +0300 Subject: [PATCH] Fix scrolling --- .idea/workspace.xml | 13 ++++++++++++- src/bin/gui/apt_update_page/mod.rs | 5 +++-- src/bin/gui/apt_update_page/process.rs | 15 ++++++++++----- src/bin/gui/build_ui/mod.rs | 2 +- src/bin/gui/flatpak_update_page/mod.rs | 5 +++-- src/bin/gui/style.css | 11 +++++++++++ 6 files changed, 40 insertions(+), 11 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d866d14..c3ea3e4 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -9,6 +9,11 @@ + + + + + diff --git a/src/bin/gui/apt_update_page/mod.rs b/src/bin/gui/apt_update_page/mod.rs index 6c69826..0429666 100644 --- a/src/bin/gui/apt_update_page/mod.rs +++ b/src/bin/gui/apt_update_page/mod.rs @@ -99,15 +99,15 @@ pub fn apt_update_page( let packages_boxedlist = ListBox::builder() .selection_mode(SelectionMode::None) - .margin_end(15) - .margin_start(15) .sensitive(false) .build(); packages_boxedlist.add_css_class("boxed-list"); + packages_boxedlist.add_css_class("round-all-scroll"); let packages_viewport = ScrolledWindow::builder() .vexpand(true) .hexpand(true) + .has_frame(true) .margin_bottom(15) .margin_top(15) .margin_end(15) @@ -115,6 +115,7 @@ pub fn apt_update_page( .height_request(390) .child(&packages_boxedlist) .build(); + packages_viewport.add_css_class("round-all-scroll"); let packages_no_viewport_page = adw::StatusPage::builder() .icon_name("emblem-default-symbolic") diff --git a/src/bin/gui/apt_update_page/process.rs b/src/bin/gui/apt_update_page/process.rs index 3a9faf7..def792a 100644 --- a/src/bin/gui/apt_update_page/process.rs +++ b/src/bin/gui/apt_update_page/process.rs @@ -334,18 +334,23 @@ fn apt_confirm_window( .buffer(&apt_remove_confirm_text_buffer) .hexpand(true) .vexpand(true) - .margin_top(15) - .margin_bottom(15) - .margin_start(15) - .margin_end(15) .editable(false) .build(); + let apt_remove_confirm_text_viewport = gtk::ScrolledWindow::builder() + .vexpand(true) + .hexpand(true) + .has_frame(true) + .hscrollbar_policy(PolicyType::Never) + .child(&apt_remove_confirm_text_view) + .build(); + apt_remove_confirm_text_viewport.add_css_class("round-all-scroll"); + let apt_remove_confirm_dialog = adw::MessageDialog::builder() .transient_for(&window) .heading(t!("apt_remove_confirm_dialog_heading")) .body(t!("apt_remove_confirm_dialog_body")) - .extra_child(&apt_remove_confirm_text_view) + .extra_child(&apt_remove_confirm_text_viewport) .build(); apt_remove_confirm_dialog.add_response( diff --git a/src/bin/gui/build_ui/mod.rs b/src/bin/gui/build_ui/mod.rs index de29b68..777d8f0 100644 --- a/src/bin/gui/build_ui/mod.rs +++ b/src/bin/gui/build_ui/mod.rs @@ -252,7 +252,7 @@ pub fn build_ui(app: &Application) { flatpak_ran_once, ))); } - ));g + )); apt_update_view_stack_bin.set_child(Some(&apt_update_page::apt_update_page( window.clone(), diff --git a/src/bin/gui/flatpak_update_page/mod.rs b/src/bin/gui/flatpak_update_page/mod.rs index e9b597e..38d5535 100644 --- a/src/bin/gui/flatpak_update_page/mod.rs +++ b/src/bin/gui/flatpak_update_page/mod.rs @@ -161,15 +161,15 @@ pub fn flatpak_update_page( let packages_boxedlist = ListBox::builder() .selection_mode(SelectionMode::None) - .margin_end(15) - .margin_start(15) .sensitive(false) .build(); packages_boxedlist.add_css_class("boxed-list"); + packages_boxedlist.add_css_class("round-all-scroll"); let packages_viewport = ScrolledWindow::builder() .vexpand(true) .hexpand(true) + .has_frame(true) .margin_bottom(15) .margin_top(15) .margin_end(15) @@ -177,6 +177,7 @@ pub fn flatpak_update_page( .height_request(390) .child(&packages_boxedlist) .build(); + packages_viewport.add_css_class("round-all-scroll"); let packages_no_viewport_page = adw::StatusPage::builder() .icon_name("emblem-default-symbolic") diff --git a/src/bin/gui/style.css b/src/bin/gui/style.css index 5ff18b8..f1fbea2 100644 --- a/src/bin/gui/style.css +++ b/src/bin/gui/style.css @@ -10,6 +10,17 @@ border-radius: 25px; } +.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; +} + .background-accent-bg { background: @accent_bg_color; border-radius: 10px;