handle removals with warnings
This commit is contained in:
parent
eae364e9ab
commit
0cae3cdf9f
@ -9,11 +9,9 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="df2ca9e1-e07d-43f4-bc68-0a6113fc1fa2" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/bin/apt/apt_full_upgrade/main.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/bin/apt/apt_full_upgrade/main.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/bin/apt/apt_update/main.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/bin/apt/apt_update/main.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/bin/gui/apt_package_row/imp.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/bin/gui/apt_package_row/imp.rs" 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/apt_update_page/process.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/bin/gui/apt_update_page/process.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/lib/pika_unixsocket_tools/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/lib/pika_unixsocket_tools/mod.rs" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -164,7 +162,7 @@
|
||||
<workItem from="1720594302708" duration="52000" />
|
||||
<workItem from="1720597532937" duration="7050000" />
|
||||
<workItem from="1720648284536" duration="9271000" />
|
||||
<workItem from="1720657757166" duration="6855000" />
|
||||
<workItem from="1720657757166" duration="9378000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
@ -423,7 +423,6 @@ fn description_stack_page(package_description: &str) -> gtk::Box {
|
||||
.margin_start(15)
|
||||
.margin_end(15)
|
||||
.editable(false)
|
||||
.buffer(&description_text_buffer)
|
||||
.build();
|
||||
description_content_box.append(&description_text_view);
|
||||
description_content_box
|
||||
|
@ -146,7 +146,6 @@ pub fn apt_update_page(
|
||||
.transient_for(&window)
|
||||
.extra_child(&apt_update_dialog_child_box)
|
||||
.heading(t!("apt_update_dialog_heading"))
|
||||
.hide_on_close(true)
|
||||
.width_request(500)
|
||||
.build();
|
||||
|
||||
@ -242,7 +241,8 @@ pub fn apt_update_page(
|
||||
|
||||
let mut upgradeable_iter = upgradable_cache.get_changes(false).peekable();
|
||||
while let Some(pkg) = upgradeable_iter.next() {
|
||||
let candidate_version_pkg = pkg.candidate().unwrap();
|
||||
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(),
|
||||
@ -265,6 +265,7 @@ pub fn apt_update_page(
|
||||
is_last: upgradeable_iter.peek().is_none()
|
||||
};
|
||||
get_upgradable_sender.send_blocking(package_struct).unwrap()
|
||||
}
|
||||
}
|
||||
});
|
||||
apt_update_dialog.close();
|
||||
|
@ -13,6 +13,8 @@ use serde_json::Value;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
use std::{fs::*, thread};
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
use tokio::runtime::Runtime;
|
||||
|
||||
struct AptChangesInfo {
|
||||
@ -108,6 +110,7 @@ fn apt_confirm_window(
|
||||
window: adw::ApplicationWindow,
|
||||
retry_signal_action: &SimpleAction,
|
||||
) {
|
||||
let to_be_removed_packages_vec: Rc<RefCell<Vec<String>>> = Rc::new(RefCell::new(Vec::new()));
|
||||
// Emulate Apt Full Upgrade to get transaction info
|
||||
let mut apt_changes_struct = AptChangesInfo {
|
||||
package_count_upgrade: 0,
|
||||
@ -133,6 +136,7 @@ fn apt_confirm_window(
|
||||
pkg.mark_install(true, false);
|
||||
} else if change.marked_delete() {
|
||||
pkg.mark_delete(false);
|
||||
to_be_removed_packages_vec.borrow_mut().push(pkg.name().to_owned());
|
||||
}
|
||||
pkg.protect();
|
||||
}
|
||||
@ -263,6 +267,7 @@ fn apt_confirm_window(
|
||||
);
|
||||
|
||||
apt_confirm_dialog.set_default_response(Some("apt_confirm_dialog_confirm"));
|
||||
apt_confirm_dialog.set_close_response("apt_confirm_dialog_cancel");
|
||||
|
||||
if !excluded_updates_vec.is_empty() {
|
||||
let exclusions_array = Exclusions {
|
||||
@ -285,13 +290,67 @@ fn apt_confirm_window(
|
||||
.expect("Failed to write to json file");
|
||||
}
|
||||
|
||||
let retry_signal_action0 = retry_signal_action.clone();
|
||||
let apt_confirm_start_signal_action = gio::SimpleAction::new("apt_confirm_start", None);
|
||||
|
||||
apt_confirm_dialog.choose(None::<&gio::Cancellable>, move |choice| {
|
||||
apt_confirm_start_signal_action.connect_activate(clone!(@weak window, @strong retry_signal_action, @strong apt_confirm_dialog => move |_, _| {
|
||||
let retry_signal_action0 = retry_signal_action.clone();
|
||||
apt_confirm_dialog.clone().choose(None::<&gio::Cancellable>, move |choice| {
|
||||
if choice == "apt_confirm_dialog_confirm" {
|
||||
apt_full_upgrade_from_socket(window, &retry_signal_action0);
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
let to_be_removed_packages_borrow = to_be_removed_packages_vec.borrow();
|
||||
if to_be_removed_packages_borrow.is_empty() {
|
||||
apt_confirm_start_signal_action.activate(None);
|
||||
} else {
|
||||
let apt_remove_confirm_text_buffer = gtk::TextBuffer::builder()
|
||||
.text(to_be_removed_packages_borrow.iter().map(|x| x.to_string() + "\n").collect::<String>() + "\n")
|
||||
.build();
|
||||
|
||||
let description_text_view = gtk::TextView::builder()
|
||||
.buffer(&apt_remove_confirm_text_buffer)
|
||||
.hexpand(true)
|
||||
.vexpand(true)
|
||||
.margin_top(15)
|
||||
.margin_bottom(15)
|
||||
.margin_start(15)
|
||||
.margin_end(15)
|
||||
.editable(false)
|
||||
.build();
|
||||
|
||||
let apt_remove_confirm_dialog = adw::MessageDialog::builder()
|
||||
.transient_for(&window)
|
||||
.heading(t!("apt_remove_confirm_dialog_heading"))
|
||||
.body(t!("apt_remove_confirm_dialog_body"))
|
||||
.extra_child(&description_text_view)
|
||||
.build();
|
||||
|
||||
apt_remove_confirm_dialog.add_response(
|
||||
"apt_remove_confirm_dialog_cancel",
|
||||
&t!("apt_remove_confirm_dialog_cancel_label").to_string(),
|
||||
);
|
||||
|
||||
apt_remove_confirm_dialog.add_response(
|
||||
"apt_remove_confirm_dialog_confirm",
|
||||
&t!("apt_remove_confirm_dialog_confirm_label").to_string(),
|
||||
);
|
||||
|
||||
apt_remove_confirm_dialog.set_response_appearance(
|
||||
"apt_remove_confirm_dialog_confirm",
|
||||
adw::ResponseAppearance::Destructive,
|
||||
);
|
||||
|
||||
apt_remove_confirm_dialog.set_default_response(Some("apt_remove_confirm_dialog_confirm"));
|
||||
apt_remove_confirm_dialog.set_close_response("apt_remove_confirm_dialog_cancel");
|
||||
|
||||
apt_remove_confirm_dialog.choose(None::<&gio::Cancellable>, move |choice| {
|
||||
if choice == "apt_remove_confirm_dialog_confirm" {
|
||||
apt_confirm_start_signal_action.activate(None);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
fn apt_full_upgrade_from_socket(
|
||||
@ -373,7 +432,6 @@ fn apt_full_upgrade_from_socket(
|
||||
.transient_for(&window)
|
||||
.extra_child(&apt_upgrade_dialog_child_box)
|
||||
.heading(t!("apt_upgrade_dialog_heading"))
|
||||
.hide_on_close(true)
|
||||
.width_request(500)
|
||||
.build();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user