This commit is contained in:
Ward from fusion-voyager-3 2024-07-20 01:26:46 +03:00
parent 521dfe6ecb
commit 809ba3bce1
4 changed files with 140 additions and 40 deletions

View File

@ -8,8 +8,9 @@
</component>
<component name="ChangeListManager">
<list default="true" id="df2ca9e1-e07d-43f4-bc68-0a6113fc1fa2" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/data/com.github.pikaos-linux.pikmanupdatemanager.gschema.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/locales/en_US.json" beforeDir="false" afterPath="$PROJECT_DIR$/locales/en_US.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/bin/gui/apt_update_page/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/bin/gui/apt_update_page/mod.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/bin/gui/build_ui/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/bin/gui/build_ui/mod.rs" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@ -165,7 +166,8 @@
<workItem from="1720668957580" duration="53000" />
<workItem from="1720669130008" duration="560000" />
<workItem from="1721340242546" duration="6495000" />
<workItem from="1721388775654" duration="8284000" />
<workItem from="1721388775654" duration="8802000" />
<workItem from="1721415142159" duration="8361000" />
</task>
<servers />
</component>

View File

@ -47,12 +47,13 @@
"upgrade_status_error_perms": "Unknown Error! (Likely Permission Denied)",
"apt_upgrade_dialog_heading": "APT Upgrade Transaction: Hang Tight!",
"apt_upgrade_dialog_ok_label": "OK",
"apt_upgrade_dialog_open_log_file_label": "Open Log File",
"apt_upgrade_dialog_open_log_file_label": "Open Apt Log File",
"apt_upgrade_dialog_status_successful": "APT Upgrade Transaction Successful!",
"apt_upgrade_dialog_status_failed": "APT Upgrade Transaction Failed!",
"banner_text_no_internet": "Warning: No Internet Connection!",
"refresh_button_tooltip_text": "Refresh Opened Page",
"apt_update_page_title": "Native Updates (APT)",
"flatpak_update_page_title" : "Flatpak Updates",
"apt_packages_no_viewport_page_title": "All Native APT Packages are Up to date!",
"summary_button_label": "Summary",
"flatpak_extra_info_ref_name": "Ref Codename",
@ -68,5 +69,16 @@
"flatpak_ref": "Flatpak Ref",
"flatpak_status": "Status",
"flatpak_transaction_bytes_transferred": "Downloaded",
"flatpak_transaction_installed_size": "Saved to Disk"
"flatpak_transaction_installed_size": "Saved to Disk",
"flatpak_confirm_dialog_body": "The following changes are going to be made:",
"system_flatref_count_badge_label": "System Flatpaks to Update",
"user_flatref_count_badge_label": "User Flatpaks to Update",
"flatpak_confirm_dialog_heading": "Flatpak Update Transaction: Please Review",
"flatpak_confirm_dialog_cancel_label": "Decline",
"flatpak_confirm_dialog_confirm_label": "Confirm & Accept",
"flatpak_transaction_dialog_heading": "Flatpak Update Transaction: Hang Tight!",
"flatpak_transaction_dialog_ok_label": "OK",
"flatpak_transaction_dialog_open_log_file_label": "Open Flatpak Log File",
"flatpak_transaction_dialog_status_successful": "Flatpak Update Transaction: Successful!",
"flatpak_transaction_dialog_status_failed": "Flatpak Update Transaction: Failed!"
}

View File

