Fix Legacy editing

This commit is contained in:
Ward from fusion-voyager-3 2024-09-27 21:35:40 +03:00
parent 47083556cc
commit 7a66251a68
4 changed files with 19 additions and 20 deletions

4
Cargo.lock generated
View File

@ -1071,8 +1071,8 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "legacy-apt-list-tools-rs"
version = "0.1.1"
source = "git+https://github.com/CosmicFusion/legacy-apt-list-tools-rs#f6ad0545a2cc32bda63ba4d72f99374644c3abf9"
version = "0.1.3"
source = "git+https://github.com/CosmicFusion/legacy-apt-list-tools-rs#b3629432a1c8567763f6e3c06c9aaf9decb6e919"
dependencies = [
"apt-sources-lists",
]

View File

@ -27,7 +27,7 @@ async-channel = "2.1.1"
rust-i18n = "3.0.1"
rust-apt = { git = "https://gitlab.com/volian/rust-apt" }
apt-deb822-tools = { package = "deb822-tools", git = "https://github.com/CosmicFusion/deb822-tools" }
apt-legacy-tools = { version = "0.1.1", package = "legacy-apt-list-tools-rs", git = "https://github.com/CosmicFusion/legacy-apt-list-tools-rs" }
apt-legacy-tools = { version = "0.1.3", package = "legacy-apt-list-tools-rs", git = "https://github.com/CosmicFusion/legacy-apt-list-tools-rs" }
tokio = { version = "1", features = ["full"] }
tokio-uds = "0.2"
serde = { version = "1.0.203", features = ["derive"] }

View File

@ -221,7 +221,9 @@ pub fn legacy_edit_dialog_fn(
unofficial_source_add_dialog.clone()
.choose(None::<&gio::Cancellable>, move |choice| {
match choice.as_str() {
"unofficial_source_edit_dialog_edit" => {
"unofficial_source_edit_dialog_edit" => {
let mut new_apt_legacy_vec = LegacyAptSource::get_legacy_sources().unwrap();
new_apt_legacy_vec.retain(|x| x != &legacy_repo_clone0);
let new_repo = LegacyAptSource {
url: unofficial_source_add_uri_entry.text().to_string(),
is_source: unofficial_source_add_is_source_switch.is_active(),
@ -231,7 +233,8 @@ pub fn legacy_edit_dialog_fn(
enabled: unofficial_source_add_is_enabled_switch.is_active(),
..legacy_repo_clone0
};
/*match LegacyAptSource::save_to_file(new_repo.clone(), LegacyAptSource::get_legacy_sources().unwrap(), &format!("/tmp/{}.list", repo_file_name)) {
new_apt_legacy_vec.push(new_repo.clone());
match LegacyAptSource::save_to_file(new_repo, new_apt_legacy_vec, &format!("/tmp/{}.list", repo_file_name)) {
Ok(_) => {
match duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh", "legacy_move", repo_file_name).run() {
Ok(_) => {}
@ -261,9 +264,7 @@ pub fn legacy_edit_dialog_fn(
apt_src_create_error_dialog.present();
reload_action_clone0.activate(None);
}
}*/
dbg!(&new_repo);
LegacyAptSource::save_to_file(new_repo.clone(), LegacyAptSource::get_legacy_sources().unwrap(), &format!("/tmp/{}.list", repo_file_name)).unwrap();
}
}
_ => {}
}

View File

@ -112,10 +112,8 @@ pub fn apt_manage_page(
let unofficial_sources_columnview_bin = adw::Bin::new();
let unofficial_sources_columnview_bin_clone0 = unofficial_sources_columnview_bin.clone();
let reload_unofficial_action = gio::SimpleAction::new("reload_unofficial_action", None);
reload_unofficial_action.connect_activate(clone!(
retry_signal_action.connect_activate(clone!(
#[weak]
unofficial_sources_columnview_bin_clone0,
move |_, _| {
@ -264,7 +262,7 @@ pub fn apt_manage_page(
unofficial_sources_columnview_bin_clone0.set_child(Some(&unofficial_sources_columnview));
}));
reload_unofficial_action.activate(None);
retry_signal_action.activate(None);
let unofficial_sources_box = Box::builder()
.orientation(Orientation::Vertical)
@ -320,13 +318,13 @@ pub fn apt_manage_page(
#[strong]
window,
#[strong]
reload_unofficial_action,
retry_signal_action,
move
|_|
{
add_dialog::add_dialog_fn(
window.clone(),
&reload_unofficial_action
&retry_signal_action
);
}
)
@ -338,7 +336,7 @@ pub fn apt_manage_page(
#[strong]
unofficial_sources_selection_model_rc,
#[strong]
reload_unofficial_action,
retry_signal_action,
move
|_|
{
@ -348,10 +346,10 @@ pub fn apt_manage_page(
let apt_src: Ref<AptSourceConfig> = item.borrow();
match apt_src.deref() {
AptSourceConfig::DEB822(src) => {
deb822_edit_dialog::deb822_edit_dialog_fn(window.clone(), src, &reload_unofficial_action);
deb822_edit_dialog::deb822_edit_dialog_fn(window.clone(), src, &retry_signal_action);
}
AptSourceConfig::Legacy(list) => {
legacy_edit_dialog::legacy_edit_dialog_fn(window.clone(), list, &reload_unofficial_action)
legacy_edit_dialog::legacy_edit_dialog_fn(window.clone(), list, &retry_signal_action)
}
};
@ -365,7 +363,7 @@ pub fn apt_manage_page(
#[strong]
unofficial_sources_selection_model_rc,
#[strong]
reload_unofficial_action,
retry_signal_action,
move
|_|
{
@ -400,13 +398,13 @@ pub fn apt_manage_page(
&t!("apt_src_remove_warning_dialog_ok_label").to_string(),
);
apt_src_remove_warning_dialog.set_response_appearance("apt_src_remove_warning_dialog_ok", adw::ResponseAppearance::Destructive);
let reload_unofficial_action_clone0 = reload_unofficial_action.clone();
let retry_signal_action_clone0 = retry_signal_action.clone();
apt_src_remove_warning_dialog.clone()
.choose(None::<&gio::Cancellable>, move |choice| {
match choice.as_str() {
"apt_src_remove_warning_dialog_ok" => {
let _ = command.run().unwrap();
reload_unofficial_action_clone0.activate(None);
retry_signal_action_clone0.activate(None);
}
_ => {}
}