basis for main page
This commit is contained in:
parent
0f7fadecbc
commit
fce2150b6f
@ -168,5 +168,6 @@
|
|||||||
"retry_interval_labal_label": "Automatically Check for updates",
|
"retry_interval_labal_label": "Automatically Check for updates",
|
||||||
"retry_interval_spinrow_title": "Automatic Check Interval",
|
"retry_interval_spinrow_title": "Automatic Check Interval",
|
||||||
"retry_interval_spinrow_subtitle": "In Hours",
|
"retry_interval_spinrow_subtitle": "In Hours",
|
||||||
"progress_bar_circle_center_text": "Percent %"
|
"progress_bar_circle_center_text": "Percent %",
|
||||||
|
"main_update_page_title": "Main Updates Page"
|
||||||
}
|
}
|
@ -61,10 +61,13 @@ pub struct AptPackageSocket {
|
|||||||
}
|
}
|
||||||
pub fn apt_update_page(
|
pub fn apt_update_page(
|
||||||
window: adw::ApplicationWindow,
|
window: adw::ApplicationWindow,
|
||||||
|
update_button: &Rc<RefCell<Button>>,
|
||||||
|
flatpak_update_button: &Rc<RefCell<Button>>,
|
||||||
retry_signal_action: &SimpleAction,
|
retry_signal_action: &SimpleAction,
|
||||||
flatpak_retry_signal_action: &SimpleAction,
|
flatpak_retry_signal_action: &SimpleAction,
|
||||||
theme_changed_action: &SimpleAction,
|
theme_changed_action: &SimpleAction,
|
||||||
flatpak_ran_once: Rc<RefCell<bool>>,
|
flatpak_ran_once: Rc<RefCell<bool>>,
|
||||||
|
initiated_by_main: Rc<RefCell<bool>>,
|
||||||
update_sys_tray: &SimpleAction,
|
update_sys_tray: &SimpleAction,
|
||||||
apt_update_count: &Rc<RefCell<i32>>,
|
apt_update_count: &Rc<RefCell<i32>>,
|
||||||
flatpak_update_count: &Rc<RefCell<i32>>,
|
flatpak_update_count: &Rc<RefCell<i32>>,
|
||||||
@ -180,8 +183,8 @@ pub fn apt_update_page(
|
|||||||
.search_delay(500)
|
.search_delay(500)
|
||||||
.margin_top(15)
|
.margin_top(15)
|
||||||
.margin_bottom(15)
|
.margin_bottom(15)
|
||||||
.margin_end(30)
|
.margin_end(15)
|
||||||
.margin_start(30)
|
.margin_start(15)
|
||||||
.build();
|
.build();
|
||||||
searchbar.add_css_class("rounded-all-25");
|
searchbar.add_css_class("rounded-all-25");
|
||||||
|
|
||||||
@ -349,16 +352,16 @@ pub fn apt_update_page(
|
|||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
let update_button = Button::builder()
|
let update_button = update_button.borrow().clone();
|
||||||
.halign(Align::End)
|
|
||||||
.valign(Align::Center)
|
update_button.set_halign(Align::End);
|
||||||
.hexpand(false)
|
update_button.set_valign(Align::Center);
|
||||||
.sensitive(false)
|
update_button.set_hexpand(false);
|
||||||
.margin_start(10)
|
update_button.set_sensitive(false);
|
||||||
.margin_end(30)
|
update_button.set_margin_start(10);
|
||||||
.margin_bottom(15)
|
update_button.set_margin_end(30);
|
||||||
.label(t!("update_button_label"))
|
update_button.set_margin_bottom(15);
|
||||||
.build();
|
update_button.set_label(&t!("update_button_label"));
|
||||||
update_button.add_css_class("destructive-action");
|
update_button.add_css_class("destructive-action");
|
||||||
|
|
||||||
update_button.connect_clicked(clone!(
|
update_button.connect_clicked(clone!(
|
||||||
@ -370,11 +373,17 @@ pub fn apt_update_page(
|
|||||||
excluded_updates_vec,
|
excluded_updates_vec,
|
||||||
#[strong]
|
#[strong]
|
||||||
theme_changed_action,
|
theme_changed_action,
|
||||||
|
#[strong]
|
||||||
|
flatpak_update_button,
|
||||||
|
#[strong]
|
||||||
|
initiated_by_main,
|
||||||
move |_| {
|
move |_| {
|
||||||
process::apt_process_update(
|
process::apt_process_update(
|
||||||
&excluded_updates_vec.borrow(),
|
&excluded_updates_vec.borrow(),
|
||||||
window,
|
window,
|
||||||
&retry_signal_action,
|
&retry_signal_action,
|
||||||
|
&flatpak_update_button.borrow(),
|
||||||
|
initiated_by_main.clone(),
|
||||||
&theme_changed_action,
|
&theme_changed_action,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,8 @@ pub fn apt_process_update(
|
|||||||
excluded_updates_vec: &Vec<String>,
|
excluded_updates_vec: &Vec<String>,
|
||||||
window: adw::ApplicationWindow,
|
window: adw::ApplicationWindow,
|
||||||
retry_signal_action: &SimpleAction,
|
retry_signal_action: &SimpleAction,
|
||||||
|
flatpak_update_button: &Button,
|
||||||
|
initiated_by_main: Rc<RefCell<bool>>,
|
||||||
theme_changed_action: &SimpleAction,
|
theme_changed_action: &SimpleAction,
|
||||||
) {
|
) {
|
||||||
let excluded_updates_alert_dialog = adw::MessageDialog::builder()
|
let excluded_updates_alert_dialog = adw::MessageDialog::builder()
|
||||||
@ -100,10 +102,16 @@ pub fn apt_process_update(
|
|||||||
excluded_updates_vec,
|
excluded_updates_vec,
|
||||||
#[strong]
|
#[strong]
|
||||||
theme_changed_action,
|
theme_changed_action,
|
||||||
|
#[strong]
|
||||||
|
initiated_by_main,
|
||||||
|
#[strong]
|
||||||
|
flatpak_update_button,
|
||||||
move |_, _| apt_confirm_window(
|
move |_, _| apt_confirm_window(
|
||||||
&excluded_updates_vec,
|
&excluded_updates_vec,
|
||||||
window,
|
window,
|
||||||
&retry_signal_action,
|
&retry_signal_action,
|
||||||
|
&flatpak_update_button,
|
||||||
|
initiated_by_main.clone(),
|
||||||
&theme_changed_action
|
&theme_changed_action
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
@ -123,6 +131,8 @@ fn apt_confirm_window(
|
|||||||
excluded_updates_vec: &Vec<String>,
|
excluded_updates_vec: &Vec<String>,
|
||||||
window: adw::ApplicationWindow,
|
window: adw::ApplicationWindow,
|
||||||
retry_signal_action: &SimpleAction,
|
retry_signal_action: &SimpleAction,
|
||||||
|
flatpak_update_button: &Button,
|
||||||
|
initiated_by_main: Rc<RefCell<bool>>,
|
||||||
theme_changed_action: &SimpleAction,
|
theme_changed_action: &SimpleAction,
|
||||||
) {
|
) {
|
||||||
let to_be_removed_packages_vec: Rc<RefCell<Vec<String>>> = Rc::new(RefCell::new(Vec::new()));
|
let to_be_removed_packages_vec: Rc<RefCell<Vec<String>>> = Rc::new(RefCell::new(Vec::new()));
|
||||||
@ -323,9 +333,15 @@ fn apt_confirm_window(
|
|||||||
apt_confirm_dialog,
|
apt_confirm_dialog,
|
||||||
#[strong]
|
#[strong]
|
||||||
theme_changed_action,
|
theme_changed_action,
|
||||||
|
#[strong]
|
||||||
|
flatpak_update_button,
|
||||||
|
#[strong]
|
||||||
|
initiated_by_main,
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
let retry_signal_action0 = retry_signal_action.clone();
|
let retry_signal_action0 = retry_signal_action.clone();
|
||||||
let theme_changed_action0 = theme_changed_action.clone();
|
let theme_changed_action0 = theme_changed_action.clone();
|
||||||
|
let flatpak_update_button0 = flatpak_update_button.clone();
|
||||||
|
let initiated_by_main0 = initiated_by_main.clone();
|
||||||
apt_confirm_dialog
|
apt_confirm_dialog
|
||||||
.clone()
|
.clone()
|
||||||
.choose(None::<&gio::Cancellable>, move |choice| {
|
.choose(None::<&gio::Cancellable>, move |choice| {
|
||||||
@ -333,6 +349,8 @@ fn apt_confirm_window(
|
|||||||
apt_full_upgrade_from_socket(
|
apt_full_upgrade_from_socket(
|
||||||
window,
|
window,
|
||||||
&retry_signal_action0,
|
&retry_signal_action0,
|
||||||
|
&flatpak_update_button0,
|
||||||
|
initiated_by_main0,
|
||||||
&theme_changed_action0,
|
&theme_changed_action0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -406,6 +424,8 @@ fn apt_confirm_window(
|
|||||||
fn apt_full_upgrade_from_socket(
|
fn apt_full_upgrade_from_socket(
|
||||||
window: adw::ApplicationWindow,
|
window: adw::ApplicationWindow,
|
||||||
retry_signal_action: &SimpleAction,
|
retry_signal_action: &SimpleAction,
|
||||||
|
flatpak_update_button: &Button,
|
||||||
|
initiated_by_main: Rc<RefCell<bool>>,
|
||||||
theme_changed_action: &SimpleAction,
|
theme_changed_action: &SimpleAction,
|
||||||
) {
|
) {
|
||||||
let (upgrade_percent_sender, upgrade_percent_receiver) = async_channel::unbounded::<String>();
|
let (upgrade_percent_sender, upgrade_percent_receiver) = async_channel::unbounded::<String>();
|
||||||
@ -646,6 +666,8 @@ fn apt_full_upgrade_from_socket(
|
|||||||
));
|
));
|
||||||
|
|
||||||
let retry_signal_action0 = retry_signal_action.clone();
|
let retry_signal_action0 = retry_signal_action.clone();
|
||||||
|
let flatpak_update_button0 = flatpak_update_button.clone();
|
||||||
|
let initiated_by_main_clone0 = initiated_by_main.clone();
|
||||||
|
|
||||||
apt_upgrade_log_button.connect_clicked(move |_| {
|
apt_upgrade_log_button.connect_clicked(move |_| {
|
||||||
let _ = Command::new("xdg-open")
|
let _ = Command::new("xdg-open")
|
||||||
@ -657,6 +679,11 @@ fn apt_full_upgrade_from_socket(
|
|||||||
match choice.as_str() {
|
match choice.as_str() {
|
||||||
"apt_upgrade_dialog_ok" => {
|
"apt_upgrade_dialog_ok" => {
|
||||||
retry_signal_action0.activate(None);
|
retry_signal_action0.activate(None);
|
||||||
|
let mut initiated_by_main_borrow = initiated_by_main_clone0.borrow_mut();
|
||||||
|
if *initiated_by_main_borrow == true {
|
||||||
|
flatpak_update_button0.emit_clicked();
|
||||||
|
*initiated_by_main_borrow = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,11 @@ use crate::apt_update_page;
|
|||||||
use crate::config::{APP_GITHUB, APP_ICON, APP_ID, VERSION};
|
use crate::config::{APP_GITHUB, APP_ICON, APP_ID, VERSION};
|
||||||
use crate::flatpak_manage_page::flatpak_manage_page;
|
use crate::flatpak_manage_page::flatpak_manage_page;
|
||||||
use crate::flatpak_update_page;
|
use crate::flatpak_update_page;
|
||||||
|
use crate::main_update_page::main_update_page;
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use adw::*;
|
use adw::*;
|
||||||
use gtk::glib::{clone, MainContext};
|
use gtk::glib::{clone, MainContext};
|
||||||
use gtk::{License, WindowControls};
|
use gtk::License;
|
||||||
use ksni;
|
use ksni;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
@ -304,10 +305,12 @@ pub fn build_ui(app: &Application) {
|
|||||||
.bottom_bar_style(ToolbarStyle::Flat)
|
.bottom_bar_style(ToolbarStyle::Flat)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
window_adw_view_switcher_sidebar_toolbar.add_top_bar(&HeaderBar::builder()
|
window_adw_view_switcher_sidebar_toolbar.add_top_bar(
|
||||||
.title_widget(&WindowTitle::builder().title(t!("application_name")).build())
|
&HeaderBar::builder()
|
||||||
.show_title(true)
|
.title_widget(&WindowTitle::builder().title(t!("application_name")).build())
|
||||||
.build());
|
.show_title(true)
|
||||||
|
.build(),
|
||||||
|
);
|
||||||
|
|
||||||
let window_content_page_split_view = adw::OverlaySplitView::builder()
|
let window_content_page_split_view = adw::OverlaySplitView::builder()
|
||||||
.content(&window_toolbar)
|
.content(&window_toolbar)
|
||||||
@ -466,6 +469,12 @@ pub fn build_ui(app: &Application) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// Update buttons
|
||||||
|
|
||||||
|
let apt_update_button = Rc::new(RefCell::new(gtk::Button::new()));
|
||||||
|
let flatpak_update_button = Rc::new(RefCell::new(gtk::Button::new()));
|
||||||
|
|
||||||
// Flatpak Update Page
|
// Flatpak Update Page
|
||||||
|
|
||||||
let flatpak_retry_signal_action = gio::SimpleAction::new("retry", None);
|
let flatpak_retry_signal_action = gio::SimpleAction::new("retry", None);
|
||||||
@ -476,6 +485,8 @@ pub fn build_ui(app: &Application) {
|
|||||||
#[weak]
|
#[weak]
|
||||||
window,
|
window,
|
||||||
#[strong]
|
#[strong]
|
||||||
|
flatpak_update_button,
|
||||||
|
#[strong]
|
||||||
flatpak_retry_signal_action,
|
flatpak_retry_signal_action,
|
||||||
#[strong]
|
#[strong]
|
||||||
flatpak_update_view_stack_bin,
|
flatpak_update_view_stack_bin,
|
||||||
@ -488,9 +499,11 @@ pub fn build_ui(app: &Application) {
|
|||||||
#[strong]
|
#[strong]
|
||||||
theme_changed_action,
|
theme_changed_action,
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
|
(*flatpak_update_button.borrow_mut() = gtk::Button::new());
|
||||||
flatpak_update_view_stack_bin.set_child(Some(
|
flatpak_update_view_stack_bin.set_child(Some(
|
||||||
&flatpak_update_page::flatpak_update_page(
|
&flatpak_update_page::flatpak_update_page(
|
||||||
window,
|
window,
|
||||||
|
&flatpak_update_button,
|
||||||
&flatpak_retry_signal_action,
|
&flatpak_retry_signal_action,
|
||||||
&theme_changed_action,
|
&theme_changed_action,
|
||||||
&update_sys_tray,
|
&update_sys_tray,
|
||||||
@ -505,6 +518,7 @@ pub fn build_ui(app: &Application) {
|
|||||||
let apt_retry_signal_action = gio::SimpleAction::new("retry", None);
|
let apt_retry_signal_action = gio::SimpleAction::new("retry", None);
|
||||||
|
|
||||||
let flatpak_ran_once = Rc::new(RefCell::new(false));
|
let flatpak_ran_once = Rc::new(RefCell::new(false));
|
||||||
|
let initiated_by_main = Rc::new(RefCell::new(false));
|
||||||
|
|
||||||
let apt_update_view_stack_bin = Bin::builder().build();
|
let apt_update_view_stack_bin = Bin::builder().build();
|
||||||
|
|
||||||
@ -512,12 +526,18 @@ pub fn build_ui(app: &Application) {
|
|||||||
#[strong]
|
#[strong]
|
||||||
window,
|
window,
|
||||||
#[strong]
|
#[strong]
|
||||||
|
apt_update_button,
|
||||||
|
#[strong]
|
||||||
|
flatpak_update_button,
|
||||||
|
#[strong]
|
||||||
flatpak_retry_signal_action,
|
flatpak_retry_signal_action,
|
||||||
#[strong]
|
#[strong]
|
||||||
apt_update_view_stack_bin,
|
apt_update_view_stack_bin,
|
||||||
#[strong]
|
#[strong]
|
||||||
flatpak_ran_once,
|
flatpak_ran_once,
|
||||||
#[strong]
|
#[strong]
|
||||||
|
initiated_by_main,
|
||||||
|
#[strong]
|
||||||
update_sys_tray,
|
update_sys_tray,
|
||||||
#[strong]
|
#[strong]
|
||||||
apt_update_count,
|
apt_update_count,
|
||||||
@ -526,12 +546,16 @@ pub fn build_ui(app: &Application) {
|
|||||||
#[strong]
|
#[strong]
|
||||||
theme_changed_action,
|
theme_changed_action,
|
||||||
move |action, _| {
|
move |action, _| {
|
||||||
|
(*apt_update_button.borrow_mut() = gtk::Button::new());
|
||||||
apt_update_view_stack_bin.set_child(Some(&apt_update_page::apt_update_page(
|
apt_update_view_stack_bin.set_child(Some(&apt_update_page::apt_update_page(
|
||||||
window.clone(),
|
window.clone(),
|
||||||
|
&apt_update_button,
|
||||||
|
&flatpak_update_button,
|
||||||
&action,
|
&action,
|
||||||
&flatpak_retry_signal_action,
|
&flatpak_retry_signal_action,
|
||||||
&theme_changed_action,
|
&theme_changed_action,
|
||||||
flatpak_ran_once.clone(),
|
flatpak_ran_once.clone(),
|
||||||
|
initiated_by_main.clone(),
|
||||||
&update_sys_tray,
|
&update_sys_tray,
|
||||||
&apt_update_count,
|
&apt_update_count,
|
||||||
&flatpak_update_count,
|
&flatpak_update_count,
|
||||||
@ -541,10 +565,13 @@ pub fn build_ui(app: &Application) {
|
|||||||
|
|
||||||
apt_update_view_stack_bin.set_child(Some(&apt_update_page::apt_update_page(
|
apt_update_view_stack_bin.set_child(Some(&apt_update_page::apt_update_page(
|
||||||
window.clone(),
|
window.clone(),
|
||||||
|
&apt_update_button,
|
||||||
|
&flatpak_update_button,
|
||||||
&apt_retry_signal_action,
|
&apt_retry_signal_action,
|
||||||
&flatpak_retry_signal_action,
|
&flatpak_retry_signal_action,
|
||||||
&theme_changed_action,
|
&theme_changed_action,
|
||||||
flatpak_ran_once.clone(),
|
flatpak_ran_once.clone(),
|
||||||
|
initiated_by_main.clone(),
|
||||||
&update_sys_tray,
|
&update_sys_tray,
|
||||||
&apt_update_count,
|
&apt_update_count,
|
||||||
&flatpak_update_count,
|
&flatpak_update_count,
|
||||||
@ -552,6 +579,25 @@ pub fn build_ui(app: &Application) {
|
|||||||
|
|
||||||
// Add to stack switcher
|
// Add to stack switcher
|
||||||
|
|
||||||
|
window_adw_stack.add_titled(
|
||||||
|
&main_update_page(
|
||||||
|
&apt_update_button,
|
||||||
|
&initiated_by_main,
|
||||||
|
&theme_changed_action,
|
||||||
|
),
|
||||||
|
Some("main_update_page"),
|
||||||
|
&t!("main_update_page_title"),
|
||||||
|
);
|
||||||
|
|
||||||
|
let main_update_page_toggle_button = add_content_button(
|
||||||
|
&window_adw_stack,
|
||||||
|
true,
|
||||||
|
"main_update_page".to_string(),
|
||||||
|
t!("main_update_page_title").to_string(),
|
||||||
|
&null_toggle_button,
|
||||||
|
);
|
||||||
|
window_adw_view_switcher_sidebar_box.append(&main_update_page_toggle_button);
|
||||||
|
|
||||||
window_adw_stack.add_titled(
|
window_adw_stack.add_titled(
|
||||||
&apt_update_view_stack_bin,
|
&apt_update_view_stack_bin,
|
||||||
Some("apt_update_page"),
|
Some("apt_update_page"),
|
||||||
@ -560,7 +606,7 @@ pub fn build_ui(app: &Application) {
|
|||||||
|
|
||||||
let apt_update_page_toggle_button = add_content_button(
|
let apt_update_page_toggle_button = add_content_button(
|
||||||
&window_adw_stack,
|
&window_adw_stack,
|
||||||
true,
|
false,
|
||||||
"apt_update_page".to_string(),
|
"apt_update_page".to_string(),
|
||||||
t!("apt_update_page_title").to_string(),
|
t!("apt_update_page_title").to_string(),
|
||||||
&null_toggle_button,
|
&null_toggle_button,
|
||||||
@ -699,8 +745,14 @@ pub fn build_ui(app: &Application) {
|
|||||||
flatpak_retry_signal_action,
|
flatpak_retry_signal_action,
|
||||||
#[weak]
|
#[weak]
|
||||||
window_adw_stack,
|
window_adw_stack,
|
||||||
|
#[strong]
|
||||||
|
flatpak_ran_once,
|
||||||
move |_| {
|
move |_| {
|
||||||
match window_adw_stack.visible_child_name().unwrap().as_str() {
|
match window_adw_stack.visible_child_name().unwrap().as_str() {
|
||||||
|
"main_update_page" => {
|
||||||
|
*flatpak_ran_once.borrow_mut() = false;
|
||||||
|
apt_retry_signal_action.activate(None);
|
||||||
|
}
|
||||||
"apt_update_page" => apt_retry_signal_action.activate(None),
|
"apt_update_page" => apt_retry_signal_action.activate(None),
|
||||||
"apt_manage_page" => apt_retry_signal_action.activate(None),
|
"apt_manage_page" => apt_retry_signal_action.activate(None),
|
||||||
"flatpak_update_page" => flatpak_retry_signal_action.activate(None),
|
"flatpak_update_page" => flatpak_retry_signal_action.activate(None),
|
||||||
|
@ -27,6 +27,7 @@ pub struct FlatpakRefStruct {
|
|||||||
}
|
}
|
||||||
pub fn flatpak_update_page(
|
pub fn flatpak_update_page(
|
||||||
window: adw::ApplicationWindow,
|
window: adw::ApplicationWindow,
|
||||||
|
update_button: &Rc<RefCell<Button>>,
|
||||||
retry_signal_action: &SimpleAction,
|
retry_signal_action: &SimpleAction,
|
||||||
theme_changed_action: &SimpleAction,
|
theme_changed_action: &SimpleAction,
|
||||||
update_sys_tray: &SimpleAction,
|
update_sys_tray: &SimpleAction,
|
||||||
@ -162,8 +163,8 @@ pub fn flatpak_update_page(
|
|||||||
.search_delay(500)
|
.search_delay(500)
|
||||||
.margin_top(15)
|
.margin_top(15)
|
||||||
.margin_bottom(15)
|
.margin_bottom(15)
|
||||||
.margin_end(30)
|
.margin_end(15)
|
||||||
.margin_start(30)
|
.margin_start(15)
|
||||||
.build();
|
.build();
|
||||||
searchbar.add_css_class("rounded-all-25");
|
searchbar.add_css_class("rounded-all-25");
|
||||||
|
|
||||||
@ -312,16 +313,16 @@ pub fn flatpak_update_page(
|
|||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
let update_button = Button::builder()
|
let update_button = update_button.borrow().clone();
|
||||||
.halign(Align::End)
|
|
||||||
.valign(Align::Center)
|
update_button.set_halign(Align::End);
|
||||||
.sensitive(false)
|
update_button.set_valign(Align::Center);
|
||||||
.hexpand(false)
|
update_button.set_hexpand(false);
|
||||||
.margin_start(10)
|
update_button.set_sensitive(false);
|
||||||
.margin_end(30)
|
update_button.set_margin_start(10);
|
||||||
.margin_bottom(15)
|
update_button.set_margin_end(30);
|
||||||
.label(t!("update_button_label"))
|
update_button.set_margin_bottom(15);
|
||||||
.build();
|
update_button.set_label(&t!("update_button_label"));
|
||||||
update_button.add_css_class("destructive-action");
|
update_button.add_css_class("destructive-action");
|
||||||
|
|
||||||
let system_refs_for_upgrade_vec_all_clone0 = &system_refs_for_upgrade_vec_all.clone();
|
let system_refs_for_upgrade_vec_all_clone0 = &system_refs_for_upgrade_vec_all.clone();
|
||||||
@ -354,9 +355,6 @@ pub fn flatpak_update_page(
|
|||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
bottom_bar.append(&select_button);
|
|
||||||
bottom_bar.append(&update_button);
|
|
||||||
|
|
||||||
let appstream_sync_percent_server_context = MainContext::default();
|
let appstream_sync_percent_server_context = MainContext::default();
|
||||||
// The main loop executes the asynchronous block
|
// The main loop executes the asynchronous block
|
||||||
appstream_sync_percent_server_context.spawn_local(clone!(
|
appstream_sync_percent_server_context.spawn_local(clone!(
|
||||||
@ -389,6 +387,10 @@ pub fn flatpak_update_page(
|
|||||||
#[strong]
|
#[strong]
|
||||||
viewport_bin,
|
viewport_bin,
|
||||||
#[strong]
|
#[strong]
|
||||||
|
update_button,
|
||||||
|
#[strong]
|
||||||
|
select_button,
|
||||||
|
#[strong]
|
||||||
packages_viewport,
|
packages_viewport,
|
||||||
#[strong]
|
#[strong]
|
||||||
update_sys_tray,
|
update_sys_tray,
|
||||||
@ -492,6 +494,9 @@ pub fn flatpak_update_page(
|
|||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
bottom_bar.append(&select_button);
|
||||||
|
bottom_bar.append(&update_button);
|
||||||
|
|
||||||
main_box.append(&searchbar);
|
main_box.append(&searchbar);
|
||||||
main_box.append(&viewport_bin);
|
main_box.append(&viewport_bin);
|
||||||
main_box.append(&bottom_bar);
|
main_box.append(&bottom_bar);
|
||||||
|
@ -6,6 +6,7 @@ mod config;
|
|||||||
mod flatpak_manage_page;
|
mod flatpak_manage_page;
|
||||||
mod flatpak_ref_row;
|
mod flatpak_ref_row;
|
||||||
mod flatpak_update_page;
|
mod flatpak_update_page;
|
||||||
|
mod main_update_page;
|
||||||
|
|
||||||
use crate::config::APP_ID;
|
use crate::config::APP_ID;
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
|
67
src/bin/gui/main_update_page/mod.rs
Normal file
67
src/bin/gui/main_update_page/mod.rs
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
use adw::gio::SimpleAction;
|
||||||
|
use adw::prelude::*;
|
||||||
|
use gtk::glib::*;
|
||||||
|
use gtk::*;
|
||||||
|
use std::cell::RefCell;
|
||||||
|
use std::rc::Rc;
|
||||||
|
|
||||||
|
pub fn main_update_page(
|
||||||
|
apt_update_button: &Rc<RefCell<Button>>,
|
||||||
|
initiated_by_main: &Rc<RefCell<bool>>,
|
||||||
|
theme_changed_action: &gio::SimpleAction,
|
||||||
|
) -> gtk::Box {
|
||||||
|
let main_box = Box::builder()
|
||||||
|
.hexpand(true)
|
||||||
|
.vexpand(true)
|
||||||
|
.orientation(Orientation::Vertical)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let bottom_icon = gtk::Image::builder()
|
||||||
|
.pixel_size(128)
|
||||||
|
.halign(Align::Center)
|
||||||
|
.hexpand(true)
|
||||||
|
.icon_name("tux-symbolic")
|
||||||
|
.margin_start(10)
|
||||||
|
.margin_end(10)
|
||||||
|
.margin_bottom(20)
|
||||||
|
.margin_top(20)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let update_badge_box = gtk::Box::builder()
|
||||||
|
.hexpand(true)
|
||||||
|
.vexpand(true)
|
||||||
|
.orientation(Orientation::Vertical)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let bottom_bar = Box::builder().valign(Align::End).build();
|
||||||
|
|
||||||
|
let update_button = Button::builder()
|
||||||
|
.halign(Align::End)
|
||||||
|
.valign(Align::Center)
|
||||||
|
.hexpand(true)
|
||||||
|
.margin_start(10)
|
||||||
|
.margin_end(30)
|
||||||
|
.margin_bottom(15)
|
||||||
|
.label(t!("update_button_label"))
|
||||||
|
.build();
|
||||||
|
update_button.add_css_class("destructive-action");
|
||||||
|
|
||||||
|
update_button.connect_clicked(clone!(
|
||||||
|
#[strong]
|
||||||
|
initiated_by_main,
|
||||||
|
#[strong]
|
||||||
|
apt_update_button,
|
||||||
|
move |_| {
|
||||||
|
*initiated_by_main.borrow_mut() = true;
|
||||||
|
apt_update_button.borrow().emit_clicked();
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
bottom_bar.append(&update_button);
|
||||||
|
|
||||||
|
main_box.append(&update_badge_box);
|
||||||
|
main_box.append(&bottom_icon);
|
||||||
|
main_box.append(&bottom_bar);
|
||||||
|
|
||||||
|
main_box
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user