Compare commits
2 Commits
650093da67
...
f33d2254f0
Author | SHA1 | Date | |
---|---|---|---|
|
f33d2254f0 | ||
|
e33e800131 |
2
.github/release-nest-v3
vendored
2
.github/release-nest-v3
vendored
@ -1 +1 @@
|
|||||||
11
|
13
|
44
Cargo.lock
generated
44
Cargo.lock
generated
@ -526,7 +526,7 @@ version = "0.3.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f"
|
checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memoffset",
|
"memoffset 0.9.1",
|
||||||
"rustc_version 0.4.0",
|
"rustc_version 0.4.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1441,6 +1441,15 @@ version = "2.7.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memoffset"
|
||||||
|
version = "0.6.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memoffset"
|
name = "memoffset"
|
||||||
version = "0.9.1"
|
version = "0.9.1"
|
||||||
@ -1546,6 +1555,19 @@ dependencies = [
|
|||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nix"
|
||||||
|
version = "0.23.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
"cc",
|
||||||
|
"cfg-if 1.0.0",
|
||||||
|
"libc",
|
||||||
|
"memoffset 0.6.5",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "normpath"
|
name = "normpath"
|
||||||
version = "1.2.0"
|
version = "1.2.0"
|
||||||
@ -1759,6 +1781,7 @@ dependencies = [
|
|||||||
"rust-i18n",
|
"rust-i18n",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
"single-instance",
|
||||||
"strfmt",
|
"strfmt",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-uds",
|
"tokio-uds",
|
||||||
@ -2223,6 +2246,19 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "single-instance"
|
||||||
|
version = "0.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4637485391f8545c9d3dbf60f9d9aab27a90c789a700999677583bcb17c8795d"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"nix",
|
||||||
|
"thiserror",
|
||||||
|
"widestring",
|
||||||
|
"winapi 0.3.9",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slab"
|
name = "slab"
|
||||||
version = "0.4.9"
|
version = "0.4.9"
|
||||||
@ -2863,6 +2899,12 @@ dependencies = [
|
|||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "widestring"
|
||||||
|
version = "0.4.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
|
@ -45,4 +45,5 @@ reqwest = { version = "0.11", features = ["blocking"] }
|
|||||||
strfmt = "0.2.4"
|
strfmt = "0.2.4"
|
||||||
configparser = "3.1.0"
|
configparser = "3.1.0"
|
||||||
ksni = "0.2.2"
|
ksni = "0.2.2"
|
||||||
|
single-instance = "0.3.3"
|
||||||
|
|
||||||
|
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-100pika4) pikauwu; urgency=medium
|
||||||
|
|
||||||
* initial release
|
* initial release
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ use pika_unixsocket_tools::pika_unixsocket_tools::*;
|
|||||||
use rust_apt::cache::Upgrade;
|
use rust_apt::cache::Upgrade;
|
||||||
use rust_apt::new_cache;
|
use rust_apt::new_cache;
|
||||||
use rust_apt::progress::{AcquireProgress, InstallProgress};
|
use rust_apt::progress::{AcquireProgress, InstallProgress};
|
||||||
use tokio::runtime::Runtime;
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
use tokio::runtime::Runtime;
|
||||||
|
|
||||||
// Init translations for current crate.
|
// Init translations for current crate.
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
@ -82,7 +82,7 @@ fn main() {
|
|||||||
let mut install_progress = InstallProgress::new(AptInstallProgressSocket::new(
|
let mut install_progress = InstallProgress::new(AptInstallProgressSocket::new(
|
||||||
percent_socket_path,
|
percent_socket_path,
|
||||||
status_socket_path,
|
status_socket_path,
|
||||||
&error_strfmt_trans_str,
|
error_strfmt_trans_str,
|
||||||
));
|
));
|
||||||
|
|
||||||
apt_upgrade_cache.resolve(true).unwrap();
|
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 pika_unixsocket_tools::pika_unixsocket_tools::*;
|
||||||
use rust_apt::new_cache;
|
use rust_apt::new_cache;
|
||||||
use rust_apt::progress::AcquireProgress;
|
use rust_apt::progress::AcquireProgress;
|
||||||
use tokio::runtime::Runtime;
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
use tokio::runtime::Runtime;
|
||||||
|
|
||||||
// Init translations for current crate.
|
// Init translations for current crate.
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
@ -13,7 +13,11 @@ i18n!("locales", fallback = "en_US");
|
|||||||
fn main() {
|
fn main() {
|
||||||
let args: Vec<String> = env::args().collect();
|
let args: Vec<String> = env::args().collect();
|
||||||
rust_i18n::set_locale(&args[1]);
|
rust_i18n::set_locale(&args[1]);
|
||||||
|
let instance = single_instance::SingleInstance::new(
|
||||||
|
"com.github.pikaos-linux.pikmanupdatemanager.update.manager",
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
let hit_strfmt_trans_str = t!("apt_update_str_hit").to_string();
|
let hit_strfmt_trans_str = t!("apt_update_str_hit").to_string();
|
||||||
let fetch_strfmt_trans_str = t!("apt_update_str_fetch").to_string();
|
let fetch_strfmt_trans_str = t!("apt_update_str_fetch").to_string();
|
||||||
let done_strfmt_trans_str = t!("apt_update_str_done").to_string();
|
let done_strfmt_trans_str = t!("apt_update_str_done").to_string();
|
||||||
@ -41,4 +45,6 @@ fn main() {
|
|||||||
panic!("{}", e.to_string())
|
panic!("{}", e.to_string())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
assert!(!instance.is_single());
|
||||||
}
|
}
|
||||||
|
@ -65,24 +65,42 @@ pub fn apt_update_page(
|
|||||||
});
|
});
|
||||||
|
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
let apt_update_command = Command::new("pkexec")
|
let instance = single_instance::SingleInstance::new(
|
||||||
.args(["/usr/lib/pika/pikman-update-manager/scripts/apt_update", "fr_FR"])
|
"com.github.pikaos-linux.pikmanupdatemanager.update.manager",
|
||||||
.status()
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
match apt_update_command.code().unwrap() {
|
if instance.is_single() {
|
||||||
0 => update_status_sender_clone0
|
let current_locale = match std::env::var_os("LANG") {
|
||||||
.send_blocking("FN_OVERRIDE_SUCCESSFUL".to_owned())
|
Some(v) => v
|
||||||
.unwrap(),
|
.into_string()
|
||||||
53 => {}
|
|
||||||
_ => {
|
|
||||||
update_status_sender_clone0
|
|
||||||
.send_blocking(t!("update_status_error_perms").to_string())
|
|
||||||
.unwrap();
|
|
||||||
update_status_sender_clone0
|
|
||||||
.send_blocking("FN_OVERRIDE_FAILED".to_owned())
|
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
.chars()
|
||||||
|
.take_while(|&ch| ch != '.')
|
||||||
|
.collect::<String>(),
|
||||||
|
None => panic!("$LANG is not set"),
|
||||||
|
};
|
||||||
|
let apt_update_command = Command::new("pkexec")
|
||||||
|
.args([
|
||||||
|
"/usr/lib/pika/pikman-update-manager/scripts/apt_update",
|
||||||
|
¤t_locale,
|
||||||
|
])
|
||||||
|
.status()
|
||||||
|
.unwrap();
|
||||||
|
match apt_update_command.code().unwrap() {
|
||||||
|
0 => update_status_sender_clone0
|
||||||
|
.send_blocking("FN_OVERRIDE_SUCCESSFUL".to_owned())
|
||||||
|
.unwrap(),
|
||||||
|
53 => {}
|
||||||
|
_ => {
|
||||||
|
update_status_sender_clone0
|
||||||
|
.send_blocking(t!("update_status_error_perms").to_string())
|
||||||
|
.unwrap();
|
||||||
|
update_status_sender_clone0
|
||||||
|
.send_blocking("FN_OVERRIDE_FAILED".to_owned())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
let main_box = Box::builder()
|
let main_box = Box::builder()
|
||||||
@ -128,11 +146,11 @@ pub fn apt_update_page(
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
/*let packages_ignored_viewport_page = adw::StatusPage::builder()
|
/*let packages_ignored_viewport_page = adw::StatusPage::builder()
|
||||||
.icon_name("dialog-warning-symbolic")
|
.icon_name("dialog-warning-symbolic")
|
||||||
.title(t!("apt_ignored_viewport_page_title"))
|
.title(t!("apt_ignored_viewport_page_title"))
|
||||||
.hexpand(true)
|
.hexpand(true)
|
||||||
.vexpand(true)
|
.vexpand(true)
|
||||||
.build();*/
|
.build();*/
|
||||||
|
|
||||||
let viewport_bin = adw::Bin::builder()
|
let viewport_bin = adw::Bin::builder()
|
||||||
.child(&packages_no_viewport_page)
|
.child(&packages_no_viewport_page)
|
||||||
@ -510,51 +528,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>) {
|
fn get_apt_upgrades(get_upgradable_sender: &async_channel::Sender<AptPackageSocket>) {
|
||||||
let get_upgradable_sender = get_upgradable_sender.clone();
|
let get_upgradable_sender = get_upgradable_sender.clone();
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
// Create upgradable list cache
|
// Create upgradable list cache
|
||||||
let upgradable_cache = new_cache!().unwrap();
|
let upgradable_cache = new_cache!().unwrap();
|
||||||
//
|
//
|
||||||
upgradable_cache.upgrade(Upgrade::FullUpgrade).unwrap();
|
upgradable_cache.upgrade(Upgrade::FullUpgrade).unwrap();
|
||||||
|
|
||||||
upgradable_cache.resolve(true).unwrap();
|
upgradable_cache.resolve(true).unwrap();
|
||||||
|
|
||||||
let mut upgradeable_iter =
|
let mut upgradeable_iter = upgradable_cache.get_changes(false).peekable();
|
||||||
upgradable_cache.get_changes(false).peekable();
|
while let Some(pkg) = upgradeable_iter.next() {
|
||||||
while let Some(pkg) = upgradeable_iter.next() {
|
if !pkg.marked_delete() {
|
||||||
if !pkg.marked_delete() {
|
let candidate_version_pkg = pkg.candidate().unwrap();
|
||||||
let candidate_version_pkg = pkg.candidate().unwrap();
|
let package_struct = AptPackageSocket {
|
||||||
let package_struct = AptPackageSocket {
|
name: pkg.name().to_string(),
|
||||||
name: pkg.name().to_string(),
|
arch: pkg.arch().to_string(),
|
||||||
arch: pkg.arch().to_string(),
|
installed_version: match pkg.installed() {
|
||||||
installed_version: match pkg.installed() {
|
Some(t) => t.version().to_string(),
|
||||||
Some(t) => t.version().to_string(),
|
_ => t!("installed_version_to_be_installed").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,
|
||||||
candidate_version: candidate_version_pkg
|
_ => t!("apt_pkg_property_unknown").to_string(),
|
||||||
.version()
|
},
|
||||||
.to_string(),
|
source_uri: candidate_version_pkg
|
||||||
description: match candidate_version_pkg.description() {
|
.uris()
|
||||||
Some(s) => s,
|
.collect::<Vec<String>>()
|
||||||
_ => t!("apt_pkg_property_unknown").to_string(),
|
.join("\n"),
|
||||||
},
|
maintainer: match candidate_version_pkg.get_record(RecordField::Maintainer) {
|
||||||
source_uri: candidate_version_pkg
|
Some(s) => s,
|
||||||
.uris()
|
_ => t!("apt_pkg_property_unknown").to_string(),
|
||||||
.collect::<Vec<String>>()
|
},
|
||||||
.join("\n"),
|
size: candidate_version_pkg.size(),
|
||||||
maintainer: match candidate_version_pkg
|
installed_size: candidate_version_pkg.installed_size(),
|
||||||
.get_record(RecordField::Maintainer)
|
is_last: upgradeable_iter.peek().is_none(),
|
||||||
{
|
};
|
||||||
Some(s) => s,
|
get_upgradable_sender.send_blocking(package_struct).unwrap()
|
||||||
_ => 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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
@ -411,8 +411,20 @@ fn apt_full_upgrade_from_socket(
|
|||||||
});
|
});
|
||||||
|
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
|
let current_locale = match std::env::var_os("LANG") {
|
||||||
|
Some(v) => v
|
||||||
|
.into_string()
|
||||||
|
.unwrap()
|
||||||
|
.chars()
|
||||||
|
.take_while(|&ch| ch != '.')
|
||||||
|
.collect::<String>(),
|
||||||
|
None => panic!("$LANG is not set"),
|
||||||
|
};
|
||||||
let apt_upgrade_command = Command::new("pkexec")
|
let apt_upgrade_command = Command::new("pkexec")
|
||||||
.args(["/usr/lib/pika/pikman-update-manager/scripts/apt_full_upgrade"])
|
.args([
|
||||||
|
"/usr/lib/pika/pikman-update-manager/scripts/apt_full_upgrade",
|
||||||
|
¤t_locale,
|
||||||
|
])
|
||||||
.status()
|
.status()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
match apt_upgrade_command.code().unwrap() {
|
match apt_upgrade_command.code().unwrap() {
|
||||||
|
@ -134,8 +134,8 @@ pub fn build_ui(app: &Application) {
|
|||||||
update_sys_tray.connect_activate(clone!(
|
update_sys_tray.connect_activate(clone!(
|
||||||
#[strong]
|
#[strong]
|
||||||
tray_handle,
|
tray_handle,
|
||||||
#[strong]
|
/*#[strong]
|
||||||
refresh_button,
|
refresh_button,*/
|
||||||
move |_, param| {
|
move |_, param| {
|
||||||
let array: &[i32] = param.unwrap().fixed_array().unwrap();
|
let array: &[i32] = param.unwrap().fixed_array().unwrap();
|
||||||
let vec = array.to_vec();
|
let vec = array.to_vec();
|
||||||
@ -175,7 +175,7 @@ pub fn build_ui(app: &Application) {
|
|||||||
.unwrap(),
|
.unwrap(),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
if apt_update_count == -1 || flatpak_update_count == -1 {
|
/*if apt_update_count == -1 || flatpak_update_count == -1 {
|
||||||
refresh_button.set_sensitive(false);
|
refresh_button.set_sensitive(false);
|
||||||
refresh_button.set_tooltip_text(Some(
|
refresh_button.set_tooltip_text(Some(
|
||||||
&t!("pikman_indicator_flatpak_item_label_calculating").to_string(),
|
&t!("pikman_indicator_flatpak_item_label_calculating").to_string(),
|
||||||
@ -184,7 +184,7 @@ pub fn build_ui(app: &Application) {
|
|||||||
refresh_button.set_sensitive(true);
|
refresh_button.set_sensitive(true);
|
||||||
refresh_button
|
refresh_button
|
||||||
.set_tooltip_text(Some(&t!("refresh_button_tooltip_text").to_string()));
|
.set_tooltip_text(Some(&t!("refresh_button_tooltip_text").to_string()));
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
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])));
|
||||||
@ -244,7 +244,7 @@ pub fn build_ui(app: &Application) {
|
|||||||
|
|
||||||
let window_breakpoint = adw::Breakpoint::new(BreakpointCondition::new_length(
|
let window_breakpoint = adw::Breakpoint::new(BreakpointCondition::new_length(
|
||||||
BreakpointConditionLengthType::MaxWidth,
|
BreakpointConditionLengthType::MaxWidth,
|
||||||
1000.0,
|
1200.0,
|
||||||
LengthUnit::Sp,
|
LengthUnit::Sp,
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -296,12 +296,12 @@ pub fn build_ui(app: &Application) {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
let window_content_page_split_view = adw::OverlaySplitView::builder()
|
let window_content_page_split_view = adw::OverlaySplitView::builder()
|
||||||
.vexpand(true)
|
|
||||||
.hexpand(true)
|
|
||||||
.content(&window_toolbar)
|
.content(&window_toolbar)
|
||||||
.sidebar(&window_adw_view_switcher_sidebar_box)
|
.sidebar(&window_adw_view_switcher_sidebar_box)
|
||||||
.max_sidebar_width(300.0)
|
.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_hide_gesture(true)
|
||||||
.enable_show_gesture(true)
|
.enable_show_gesture(true)
|
||||||
.build();
|
.build();
|
||||||
@ -338,7 +338,7 @@ pub fn build_ui(app: &Application) {
|
|||||||
.default_width(glib_settings.int("window-width"))
|
.default_width(glib_settings.int("window-width"))
|
||||||
.default_height(glib_settings.int("window-height"))
|
.default_height(glib_settings.int("window-height"))
|
||||||
//
|
//
|
||||||
.width_request(900)
|
.width_request(1000)
|
||||||
.height_request(700)
|
.height_request(700)
|
||||||
.content(&window_content_page_split_view)
|
.content(&window_content_page_split_view)
|
||||||
// Startup
|
// Startup
|
||||||
@ -664,7 +664,8 @@ pub fn build_ui(app: &Application) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ConstantLoopMessage::RefreshRequest => {
|
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);
|
apt_retry_signal_action.activate(None);
|
||||||
flatpak_retry_signal_action.activate(None);
|
flatpak_retry_signal_action.activate(None);
|
||||||
}
|
}
|
||||||
|
@ -193,11 +193,11 @@ pub fn flatpak_update_page(
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
/*let packages_ignored_viewport_page = adw::StatusPage::builder()
|
/*let packages_ignored_viewport_page = adw::StatusPage::builder()
|
||||||
.icon_name("dialog-warning-symbolic")
|
.icon_name("dialog-warning-symbolic")
|
||||||
.title(t!("flatpak_ignored_viewport_page_title"))
|
.title(t!("flatpak_ignored_viewport_page_title"))
|
||||||
.hexpand(true)
|
.hexpand(true)
|
||||||
.vexpand(true)
|
.vexpand(true)
|
||||||
.build();*/
|
.build();*/
|
||||||
|
|
||||||
let viewport_bin = adw::Bin::builder()
|
let viewport_bin = adw::Bin::builder()
|
||||||
.child(&packages_no_viewport_page)
|
.child(&packages_no_viewport_page)
|
||||||
@ -529,337 +529,296 @@ fn get_flatpak_updates(
|
|||||||
apt_update_count: &Rc<RefCell<i32>>,
|
apt_update_count: &Rc<RefCell<i32>>,
|
||||||
flatpak_update_count: &Rc<RefCell<i32>>,
|
flatpak_update_count: &Rc<RefCell<i32>>,
|
||||||
) {
|
) {
|
||||||
let flatpak_system_installation =
|
let flatpak_system_installation = libflatpak::Installation::new_system(cancellable_no).unwrap();
|
||||||
libflatpak::Installation::new_system(cancellable_no).unwrap();
|
let flatpak_system_updates = flatpak_system_installation
|
||||||
let flatpak_system_updates = flatpak_system_installation
|
.list_installed_refs_for_update(cancellable_no)
|
||||||
.list_installed_refs_for_update(cancellable_no)
|
.unwrap();
|
||||||
.unwrap();
|
//
|
||||||
//
|
let flatpak_user_installation = libflatpak::Installation::new_user(cancellable_no).unwrap();
|
||||||
let flatpak_user_installation =
|
let flatpak_user_updates = flatpak_user_installation
|
||||||
libflatpak::Installation::new_user(cancellable_no).unwrap();
|
.list_installed_refs_for_update(cancellable_no)
|
||||||
let flatpak_user_updates = flatpak_user_installation
|
.unwrap();
|
||||||
.list_installed_refs_for_update(cancellable_no)
|
//
|
||||||
.unwrap();
|
let mut system_last_triggered = false;
|
||||||
//
|
let mut user_last_triggered = false;
|
||||||
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);
|
||||||
if !flatpak_system_updates.is_empty() || !flatpak_user_updates.is_empty() {
|
viewport_bin.set_child(Some(packages_viewport));
|
||||||
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;
|
||||||
}
|
}
|
||||||
//
|
Err(_) => continue,
|
||||||
if !flatpak_system_updates.is_empty() {
|
}
|
||||||
let flatpak_system_updates_iter =
|
}
|
||||||
&mut flatpak_system_updates.iter().peekable();
|
if remote_flatpak_ref.is_some() {
|
||||||
//
|
break;
|
||||||
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(
|
let flatref_struct = FlatpakRefStruct {
|
||||||
&flatpak_system_installation,
|
ref_name: flatpak_ref.name().unwrap_or("Unknown".into()).to_string(),
|
||||||
cancellable_no,
|
name: flatpak_ref
|
||||||
) {
|
.appdata_name()
|
||||||
for remote in remotes {
|
.unwrap_or(flatpak_ref.name().unwrap_or("Unknown".into()))
|
||||||
if remote.is_disabled() {
|
.to_string(),
|
||||||
continue;
|
arch: flatpak_ref
|
||||||
};
|
.arch()
|
||||||
match libflatpak::Installation::fetch_remote_ref_sync(
|
.unwrap_or("Unknown Arch".into())
|
||||||
&flatpak_system_installation,
|
.to_string(),
|
||||||
&match remote.name() {
|
summary: flatpak_ref
|
||||||
Some(t) => t,
|
.appdata_summary()
|
||||||
None => continue,
|
.unwrap_or("No Summary".into())
|
||||||
},
|
.to_string(),
|
||||||
flatpak_ref.kind(),
|
remote_name: match remote_flatpak_ref {
|
||||||
&match flatpak_ref.name() {
|
Some(ref t) => t.remote_name().unwrap_or("Unknown".into()).to_string(),
|
||||||
Some(t) => t,
|
None => "Unknown".into(),
|
||||||
None => continue,
|
},
|
||||||
},
|
installed_size_installed: flatpak_ref.installed_size(),
|
||||||
flatpak_ref.arch().as_deref(),
|
installed_size_remote: match remote_flatpak_ref {
|
||||||
flatpak_ref.branch().as_deref(),
|
Some(ref t) => t.installed_size(),
|
||||||
cancellable_no,
|
None => 0,
|
||||||
) {
|
},
|
||||||
Ok(t) => {
|
download_size: match remote_flatpak_ref {
|
||||||
remote_flatpak_ref = Some(t);
|
Some(t) => t.download_size(),
|
||||||
break;
|
None => 0,
|
||||||
}
|
},
|
||||||
Err(_) => continue,
|
ref_format: flatpak_ref.format_ref().unwrap().into(),
|
||||||
}
|
is_system: true,
|
||||||
}
|
is_last: flatpak_system_updates_iter.peek().is_none(),
|
||||||
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
|
system_refs_for_upgrade_vec
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.push(flatpak_row.clone());
|
.push(flatpak_row.clone());
|
||||||
|
|
||||||
system_refs_for_upgrade_vec_all
|
system_refs_for_upgrade_vec_all
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.push(flatpak_row.clone());
|
.push(flatpak_row.clone());
|
||||||
|
|
||||||
flatpak_row.connect_closure(
|
flatpak_row.connect_closure(
|
||||||
"checkbutton-toggled",
|
"checkbutton-toggled",
|
||||||
false,
|
false,
|
||||||
closure_local!(
|
closure_local!(
|
||||||
#[strong]
|
#[strong]
|
||||||
select_button,
|
select_button,
|
||||||
#[strong]
|
#[strong]
|
||||||
update_button,
|
update_button,
|
||||||
#[strong]
|
#[strong]
|
||||||
packages_boxedlist,
|
packages_boxedlist,
|
||||||
#[strong]
|
#[strong]
|
||||||
system_refs_for_upgrade_vec,
|
system_refs_for_upgrade_vec,
|
||||||
move |flatpak_row: FlatpakRefRow| {
|
move |flatpak_row: FlatpakRefRow| {
|
||||||
if is_widget_select_all_ready(&packages_boxedlist) {
|
if is_widget_select_all_ready(&packages_boxedlist) {
|
||||||
select_button.set_label(
|
select_button.set_label(&t!("select_button_select_all").to_string());
|
||||||
&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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
system_last_triggered = true
|
select_button.set_label(&t!("select_button_deselect_all").to_string());
|
||||||
}
|
}
|
||||||
if !flatpak_user_updates.is_empty() {
|
update_button.set_sensitive(!is_all_children_unmarked(&packages_boxedlist));
|
||||||
let flatpak_user_updates_iter =
|
system_refs_for_upgrade_vec.borrow_mut().push(flatpak_row);
|
||||||
&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;
|
flatpak_row.connect_closure(
|
||||||
while let Ok(remotes) = libflatpak::Installation::list_remotes(
|
"checkbutton-untoggled",
|
||||||
&flatpak_user_installation,
|
false,
|
||||||
cancellable_no,
|
closure_local!(
|
||||||
) {
|
#[strong]
|
||||||
for remote in remotes {
|
select_button,
|
||||||
if remote.is_disabled() {
|
#[strong]
|
||||||
continue;
|
update_button,
|
||||||
};
|
#[strong]
|
||||||
match libflatpak::Installation::fetch_remote_ref_sync(
|
packages_boxedlist,
|
||||||
&flatpak_user_installation,
|
#[strong]
|
||||||
&match remote.name() {
|
system_refs_for_upgrade_vec,
|
||||||
Some(t) => t,
|
move |flatpak_row: FlatpakRefRow| {
|
||||||
None => continue,
|
select_button.set_label(&t!("select_button_select_all").to_string());
|
||||||
},
|
update_button.set_sensitive(!is_all_children_unmarked(&packages_boxedlist));
|
||||||
flatpak_ref.kind(),
|
system_refs_for_upgrade_vec
|
||||||
&match flatpak_ref.name() {
|
.borrow_mut()
|
||||||
Some(t) => t,
|
.retain(|x| x.flatref_ref_format() != flatpak_row.flatref_ref_format());
|
||||||
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(),
|
|
||||||
};
|
|
||||||
|
|
||||||
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
|
let flatpak_row = FlatpakRefRow::new(&flatref_struct);
|
||||||
.borrow_mut()
|
|
||||||
.push(flatpak_row.clone());
|
|
||||||
|
|
||||||
user_refs_for_upgrade_vec_all
|
user_refs_for_upgrade_vec
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.push(flatpak_row.clone());
|
.push(flatpak_row.clone());
|
||||||
|
|
||||||
flatpak_row.connect_closure(
|
user_refs_for_upgrade_vec_all
|
||||||
"checkbutton-toggled",
|
.borrow_mut()
|
||||||
false,
|
.push(flatpak_row.clone());
|
||||||
closure_local!(
|
|
||||||
#[strong]
|
flatpak_row.connect_closure(
|
||||||
select_button,
|
"checkbutton-toggled",
|
||||||
#[strong]
|
false,
|
||||||
update_button,
|
closure_local!(
|
||||||
#[strong]
|
#[strong]
|
||||||
packages_boxedlist,
|
select_button,
|
||||||
#[strong]
|
#[strong]
|
||||||
user_refs_for_upgrade_vec,
|
update_button,
|
||||||
move |flatpak_row: FlatpakRefRow| {
|
#[strong]
|
||||||
if is_widget_select_all_ready(&packages_boxedlist) {
|
packages_boxedlist,
|
||||||
select_button.set_label(
|
#[strong]
|
||||||
&t!("select_button_select_all").to_string(),
|
user_refs_for_upgrade_vec,
|
||||||
);
|
move |flatpak_row: FlatpakRefRow| {
|
||||||
} else {
|
if is_widget_select_all_ready(&packages_boxedlist) {
|
||||||
select_button.set_label(
|
select_button.set_label(&t!("select_button_select_all").to_string());
|
||||||
&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 {
|
} else {
|
||||||
user_last_triggered = true
|
select_button.set_label(&t!("select_button_deselect_all").to_string());
|
||||||
}
|
}
|
||||||
if user_last_triggered && system_last_triggered {
|
update_button.set_sensitive(!is_all_children_unmarked(&packages_boxedlist));
|
||||||
packages_boxedlist.set_sensitive(true);
|
user_refs_for_upgrade_vec.borrow_mut().push(flatpak_row);
|
||||||
update_sys_tray.activate(Some(&glib::Variant::array_from_fixed_array(
|
}
|
||||||
&[*apt_update_count.borrow(), *flatpak_update_count.borrow()],
|
),
|
||||||
)));
|
);
|
||||||
}
|
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> {
|
pub struct AptInstallProgressSocket<'a> {
|
||||||
percent_socket_path: &'a str,
|
percent_socket_path: &'a str,
|
||||||
status_socket_path: &'a str,
|
status_socket_path: &'a str,
|
||||||
error_strfmt_trans_str: &'a str,
|
error_strfmt_trans_str: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> AptInstallProgressSocket<'a> {
|
impl<'a> AptInstallProgressSocket<'a> {
|
||||||
/// Returns a new default progress instance.
|
/// 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 {
|
let progress = Self {
|
||||||
percent_socket_path: percent_socket_path,
|
percent_socket_path: percent_socket_path,
|
||||||
status_socket_path: status_socket_path,
|
status_socket_path: status_socket_path,
|
||||||
|
@ -18,7 +18,14 @@ pub struct AptUpdateProgressSocket<'a> {
|
|||||||
|
|
||||||
impl<'a> AptUpdateProgressSocket<'a> {
|
impl<'a> AptUpdateProgressSocket<'a> {
|
||||||
/// Returns a new default progress instance.
|
/// 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 {
|
let progress = Self {
|
||||||
pulse_interval: 0,
|
pulse_interval: 0,
|
||||||
percent_socket_path: percent_socket_path,
|
percent_socket_path: percent_socket_path,
|
||||||
|
Loading…
Reference in New Issue
Block a user