@ -31,6 +31,8 @@ pub struct AptPackageSocket {
pub fn apt_update_page(
window: adw::ApplicationWindow,
retry_signal_action: &SimpleAction,
flatpak_retry_signal_action: &SimpleAction,
flatpak_ran_once: Rc<RefCell<bool>>
) -> gtk::Box {
let (update_percent_sender, update_percent_receiver) = async_channel::unbounded::<String>();
let update_percent_sender = update_percent_sender.clone();
@ -254,6 +256,8 @@ pub fn apt_update_page(
apt_update_dialog,
#[weak]
apt_update_dialog_child_box,
#[weak]
flatpak_retry_signal_action,
async move {
while let Ok(state) = update_status_receiver.recv().await {
match state.as_ref() {
@ -307,6 +311,11 @@ pub fn apt_update_page(
}
});
apt_update_dialog.close();
let mut flatpak_ran_once_borrow = flatpak_ran_once.borrow_mut();
if *flatpak_ran_once_borrow != true {
flatpak_retry_signal_action.activate(None);
*flatpak_ran_once_borrow = true;
}
}
"FN_OVERRIDE_FAILED" => {
apt_update_dialog_child_box.set_visible(false);

View File

@ -60,8 +60,15 @@ pub fn build_ui(app: &Application) {
let window_headerbar = HeaderBar::builder()
.title_widget(&WindowTitle::builder().title(t!("application_name")).build())
.show_title(false)
.build();
let window_breakpoint = adw::Breakpoint::new(BreakpointCondition::new_length(
BreakpointConditionLengthType::MaxWidth,
800.0,
LengthUnit::Px,
));
let window_adw_stack = gtk::Stack::builder()
.hhomogeneous(true)
.vhomogeneous(true)
@ -77,10 +84,56 @@ pub fn build_ui(app: &Application) {
let window_adw_view_switcher_sidebar = gtk::StackSidebar::builder()
.vexpand(true)
.hexpand(true)
.margin_start(5)
.margin_end(5)
.stack(&window_adw_stack)
.build();
window_headerbar.pack_start(&window_adw_view_switcher_sidebar);
let window_adw_view_switcher_sidebar_box = gtk::Box::new(gtk::Orientation::Vertical, 0);
window_adw_view_switcher_sidebar_box.append(&WindowTitle::builder().title(t!("application_name")).margin_top(20).margin_bottom(20).margin_start(5).margin_end(5).build());
window_adw_view_switcher_sidebar_box.append(&window_adw_view_switcher_sidebar);
let window_adw_view_sidebar_navigation_page = adw::NavigationPage::new(&window_adw_view_switcher_sidebar_box, "sidebar_view");
let sidebar_toggle_button = gtk::ToggleButton::builder()
.icon_name("view-right-pane-symbolic")
.visible(false)
.build();
let window_content_page_split_view = adw::OverlaySplitView::builder()
.vexpand(true)
.hexpand(true)
.content(&window_toolbar)
.sidebar(&window_adw_view_sidebar_navigation_page)
.max_sidebar_width(300.0)
.min_sidebar_width(300.0)
.enable_hide_gesture(true)
.enable_show_gesture(true)
.build();
let _sidebar_toggle_button_binding = window_content_page_split_view
.bind_property("show_sidebar", &sidebar_toggle_button, "active")
.sync_create()
.bidirectional()
.build();
window_breakpoint.add_setter(
&window_content_page_split_view,
"collapsed",
Some(&true.to_value()),
);
window_breakpoint.add_setter(
&sidebar_toggle_button,
"visible",
Some(&true.to_value()),
);
window_breakpoint.add_setter(
&window_headerbar,
"show_title",
Some(&true.to_value()),
);
window_headerbar.pack_end(&sidebar_toggle_button);
window_toolbar.add_top_bar(&window_headerbar);
window_toolbar.add_top_bar(&window_banner);
@ -100,12 +153,14 @@ pub fn build_ui(app: &Application) {
//
.width_request(700)
.height_request(500)
.content(&window_toolbar)
.content(&window_content_page_split_view)
// Startup
.startup_id(APP_ID)
// build the window
.build();
window.add_breakpoint(window_breakpoint);
if glib_settings.boolean("is-maximized") == true {
window.maximize()
}
@ -149,37 +204,34 @@ pub fn build_ui(app: &Application) {
window.present();
// Flatpak Update Page
let flatpak_retry_signal_action = gio::SimpleAction::new("retry", None);
let flatpak_update_view_stack_bin = Bin::builder()
.build();
flatpak_retry_signal_action.connect_activate(clone!(
#[weak]
window,
#[strong]
flatpak_retry_signal_action,
#[strong]
flatpak_update_view_stack_bin,
move |_, _| {
flatpak_update_view_stack_bin.set_child(Some(&flatpak_update_page::flatpak_update_page(
window,
&flatpak_retry_signal_action,
)));
}
));
// Apt Update Page
let apt_retry_signal_action = gio::SimpleAction::new("retry", None);
//let apt_update_view_stack_bin = Bin::builder()
// .child(&apt_update_page::apt_update_page(
// window.clone(),
// &apt_retry_signal_action,
// ))
// .build();
let flatpak_ran_once = Rc::new(RefCell::new(false));
// apt_retry_signal_action.connect_activate(clone!(
// #[weak]
// window,
// #[strong]
// apt_retry_signal_action,
// #[strong]
// apt_update_view_stack_bin,
// move |_, _| {
// apt_update_view_stack_bin.set_child(Some(&apt_update_page::apt_update_page(
// window,
// &apt_retry_signal_action,
// )));
// }
// ));
let apt_update_view_stack_bin = Bin::builder()
.child(&flatpak_update_page::flatpak_update_page(
window.clone(),
&apt_retry_signal_action,
))
.build();
let apt_update_view_stack_bin = Bin::builder().build();
apt_retry_signal_action.connect_activate(clone!(
#[weak]
@ -187,30 +239,55 @@ pub fn build_ui(app: &Application) {
#[strong]
apt_retry_signal_action,
#[strong]
flatpak_retry_signal_action,
#[strong]
apt_update_view_stack_bin,
#[weak]
flatpak_ran_once,
move |_, _| {
apt_update_view_stack_bin.set_child(Some(&flatpak_update_page::flatpak_update_page(
apt_update_view_stack_bin.set_child(Some(&apt_update_page::apt_update_page(
window,
&apt_retry_signal_action,
&flatpak_retry_signal_action,
flatpak_ran_once,
)));
}
));
apt_update_view_stack_bin.set_child(Some(&apt_update_page::apt_update_page(
window.clone(),
&apt_retry_signal_action,
&flatpak_retry_signal_action,
flatpak_ran_once,
)));
// Add to stack switcher
window_adw_stack.add_titled(
&apt_update_view_stack_bin,
Some("apt_update_page"),
&t!("apt_update_page_title"),
);
//
window_adw_stack.add_titled(
&flatpak_update_view_stack_bin,
Some("flatpak_update_page"),
&t!("flatpak_update_page_title"),
);
// Refresh button
refresh_button.connect_clicked(clone!(
#[weak]
apt_retry_signal_action,
#[weak]
flatpak_retry_signal_action,
#[weak]
window_adw_stack,
move |_| {
match window_adw_stack.visible_child_name().unwrap().as_str() {
"apt_update_page" => apt_retry_signal_action.activate(None),
"flatpak_update_page" => flatpak_retry_signal_action.activate(None),
_ => {}
}
}