fix break points
This commit is contained in:
parent
650093da67
commit
e33e800131
2
.github/release-nest-v3
vendored
2
.github/release-nest-v3
vendored
@ -1 +1 @@
|
||||
11
|
||||
12
|
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -1,4 +1,4 @@
|
||||
pikman-update-manager (1.0.1-100pika2) pikauwu; urgency=medium
|
||||
pikman-update-manager (1.0.1-100pika3) pikauwu; urgency=medium
|
||||
|
||||
* initial release
|
||||
|
||||
|
@ -4,8 +4,8 @@ use pika_unixsocket_tools::pika_unixsocket_tools::*;
|
||||
use rust_apt::cache::Upgrade;
|
||||
use rust_apt::new_cache;
|
||||
use rust_apt::progress::{AcquireProgress, InstallProgress};
|
||||
use tokio::runtime::Runtime;
|
||||
use std::env;
|
||||
use tokio::runtime::Runtime;
|
||||
|
||||
// Init translations for current crate.
|
||||
#[macro_use]
|
||||
@ -82,7 +82,7 @@ fn main() {
|
||||
let mut install_progress = InstallProgress::new(AptInstallProgressSocket::new(
|
||||
percent_socket_path,
|
||||
status_socket_path,
|
||||
&error_strfmt_trans_str,
|
||||
error_strfmt_trans_str,
|
||||
));
|
||||
|
||||
apt_upgrade_cache.resolve(true).unwrap();
|
||||
|
@ -2,8 +2,8 @@ use pika_unixsocket_tools::apt_update_progress_socket::AptUpdateProgressSocket;
|
||||
use pika_unixsocket_tools::pika_unixsocket_tools::*;
|
||||
use rust_apt::new_cache;
|
||||
use rust_apt::progress::AcquireProgress;
|
||||
use tokio::runtime::Runtime;
|
||||
use std::env;
|
||||
use tokio::runtime::Runtime;
|
||||
|
||||
// Init translations for current crate.
|
||||
#[macro_use]
|
||||
|
@ -66,7 +66,10 @@ pub fn apt_update_page(
|
||||
|
||||
thread::spawn(move || {
|
||||
let apt_update_command = Command::new("pkexec")
|
||||
.args(["/usr/lib/pika/pikman-update-manager/scripts/apt_update", "fr_FR"])
|
||||
.args([
|
||||
"/usr/lib/pika/pikman-update-manager/scripts/apt_update",
|
||||
"fr_FR",
|
||||
])
|
||||
.status()
|
||||
.unwrap();
|
||||
match apt_update_command.code().unwrap() {
|
||||
@ -128,11 +131,11 @@ pub fn apt_update_page(
|
||||
.build();
|
||||
|
||||
/*let packages_ignored_viewport_page = adw::StatusPage::builder()
|
||||
.icon_name("dialog-warning-symbolic")
|
||||
.title(t!("apt_ignored_viewport_page_title"))
|
||||
.hexpand(true)
|
||||
.vexpand(true)
|
||||
.build();*/
|
||||
.icon_name("dialog-warning-symbolic")
|
||||
.title(t!("apt_ignored_viewport_page_title"))
|
||||
.hexpand(true)
|
||||
.vexpand(true)
|
||||
.build();*/
|
||||
|
||||
let viewport_bin = adw::Bin::builder()
|
||||
.child(&packages_no_viewport_page)
|
||||
@ -510,51 +513,44 @@ fn set_all_apt_row_marks_to(parent_listbox: &impl IsA<ListBox>, value: bool) {
|
||||
|
||||
fn get_apt_upgrades(get_upgradable_sender: &async_channel::Sender<AptPackageSocket>) {
|
||||
let get_upgradable_sender = get_upgradable_sender.clone();
|
||||
thread::spawn(move || {
|
||||
// Create upgradable list cache
|
||||
let upgradable_cache = new_cache!().unwrap();
|
||||
//
|
||||
upgradable_cache.upgrade(Upgrade::FullUpgrade).unwrap();
|
||||
thread::spawn(move || {
|
||||
// Create upgradable list cache
|
||||
let upgradable_cache = new_cache!().unwrap();
|
||||
//
|
||||
upgradable_cache.upgrade(Upgrade::FullUpgrade).unwrap();
|
||||
|
||||
upgradable_cache.resolve(true).unwrap();
|
||||
upgradable_cache.resolve(true).unwrap();
|
||||
|
||||
let mut upgradeable_iter =
|
||||
upgradable_cache.get_changes(false).peekable();
|
||||
while let Some(pkg) = upgradeable_iter.next() {
|
||||
if !pkg.marked_delete() {
|
||||
let candidate_version_pkg = pkg.candidate().unwrap();
|
||||
let package_struct = AptPackageSocket {
|
||||
name: pkg.name().to_string(),
|
||||
arch: pkg.arch().to_string(),
|
||||
installed_version: match pkg.installed() {
|
||||
Some(t) => t.version().to_string(),
|
||||
_ => {
|
||||
t!("installed_version_to_be_installed").to_string()
|
||||
}
|
||||
},
|
||||
candidate_version: candidate_version_pkg
|
||||
.version()
|
||||
.to_string(),
|
||||
description: match candidate_version_pkg.description() {
|
||||
Some(s) => s,
|
||||
_ => t!("apt_pkg_property_unknown").to_string(),
|
||||
},
|
||||
source_uri: candidate_version_pkg
|
||||
.uris()
|
||||
.collect::<Vec<String>>()
|
||||
.join("\n"),
|
||||
maintainer: match candidate_version_pkg
|
||||
.get_record(RecordField::Maintainer)
|
||||
{
|
||||
Some(s) => s,
|
||||
_ => t!("apt_pkg_property_unknown").to_string(),
|
||||
},
|
||||
size: candidate_version_pkg.size(),
|
||||
installed_size: candidate_version_pkg.installed_size(),
|
||||
is_last: upgradeable_iter.peek().is_none(),
|
||||
};
|
||||
get_upgradable_sender.send_blocking(package_struct).unwrap()
|
||||
}
|
||||
}
|
||||
});
|
||||
let mut upgradeable_iter = upgradable_cache.get_changes(false).peekable();
|
||||
while let Some(pkg) = upgradeable_iter.next() {
|
||||
if !pkg.marked_delete() {
|
||||
let candidate_version_pkg = pkg.candidate().unwrap();
|
||||
let package_struct = AptPackageSocket {
|
||||
name: pkg.name().to_string(),
|
||||
arch: pkg.arch().to_string(),
|
||||
installed_version: match pkg.installed() {
|
||||
Some(t) => t.version().to_string(),
|
||||
_ => t!("installed_version_to_be_installed").to_string(),
|
||||
},
|
||||
candidate_version: candidate_version_pkg.version().to_string(),
|
||||
description: match candidate_version_pkg.description() {
|
||||
Some(s) => s,
|
||||
_ => t!("apt_pkg_property_unknown").to_string(),
|
||||
},
|
||||
source_uri: candidate_version_pkg
|
||||
.uris()
|
||||
.collect::<Vec<String>>()
|
||||
.join("\n"),
|
||||
maintainer: match candidate_version_pkg.get_record(RecordField::Maintainer) {
|
||||
Some(s) => s,
|
||||
_ => t!("apt_pkg_property_unknown").to_string(),
|
||||
},
|
||||
size: candidate_version_pkg.size(),
|
||||
installed_size: candidate_version_pkg.installed_size(),
|
||||
is_last: upgradeable_iter.peek().is_none(),
|
||||
};
|
||||
get_upgradable_sender.send_blocking(package_struct).unwrap()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
@ -244,7 +244,7 @@ pub fn build_ui(app: &Application) {
|
||||
|
||||
let window_breakpoint = adw::Breakpoint::new(BreakpointCondition::new_length(
|
||||
BreakpointConditionLengthType::MaxWidth,
|
||||
1000.0,
|
||||
1200.0,
|
||||
LengthUnit::Sp,
|
||||
));
|
||||
|
||||
@ -296,12 +296,12 @@ pub fn build_ui(app: &Application) {
|
||||
.build();
|
||||
|
||||
let window_content_page_split_view = adw::OverlaySplitView::builder()
|
||||
.vexpand(true)
|
||||
.hexpand(true)
|
||||
.content(&window_toolbar)
|
||||
.sidebar(&window_adw_view_switcher_sidebar_box)
|
||||
.max_sidebar_width(300.0)
|
||||
.min_sidebar_width(300.0)
|
||||
.min_sidebar_width(290.0)
|
||||
.sidebar_width_unit(adw::LengthUnit::Px)
|
||||
.sidebar_width_fraction(0.2)
|
||||
.enable_hide_gesture(true)
|
||||
.enable_show_gesture(true)
|
||||
.build();
|
||||
@ -338,7 +338,7 @@ pub fn build_ui(app: &Application) {
|
||||
.default_width(glib_settings.int("window-width"))
|
||||
.default_height(glib_settings.int("window-height"))
|
||||
//
|
||||
.width_request(900)
|
||||
.width_request(1000)
|
||||
.height_request(700)
|
||||
.content(&window_content_page_split_view)
|
||||
// Startup
|
||||
@ -664,7 +664,8 @@ pub fn build_ui(app: &Application) {
|
||||
}
|
||||
}
|
||||
ConstantLoopMessage::RefreshRequest => {
|
||||
update_sys_tray.activate(Some(&glib::Variant::array_from_fixed_array(&[-1, -1])));
|
||||
update_sys_tray
|
||||
.activate(Some(&glib::Variant::array_from_fixed_array(&[-1, -1])));
|
||||
apt_retry_signal_action.activate(None);
|
||||
flatpak_retry_signal_action.activate(None);
|
||||
}
|
||||
|
@ -193,11 +193,11 @@ pub fn flatpak_update_page(
|
||||
.build();
|
||||
|
||||
/*let packages_ignored_viewport_page = adw::StatusPage::builder()
|
||||
.icon_name("dialog-warning-symbolic")
|
||||
.title(t!("flatpak_ignored_viewport_page_title"))
|
||||
.hexpand(true)
|
||||
.vexpand(true)
|
||||
.build();*/
|
||||
.icon_name("dialog-warning-symbolic")
|
||||
.title(t!("flatpak_ignored_viewport_page_title"))
|
||||
.hexpand(true)
|
||||
.vexpand(true)
|
||||
.build();*/
|
||||
|
||||
let viewport_bin = adw::Bin::builder()
|
||||
.child(&packages_no_viewport_page)
|
||||
@ -529,337 +529,296 @@ fn get_flatpak_updates(
|
||||
apt_update_count: &Rc<RefCell<i32>>,
|
||||
flatpak_update_count: &Rc<RefCell<i32>>,
|
||||
) {
|
||||
let flatpak_system_installation =
|
||||
libflatpak::Installation::new_system(cancellable_no).unwrap();
|
||||
let flatpak_system_updates = flatpak_system_installation
|
||||
.list_installed_refs_for_update(cancellable_no)
|
||||
.unwrap();
|
||||
//
|
||||
let flatpak_user_installation =
|
||||
libflatpak::Installation::new_user(cancellable_no).unwrap();
|
||||
let flatpak_user_updates = flatpak_user_installation
|
||||
.list_installed_refs_for_update(cancellable_no)
|
||||
.unwrap();
|
||||
//
|
||||
let mut system_last_triggered = false;
|
||||
let mut user_last_triggered = false;
|
||||
//
|
||||
if !flatpak_system_updates.is_empty() || !flatpak_user_updates.is_empty() {
|
||||
update_button.set_sensitive(true);
|
||||
viewport_bin.set_child(Some(packages_viewport));
|
||||
let flatpak_system_installation = libflatpak::Installation::new_system(cancellable_no).unwrap();
|
||||
let flatpak_system_updates = flatpak_system_installation
|
||||
.list_installed_refs_for_update(cancellable_no)
|
||||
.unwrap();
|
||||
//
|
||||
let flatpak_user_installation = libflatpak::Installation::new_user(cancellable_no).unwrap();
|
||||
let flatpak_user_updates = flatpak_user_installation
|
||||
.list_installed_refs_for_update(cancellable_no)
|
||||
.unwrap();
|
||||
//
|
||||
let mut system_last_triggered = false;
|
||||
let mut user_last_triggered = false;
|
||||
//
|
||||
if !flatpak_system_updates.is_empty() || !flatpak_user_updates.is_empty() {
|
||||
update_button.set_sensitive(true);
|
||||
viewport_bin.set_child(Some(packages_viewport));
|
||||
}
|
||||
//
|
||||
if !flatpak_system_updates.is_empty() {
|
||||
let flatpak_system_updates_iter = &mut flatpak_system_updates.iter().peekable();
|
||||
//
|
||||
while let Some(flatpak_ref) = flatpak_system_updates_iter.next() {
|
||||
let mut remote_flatpak_ref: Option<libflatpak::RemoteRef> = None;
|
||||
while let Ok(remotes) =
|
||||
libflatpak::Installation::list_remotes(&flatpak_system_installation, cancellable_no)
|
||||
{
|
||||
for remote in remotes {
|
||||
if remote.is_disabled() {
|
||||
continue;
|
||||
};
|
||||
match libflatpak::Installation::fetch_remote_ref_sync(
|
||||
&flatpak_system_installation,
|
||||
&match remote.name() {
|
||||
Some(t) => t,
|
||||
None => continue,
|
||||
},
|
||||
flatpak_ref.kind(),
|
||||
&match flatpak_ref.name() {
|
||||
Some(t) => t,
|
||||
None => continue,
|
||||
},
|
||||
flatpak_ref.arch().as_deref(),
|
||||
flatpak_ref.branch().as_deref(),
|
||||
cancellable_no,
|
||||
) {
|
||||
Ok(t) => {
|
||||
remote_flatpak_ref = Some(t);
|
||||
break;
|
||||
}
|
||||
//
|
||||
if !flatpak_system_updates.is_empty() {
|
||||
let flatpak_system_updates_iter =
|
||||
&mut flatpak_system_updates.iter().peekable();
|
||||
//
|
||||
while let Some(flatpak_ref) = flatpak_system_updates_iter.next() {
|
||||
let mut remote_flatpak_ref: Option<libflatpak::RemoteRef> = None;
|
||||
while let Ok(remotes) = libflatpak::Installation::list_remotes(
|
||||
&flatpak_system_installation,
|
||||
cancellable_no,
|
||||
) {
|
||||
for remote in remotes {
|
||||
if remote.is_disabled() {
|
||||
continue;
|
||||
};
|
||||
match libflatpak::Installation::fetch_remote_ref_sync(
|
||||
&flatpak_system_installation,
|
||||
&match remote.name() {
|
||||
Some(t) => t,
|
||||
None => continue,
|
||||
},
|
||||
flatpak_ref.kind(),
|
||||
&match flatpak_ref.name() {
|
||||
Some(t) => t,
|
||||
None => continue,
|
||||
},
|
||||
flatpak_ref.arch().as_deref(),
|
||||
flatpak_ref.branch().as_deref(),
|
||||
cancellable_no,
|
||||
) {
|
||||
Ok(t) => {
|
||||
remote_flatpak_ref = Some(t);
|
||||
break;
|
||||
}
|
||||
Err(_) => continue,
|
||||
}
|
||||
}
|
||||
if remote_flatpak_ref.is_some() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
let flatref_struct = FlatpakRefStruct {
|
||||
ref_name: flatpak_ref
|
||||
.name()
|
||||
.unwrap_or("Unknown".into())
|
||||
.to_string(),
|
||||
name: flatpak_ref
|
||||
.appdata_name()
|
||||
.unwrap_or(flatpak_ref.name().unwrap_or("Unknown".into()))
|
||||
.to_string(),
|
||||
arch: flatpak_ref
|
||||
.arch()
|
||||
.unwrap_or("Unknown Arch".into())
|
||||
.to_string(),
|
||||
summary: flatpak_ref
|
||||
.appdata_summary()
|
||||
.unwrap_or("No Summary".into())
|
||||
.to_string(),
|
||||
remote_name: match remote_flatpak_ref {
|
||||
Some(ref t) => {
|
||||
t.remote_name().unwrap_or("Unknown".into()).to_string()
|
||||
}
|
||||
None => "Unknown".into(),
|
||||
},
|
||||
installed_size_installed: flatpak_ref.installed_size(),
|
||||
installed_size_remote: match remote_flatpak_ref {
|
||||
Some(ref t) => t.installed_size(),
|
||||
None => 0,
|
||||
},
|
||||
download_size: match remote_flatpak_ref {
|
||||
Some(t) => t.download_size(),
|
||||
None => 0,
|
||||
},
|
||||
ref_format: flatpak_ref.format_ref().unwrap().into(),
|
||||
is_system: true,
|
||||
is_last: flatpak_system_updates_iter.peek().is_none(),
|
||||
};
|
||||
Err(_) => continue,
|
||||
}
|
||||
}
|
||||
if remote_flatpak_ref.is_some() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
let flatref_struct = FlatpakRefStruct {
|
||||
ref_name: flatpak_ref.name().unwrap_or("Unknown".into()).to_string(),
|
||||
name: flatpak_ref
|
||||
.appdata_name()
|
||||
.unwrap_or(flatpak_ref.name().unwrap_or("Unknown".into()))
|
||||
.to_string(),
|
||||
arch: flatpak_ref
|
||||
.arch()
|
||||
.unwrap_or("Unknown Arch".into())
|
||||
.to_string(),
|
||||
summary: flatpak_ref
|
||||
.appdata_summary()
|
||||
.unwrap_or("No Summary".into())
|
||||
.to_string(),
|
||||
remote_name: match remote_flatpak_ref {
|
||||
Some(ref t) => t.remote_name().unwrap_or("Unknown".into()).to_string(),
|
||||
None => "Unknown".into(),
|
||||
},
|
||||
installed_size_installed: flatpak_ref.installed_size(),
|
||||
installed_size_remote: match remote_flatpak_ref {
|
||||
Some(ref t) => t.installed_size(),
|
||||
None => 0,
|
||||
},
|
||||
download_size: match remote_flatpak_ref {
|
||||
Some(t) => t.download_size(),
|
||||
None => 0,
|
||||
},
|
||||
ref_format: flatpak_ref.format_ref().unwrap().into(),
|
||||
is_system: true,
|
||||
is_last: flatpak_system_updates_iter.peek().is_none(),
|
||||
};
|
||||
|
||||
let flatpak_row = FlatpakRefRow::new(&flatref_struct);
|
||||
let flatpak_row = FlatpakRefRow::new(&flatref_struct);
|
||||
|
||||
system_refs_for_upgrade_vec
|
||||
.borrow_mut()
|
||||
.push(flatpak_row.clone());
|
||||
system_refs_for_upgrade_vec
|
||||
.borrow_mut()
|
||||
.push(flatpak_row.clone());
|
||||
|
||||
system_refs_for_upgrade_vec_all
|
||||
.borrow_mut()
|
||||
.push(flatpak_row.clone());
|
||||
system_refs_for_upgrade_vec_all
|
||||
.borrow_mut()
|
||||
.push(flatpak_row.clone());
|
||||
|
||||
flatpak_row.connect_closure(
|
||||
"checkbutton-toggled",
|
||||
false,
|
||||
closure_local!(
|
||||
#[strong]
|
||||
select_button,
|
||||
#[strong]
|
||||
update_button,
|
||||
#[strong]
|
||||
packages_boxedlist,
|
||||
#[strong]
|
||||
system_refs_for_upgrade_vec,
|
||||
move |flatpak_row: FlatpakRefRow| {
|
||||
if is_widget_select_all_ready(&packages_boxedlist) {
|
||||
select_button.set_label(
|
||||
&t!("select_button_select_all").to_string(),
|
||||
);
|
||||
} else {
|
||||
select_button.set_label(
|
||||
&t!("select_button_deselect_all").to_string(),
|
||||
);
|
||||
}
|
||||
update_button.set_sensitive(!is_all_children_unmarked(
|
||||
&packages_boxedlist,
|
||||
));
|
||||
system_refs_for_upgrade_vec
|
||||
.borrow_mut()
|
||||
.push(flatpak_row);
|
||||
}
|
||||
),
|
||||
);
|
||||
flatpak_row.connect_closure(
|
||||
"checkbutton-untoggled",
|
||||
false,
|
||||
closure_local!(
|
||||
#[strong]
|
||||
select_button,
|
||||
#[strong]
|
||||
update_button,
|
||||
#[strong]
|
||||
packages_boxedlist,
|
||||
#[strong]
|
||||
system_refs_for_upgrade_vec,
|
||||
move |flatpak_row: FlatpakRefRow| {
|
||||
select_button.set_label(
|
||||
&t!("select_button_select_all").to_string(),
|
||||
);
|
||||
update_button.set_sensitive(!is_all_children_unmarked(
|
||||
&packages_boxedlist,
|
||||
));
|
||||
system_refs_for_upgrade_vec.borrow_mut().retain(|x| {
|
||||
x.flatref_ref_format()
|
||||
!= flatpak_row.flatref_ref_format()
|
||||
});
|
||||
}
|
||||
),
|
||||
);
|
||||
|
||||
packages_boxedlist.append(&flatpak_row);
|
||||
(*flatpak_update_count.borrow_mut() += 1);
|
||||
if flatref_struct.is_system && flatref_struct.is_last {
|
||||
system_last_triggered = true
|
||||
}
|
||||
}
|
||||
flatpak_row.connect_closure(
|
||||
"checkbutton-toggled",
|
||||
false,
|
||||
closure_local!(
|
||||
#[strong]
|
||||
select_button,
|
||||
#[strong]
|
||||
update_button,
|
||||
#[strong]
|
||||
packages_boxedlist,
|
||||
#[strong]
|
||||
system_refs_for_upgrade_vec,
|
||||
move |flatpak_row: FlatpakRefRow| {
|
||||
if is_widget_select_all_ready(&packages_boxedlist) {
|
||||
select_button.set_label(&t!("select_button_select_all").to_string());
|
||||
} else {
|
||||
system_last_triggered = true
|
||||
select_button.set_label(&t!("select_button_deselect_all").to_string());
|
||||
}
|
||||
if !flatpak_user_updates.is_empty() {
|
||||
let flatpak_user_updates_iter =
|
||||
&mut flatpak_user_updates.iter().peekable();
|
||||
//
|
||||
while let Some(flatpak_ref) = flatpak_user_updates_iter.next() {
|
||||
let mut remote_flatpak_ref: Option<libflatpak::RemoteRef> = None;
|
||||
while let Ok(remotes) = libflatpak::Installation::list_remotes(
|
||||
&flatpak_user_installation,
|
||||
cancellable_no,
|
||||
) {
|
||||
for remote in remotes {
|
||||
if remote.is_disabled() {
|
||||
continue;
|
||||
};
|
||||
match libflatpak::Installation::fetch_remote_ref_sync(
|
||||
&flatpak_user_installation,
|
||||
&match remote.name() {
|
||||
Some(t) => t,
|
||||
None => continue,
|
||||
},
|
||||
flatpak_ref.kind(),
|
||||
&match flatpak_ref.name() {
|
||||
Some(t) => t,
|
||||
None => continue,
|
||||
},
|
||||
flatpak_ref.arch().as_deref(),
|
||||
flatpak_ref.branch().as_deref(),
|
||||
cancellable_no,
|
||||
) {
|
||||
Ok(t) => {
|
||||
remote_flatpak_ref = Some(t);
|
||||
break;
|
||||
}
|
||||
Err(_) => continue,
|
||||
}
|
||||
}
|
||||
if remote_flatpak_ref.is_some() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
let flatref_struct = FlatpakRefStruct {
|
||||
ref_name: flatpak_ref
|
||||
.name()
|
||||
.unwrap_or("Unknown".into())
|
||||
.to_string(),
|
||||
name: flatpak_ref
|
||||
.appdata_name()
|
||||
.unwrap_or(flatpak_ref.name().unwrap_or("Unknown".into()))
|
||||
.to_string(),
|
||||
arch: flatpak_ref
|
||||
.arch()
|
||||
.unwrap_or("Unknown Arch".into())
|
||||
.to_string(),
|
||||
summary: flatpak_ref
|
||||
.appdata_summary()
|
||||
.unwrap_or("No Summary".into())
|
||||
.to_string(),
|
||||
remote_name: match remote_flatpak_ref {
|
||||
Some(ref t) => {
|
||||
t.remote_name().unwrap_or("Unknown".into()).to_string()
|
||||
}
|
||||
None => "Unknown".into(),
|
||||
},
|
||||
installed_size_installed: flatpak_ref.installed_size(),
|
||||
installed_size_remote: match remote_flatpak_ref {
|
||||
Some(ref t) => t.installed_size(),
|
||||
None => 0,
|
||||
},
|
||||
download_size: match remote_flatpak_ref {
|
||||
Some(t) => t.download_size(),
|
||||
None => 0,
|
||||
},
|
||||
ref_format: flatpak_ref.format_ref().unwrap().into(),
|
||||
is_system: false,
|
||||
is_last: flatpak_user_updates_iter.peek().is_none(),
|
||||
};
|
||||
update_button.set_sensitive(!is_all_children_unmarked(&packages_boxedlist));
|
||||
system_refs_for_upgrade_vec.borrow_mut().push(flatpak_row);
|
||||
}
|
||||
),
|
||||
);
|
||||
flatpak_row.connect_closure(
|
||||
"checkbutton-untoggled",
|
||||
false,
|
||||
closure_local!(
|
||||
#[strong]
|
||||
select_button,
|
||||
#[strong]
|
||||
update_button,
|
||||
#[strong]
|
||||
packages_boxedlist,
|
||||
#[strong]
|
||||
system_refs_for_upgrade_vec,
|
||||
move |flatpak_row: FlatpakRefRow| {
|
||||
select_button.set_label(&t!("select_button_select_all").to_string());
|
||||
update_button.set_sensitive(!is_all_children_unmarked(&packages_boxedlist));
|
||||
system_refs_for_upgrade_vec
|
||||
.borrow_mut()
|
||||
.retain(|x| x.flatref_ref_format() != flatpak_row.flatref_ref_format());
|
||||
}
|
||||
),
|
||||
);
|
||||
|
||||
let flatpak_row = FlatpakRefRow::new(&flatref_struct);
|
||||
packages_boxedlist.append(&flatpak_row);
|
||||
(*flatpak_update_count.borrow_mut() += 1);
|
||||
if flatref_struct.is_system && flatref_struct.is_last {
|
||||
system_last_triggered = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
system_last_triggered = true
|
||||
}
|
||||
if !flatpak_user_updates.is_empty() {
|
||||
let flatpak_user_updates_iter = &mut flatpak_user_updates.iter().peekable();
|
||||
//
|
||||
while let Some(flatpak_ref) = flatpak_user_updates_iter.next() {
|
||||
let mut remote_flatpak_ref: Option<libflatpak::RemoteRef> = None;
|
||||
while let Ok(remotes) =
|
||||
libflatpak::Installation::list_remotes(&flatpak_user_installation, cancellable_no)
|
||||
{
|
||||
for remote in remotes {
|
||||
if remote.is_disabled() {
|
||||
continue;
|
||||
};
|
||||
match libflatpak::Installation::fetch_remote_ref_sync(
|
||||
&flatpak_user_installation,
|
||||
&match remote.name() {
|
||||
Some(t) => t,
|
||||
None => continue,
|
||||
},
|
||||
flatpak_ref.kind(),
|
||||
&match flatpak_ref.name() {
|
||||
Some(t) => t,
|
||||
None => continue,
|
||||
},
|
||||
flatpak_ref.arch().as_deref(),
|
||||
flatpak_ref.branch().as_deref(),
|
||||
cancellable_no,
|
||||
) {
|
||||
Ok(t) => {
|
||||
remote_flatpak_ref = Some(t);
|
||||
break;
|
||||
}
|
||||
Err(_) => continue,
|
||||
}
|
||||
}
|
||||
if remote_flatpak_ref.is_some() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
let flatref_struct = FlatpakRefStruct {
|
||||
ref_name: flatpak_ref.name().unwrap_or("Unknown".into()).to_string(),
|
||||
name: flatpak_ref
|
||||
.appdata_name()
|
||||
.unwrap_or(flatpak_ref.name().unwrap_or("Unknown".into()))
|
||||
.to_string(),
|
||||
arch: flatpak_ref
|
||||
.arch()
|
||||
.unwrap_or("Unknown Arch".into())
|
||||
.to_string(),
|
||||
summary: flatpak_ref
|
||||
.appdata_summary()
|
||||
.unwrap_or("No Summary".into())
|
||||
.to_string(),
|
||||
remote_name: match remote_flatpak_ref {
|
||||
Some(ref t) => t.remote_name().unwrap_or("Unknown".into()).to_string(),
|
||||
None => "Unknown".into(),
|
||||
},
|
||||
installed_size_installed: flatpak_ref.installed_size(),
|
||||
installed_size_remote: match remote_flatpak_ref {
|
||||
Some(ref t) => t.installed_size(),
|
||||
None => 0,
|
||||
},
|
||||
download_size: match remote_flatpak_ref {
|
||||
Some(t) => t.download_size(),
|
||||
None => 0,
|
||||
},
|
||||
ref_format: flatpak_ref.format_ref().unwrap().into(),
|
||||
is_system: false,
|
||||
is_last: flatpak_user_updates_iter.peek().is_none(),
|
||||
};
|
||||
|
||||
user_refs_for_upgrade_vec
|
||||
.borrow_mut()
|
||||
.push(flatpak_row.clone());
|
||||
let flatpak_row = FlatpakRefRow::new(&flatref_struct);
|
||||
|
||||
user_refs_for_upgrade_vec_all
|
||||
.borrow_mut()
|
||||
.push(flatpak_row.clone());
|
||||
user_refs_for_upgrade_vec
|
||||
.borrow_mut()
|
||||
.push(flatpak_row.clone());
|
||||
|
||||
flatpak_row.connect_closure(
|
||||
"checkbutton-toggled",
|
||||
false,
|
||||
closure_local!(
|
||||
#[strong]
|
||||
select_button,
|
||||
#[strong]
|
||||
update_button,
|
||||
#[strong]
|
||||
packages_boxedlist,
|
||||
#[strong]
|
||||
user_refs_for_upgrade_vec,
|
||||
move |flatpak_row: FlatpakRefRow| {
|
||||
if is_widget_select_all_ready(&packages_boxedlist) {
|
||||
select_button.set_label(
|
||||
&t!("select_button_select_all").to_string(),
|
||||
);
|
||||
} else {
|
||||
select_button.set_label(
|
||||
&t!("select_button_deselect_all").to_string(),
|
||||
);
|
||||
}
|
||||
update_button.set_sensitive(!is_all_children_unmarked(
|
||||
&packages_boxedlist,
|
||||
));
|
||||
user_refs_for_upgrade_vec
|
||||
.borrow_mut()
|
||||
.push(flatpak_row);
|
||||
}
|
||||
),
|
||||
);
|
||||
flatpak_row.connect_closure(
|
||||
"checkbutton-untoggled",
|
||||
false,
|
||||
closure_local!(
|
||||
#[strong]
|
||||
select_button,
|
||||
#[strong]
|
||||
update_button,
|
||||
#[strong]
|
||||
packages_boxedlist,
|
||||
#[strong]
|
||||
user_refs_for_upgrade_vec,
|
||||
move |flatpak_row: FlatpakRefRow| {
|
||||
select_button.set_label(
|
||||
&t!("select_button_select_all").to_string(),
|
||||
);
|
||||
update_button.set_sensitive(!is_all_children_unmarked(
|
||||
&packages_boxedlist,
|
||||
));
|
||||
user_refs_for_upgrade_vec.borrow_mut().retain(|x| {
|
||||
x.flatref_ref_format()
|
||||
!= flatpak_row.flatref_ref_format()
|
||||
});
|
||||
}
|
||||
),
|
||||
);
|
||||
packages_boxedlist.append(&flatpak_row);
|
||||
(*flatpak_update_count.borrow_mut() += 1);
|
||||
if !flatref_struct.is_system && flatref_struct.is_last {
|
||||
user_last_triggered = true
|
||||
}
|
||||
}
|
||||
user_refs_for_upgrade_vec_all
|
||||
.borrow_mut()
|
||||
.push(flatpak_row.clone());
|
||||
|
||||
flatpak_row.connect_closure(
|
||||
"checkbutton-toggled",
|
||||
false,
|
||||
closure_local!(
|
||||
#[strong]
|
||||
select_button,
|
||||
#[strong]
|
||||
update_button,
|
||||
#[strong]
|
||||
packages_boxedlist,
|
||||
#[strong]
|
||||
user_refs_for_upgrade_vec,
|
||||
move |flatpak_row: FlatpakRefRow| {
|
||||
if is_widget_select_all_ready(&packages_boxedlist) {
|
||||
select_button.set_label(&t!("select_button_select_all").to_string());
|
||||
} else {
|
||||
user_last_triggered = true
|
||||
}
|
||||
if user_last_triggered && system_last_triggered {
|
||||
packages_boxedlist.set_sensitive(true);
|
||||
update_sys_tray.activate(Some(&glib::Variant::array_from_fixed_array(
|
||||
&[*apt_update_count.borrow(), *flatpak_update_count.borrow()],
|
||||
)));
|
||||
select_button.set_label(&t!("select_button_deselect_all").to_string());
|
||||
}
|
||||
update_button.set_sensitive(!is_all_children_unmarked(&packages_boxedlist));
|
||||
user_refs_for_upgrade_vec.borrow_mut().push(flatpak_row);
|
||||
}
|
||||
),
|
||||
);
|
||||
flatpak_row.connect_closure(
|
||||
"checkbutton-untoggled",
|
||||
false,
|
||||
closure_local!(
|
||||
#[strong]
|
||||
select_button,
|
||||
#[strong]
|
||||
update_button,
|
||||
#[strong]
|
||||
packages_boxedlist,
|
||||
#[strong]
|
||||
user_refs_for_upgrade_vec,
|
||||
move |flatpak_row: FlatpakRefRow| {
|
||||
select_button.set_label(&t!("select_button_select_all").to_string());
|
||||
update_button.set_sensitive(!is_all_children_unmarked(&packages_boxedlist));
|
||||
user_refs_for_upgrade_vec
|
||||
.borrow_mut()
|
||||
.retain(|x| x.flatref_ref_format() != flatpak_row.flatref_ref_format());
|
||||
}
|
||||
),
|
||||
);
|
||||
packages_boxedlist.append(&flatpak_row);
|
||||
(*flatpak_update_count.borrow_mut() += 1);
|
||||
if !flatref_struct.is_system && flatref_struct.is_last {
|
||||
user_last_triggered = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
user_last_triggered = true
|
||||
}
|
||||
if user_last_triggered && system_last_triggered {
|
||||
packages_boxedlist.set_sensitive(true);
|
||||
update_sys_tray.activate(Some(&glib::Variant::array_from_fixed_array(&[
|
||||
*apt_update_count.borrow(),
|
||||
*flatpak_update_count.borrow(),
|
||||
])));
|
||||
}
|
||||
}
|
@ -8,12 +8,16 @@ use tokio::runtime::Runtime;
|
||||
pub struct AptInstallProgressSocket<'a> {
|
||||
percent_socket_path: &'a str,
|
||||
status_socket_path: &'a str,
|
||||
error_strfmt_trans_str: &'a str,
|
||||
error_strfmt_trans_str: String,
|
||||
}
|
||||
|
||||
impl<'a> AptInstallProgressSocket<'a> {
|
||||
/// Returns a new default progress instance.
|
||||
pub fn new(percent_socket_path: &'a str, status_socket_path: &'a str, error_strfmt_trans_str: &'a str) -> Self {
|
||||
pub fn new(
|
||||
percent_socket_path: &'a str,
|
||||
status_socket_path: &'a str,
|
||||
error_strfmt_trans_str: String,
|
||||
) -> Self {
|
||||
let progress = Self {
|
||||
percent_socket_path: percent_socket_path,
|
||||
status_socket_path: status_socket_path,
|
||||
|
@ -18,7 +18,14 @@ pub struct AptUpdateProgressSocket<'a> {
|
||||
|
||||
impl<'a> AptUpdateProgressSocket<'a> {
|
||||
/// Returns a new default progress instance.
|
||||
pub fn new(percent_socket_path: &'a str, status_socket_path: &'a str, hit_strfmt_trans_str: &'a str, fetch_strfmt_trans_str: &'a str, done_strfmt_trans_str: &'a str, fail_strfmt_trans_str: &'a str) -> Self {
|
||||
pub fn new(
|
||||
percent_socket_path: &'a str,
|
||||
status_socket_path: &'a str,
|
||||
hit_strfmt_trans_str: &'a str,
|
||||
fetch_strfmt_trans_str: &'a str,
|
||||
done_strfmt_trans_str: &'a str,
|
||||
fail_strfmt_trans_str: &'a str,
|
||||
) -> Self {
|
||||
let progress = Self {
|
||||
pulse_interval: 0,
|
||||
percent_socket_path: percent_socket_path,
|
||||
|
Loading…
Reference in New Issue
Block a user