From f3751ab535ec3bc5ea437e39372c538531764f3a Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Tue, 9 Jul 2024 09:13:09 +0300 Subject: [PATCH] fix some ui margins --- .idea/workspace.xml | 3 ++- src/apt_update_page/mod.rs | 23 ++++++++++++++++++----- src/apt_update_page/process.rs | 0 src/build_ui/mod.rs | 13 +++++++------ 4 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 src/apt_update_page/process.rs diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0cbc5b4..aaa320e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -8,6 +8,7 @@ + @@ -112,7 +113,7 @@ - + diff --git a/src/apt_update_page/mod.rs b/src/apt_update_page/mod.rs index 12b0632..b634eaa 100644 --- a/src/apt_update_page/mod.rs +++ b/src/apt_update_page/mod.rs @@ -1,3 +1,5 @@ +mod process; + use std::rc::Rc; use crate::apt_package_row::AptPackageRow; use adw::gio::{Action, SimpleAction}; @@ -43,6 +45,8 @@ pub fn apt_update_page(window: adw::ApplicationWindow, retry_signal_action: &Sim let (get_upgradable_sender, get_upgradable_receiver) = async_channel::unbounded(); let get_upgradable_sender = get_upgradable_sender.clone(); + //let excluded_updates_vec = Vec::new(); + thread::spawn(move || { Runtime::new() .unwrap() @@ -87,8 +91,6 @@ pub fn apt_update_page(window: adw::ApplicationWindow, retry_signal_action: &Sim let packages_boxedlist = gtk::ListBox::builder() .selection_mode(SelectionMode::None) - .margin_bottom(15) - .margin_start(15) .margin_end(15) .margin_start(15) .sensitive(false) @@ -101,7 +103,7 @@ pub fn apt_update_page(window: adw::ApplicationWindow, retry_signal_action: &Sim .vexpand(true) .hexpand(true) .margin_bottom(15) - .margin_start(15) + .margin_top(15) .margin_end(15) .margin_start(15) .height_request(390) @@ -163,8 +165,7 @@ pub fn apt_update_page(window: adw::ApplicationWindow, retry_signal_action: &Sim .valign(Align::Center) .hexpand(true) .margin_start(10) - .margin_end(30) - .margin_top(2) + .margin_end(10) .margin_bottom(15) .label(t!("select_button_deselect_all")) .build(); @@ -181,7 +182,19 @@ pub fn apt_update_page(window: adw::ApplicationWindow, retry_signal_action: &Sim set_all_apt_row_marks_to(&packages_boxedlist, value_to_mark) })); + let update_button = gtk::Button::builder() + .halign(Align::End) + .valign(Align::Center) + .hexpand(false) + .margin_start(10) + .margin_end(30) + .margin_bottom(15) + .label(t!("update_button_label")) + .build(); + update_button.add_css_class("destructive-action"); + bottom_bar.append(&select_button); + bottom_bar.append(&update_button); let update_percent_server_context = MainContext::default(); // The main loop executes the asynchronous block diff --git a/src/apt_update_page/process.rs b/src/apt_update_page/process.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/build_ui/mod.rs b/src/build_ui/mod.rs index c15ec5e..9ce949d 100644 --- a/src/build_ui/mod.rs +++ b/src/build_ui/mod.rs @@ -111,7 +111,8 @@ pub fn build_ui(app: &adw::Application) { .build(); let refresh_button = gtk::Button::builder() - .label(t!("refresh_button_label")) + .icon_name("view-refresh-symbolic") + .tooltip_text(t!("refresh_button_tooltip_text")) .build(); let credits_window = adw::AboutWindow::builder() @@ -135,7 +136,6 @@ pub fn build_ui(app: &adw::Application) { window.present(); // Apt Update Page - let apt_retry_signal_action = gio::SimpleAction::new("retry", None); let apt_update_view_stack_bin = adw::Bin::builder() @@ -147,11 +147,12 @@ pub fn build_ui(app: &adw::Application) { })); window_adw_view_stack.add_titled_with_icon(&apt_update_view_stack_bin, Some("apt_update_page"), &t!("apt_update_page_title"), "software-update-available-symbolic"); - window_adw_view_stack.add_titled(>k::Image::builder().icon_name("firefox").build(), Some("apt_update_page2"), &t!("apt_update_page_title2")); - // - refresh_button.connect_clicked(clone!(@weak apt_retry_signal_action => move |_| { - apt_retry_signal_action.activate(None); + refresh_button.connect_clicked(clone!(@weak apt_retry_signal_action, @weak window_adw_view_stack => move |_| { + match window_adw_view_stack.visible_child_name().unwrap().as_str() { + "apt_update_page" => apt_retry_signal_action.activate(None), + _ => {} + } })); }