Fix Warnings and fmt
This commit is contained in:
parent
f5dcfc455a
commit
c2010b7136
@ -1,28 +1,14 @@
|
|||||||
use crate::apt_package_row::AptPackageRow;
|
|
||||||
use adw::gio::SimpleAction;
|
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use apt_deb822_tools::Deb822Repository;
|
use apt_deb822_tools::Deb822Repository;
|
||||||
use regex::Regex;
|
use gtk::glib::clone;
|
||||||
use gtk::glib::{property::PropertyGet, clone, BoxedAnyObject};
|
|
||||||
use gtk::*;
|
use gtk::*;
|
||||||
use std::cell::Ref;
|
use regex::Regex;
|
||||||
use std::ops::Deref;
|
|
||||||
use pika_unixsocket_tools::pika_unixsocket_tools::*;
|
|
||||||
use rust_apt::cache::*;
|
|
||||||
use rust_apt::new_cache;
|
|
||||||
use rust_apt::records::RecordField;
|
|
||||||
use std::cell::RefCell;
|
|
||||||
use std::process::Command;
|
|
||||||
use std::rc::Rc;
|
|
||||||
use std::thread;
|
|
||||||
use tokio::runtime::Runtime;
|
|
||||||
|
|
||||||
pub fn add_dialog_fn(
|
pub fn add_dialog_fn(
|
||||||
window: adw::ApplicationWindow,
|
window: adw::ApplicationWindow,
|
||||||
reload_action: &gio::SimpleAction,
|
reload_action: &gio::SimpleAction,
|
||||||
apt_retry_signal_action: &gio::SimpleAction,
|
apt_retry_signal_action: &gio::SimpleAction,
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
let unofficial_source_add_dialog_child_box = Box::builder()
|
let unofficial_source_add_dialog_child_box = Box::builder()
|
||||||
.hexpand(true)
|
.hexpand(true)
|
||||||
.orientation(Orientation::Vertical)
|
.orientation(Orientation::Vertical)
|
||||||
@ -68,9 +54,7 @@ pub fn add_dialog_fn(
|
|||||||
|
|
||||||
unofficial_source_add_components_prefrencesgroup.add(&unofficial_source_add_components_entry);
|
unofficial_source_add_components_prefrencesgroup.add(&unofficial_source_add_components_entry);
|
||||||
|
|
||||||
let unofficial_source_add_signed_entry = gtk::Entry::builder()
|
let unofficial_source_add_signed_entry = gtk::Entry::builder().sensitive(false).build();
|
||||||
.sensitive(false)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let unofficial_source_add_signed_prefrencesgroup = adw::PreferencesGroup::builder()
|
let unofficial_source_add_signed_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||||
.title(t!("unofficial_source_add_signed_prefrencesgroup_title"))
|
.title(t!("unofficial_source_add_signed_prefrencesgroup_title"))
|
||||||
@ -176,26 +160,33 @@ pub fn add_dialog_fn(
|
|||||||
let unofficial_source_add_name_entry_clone0 = unofficial_source_add_name_entry.clone();
|
let unofficial_source_add_name_entry_clone0 = unofficial_source_add_name_entry.clone();
|
||||||
let unofficial_source_add_uri_entry_clone0 = unofficial_source_add_uri_entry.clone();
|
let unofficial_source_add_uri_entry_clone0 = unofficial_source_add_uri_entry.clone();
|
||||||
let unofficial_source_add_suites_entry_clone0 = unofficial_source_add_suites_entry.clone();
|
let unofficial_source_add_suites_entry_clone0 = unofficial_source_add_suites_entry.clone();
|
||||||
let unofficial_source_add_components_entry_clone0 = unofficial_source_add_components_entry.clone();
|
let unofficial_source_add_components_entry_clone0 =
|
||||||
|
unofficial_source_add_components_entry.clone();
|
||||||
let unofficial_source_add_signed_entry_clone0 = unofficial_source_add_signed_entry.clone();
|
let unofficial_source_add_signed_entry_clone0 = unofficial_source_add_signed_entry.clone();
|
||||||
let unofficial_source_signed_keyring_checkbutton_clone0 = unofficial_source_signed_keyring_checkbutton.clone();
|
let unofficial_source_signed_keyring_checkbutton_clone0 =
|
||||||
|
unofficial_source_signed_keyring_checkbutton.clone();
|
||||||
|
|
||||||
let add_button_update_state = move || {
|
let add_button_update_state = move || {
|
||||||
if
|
if !unofficial_source_add_name_entry_clone0.text().is_empty()
|
||||||
!unofficial_source_add_name_entry_clone0.text().is_empty() &&
|
&& !unofficial_source_add_uri_entry_clone0.text().is_empty()
|
||||||
!unofficial_source_add_uri_entry_clone0.text().is_empty() &&
|
&& !unofficial_source_add_suites_entry_clone0.text().is_empty()
|
||||||
!unofficial_source_add_suites_entry_clone0.text().is_empty() &&
|
&& !unofficial_source_add_components_entry_clone0
|
||||||
!unofficial_source_add_components_entry_clone0.text().is_empty()
|
.text()
|
||||||
|
.is_empty()
|
||||||
{
|
{
|
||||||
if unofficial_source_signed_keyring_checkbutton_clone0.is_active() {
|
if unofficial_source_signed_keyring_checkbutton_clone0.is_active() {
|
||||||
unofficial_source_add_dialog_clone0.set_response_enabled("unofficial_source_add_dialog_add", true);
|
unofficial_source_add_dialog_clone0
|
||||||
|
.set_response_enabled("unofficial_source_add_dialog_add", true);
|
||||||
} else if !unofficial_source_add_signed_entry_clone0.text().is_empty() {
|
} else if !unofficial_source_add_signed_entry_clone0.text().is_empty() {
|
||||||
unofficial_source_add_dialog_clone0.set_response_enabled("unofficial_source_add_dialog_add", true);
|
unofficial_source_add_dialog_clone0
|
||||||
|
.set_response_enabled("unofficial_source_add_dialog_add", true);
|
||||||
} else {
|
} else {
|
||||||
unofficial_source_add_dialog_clone0.set_response_enabled("unofficial_source_add_dialog_add", false);
|
unofficial_source_add_dialog_clone0
|
||||||
|
.set_response_enabled("unofficial_source_add_dialog_add", false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
unofficial_source_add_dialog_clone0.set_response_enabled("unofficial_source_add_dialog_add", false);
|
unofficial_source_add_dialog_clone0
|
||||||
|
.set_response_enabled("unofficial_source_add_dialog_add", false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -211,12 +202,10 @@ pub fn add_dialog_fn(
|
|||||||
entry.connect_text_notify(clone!(
|
entry.connect_text_notify(clone!(
|
||||||
#[strong]
|
#[strong]
|
||||||
add_button_update_state,
|
add_button_update_state,
|
||||||
move |_|
|
move |_| {
|
||||||
{
|
|
||||||
add_button_update_state();
|
add_button_update_state();
|
||||||
}
|
}
|
||||||
)
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -226,48 +215,44 @@ pub fn add_dialog_fn(
|
|||||||
unofficial_source_add_signed_entry,
|
unofficial_source_add_signed_entry,
|
||||||
#[strong]
|
#[strong]
|
||||||
add_button_update_state,
|
add_button_update_state,
|
||||||
move |checkbutton|
|
move |checkbutton| {
|
||||||
{
|
|
||||||
if checkbutton.is_active() {
|
if checkbutton.is_active() {
|
||||||
unofficial_source_add_signed_entry.set_sensitive(false);
|
unofficial_source_add_signed_entry.set_sensitive(false);
|
||||||
unofficial_source_add_signed_entry.set_placeholder_text(Some(""));
|
unofficial_source_add_signed_entry.set_placeholder_text(Some(""));
|
||||||
add_button_update_state();
|
add_button_update_state();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
));
|
||||||
);
|
|
||||||
|
|
||||||
unofficial_source_signed_file_checkbutton.connect_toggled(clone!(
|
unofficial_source_signed_file_checkbutton.connect_toggled(clone!(
|
||||||
#[weak]
|
#[weak]
|
||||||
unofficial_source_add_signed_entry,
|
unofficial_source_add_signed_entry,
|
||||||
#[strong]
|
#[strong]
|
||||||
add_button_update_state,
|
add_button_update_state,
|
||||||
move |checkbutton|
|
move |checkbutton| {
|
||||||
{
|
|
||||||
if checkbutton.is_active() {
|
if checkbutton.is_active() {
|
||||||
unofficial_source_add_signed_entry.set_sensitive(true);
|
unofficial_source_add_signed_entry.set_sensitive(true);
|
||||||
unofficial_source_add_signed_entry.set_placeholder_text(Some("/etc/apt/keyrings/winehq-archive.key"));
|
unofficial_source_add_signed_entry
|
||||||
|
.set_placeholder_text(Some("/etc/apt/keyrings/winehq-archive.key"));
|
||||||
add_button_update_state();
|
add_button_update_state();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
));
|
||||||
);
|
|
||||||
|
|
||||||
unofficial_source_signed_url_checkbutton.connect_toggled(clone!(
|
unofficial_source_signed_url_checkbutton.connect_toggled(clone!(
|
||||||
#[weak]
|
#[weak]
|
||||||
unofficial_source_add_signed_entry,
|
unofficial_source_add_signed_entry,
|
||||||
#[strong]
|
#[strong]
|
||||||
add_button_update_state,
|
add_button_update_state,
|
||||||
move |checkbutton|
|
move |checkbutton| {
|
||||||
{
|
|
||||||
if checkbutton.is_active() {
|
if checkbutton.is_active() {
|
||||||
unofficial_source_add_signed_entry.set_sensitive(true);
|
unofficial_source_add_signed_entry.set_sensitive(true);
|
||||||
unofficial_source_add_signed_entry.set_placeholder_text(Some("https://dl.winehq.org/wine-builds/winehq.key"));
|
unofficial_source_add_signed_entry
|
||||||
|
.set_placeholder_text(Some("https://dl.winehq.org/wine-builds/winehq.key"));
|
||||||
add_button_update_state();
|
add_button_update_state();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
));
|
||||||
);
|
|
||||||
|
|
||||||
unofficial_source_add_box2.append(&unofficial_source_add_is_source_label);
|
unofficial_source_add_box2.append(&unofficial_source_add_is_source_label);
|
||||||
unofficial_source_add_box2.append(&unofficial_source_add_is_source_switch);
|
unofficial_source_add_box2.append(&unofficial_source_add_is_source_switch);
|
||||||
@ -278,7 +263,8 @@ pub fn add_dialog_fn(
|
|||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_name_prefrencesgroup);
|
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_name_prefrencesgroup);
|
||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_uri_prefrencesgroup);
|
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_uri_prefrencesgroup);
|
||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_suites_prefrencesgroup);
|
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_suites_prefrencesgroup);
|
||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_components_prefrencesgroup);
|
unofficial_source_add_dialog_child_box
|
||||||
|
.append(&unofficial_source_add_components_prefrencesgroup);
|
||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_archs_prefrencesgroup);
|
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_archs_prefrencesgroup);
|
||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_box2);
|
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_box2);
|
||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_signed_prefrencesgroup);
|
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_signed_prefrencesgroup);
|
||||||
@ -286,7 +272,8 @@ pub fn add_dialog_fn(
|
|||||||
let reload_action_clone0 = reload_action.clone();
|
let reload_action_clone0 = reload_action.clone();
|
||||||
let apt_retry_signal_action_clone0 = apt_retry_signal_action.clone();
|
let apt_retry_signal_action_clone0 = apt_retry_signal_action.clone();
|
||||||
|
|
||||||
unofficial_source_add_dialog.clone()
|
unofficial_source_add_dialog
|
||||||
|
.clone()
|
||||||
.choose(None::<&gio::Cancellable>, move |choice| {
|
.choose(None::<&gio::Cancellable>, move |choice| {
|
||||||
match choice.as_str() {
|
match choice.as_str() {
|
||||||
"unofficial_source_add_dialog_add" => {
|
"unofficial_source_add_dialog_add" => {
|
||||||
@ -298,7 +285,10 @@ pub fn add_dialog_fn(
|
|||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
let repo_file_name = non_alphanum_regex.replace_all(unofficial_source_add_name_entry.text().as_str(), "_").to_string().to_lowercase();
|
let repo_file_name = non_alphanum_regex
|
||||||
|
.replace_all(unofficial_source_add_name_entry.text().as_str(), "_")
|
||||||
|
.to_string()
|
||||||
|
.to_lowercase();
|
||||||
let new_repo = Deb822Repository {
|
let new_repo = Deb822Repository {
|
||||||
repolib_name: Some(unofficial_source_add_name_entry.text().to_string()),
|
repolib_name: Some(unofficial_source_add_name_entry.text().to_string()),
|
||||||
filepath: format!("/etc/apt/sources.list.d/{}.source", repo_file_name),
|
filepath: format!("/etc/apt/sources.list.d/{}.source", repo_file_name),
|
||||||
@ -318,21 +308,33 @@ pub fn add_dialog_fn(
|
|||||||
signed_by: match sign_method {
|
signed_by: match sign_method {
|
||||||
1 => Some(unofficial_source_add_signed_entry.text().to_string()),
|
1 => Some(unofficial_source_add_signed_entry.text().to_string()),
|
||||||
2 => Some(format!("/etc/apt/keyrings/{}.gpg.key", repo_file_name)),
|
2 => Some(format!("/etc/apt/keyrings/{}.gpg.key", repo_file_name)),
|
||||||
_ => None
|
_ => None,
|
||||||
},
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
if sign_method == 2 {
|
if sign_method == 2 {
|
||||||
match Deb822Repository::write_to_file(new_repo.clone(), format!("/tmp/{}.sources", repo_file_name).into()) {
|
match Deb822Repository::write_to_file(
|
||||||
|
new_repo.clone(),
|
||||||
|
format!("/tmp/{}.sources", repo_file_name).into(),
|
||||||
|
) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
match duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh", "deb822_move_with_wget", &repo_file_name, &unofficial_source_add_signed_entry.text().to_string(), &format!("/etc/apt/keyrings/{}.gpg.key", &repo_file_name)).run() {
|
match duct::cmd!(
|
||||||
|
"pkexec",
|
||||||
|
"/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh",
|
||||||
|
"deb822_move_with_wget",
|
||||||
|
&repo_file_name,
|
||||||
|
&unofficial_source_add_signed_entry.text().to_string(),
|
||||||
|
&format!("/etc/apt/keyrings/{}.gpg.key", &repo_file_name)
|
||||||
|
)
|
||||||
|
.run()
|
||||||
|
{
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
reload_action_clone0.activate(None);
|
reload_action_clone0.activate(None);
|
||||||
apt_retry_signal_action_clone0.activate(None);
|
apt_retry_signal_action_clone0.activate(None);
|
||||||
|
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
let apt_src_create_error_dialog =
|
||||||
|
adw::MessageDialog::builder()
|
||||||
.heading(t!("apt_src_create_error_dialog_heading"))
|
.heading(t!("apt_src_create_error_dialog_heading"))
|
||||||
.body(e.to_string())
|
.body(e.to_string())
|
||||||
.build();
|
.build();
|
||||||
@ -359,15 +361,26 @@ pub fn add_dialog_fn(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
match Deb822Repository::write_to_file(new_repo.clone(), format!("/tmp/{}.sources", repo_file_name).into()) {
|
match Deb822Repository::write_to_file(
|
||||||
|
new_repo.clone(),
|
||||||
|
format!("/tmp/{}.sources", repo_file_name).into(),
|
||||||
|
) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
match duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh", "deb822_move", repo_file_name).run() {
|
match duct::cmd!(
|
||||||
|
"pkexec",
|
||||||
|
"/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh",
|
||||||
|
"deb822_move",
|
||||||
|
repo_file_name
|
||||||
|
)
|
||||||
|
.run()
|
||||||
|
{
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
reload_action_clone0.activate(None);
|
reload_action_clone0.activate(None);
|
||||||
apt_retry_signal_action_clone0.activate(None);
|
apt_retry_signal_action_clone0.activate(None);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
let apt_src_create_error_dialog =
|
||||||
|
adw::MessageDialog::builder()
|
||||||
.heading(t!("apt_src_create_error_dialog_heading"))
|
.heading(t!("apt_src_create_error_dialog_heading"))
|
||||||
.body(e.to_string())
|
.body(e.to_string())
|
||||||
.build();
|
.build();
|
||||||
|
@ -1,21 +1,8 @@
|
|||||||
use crate::apt_package_row::AptPackageRow;
|
|
||||||
use adw::gio::SimpleAction;
|
use adw::gio::SimpleAction;
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use apt_deb822_tools::Deb822Repository;
|
use apt_deb822_tools::Deb822Repository;
|
||||||
use regex::Regex;
|
use gtk::glib::clone;
|
||||||
use gtk::glib::{property::PropertyGet, clone, BoxedAnyObject};
|
|
||||||
use gtk::*;
|
use gtk::*;
|
||||||
use std::cell::Ref;
|
|
||||||
use std::ops::Deref;
|
|
||||||
use pika_unixsocket_tools::pika_unixsocket_tools::*;
|
|
||||||
use rust_apt::cache::*;
|
|
||||||
use rust_apt::new_cache;
|
|
||||||
use rust_apt::records::RecordField;
|
|
||||||
use std::cell::RefCell;
|
|
||||||
use std::process::Command;
|
|
||||||
use std::rc::Rc;
|
|
||||||
use std::thread;
|
|
||||||
use tokio::runtime::Runtime;
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
pub fn deb822_edit_dialog_fn(
|
pub fn deb822_edit_dialog_fn(
|
||||||
@ -38,8 +25,7 @@ pub fn deb822_edit_dialog_fn(
|
|||||||
.orientation(Orientation::Vertical)
|
.orientation(Orientation::Vertical)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let unofficial_source_add_name_entry = gtk::Entry::builder()
|
let unofficial_source_add_name_entry = gtk::Entry::builder().build();
|
||||||
.build();
|
|
||||||
|
|
||||||
let unofficial_source_add_name_prefrencesgroup = adw::PreferencesGroup::builder()
|
let unofficial_source_add_name_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||||
.title(t!("unofficial_source_add_name_prefrencesgroup_title"))
|
.title(t!("unofficial_source_add_name_prefrencesgroup_title"))
|
||||||
@ -47,8 +33,7 @@ pub fn deb822_edit_dialog_fn(
|
|||||||
|
|
||||||
unofficial_source_add_name_prefrencesgroup.add(&unofficial_source_add_name_entry);
|
unofficial_source_add_name_prefrencesgroup.add(&unofficial_source_add_name_entry);
|
||||||
|
|
||||||
let unofficial_source_add_uri_entry = gtk::Entry::builder()
|
let unofficial_source_add_uri_entry = gtk::Entry::builder().build();
|
||||||
.build();
|
|
||||||
|
|
||||||
let unofficial_source_add_uri_prefrencesgroup = adw::PreferencesGroup::builder()
|
let unofficial_source_add_uri_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||||
.title(t!("unofficial_source_add_uri_prefrencesgroup_title"))
|
.title(t!("unofficial_source_add_uri_prefrencesgroup_title"))
|
||||||
@ -56,8 +41,7 @@ pub fn deb822_edit_dialog_fn(
|
|||||||
|
|
||||||
unofficial_source_add_uri_prefrencesgroup.add(&unofficial_source_add_uri_entry);
|
unofficial_source_add_uri_prefrencesgroup.add(&unofficial_source_add_uri_entry);
|
||||||
|
|
||||||
let unofficial_source_add_suites_entry = gtk::Entry::builder()
|
let unofficial_source_add_suites_entry = gtk::Entry::builder().build();
|
||||||
.build();
|
|
||||||
|
|
||||||
let unofficial_source_add_suites_prefrencesgroup = adw::PreferencesGroup::builder()
|
let unofficial_source_add_suites_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||||
.title(t!("unofficial_source_add_suites_prefrencesgroup_title"))
|
.title(t!("unofficial_source_add_suites_prefrencesgroup_title"))
|
||||||
@ -65,8 +49,7 @@ pub fn deb822_edit_dialog_fn(
|
|||||||
|
|
||||||
unofficial_source_add_suites_prefrencesgroup.add(&unofficial_source_add_suites_entry);
|
unofficial_source_add_suites_prefrencesgroup.add(&unofficial_source_add_suites_entry);
|
||||||
|
|
||||||
let unofficial_source_add_components_entry = gtk::Entry::builder()
|
let unofficial_source_add_components_entry = gtk::Entry::builder().build();
|
||||||
.build();
|
|
||||||
|
|
||||||
let unofficial_source_add_components_prefrencesgroup = adw::PreferencesGroup::builder()
|
let unofficial_source_add_components_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||||
.title(t!("unofficial_source_add_components_prefrencesgroup_title"))
|
.title(t!("unofficial_source_add_components_prefrencesgroup_title"))
|
||||||
@ -74,9 +57,7 @@ pub fn deb822_edit_dialog_fn(
|
|||||||
|
|
||||||
unofficial_source_add_components_prefrencesgroup.add(&unofficial_source_add_components_entry);
|
unofficial_source_add_components_prefrencesgroup.add(&unofficial_source_add_components_entry);
|
||||||
|
|
||||||
let unofficial_source_add_signed_entry = gtk::Entry::builder()
|
let unofficial_source_add_signed_entry = gtk::Entry::builder().sensitive(false).build();
|
||||||
.sensitive(false)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let unofficial_source_add_signed_prefrencesgroup = adw::PreferencesGroup::builder()
|
let unofficial_source_add_signed_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||||
.title(t!("unofficial_source_add_signed_prefrencesgroup_title"))
|
.title(t!("unofficial_source_add_signed_prefrencesgroup_title"))
|
||||||
@ -84,8 +65,7 @@ pub fn deb822_edit_dialog_fn(
|
|||||||
|
|
||||||
unofficial_source_add_signed_prefrencesgroup.add(&unofficial_source_add_signed_entry);
|
unofficial_source_add_signed_prefrencesgroup.add(&unofficial_source_add_signed_entry);
|
||||||
|
|
||||||
let unofficial_source_add_archs_entry = gtk::Entry::builder()
|
let unofficial_source_add_archs_entry = gtk::Entry::builder().build();
|
||||||
.build();
|
|
||||||
|
|
||||||
let unofficial_source_add_archs_prefrencesgroup = adw::PreferencesGroup::builder()
|
let unofficial_source_add_archs_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||||
.title(t!("unofficial_source_add_archs_prefrencesgroup_title"))
|
.title(t!("unofficial_source_add_archs_prefrencesgroup_title"))
|
||||||
@ -106,7 +86,6 @@ pub fn deb822_edit_dialog_fn(
|
|||||||
.valign(Align::Center)
|
.valign(Align::Center)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
let unofficial_source_add_is_enabled_label = gtk::Label::builder()
|
let unofficial_source_add_is_enabled_label = gtk::Label::builder()
|
||||||
.label(t!("unofficial_source_add_is_enabled_label_label"))
|
.label(t!("unofficial_source_add_is_enabled_label_label"))
|
||||||
.halign(Align::Start)
|
.halign(Align::Start)
|
||||||
@ -185,26 +164,33 @@ pub fn deb822_edit_dialog_fn(
|
|||||||
let unofficial_source_add_name_entry_clone0 = unofficial_source_add_name_entry.clone();
|
let unofficial_source_add_name_entry_clone0 = unofficial_source_add_name_entry.clone();
|
||||||
let unofficial_source_add_uri_entry_clone0 = unofficial_source_add_uri_entry.clone();
|
let unofficial_source_add_uri_entry_clone0 = unofficial_source_add_uri_entry.clone();
|
||||||
let unofficial_source_add_suites_entry_clone0 = unofficial_source_add_suites_entry.clone();
|
let unofficial_source_add_suites_entry_clone0 = unofficial_source_add_suites_entry.clone();
|
||||||
let unofficial_source_add_components_entry_clone0 = unofficial_source_add_components_entry.clone();
|
let unofficial_source_add_components_entry_clone0 =
|
||||||
|
unofficial_source_add_components_entry.clone();
|
||||||
let unofficial_source_add_signed_entry_clone0 = unofficial_source_add_signed_entry.clone();
|
let unofficial_source_add_signed_entry_clone0 = unofficial_source_add_signed_entry.clone();
|
||||||
let unofficial_source_signed_keyring_checkbutton_clone0 = unofficial_source_signed_keyring_checkbutton.clone();
|
let unofficial_source_signed_keyring_checkbutton_clone0 =
|
||||||
|
unofficial_source_signed_keyring_checkbutton.clone();
|
||||||
|
|
||||||
let add_button_update_state = move || {
|
let add_button_update_state = move || {
|
||||||
if
|
if !unofficial_source_add_name_entry_clone0.text().is_empty()
|
||||||
!unofficial_source_add_name_entry_clone0.text().is_empty() &&
|
&& !unofficial_source_add_uri_entry_clone0.text().is_empty()
|
||||||
!unofficial_source_add_uri_entry_clone0.text().is_empty() &&
|
&& !unofficial_source_add_suites_entry_clone0.text().is_empty()
|
||||||
!unofficial_source_add_suites_entry_clone0.text().is_empty() &&
|
&& !unofficial_source_add_components_entry_clone0
|
||||||
!unofficial_source_add_components_entry_clone0.text().is_empty()
|
.text()
|
||||||
|
.is_empty()
|
||||||
{
|
{
|
||||||
if unofficial_source_signed_keyring_checkbutton_clone0.is_active() {
|
if unofficial_source_signed_keyring_checkbutton_clone0.is_active() {
|
||||||
unofficial_source_add_dialog_clone0.set_response_enabled("unofficial_source_add_dialog_add", true);
|
unofficial_source_add_dialog_clone0
|
||||||
|
.set_response_enabled("unofficial_source_add_dialog_add", true);
|
||||||
} else if !unofficial_source_add_signed_entry_clone0.text().is_empty() {
|
} else if !unofficial_source_add_signed_entry_clone0.text().is_empty() {
|
||||||
unofficial_source_add_dialog_clone0.set_response_enabled("unofficial_source_add_dialog_add", true);
|
unofficial_source_add_dialog_clone0
|
||||||
|
.set_response_enabled("unofficial_source_add_dialog_add", true);
|
||||||
} else {
|
} else {
|
||||||
unofficial_source_add_dialog_clone0.set_response_enabled("unofficial_source_add_dialog_add", false);
|
unofficial_source_add_dialog_clone0
|
||||||
|
.set_response_enabled("unofficial_source_add_dialog_add", false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
unofficial_source_add_dialog_clone0.set_response_enabled("unofficial_source_add_dialog_add", false);
|
unofficial_source_add_dialog_clone0
|
||||||
|
.set_response_enabled("unofficial_source_add_dialog_add", false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -220,12 +206,10 @@ pub fn deb822_edit_dialog_fn(
|
|||||||
entry.connect_text_notify(clone!(
|
entry.connect_text_notify(clone!(
|
||||||
#[strong]
|
#[strong]
|
||||||
add_button_update_state,
|
add_button_update_state,
|
||||||
move |_|
|
move |_| {
|
||||||
{
|
|
||||||
add_button_update_state();
|
add_button_update_state();
|
||||||
}
|
}
|
||||||
)
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -235,30 +219,26 @@ pub fn deb822_edit_dialog_fn(
|
|||||||
unofficial_source_add_signed_entry,
|
unofficial_source_add_signed_entry,
|
||||||
#[strong]
|
#[strong]
|
||||||
add_button_update_state,
|
add_button_update_state,
|
||||||
move |checkbutton|
|
move |checkbutton| {
|
||||||
{
|
|
||||||
if checkbutton.is_active() {
|
if checkbutton.is_active() {
|
||||||
unofficial_source_add_signed_entry.set_sensitive(false);
|
unofficial_source_add_signed_entry.set_sensitive(false);
|
||||||
add_button_update_state();
|
add_button_update_state();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
));
|
||||||
);
|
|
||||||
|
|
||||||
unofficial_source_signed_file_checkbutton.connect_toggled(clone!(
|
unofficial_source_signed_file_checkbutton.connect_toggled(clone!(
|
||||||
#[weak]
|
#[weak]
|
||||||
unofficial_source_add_signed_entry,
|
unofficial_source_add_signed_entry,
|
||||||
#[strong]
|
#[strong]
|
||||||
add_button_update_state,
|
add_button_update_state,
|
||||||
move |checkbutton|
|
move |checkbutton| {
|
||||||
{
|
|
||||||
if checkbutton.is_active() {
|
if checkbutton.is_active() {
|
||||||
unofficial_source_add_signed_entry.set_sensitive(true);
|
unofficial_source_add_signed_entry.set_sensitive(true);
|
||||||
add_button_update_state();
|
add_button_update_state();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
));
|
||||||
);
|
|
||||||
|
|
||||||
unofficial_source_add_box2.append(&unofficial_source_add_is_source_label);
|
unofficial_source_add_box2.append(&unofficial_source_add_is_source_label);
|
||||||
unofficial_source_add_box2.append(&unofficial_source_add_is_source_switch);
|
unofficial_source_add_box2.append(&unofficial_source_add_is_source_switch);
|
||||||
@ -270,12 +250,12 @@ pub fn deb822_edit_dialog_fn(
|
|||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_name_prefrencesgroup);
|
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_name_prefrencesgroup);
|
||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_uri_prefrencesgroup);
|
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_uri_prefrencesgroup);
|
||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_suites_prefrencesgroup);
|
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_suites_prefrencesgroup);
|
||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_components_prefrencesgroup);
|
unofficial_source_add_dialog_child_box
|
||||||
|
.append(&unofficial_source_add_components_prefrencesgroup);
|
||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_archs_prefrencesgroup);
|
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_archs_prefrencesgroup);
|
||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_box2);
|
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_box2);
|
||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_signed_prefrencesgroup);
|
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_signed_prefrencesgroup);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
match &deb822_repo.repolib_name {
|
match &deb822_repo.repolib_name {
|
||||||
@ -307,9 +287,7 @@ pub fn deb822_edit_dialog_fn(
|
|||||||
unofficial_source_signed_file_checkbutton.set_active(true);
|
unofficial_source_signed_file_checkbutton.set_active(true);
|
||||||
unofficial_source_add_signed_entry.set_text(&t);
|
unofficial_source_add_signed_entry.set_text(&t);
|
||||||
}
|
}
|
||||||
None => {
|
None => unofficial_source_signed_keyring_checkbutton.set_active(true),
|
||||||
unofficial_source_signed_keyring_checkbutton.set_active(true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
match &deb822_repo.architectures {
|
match &deb822_repo.architectures {
|
||||||
Some(t) => {
|
Some(t) => {
|
||||||
@ -345,8 +323,8 @@ pub fn deb822_edit_dialog_fn(
|
|||||||
let reload_action_clone0 = reload_action.clone();
|
let reload_action_clone0 = reload_action.clone();
|
||||||
let apt_retry_signal_action_clone0 = apt_retry_signal_action.clone();
|
let apt_retry_signal_action_clone0 = apt_retry_signal_action.clone();
|
||||||
|
|
||||||
|
unofficial_source_add_dialog
|
||||||
unofficial_source_add_dialog.clone()
|
.clone()
|
||||||
.choose(None::<&gio::Cancellable>, move |choice| {
|
.choose(None::<&gio::Cancellable>, move |choice| {
|
||||||
match choice.as_str() {
|
match choice.as_str() {
|
||||||
"unofficial_source_edit_dialog_edit" => {
|
"unofficial_source_edit_dialog_edit" => {
|
||||||
@ -373,17 +351,27 @@ pub fn deb822_edit_dialog_fn(
|
|||||||
},
|
},
|
||||||
signed_by: match sign_method {
|
signed_by: match sign_method {
|
||||||
1 => Some(unofficial_source_add_signed_entry.text().to_string()),
|
1 => Some(unofficial_source_add_signed_entry.text().to_string()),
|
||||||
_ => None
|
_ => None,
|
||||||
},
|
},
|
||||||
enabled: match unofficial_source_add_is_enabled_switch.is_active() {
|
enabled: match unofficial_source_add_is_enabled_switch.is_active() {
|
||||||
true => Some("yes".to_string()),
|
true => Some("yes".to_string()),
|
||||||
false => Some("no".to_string())
|
false => Some("no".to_string()),
|
||||||
},
|
},
|
||||||
..deb822_repo_clone0
|
..deb822_repo_clone0
|
||||||
};
|
};
|
||||||
match Deb822Repository::write_to_file(new_repo.clone(), format!("/tmp/{}.sources", repo_file_name).into()) {
|
match Deb822Repository::write_to_file(
|
||||||
|
new_repo.clone(),
|
||||||
|
format!("/tmp/{}.sources", repo_file_name).into(),
|
||||||
|
) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
match duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh", "deb822_move", repo_file_name).run() {
|
match duct::cmd!(
|
||||||
|
"pkexec",
|
||||||
|
"/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh",
|
||||||
|
"deb822_move",
|
||||||
|
repo_file_name
|
||||||
|
)
|
||||||
|
.run()
|
||||||
|
{
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
||||||
|
@ -1,21 +1,8 @@
|
|||||||
use crate::apt_package_row::AptPackageRow;
|
|
||||||
use adw::gio::SimpleAction;
|
use adw::gio::SimpleAction;
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use apt_legacy_tools::LegacyAptSource;
|
use apt_legacy_tools::LegacyAptSource;
|
||||||
use regex::Regex;
|
use gtk::glib::clone;
|
||||||
use gtk::glib::{property::PropertyGet, clone, BoxedAnyObject};
|
|
||||||
use gtk::*;
|
use gtk::*;
|
||||||
use std::cell::Ref;
|
|
||||||
use std::ops::Deref;
|
|
||||||
use pika_unixsocket_tools::pika_unixsocket_tools::*;
|
|
||||||
use rust_apt::cache::*;
|
|
||||||
use rust_apt::new_cache;
|
|
||||||
use rust_apt::records::RecordField;
|
|
||||||
use std::cell::RefCell;
|
|
||||||
use std::process::Command;
|
|
||||||
use std::rc::Rc;
|
|
||||||
use std::thread;
|
|
||||||
use tokio::runtime::Runtime;
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
pub fn legacy_edit_dialog_fn(
|
pub fn legacy_edit_dialog_fn(
|
||||||
@ -38,8 +25,7 @@ pub fn legacy_edit_dialog_fn(
|
|||||||
.orientation(Orientation::Vertical)
|
.orientation(Orientation::Vertical)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let unofficial_source_add_uri_entry = gtk::Entry::builder()
|
let unofficial_source_add_uri_entry = gtk::Entry::builder().build();
|
||||||
.build();
|
|
||||||
|
|
||||||
let unofficial_source_add_uri_prefrencesgroup = adw::PreferencesGroup::builder()
|
let unofficial_source_add_uri_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||||
.title(t!("unofficial_source_add_uri_prefrencesgroup_title"))
|
.title(t!("unofficial_source_add_uri_prefrencesgroup_title"))
|
||||||
@ -47,8 +33,7 @@ pub fn legacy_edit_dialog_fn(
|
|||||||
|
|
||||||
unofficial_source_add_uri_prefrencesgroup.add(&unofficial_source_add_uri_entry);
|
unofficial_source_add_uri_prefrencesgroup.add(&unofficial_source_add_uri_entry);
|
||||||
|
|
||||||
let unofficial_source_add_suites_entry = gtk::Entry::builder()
|
let unofficial_source_add_suites_entry = gtk::Entry::builder().build();
|
||||||
.build();
|
|
||||||
|
|
||||||
let unofficial_source_add_suites_prefrencesgroup = adw::PreferencesGroup::builder()
|
let unofficial_source_add_suites_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||||
.title(t!("unofficial_source_add_suites_prefrencesgroup_title"))
|
.title(t!("unofficial_source_add_suites_prefrencesgroup_title"))
|
||||||
@ -56,8 +41,7 @@ pub fn legacy_edit_dialog_fn(
|
|||||||
|
|
||||||
unofficial_source_add_suites_prefrencesgroup.add(&unofficial_source_add_suites_entry);
|
unofficial_source_add_suites_prefrencesgroup.add(&unofficial_source_add_suites_entry);
|
||||||
|
|
||||||
let unofficial_source_add_components_entry = gtk::Entry::builder()
|
let unofficial_source_add_components_entry = gtk::Entry::builder().build();
|
||||||
.build();
|
|
||||||
|
|
||||||
let unofficial_source_add_components_prefrencesgroup = adw::PreferencesGroup::builder()
|
let unofficial_source_add_components_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||||
.title(t!("unofficial_source_add_components_prefrencesgroup_title"))
|
.title(t!("unofficial_source_add_components_prefrencesgroup_title"))
|
||||||
@ -65,14 +49,16 @@ pub fn legacy_edit_dialog_fn(
|
|||||||
|
|
||||||
unofficial_source_add_components_prefrencesgroup.add(&unofficial_source_add_components_entry);
|
unofficial_source_add_components_prefrencesgroup.add(&unofficial_source_add_components_entry);
|
||||||
|
|
||||||
let unofficial_source_add_legacy_options_entry = gtk::Entry::builder()
|
let unofficial_source_add_legacy_options_entry = gtk::Entry::builder().build();
|
||||||
.build();
|
|
||||||
|
|
||||||
let unofficial_source_add_legacy_options_prefrencesgroup = adw::PreferencesGroup::builder()
|
let unofficial_source_add_legacy_options_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||||
.title(t!("unofficial_source_add_legacy_options_prefrencesgroup_title"))
|
.title(t!(
|
||||||
|
"unofficial_source_add_legacy_options_prefrencesgroup_title"
|
||||||
|
))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
unofficial_source_add_legacy_options_prefrencesgroup.add(&unofficial_source_add_legacy_options_entry);
|
unofficial_source_add_legacy_options_prefrencesgroup
|
||||||
|
.add(&unofficial_source_add_legacy_options_entry);
|
||||||
|
|
||||||
let unofficial_source_add_box2 = gtk::Box::builder()
|
let unofficial_source_add_box2 = gtk::Box::builder()
|
||||||
.margin_top(10)
|
.margin_top(10)
|
||||||
@ -87,7 +73,6 @@ pub fn legacy_edit_dialog_fn(
|
|||||||
.valign(Align::Center)
|
.valign(Align::Center)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
let unofficial_source_add_is_enabled_label = gtk::Label::builder()
|
let unofficial_source_add_is_enabled_label = gtk::Label::builder()
|
||||||
.label(t!("unofficial_source_add_is_enabled_label_label"))
|
.label(t!("unofficial_source_add_is_enabled_label_label"))
|
||||||
.halign(Align::Start)
|
.halign(Align::Start)
|
||||||
@ -152,17 +137,21 @@ pub fn legacy_edit_dialog_fn(
|
|||||||
let unofficial_source_add_dialog_clone0 = unofficial_source_add_dialog.clone();
|
let unofficial_source_add_dialog_clone0 = unofficial_source_add_dialog.clone();
|
||||||
let unofficial_source_add_uri_entry_clone0 = unofficial_source_add_uri_entry.clone();
|
let unofficial_source_add_uri_entry_clone0 = unofficial_source_add_uri_entry.clone();
|
||||||
let unofficial_source_add_suites_entry_clone0 = unofficial_source_add_suites_entry.clone();
|
let unofficial_source_add_suites_entry_clone0 = unofficial_source_add_suites_entry.clone();
|
||||||
let unofficial_source_add_components_entry_clone0 = unofficial_source_add_components_entry.clone();
|
let unofficial_source_add_components_entry_clone0 =
|
||||||
|
unofficial_source_add_components_entry.clone();
|
||||||
|
|
||||||
let add_button_update_state = move || {
|
let add_button_update_state = move || {
|
||||||
if
|
if !unofficial_source_add_uri_entry_clone0.text().is_empty()
|
||||||
!unofficial_source_add_uri_entry_clone0.text().is_empty() &&
|
&& !unofficial_source_add_suites_entry_clone0.text().is_empty()
|
||||||
!unofficial_source_add_suites_entry_clone0.text().is_empty() &&
|
&& !unofficial_source_add_components_entry_clone0
|
||||||
!unofficial_source_add_components_entry_clone0.text().is_empty()
|
.text()
|
||||||
|
.is_empty()
|
||||||
{
|
{
|
||||||
unofficial_source_add_dialog_clone0.set_response_enabled("unofficial_source_add_dialog_add", true);
|
unofficial_source_add_dialog_clone0
|
||||||
|
.set_response_enabled("unofficial_source_add_dialog_add", true);
|
||||||
} else {
|
} else {
|
||||||
unofficial_source_add_dialog_clone0.set_response_enabled("unofficial_source_add_dialog_add", false);
|
unofficial_source_add_dialog_clone0
|
||||||
|
.set_response_enabled("unofficial_source_add_dialog_add", false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -177,12 +166,10 @@ pub fn legacy_edit_dialog_fn(
|
|||||||
entry.connect_text_notify(clone!(
|
entry.connect_text_notify(clone!(
|
||||||
#[strong]
|
#[strong]
|
||||||
add_button_update_state,
|
add_button_update_state,
|
||||||
move |_|
|
move |_| {
|
||||||
{
|
|
||||||
add_button_update_state();
|
add_button_update_state();
|
||||||
}
|
}
|
||||||
)
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -194,10 +181,11 @@ pub fn legacy_edit_dialog_fn(
|
|||||||
|
|
||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_uri_prefrencesgroup);
|
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_uri_prefrencesgroup);
|
||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_suites_prefrencesgroup);
|
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_suites_prefrencesgroup);
|
||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_components_prefrencesgroup);
|
unofficial_source_add_dialog_child_box
|
||||||
|
.append(&unofficial_source_add_components_prefrencesgroup);
|
||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_box2);
|
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_box2);
|
||||||
unofficial_source_add_dialog_child_box.append(&unofficial_source_add_legacy_options_prefrencesgroup);
|
unofficial_source_add_dialog_child_box
|
||||||
|
.append(&unofficial_source_add_legacy_options_prefrencesgroup);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
@ -220,7 +208,8 @@ pub fn legacy_edit_dialog_fn(
|
|||||||
let reload_action_clone0 = reload_action.clone();
|
let reload_action_clone0 = reload_action.clone();
|
||||||
let apt_retry_signal_action_clone0 = apt_retry_signal_action.clone();
|
let apt_retry_signal_action_clone0 = apt_retry_signal_action.clone();
|
||||||
|
|
||||||
unofficial_source_add_dialog.clone()
|
unofficial_source_add_dialog
|
||||||
|
.clone()
|
||||||
.choose(None::<&gio::Cancellable>, move |choice| {
|
.choose(None::<&gio::Cancellable>, move |choice| {
|
||||||
match choice.as_str() {
|
match choice.as_str() {
|
||||||
"unofficial_source_edit_dialog_edit" => {
|
"unofficial_source_edit_dialog_edit" => {
|
||||||
@ -231,14 +220,29 @@ pub fn legacy_edit_dialog_fn(
|
|||||||
is_source: unofficial_source_add_is_source_switch.is_active(),
|
is_source: unofficial_source_add_is_source_switch.is_active(),
|
||||||
suite: unofficial_source_add_suites_entry.text().to_string(),
|
suite: unofficial_source_add_suites_entry.text().to_string(),
|
||||||
components: unofficial_source_add_components_entry.text().to_string(),
|
components: unofficial_source_add_components_entry.text().to_string(),
|
||||||
options: Some(unofficial_source_add_legacy_options_entry.text().to_string()),
|
options: Some(
|
||||||
|
unofficial_source_add_legacy_options_entry
|
||||||
|
.text()
|
||||||
|
.to_string(),
|
||||||
|
),
|
||||||
enabled: unofficial_source_add_is_enabled_switch.is_active(),
|
enabled: unofficial_source_add_is_enabled_switch.is_active(),
|
||||||
..legacy_repo_clone0
|
..legacy_repo_clone0
|
||||||
};
|
};
|
||||||
new_apt_legacy_vec.push(new_repo.clone());
|
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)) {
|
match LegacyAptSource::save_to_file(
|
||||||
|
new_repo,
|
||||||
|
new_apt_legacy_vec,
|
||||||
|
&format!("/tmp/{}.list", repo_file_name),
|
||||||
|
) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
match duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh", "legacy_move", repo_file_name).run() {
|
match duct::cmd!(
|
||||||
|
"pkexec",
|
||||||
|
"/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh",
|
||||||
|
"legacy_move",
|
||||||
|
repo_file_name
|
||||||
|
)
|
||||||
|
.run()
|
||||||
|
{
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
let apt_src_create_error_dialog = adw::MessageDialog::builder()
|
||||||
|
@ -1,22 +1,12 @@
|
|||||||
use crate::apt_package_row::AptPackageRow;
|
|
||||||
use add_dialog::add_dialog_fn;
|
|
||||||
use adw::gio::SimpleAction;
|
use adw::gio::SimpleAction;
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use apt_deb822_tools::Deb822Repository;
|
use apt_deb822_tools::Deb822Repository;
|
||||||
use regex::Regex;
|
use gtk::glib::{clone, BoxedAnyObject};
|
||||||
use gtk::glib::{property::PropertyGet, clone, BoxedAnyObject};
|
|
||||||
use gtk::*;
|
use gtk::*;
|
||||||
use std::cell::Ref;
|
use std::cell::Ref;
|
||||||
use std::ops::Deref;
|
|
||||||
use pika_unixsocket_tools::pika_unixsocket_tools::*;
|
|
||||||
use rust_apt::cache::*;
|
|
||||||
use rust_apt::new_cache;
|
|
||||||
use rust_apt::records::RecordField;
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::process::Command;
|
use std::ops::Deref;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::thread;
|
|
||||||
use tokio::runtime::Runtime;
|
|
||||||
|
|
||||||
mod add_dialog;
|
mod add_dialog;
|
||||||
mod deb822_edit_dialog;
|
mod deb822_edit_dialog;
|
||||||
@ -24,7 +14,7 @@ mod legacy_edit_dialog;
|
|||||||
|
|
||||||
enum AptSourceConfig {
|
enum AptSourceConfig {
|
||||||
Legacy(apt_legacy_tools::LegacyAptSource),
|
Legacy(apt_legacy_tools::LegacyAptSource),
|
||||||
DEB822(apt_deb822_tools::Deb822Repository)
|
DEB822(apt_deb822_tools::Deb822Repository),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn apt_manage_page(
|
pub fn apt_manage_page(
|
||||||
@ -35,16 +25,22 @@ pub fn apt_manage_page(
|
|||||||
|
|
||||||
let deb822_sources = Deb822Repository::get_deb822_sources().unwrap();
|
let deb822_sources = Deb822Repository::get_deb822_sources().unwrap();
|
||||||
|
|
||||||
let system_source = deb822_sources.iter().filter(|x| {
|
let system_source = deb822_sources
|
||||||
match &x.repolib_id {
|
.iter()
|
||||||
Some(t) => {
|
.filter(|x| match &x.repolib_id {
|
||||||
t == "system"
|
Some(t) => t == "system",
|
||||||
}
|
None => false,
|
||||||
None => false
|
})
|
||||||
}
|
.next()
|
||||||
}).next().unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let system_mirror_refcell = Rc::new(RefCell::new(system_source.repolib_default_mirror.as_deref().unwrap().to_string()));
|
let system_mirror_refcell = Rc::new(RefCell::new(
|
||||||
|
system_source
|
||||||
|
.repolib_default_mirror
|
||||||
|
.as_deref()
|
||||||
|
.unwrap()
|
||||||
|
.to_string(),
|
||||||
|
));
|
||||||
|
|
||||||
let main_box = Box::builder()
|
let main_box = Box::builder()
|
||||||
.hexpand(true)
|
.hexpand(true)
|
||||||
@ -105,7 +101,9 @@ pub fn apt_manage_page(
|
|||||||
#[strong]
|
#[strong]
|
||||||
system_mirror_refcell,
|
system_mirror_refcell,
|
||||||
move |entry| {
|
move |entry| {
|
||||||
system_mirror_save_button.set_sensitive(!(entry.text().to_string() == system_mirror_refcell.borrow().to_string()));
|
system_mirror_save_button.set_sensitive(
|
||||||
|
!(entry.text().to_string() == system_mirror_refcell.borrow().to_string()),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -123,12 +121,24 @@ pub fn apt_manage_page(
|
|||||||
uris: (Some(system_mirror_entry.text().to_string())),
|
uris: (Some(system_mirror_entry.text().to_string())),
|
||||||
..system_source.clone()
|
..system_source.clone()
|
||||||
};
|
};
|
||||||
match Deb822Repository::write_to_file(new_repo.clone(), std::path::Path::new("/tmp/system.sources").to_path_buf()) {
|
match Deb822Repository::write_to_file(
|
||||||
|
new_repo.clone(),
|
||||||
|
std::path::Path::new("/tmp/system.sources").to_path_buf(),
|
||||||
|
) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
match duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh", "deb822_move", "system", "system").run() {
|
match duct::cmd!(
|
||||||
|
"pkexec",
|
||||||
|
"/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh",
|
||||||
|
"deb822_move",
|
||||||
|
"system",
|
||||||
|
"system"
|
||||||
|
)
|
||||||
|
.run()
|
||||||
|
{
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
retry_signal_action.activate(None);
|
retry_signal_action.activate(None);
|
||||||
*system_mirror_refcell.borrow_mut() = system_mirror_entry.text().to_string();
|
*system_mirror_refcell.borrow_mut() =
|
||||||
|
system_mirror_entry.text().to_string();
|
||||||
button.set_sensitive(false);
|
button.set_sensitive(false);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
@ -182,9 +192,11 @@ pub fn apt_manage_page(
|
|||||||
.margin_end(15)
|
.margin_end(15)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let unofficial_sources_selection_model_rc: Rc<RefCell<gtk::SingleSelection>> = Rc::new(RefCell::default());
|
let unofficial_sources_selection_model_rc: Rc<RefCell<gtk::SingleSelection>> =
|
||||||
|
Rc::new(RefCell::default());
|
||||||
|
|
||||||
let unofficial_sources_selection_model_rc_clone0 = Rc::clone(&unofficial_sources_selection_model_rc);
|
let unofficial_sources_selection_model_rc_clone0 =
|
||||||
|
Rc::clone(&unofficial_sources_selection_model_rc);
|
||||||
|
|
||||||
let unofficial_sources_columnview_bin = adw::Bin::new();
|
let unofficial_sources_columnview_bin = adw::Bin::new();
|
||||||
|
|
||||||
@ -194,16 +206,11 @@ pub fn apt_manage_page(
|
|||||||
#[weak]
|
#[weak]
|
||||||
unofficial_sources_columnview_bin_clone0,
|
unofficial_sources_columnview_bin_clone0,
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
|
|
||||||
let mut unofficial_deb822_sources = Deb822Repository::get_deb822_sources().unwrap();
|
let mut unofficial_deb822_sources = Deb822Repository::get_deb822_sources().unwrap();
|
||||||
|
|
||||||
unofficial_deb822_sources.retain(|x| {
|
unofficial_deb822_sources.retain(|x| match &x.repolib_id {
|
||||||
match &x.repolib_id {
|
Some(t) => !(t == "system"),
|
||||||
Some(t) => {
|
None => true,
|
||||||
!(t == "system")
|
|
||||||
}
|
|
||||||
None => true
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let legacy_apt_repos = apt_legacy_tools::LegacyAptSource::get_legacy_sources();
|
let legacy_apt_repos = apt_legacy_tools::LegacyAptSource::get_legacy_sources();
|
||||||
@ -211,21 +218,25 @@ pub fn apt_manage_page(
|
|||||||
let unofficial_sources_list_store = gio::ListStore::new::<BoxedAnyObject>();
|
let unofficial_sources_list_store = gio::ListStore::new::<BoxedAnyObject>();
|
||||||
|
|
||||||
for deb822_source in unofficial_deb822_sources {
|
for deb822_source in unofficial_deb822_sources {
|
||||||
unofficial_sources_list_store.append(&BoxedAnyObject::new(AptSourceConfig::DEB822(deb822_source)));
|
unofficial_sources_list_store
|
||||||
};
|
.append(&BoxedAnyObject::new(AptSourceConfig::DEB822(deb822_source)));
|
||||||
|
}
|
||||||
|
|
||||||
match legacy_apt_repos {
|
match legacy_apt_repos {
|
||||||
Ok(vec) => {
|
Ok(vec) => {
|
||||||
for legacy_repo in vec {
|
for legacy_repo in vec {
|
||||||
unofficial_sources_list_store.append(&BoxedAnyObject::new(AptSourceConfig::Legacy(legacy_repo)));
|
unofficial_sources_list_store
|
||||||
};
|
.append(&BoxedAnyObject::new(AptSourceConfig::Legacy(legacy_repo)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(_) => {}
|
Err(_) => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
let unofficial_sources_selection_model = SingleSelection::new(Some(unofficial_sources_list_store));
|
let unofficial_sources_selection_model =
|
||||||
|
SingleSelection::new(Some(unofficial_sources_list_store));
|
||||||
|
|
||||||
(*unofficial_sources_selection_model_rc_clone0.borrow_mut() = unofficial_sources_selection_model.clone());
|
(*unofficial_sources_selection_model_rc_clone0.borrow_mut() =
|
||||||
|
unofficial_sources_selection_model.clone());
|
||||||
|
|
||||||
let unofficial_sources_columnview = ColumnView::builder()
|
let unofficial_sources_columnview = ColumnView::builder()
|
||||||
.vexpand(true)
|
.vexpand(true)
|
||||||
@ -238,9 +249,7 @@ pub fn apt_manage_page(
|
|||||||
|
|
||||||
unofficial_sources_columnview_factory0.connect_setup(move |_factory, item| {
|
unofficial_sources_columnview_factory0.connect_setup(move |_factory, item| {
|
||||||
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
|
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
|
||||||
let row = Label::builder()
|
let row = Label::builder().halign(Align::Start).build();
|
||||||
.halign(Align::Start)
|
|
||||||
.build();
|
|
||||||
item.set_child(Some(&row));
|
item.set_child(Some(&row));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -250,23 +259,17 @@ pub fn apt_manage_page(
|
|||||||
let entry: BoxedAnyObject = item.item().and_downcast::<BoxedAnyObject>().unwrap();
|
let entry: BoxedAnyObject = item.item().and_downcast::<BoxedAnyObject>().unwrap();
|
||||||
let entry_borrow = entry.borrow::<AptSourceConfig>();
|
let entry_borrow = entry.borrow::<AptSourceConfig>();
|
||||||
let repo_name = match entry_borrow.deref() {
|
let repo_name = match entry_borrow.deref() {
|
||||||
AptSourceConfig::DEB822(src) => {
|
AptSourceConfig::DEB822(src) => match &src.repolib_name {
|
||||||
match &src.repolib_name {
|
|
||||||
Some(name) => name,
|
Some(name) => name,
|
||||||
None => match(&src.uris, &src.suites, &src.components) {
|
None => match (&src.uris, &src.suites, &src.components) {
|
||||||
(Some(uris),Some(suites),Some(components)) => {
|
(Some(uris), Some(suites), Some(components)) => {
|
||||||
&format!("{} {} {}", uris, suites, components)
|
&format!("{} {} {}", uris, suites, components)
|
||||||
}
|
}
|
||||||
(_,_,_) => {
|
(_, _, _) => &t!("apt_source_parse_error").to_string(),
|
||||||
&t!("apt_source_parse_error").to_string()
|
},
|
||||||
}
|
},
|
||||||
}
|
AptSourceConfig::Legacy(src) => &format!(
|
||||||
|
"{} {} {} {}",
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AptSourceConfig::Legacy(src) => {
|
|
||||||
&format!("{} {} {} {}",
|
|
||||||
if src.is_source {
|
if src.is_source {
|
||||||
"(Legacy Src)"
|
"(Legacy Src)"
|
||||||
} else {
|
} else {
|
||||||
@ -275,8 +278,7 @@ pub fn apt_manage_page(
|
|||||||
&src.url,
|
&src.url,
|
||||||
&src.suite,
|
&src.suite,
|
||||||
&src.components
|
&src.components
|
||||||
)
|
),
|
||||||
}
|
|
||||||
};
|
};
|
||||||
child.set_label(&repo_name);
|
child.set_label(&repo_name);
|
||||||
});
|
});
|
||||||
@ -293,9 +295,7 @@ pub fn apt_manage_page(
|
|||||||
|
|
||||||
unofficial_sources_columnview_factory1.connect_setup(move |_factory, item| {
|
unofficial_sources_columnview_factory1.connect_setup(move |_factory, item| {
|
||||||
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
|
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
|
||||||
let row = Label::builder()
|
let row = Label::builder().halign(Align::Start).build();
|
||||||
.halign(Align::Start)
|
|
||||||
.build();
|
|
||||||
item.set_child(Some(&row));
|
item.set_child(Some(&row));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -305,21 +305,17 @@ pub fn apt_manage_page(
|
|||||||
let entry: BoxedAnyObject = item.item().and_downcast::<BoxedAnyObject>().unwrap();
|
let entry: BoxedAnyObject = item.item().and_downcast::<BoxedAnyObject>().unwrap();
|
||||||
let entry_borrow = entry.borrow::<AptSourceConfig>();
|
let entry_borrow = entry.borrow::<AptSourceConfig>();
|
||||||
let repo_enabled = match entry_borrow.deref() {
|
let repo_enabled = match entry_borrow.deref() {
|
||||||
AptSourceConfig::DEB822(src) => {
|
AptSourceConfig::DEB822(src) => match &src.enabled {
|
||||||
match &src.enabled {
|
|
||||||
Some(t) => match t.to_lowercase().as_str() {
|
Some(t) => match t.to_lowercase().as_str() {
|
||||||
"yes" => true,
|
"yes" => true,
|
||||||
"true" => true,
|
"true" => true,
|
||||||
"no" => false,
|
"no" => false,
|
||||||
"false" => false,
|
"false" => false,
|
||||||
_ => true,
|
_ => true,
|
||||||
}
|
},
|
||||||
None => true,
|
None => true,
|
||||||
}
|
},
|
||||||
}
|
AptSourceConfig::Legacy(src) => src.enabled,
|
||||||
AptSourceConfig::Legacy(src) => {
|
|
||||||
src.enabled
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
if repo_enabled {
|
if repo_enabled {
|
||||||
child.set_label(&t!("apt_repo_enabled"));
|
child.set_label(&t!("apt_repo_enabled"));
|
||||||
@ -336,8 +332,10 @@ pub fn apt_manage_page(
|
|||||||
//
|
//
|
||||||
unofficial_sources_columnview.append_column(&unofficial_sources_columnview_col0);
|
unofficial_sources_columnview.append_column(&unofficial_sources_columnview_col0);
|
||||||
unofficial_sources_columnview.append_column(&unofficial_sources_columnview_col1);
|
unofficial_sources_columnview.append_column(&unofficial_sources_columnview_col1);
|
||||||
unofficial_sources_columnview_bin_clone0.set_child(Some(&unofficial_sources_columnview));
|
unofficial_sources_columnview_bin_clone0
|
||||||
}));
|
.set_child(Some(&unofficial_sources_columnview));
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
retry_signal_action.activate(None);
|
retry_signal_action.activate(None);
|
||||||
|
|
||||||
@ -398,17 +396,14 @@ pub fn apt_manage_page(
|
|||||||
retry_signal_action,
|
retry_signal_action,
|
||||||
#[strong]
|
#[strong]
|
||||||
apt_retry_signal_action,
|
apt_retry_signal_action,
|
||||||
move
|
move |_| {
|
||||||
|_|
|
|
||||||
{
|
|
||||||
add_dialog::add_dialog_fn(
|
add_dialog::add_dialog_fn(
|
||||||
window.clone(),
|
window.clone(),
|
||||||
&retry_signal_action,
|
&retry_signal_action,
|
||||||
&apt_retry_signal_action
|
&apt_retry_signal_action,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
)
|
));
|
||||||
);
|
|
||||||
|
|
||||||
unofficial_source_edit_button.connect_clicked(clone!(
|
unofficial_source_edit_button.connect_clicked(clone!(
|
||||||
#[strong]
|
#[strong]
|
||||||
@ -419,25 +414,29 @@ pub fn apt_manage_page(
|
|||||||
retry_signal_action,
|
retry_signal_action,
|
||||||
#[strong]
|
#[strong]
|
||||||
apt_retry_signal_action,
|
apt_retry_signal_action,
|
||||||
move
|
move |_| {
|
||||||
|_|
|
|
||||||
{
|
|
||||||
let unofficial_sources_selection_model = unofficial_sources_selection_model_rc.borrow();
|
let unofficial_sources_selection_model = unofficial_sources_selection_model_rc.borrow();
|
||||||
let selection = unofficial_sources_selection_model.selected_item().unwrap();
|
let selection = unofficial_sources_selection_model.selected_item().unwrap();
|
||||||
let item = selection.downcast_ref::<BoxedAnyObject>().unwrap();
|
let item = selection.downcast_ref::<BoxedAnyObject>().unwrap();
|
||||||
let apt_src: Ref<AptSourceConfig> = item.borrow();
|
let apt_src: Ref<AptSourceConfig> = item.borrow();
|
||||||
match apt_src.deref() {
|
match apt_src.deref() {
|
||||||
AptSourceConfig::DEB822(src) => {
|
AptSourceConfig::DEB822(src) => {
|
||||||
deb822_edit_dialog::deb822_edit_dialog_fn(window.clone(), src, &retry_signal_action, &apt_retry_signal_action);
|
deb822_edit_dialog::deb822_edit_dialog_fn(
|
||||||
}
|
window.clone(),
|
||||||
AptSourceConfig::Legacy(list) => {
|
src,
|
||||||
legacy_edit_dialog::legacy_edit_dialog_fn(window.clone(), list, &retry_signal_action, &apt_retry_signal_action)
|
&retry_signal_action,
|
||||||
}
|
&apt_retry_signal_action,
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
AptSourceConfig::Legacy(list) => legacy_edit_dialog::legacy_edit_dialog_fn(
|
||||||
|
window.clone(),
|
||||||
|
list,
|
||||||
|
&retry_signal_action,
|
||||||
|
&apt_retry_signal_action,
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
unofficial_source_remove_button.connect_clicked(clone!(
|
unofficial_source_remove_button.connect_clicked(clone!(
|
||||||
#[strong]
|
#[strong]
|
||||||
@ -448,24 +447,41 @@ pub fn apt_manage_page(
|
|||||||
retry_signal_action,
|
retry_signal_action,
|
||||||
#[strong]
|
#[strong]
|
||||||
apt_retry_signal_action,
|
apt_retry_signal_action,
|
||||||
move
|
move |_| {
|
||||||
|_|
|
|
||||||
{
|
{
|
||||||
|
let mut _command = duct::cmd!("");
|
||||||
{
|
{
|
||||||
let mut command = duct::cmd!("");
|
let unofficial_sources_selection_model =
|
||||||
{
|
unofficial_sources_selection_model_rc.borrow();
|
||||||
let unofficial_sources_selection_model = unofficial_sources_selection_model_rc.borrow();
|
|
||||||
let selection = unofficial_sources_selection_model.selected_item().unwrap();
|
let selection = unofficial_sources_selection_model.selected_item().unwrap();
|
||||||
let item = selection.downcast_ref::<BoxedAnyObject>().unwrap();
|
let item = selection.downcast_ref::<BoxedAnyObject>().unwrap();
|
||||||
let apt_src: Ref<AptSourceConfig> = item.borrow();
|
let apt_src: Ref<AptSourceConfig> = item.borrow();
|
||||||
match apt_src.deref() {
|
match apt_src.deref() {
|
||||||
AptSourceConfig::DEB822(src) => {
|
AptSourceConfig::DEB822(src) => {
|
||||||
match &src.signed_by {
|
match &src.signed_by {
|
||||||
Some(t) => {command = duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh", "delete_deb822", &src.filepath, t)}
|
Some(t) => _command = duct::cmd!(
|
||||||
None => {command = duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh", "delete_legacy", &src.filepath)}
|
"pkexec",
|
||||||
|
"/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh",
|
||||||
|
"delete_deb822",
|
||||||
|
&src.filepath,
|
||||||
|
t
|
||||||
|
),
|
||||||
|
None => _command = duct::cmd!(
|
||||||
|
"pkexec",
|
||||||
|
"/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh",
|
||||||
|
"delete_legacy",
|
||||||
|
&src.filepath
|
||||||
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AptSourceConfig::Legacy(list) => {command = duct::cmd!("pkexec", "/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh", "delete_legacy", &list.filepath)}
|
AptSourceConfig::Legacy(list) => {
|
||||||
|
_command = duct::cmd!(
|
||||||
|
"pkexec",
|
||||||
|
"/usr/lib/pika/pikman-update-manager/scripts/modify_repo.sh",
|
||||||
|
"delete_legacy",
|
||||||
|
&list.filepath
|
||||||
|
)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
let apt_src_remove_warning_dialog = adw::MessageDialog::builder()
|
let apt_src_remove_warning_dialog = adw::MessageDialog::builder()
|
||||||
@ -481,14 +497,16 @@ pub fn apt_manage_page(
|
|||||||
"apt_src_remove_warning_dialog_ok",
|
"apt_src_remove_warning_dialog_ok",
|
||||||
&t!("apt_src_remove_warning_dialog_ok_label").to_string(),
|
&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);
|
apt_src_remove_warning_dialog.set_response_appearance(
|
||||||
|
"apt_src_remove_warning_dialog_ok",
|
||||||
|
adw::ResponseAppearance::Destructive,
|
||||||
|
);
|
||||||
let retry_signal_action_clone0 = retry_signal_action.clone();
|
let retry_signal_action_clone0 = retry_signal_action.clone();
|
||||||
let apt_retry_signal_action_clone0 = apt_retry_signal_action.clone();
|
let apt_retry_signal_action_clone0 = apt_retry_signal_action.clone();
|
||||||
apt_src_remove_warning_dialog.clone()
|
apt_src_remove_warning_dialog.clone().choose(
|
||||||
.choose(None::<&gio::Cancellable>, move |choice| {
|
None::<&gio::Cancellable>,
|
||||||
match choice.as_str() {
|
move |choice| match choice.as_str() {
|
||||||
"apt_src_remove_warning_dialog_ok" => {
|
"apt_src_remove_warning_dialog_ok" => match _command.run() {
|
||||||
match command.run() {
|
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
retry_signal_action_clone0.activate(None);
|
retry_signal_action_clone0.activate(None);
|
||||||
apt_retry_signal_action_clone0.activate(None)
|
apt_retry_signal_action_clone0.activate(None)
|
||||||
@ -506,15 +524,13 @@ pub fn apt_manage_page(
|
|||||||
retry_signal_action_clone0.activate(None);
|
retry_signal_action_clone0.activate(None);
|
||||||
apt_retry_signal_action_clone0.activate(None)
|
apt_retry_signal_action_clone0.activate(None)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
},
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -66,9 +66,7 @@ pub fn apt_update_page(
|
|||||||
|
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
let apt_update_command = Command::new("pkexec")
|
let apt_update_command = Command::new("pkexec")
|
||||||
.args([
|
.args(["/usr/lib/pika/pikman-update-manager/scripts/apt_update"])
|
||||||
"/usr/lib/pika/pikman-update-manager/scripts/apt_update",
|
|
||||||
])
|
|
||||||
.status()
|
.status()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
match apt_update_command.code().unwrap() {
|
match apt_update_command.code().unwrap() {
|
||||||
@ -182,8 +180,6 @@ pub fn apt_update_page(
|
|||||||
apt_update_dialog.set_response_enabled("apt_update_dialog_retry", false);
|
apt_update_dialog.set_response_enabled("apt_update_dialog_retry", false);
|
||||||
apt_update_dialog.set_response_enabled("apt_update_dialog_ignore", false);
|
apt_update_dialog.set_response_enabled("apt_update_dialog_ignore", false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if window.is_visible() {
|
if window.is_visible() {
|
||||||
let retry_signal_action0 = retry_signal_action.clone();
|
let retry_signal_action0 = retry_signal_action.clone();
|
||||||
let viewport_bin = viewport_bin.clone();
|
let viewport_bin = viewport_bin.clone();
|
||||||
@ -455,7 +451,10 @@ pub fn apt_update_page(
|
|||||||
(*apt_update_count.borrow_mut() += 1);
|
(*apt_update_count.borrow_mut() += 1);
|
||||||
if state.is_last {
|
if state.is_last {
|
||||||
packages_boxedlist.set_sensitive(true);
|
packages_boxedlist.set_sensitive(true);
|
||||||
update_sys_tray.activate(Some(&glib::Variant::array_from_fixed_array(&[*apt_update_count.borrow(),*flatpak_update_count.borrow()])));
|
update_sys_tray.activate(Some(&glib::Variant::array_from_fixed_array(&[
|
||||||
|
*apt_update_count.borrow(),
|
||||||
|
*flatpak_update_count.borrow(),
|
||||||
|
])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -412,9 +412,7 @@ fn apt_full_upgrade_from_socket(
|
|||||||
|
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
let apt_upgrade_command = Command::new("pkexec")
|
let apt_upgrade_command = Command::new("pkexec")
|
||||||
.args([
|
.args(["/usr/lib/pika/pikman-update-manager/scripts/apt_full_upgrade"])
|
||||||
"/usr/lib/pika/pikman-update-manager/scripts/apt_full_upgrade",
|
|
||||||
])
|
|
||||||
.status()
|
.status()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
match apt_upgrade_command.code().unwrap() {
|
match apt_upgrade_command.code().unwrap() {
|
||||||
|
@ -1,22 +1,17 @@
|
|||||||
use crate::apt_manage_page::apt_manage_page;
|
use crate::apt_manage_page::apt_manage_page;
|
||||||
use crate::flatpak_manage_page::flatpak_manage_page;
|
|
||||||
use crate::apt_update_page;
|
use crate::apt_update_page;
|
||||||
use crate::config::{APP_GITHUB, APP_ICON, APP_ID, VERSION};
|
use crate::config::{APP_GITHUB, APP_ICON, APP_ID, VERSION};
|
||||||
|
use crate::flatpak_manage_page::flatpak_manage_page;
|
||||||
use crate::flatpak_update_page;
|
use crate::flatpak_update_page;
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use adw::*;
|
use adw::*;
|
||||||
use async_channel::Sender;
|
|
||||||
use futures::task::SpawnExt;
|
|
||||||
use gtk::glib::{clone, MainContext};
|
use gtk::glib::{clone, MainContext};
|
||||||
use gtk::{License, WindowControls};
|
use gtk::{License, WindowControls};
|
||||||
|
use ksni;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::ops::Index;
|
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::atomic::AtomicBool;
|
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::sync::Arc;
|
|
||||||
use ksni;
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct PikmanTray {
|
struct PikmanTray {
|
||||||
@ -30,7 +25,7 @@ impl ksni::Tray for PikmanTray {
|
|||||||
fn icon_name(&self) -> String {
|
fn icon_name(&self) -> String {
|
||||||
match &self.icon_name {
|
match &self.icon_name {
|
||||||
Some(t) => t.into(),
|
Some(t) => t.into(),
|
||||||
None => "help-about".into()
|
None => "help-about".into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn title(&self) -> String {
|
fn title(&self) -> String {
|
||||||
@ -46,8 +41,9 @@ impl ksni::Tray for PikmanTray {
|
|||||||
StandardItem {
|
StandardItem {
|
||||||
label: match &self.apt_item_label {
|
label: match &self.apt_item_label {
|
||||||
Some(t) => t,
|
Some(t) => t,
|
||||||
None => "?"
|
None => "?",
|
||||||
}.into(),
|
}
|
||||||
|
.into(),
|
||||||
icon_name: "application-vnd.debian.binary-package".into(),
|
icon_name: "application-vnd.debian.binary-package".into(),
|
||||||
enabled: false,
|
enabled: false,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -56,8 +52,9 @@ impl ksni::Tray for PikmanTray {
|
|||||||
StandardItem {
|
StandardItem {
|
||||||
label: match &self.flatpak_item_label {
|
label: match &self.flatpak_item_label {
|
||||||
Some(t) => t,
|
Some(t) => t,
|
||||||
None => "?"
|
None => "?",
|
||||||
}.into(),
|
}
|
||||||
|
.into(),
|
||||||
icon_name: "application-vnd.flatpak".into(),
|
icon_name: "application-vnd.flatpak".into(),
|
||||||
enabled: false,
|
enabled: false,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -68,7 +65,9 @@ impl ksni::Tray for PikmanTray {
|
|||||||
label: t!("pikman_indicator_open_item_label").into(),
|
label: t!("pikman_indicator_open_item_label").into(),
|
||||||
icon_name: "view-paged-symbolic".into(),
|
icon_name: "view-paged-symbolic".into(),
|
||||||
activate: Box::new(|_| {
|
activate: Box::new(|_| {
|
||||||
self.action_sender.send_blocking(String::from("open")).unwrap()
|
self.action_sender
|
||||||
|
.send_blocking(String::from("open"))
|
||||||
|
.unwrap()
|
||||||
}),
|
}),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
@ -117,7 +116,7 @@ pub fn build_ui(app: &Application) {
|
|||||||
update_sys_tray.connect_activate(clone!(
|
update_sys_tray.connect_activate(clone!(
|
||||||
#[strong]
|
#[strong]
|
||||||
tray_handle,
|
tray_handle,
|
||||||
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();
|
||||||
let apt_update_count = vec[0];
|
let apt_update_count = vec[0];
|
||||||
@ -129,35 +128,36 @@ pub fn build_ui(app: &Application) {
|
|||||||
};
|
};
|
||||||
tray_handle.update(|tray: &mut PikmanTray| {
|
tray_handle.update(|tray: &mut PikmanTray| {
|
||||||
tray.icon_name = tray_icon;
|
tray.icon_name = tray_icon;
|
||||||
tray.apt_item_label = Some(strfmt::strfmt(
|
tray.apt_item_label = Some(
|
||||||
|
strfmt::strfmt(
|
||||||
&t!("pikman_indicator_apt_count_item_label").to_string(),
|
&t!("pikman_indicator_apt_count_item_label").to_string(),
|
||||||
&std::collections::HashMap::from([
|
&std::collections::HashMap::from([(
|
||||||
(
|
|
||||||
"NUM".to_string(),
|
"NUM".to_string(),
|
||||||
match apt_update_count {
|
match apt_update_count {
|
||||||
-1 => t!("pikman_indicator_flatpak_item_label_calculating").into(),
|
-1 => t!("pikman_indicator_flatpak_item_label_calculating").into(),
|
||||||
_ => apt_update_count.to_string(),
|
_ => apt_update_count.to_string(),
|
||||||
},
|
},
|
||||||
),
|
)]),
|
||||||
]),
|
|
||||||
)
|
)
|
||||||
.unwrap());
|
.unwrap(),
|
||||||
tray.flatpak_item_label = Some(strfmt::strfmt(
|
);
|
||||||
|
tray.flatpak_item_label = Some(
|
||||||
|
strfmt::strfmt(
|
||||||
&t!("pikman_indicator_flatpak_count_item_label").to_string(),
|
&t!("pikman_indicator_flatpak_count_item_label").to_string(),
|
||||||
&std::collections::HashMap::from([
|
&std::collections::HashMap::from([(
|
||||||
(
|
|
||||||
"NUM".to_string(),
|
"NUM".to_string(),
|
||||||
match flatpak_update_count {
|
match flatpak_update_count {
|
||||||
-1 => t!("pikman_indicator_flatpak_item_label_calculating").into(),
|
-1 => t!("pikman_indicator_flatpak_item_label_calculating").into(),
|
||||||
_ => flatpak_update_count.to_string(),
|
_ => flatpak_update_count.to_string(),
|
||||||
},
|
},
|
||||||
),
|
)]),
|
||||||
]),
|
|
||||||
)
|
)
|
||||||
.unwrap());
|
.unwrap(),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}));
|
}
|
||||||
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])));
|
||||||
|
|
||||||
thread::spawn(move || loop {
|
thread::spawn(move || loop {
|
||||||
match Command::new("ping").arg("google.com").arg("-c 1").output() {
|
match Command::new("ping").arg("google.com").arg("-c 1").output() {
|
||||||
@ -228,17 +228,28 @@ pub fn build_ui(app: &Application) {
|
|||||||
.margin_end(5)
|
.margin_end(5)
|
||||||
.hexpand(true)
|
.hexpand(true)
|
||||||
.build();
|
.build();
|
||||||
window_adw_view_switcher_sidebar_control_box.append(&WindowControls::builder().halign(gtk::Align::Start).valign(gtk::Align::Center).build());
|
window_adw_view_switcher_sidebar_control_box.append(
|
||||||
window_adw_view_switcher_sidebar_control_box.append(&WindowTitle::builder().halign(gtk::Align::Center).margin_top(10).margin_bottom(20).valign(gtk::Align::Center).hexpand(true).title(t!("application_name")).build());
|
&WindowControls::builder()
|
||||||
|
.halign(gtk::Align::Start)
|
||||||
|
.valign(gtk::Align::Center)
|
||||||
|
.build(),
|
||||||
|
);
|
||||||
|
window_adw_view_switcher_sidebar_control_box.append(
|
||||||
|
&WindowTitle::builder()
|
||||||
|
.halign(gtk::Align::Center)
|
||||||
|
.margin_top(10)
|
||||||
|
.margin_bottom(20)
|
||||||
|
.valign(gtk::Align::Center)
|
||||||
|
.hexpand(true)
|
||||||
|
.title(t!("application_name"))
|
||||||
|
.build(),
|
||||||
|
);
|
||||||
|
|
||||||
let window_adw_view_switcher_sidebar_box = gtk::Box::new(gtk::Orientation::Vertical, 0);
|
let window_adw_view_switcher_sidebar_box = gtk::Box::new(gtk::Orientation::Vertical, 0);
|
||||||
window_adw_view_switcher_sidebar_box.append(&window_adw_view_switcher_sidebar_control_box);
|
window_adw_view_switcher_sidebar_box.append(&window_adw_view_switcher_sidebar_control_box);
|
||||||
|
|
||||||
let null_toggle_button: gtk::ToggleButton = gtk::ToggleButton::new();
|
let null_toggle_button: gtk::ToggleButton = gtk::ToggleButton::new();
|
||||||
|
|
||||||
let window_adw_stack_clone0 = window_adw_stack.clone();
|
|
||||||
let window_adw_view_switcher_sidebar_box_clone0 = window_adw_view_switcher_sidebar_box.clone();
|
|
||||||
|
|
||||||
let sidebar_toggle_button = gtk::ToggleButton::builder()
|
let sidebar_toggle_button = gtk::ToggleButton::builder()
|
||||||
.icon_name("view-right-pane-symbolic")
|
.icon_name("view-right-pane-symbolic")
|
||||||
.visible(false)
|
.visible(false)
|
||||||
@ -266,16 +277,8 @@ pub fn build_ui(app: &Application) {
|
|||||||
"collapsed",
|
"collapsed",
|
||||||
Some(&true.to_value()),
|
Some(&true.to_value()),
|
||||||
);
|
);
|
||||||
window_breakpoint.add_setter(
|
window_breakpoint.add_setter(&sidebar_toggle_button, "visible", Some(&true.to_value()));
|
||||||
&sidebar_toggle_button,
|
window_breakpoint.add_setter(&window_headerbar, "show_title", Some(&true.to_value()));
|
||||||
"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_headerbar.pack_end(&sidebar_toggle_button);
|
||||||
|
|
||||||
@ -312,12 +315,10 @@ pub fn build_ui(app: &Application) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.connect_close_request(move |window| {
|
window.connect_close_request(move |window| {
|
||||||
if let Some(application) = window.application() {
|
|
||||||
let size = window.default_size();
|
let size = window.default_size();
|
||||||
let _ = glib_settings.set_int("window-width", size.0);
|
let _ = glib_settings.set_int("window-width", size.0);
|
||||||
let _ = glib_settings.set_int("window-height", size.1);
|
let _ = glib_settings.set_int("window-height", size.1);
|
||||||
let _ = glib_settings.set_boolean("is-maximized", window.is_maximized());
|
let _ = glib_settings.set_boolean("is-maximized", window.is_maximized());
|
||||||
}
|
|
||||||
glib::Propagation::Proceed
|
glib::Propagation::Proceed
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -353,8 +354,7 @@ pub fn build_ui(app: &Application) {
|
|||||||
|
|
||||||
let flatpak_retry_signal_action = gio::SimpleAction::new("retry", None);
|
let flatpak_retry_signal_action = gio::SimpleAction::new("retry", None);
|
||||||
|
|
||||||
let flatpak_update_view_stack_bin = Bin::builder()
|
let flatpak_update_view_stack_bin = Bin::builder().build();
|
||||||
.build();
|
|
||||||
|
|
||||||
flatpak_retry_signal_action.connect_activate(clone!(
|
flatpak_retry_signal_action.connect_activate(clone!(
|
||||||
#[weak]
|
#[weak]
|
||||||
@ -370,13 +370,15 @@ pub fn build_ui(app: &Application) {
|
|||||||
#[strong]
|
#[strong]
|
||||||
flatpak_update_count,
|
flatpak_update_count,
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
flatpak_update_view_stack_bin.set_child(Some(&flatpak_update_page::flatpak_update_page(
|
flatpak_update_view_stack_bin.set_child(Some(
|
||||||
|
&flatpak_update_page::flatpak_update_page(
|
||||||
window,
|
window,
|
||||||
&flatpak_retry_signal_action,
|
&flatpak_retry_signal_action,
|
||||||
&update_sys_tray,
|
&update_sys_tray,
|
||||||
&apt_update_count,
|
&apt_update_count,
|
||||||
&flatpak_update_count,
|
&flatpak_update_count,
|
||||||
)));
|
),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -435,7 +437,13 @@ pub fn build_ui(app: &Application) {
|
|||||||
&t!("apt_update_page_title"),
|
&t!("apt_update_page_title"),
|
||||||
);
|
);
|
||||||
|
|
||||||
let apt_update_page_toggle_button = add_content_button(&window_adw_stack, true, "apt_update_page".to_string(), t!("apt_update_page_title").to_string(), &null_toggle_button);
|
let apt_update_page_toggle_button = add_content_button(
|
||||||
|
&window_adw_stack,
|
||||||
|
true,
|
||||||
|
"apt_update_page".to_string(),
|
||||||
|
t!("apt_update_page_title").to_string(),
|
||||||
|
&null_toggle_button,
|
||||||
|
);
|
||||||
window_adw_view_switcher_sidebar_box.append(&apt_update_page_toggle_button);
|
window_adw_view_switcher_sidebar_box.append(&apt_update_page_toggle_button);
|
||||||
|
|
||||||
window_adw_stack.add_titled(
|
window_adw_stack.add_titled(
|
||||||
@ -444,7 +452,13 @@ pub fn build_ui(app: &Application) {
|
|||||||
&t!("flatpak_update_page_title"),
|
&t!("flatpak_update_page_title"),
|
||||||
);
|
);
|
||||||
|
|
||||||
let flatpak_update_page_toggle_button = add_content_button(&window_adw_stack, false, "flatpak_update_page".to_string(), t!("flatpak_update_page_title").to_string(), &null_toggle_button);
|
let flatpak_update_page_toggle_button = add_content_button(
|
||||||
|
&window_adw_stack,
|
||||||
|
false,
|
||||||
|
"flatpak_update_page".to_string(),
|
||||||
|
t!("flatpak_update_page_title").to_string(),
|
||||||
|
&null_toggle_button,
|
||||||
|
);
|
||||||
window_adw_view_switcher_sidebar_box.append(&flatpak_update_page_toggle_button);
|
window_adw_view_switcher_sidebar_box.append(&flatpak_update_page_toggle_button);
|
||||||
|
|
||||||
window_adw_stack.add_titled(
|
window_adw_stack.add_titled(
|
||||||
@ -453,10 +467,17 @@ pub fn build_ui(app: &Application) {
|
|||||||
&t!("apt_manage_page_title"),
|
&t!("apt_manage_page_title"),
|
||||||
);
|
);
|
||||||
|
|
||||||
let apt_manage_page_toggle_button = add_content_button(&window_adw_stack, false, "apt_manage_page".to_string(), t!("apt_manage_page_title").to_string(), &null_toggle_button);
|
let apt_manage_page_toggle_button = add_content_button(
|
||||||
|
&window_adw_stack,
|
||||||
|
false,
|
||||||
|
"apt_manage_page".to_string(),
|
||||||
|
t!("apt_manage_page_title").to_string(),
|
||||||
|
&null_toggle_button,
|
||||||
|
);
|
||||||
window_adw_view_switcher_sidebar_box.append(&apt_manage_page_toggle_button);
|
window_adw_view_switcher_sidebar_box.append(&apt_manage_page_toggle_button);
|
||||||
|
|
||||||
let flatpak_entry_signal_action = gio::SimpleAction::new("entry-change", Some(glib::VariantTy::STRING));
|
let flatpak_entry_signal_action =
|
||||||
|
gio::SimpleAction::new("entry-change", Some(glib::VariantTy::STRING));
|
||||||
|
|
||||||
let flatpak_flatref_install_button = gtk::Button::builder()
|
let flatpak_flatref_install_button = gtk::Button::builder()
|
||||||
.icon_name("document-open-symbolic")
|
.icon_name("document-open-symbolic")
|
||||||
@ -466,12 +487,23 @@ pub fn build_ui(app: &Application) {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
window_adw_stack.add_titled(
|
window_adw_stack.add_titled(
|
||||||
&flatpak_manage_page(window.clone(), &flatpak_retry_signal_action, &flatpak_entry_signal_action, &flatpak_flatref_install_button),
|
&flatpak_manage_page(
|
||||||
|
window.clone(),
|
||||||
|
&flatpak_retry_signal_action,
|
||||||
|
&flatpak_entry_signal_action,
|
||||||
|
&flatpak_flatref_install_button,
|
||||||
|
),
|
||||||
Some("flatpak_manage_page"),
|
Some("flatpak_manage_page"),
|
||||||
&t!("flatpak_manage_page_title"),
|
&t!("flatpak_manage_page_title"),
|
||||||
);
|
);
|
||||||
|
|
||||||
let flatpak_manage_page_toggle_button = add_content_button(&window_adw_stack, false, "flatpak_manage_page".to_string(), t!("flatpak_manage_page_title").to_string(), &null_toggle_button);
|
let flatpak_manage_page_toggle_button = add_content_button(
|
||||||
|
&window_adw_stack,
|
||||||
|
false,
|
||||||
|
"flatpak_manage_page".to_string(),
|
||||||
|
t!("flatpak_manage_page_title").to_string(),
|
||||||
|
&null_toggle_button,
|
||||||
|
);
|
||||||
window_adw_view_switcher_sidebar_box.append(&flatpak_manage_page_toggle_button);
|
window_adw_view_switcher_sidebar_box.append(&flatpak_manage_page_toggle_button);
|
||||||
|
|
||||||
app.connect_command_line(clone!(
|
app.connect_command_line(clone!(
|
||||||
@ -496,7 +528,10 @@ pub fn build_ui(app: &Application) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for cmd lines
|
// Check for cmd lines
|
||||||
if !(gtk_application_args.contains(&"--hidden".to_string())) && !(gtk_application_args.contains(&"--flatpak-installer".to_string())) && !window.is_visible() {
|
if !(gtk_application_args.contains(&"--hidden".to_string()))
|
||||||
|
&& !(gtk_application_args.contains(&"--flatpak-installer".to_string()))
|
||||||
|
&& !window.is_visible()
|
||||||
|
{
|
||||||
window.present();
|
window.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,13 +545,18 @@ pub fn build_ui(app: &Application) {
|
|||||||
}
|
}
|
||||||
if gtk_application_args.contains(&"--flatpak-installer".to_string()) {
|
if gtk_application_args.contains(&"--flatpak-installer".to_string()) {
|
||||||
flatpak_flatref_install_button.emit_clicked();
|
flatpak_flatref_install_button.emit_clicked();
|
||||||
let index = ((gtk_application_args.iter().position(|r| r == "--flatpak-installer").unwrap() as i32) +1) as usize;
|
let index = ((gtk_application_args
|
||||||
flatpak_entry_signal_action.activate(Some(&glib::Variant::from(>k_application_args[index])));
|
.iter()
|
||||||
|
.position(|r| r == "--flatpak-installer")
|
||||||
|
.unwrap() as i32)
|
||||||
|
+ 1) as usize;
|
||||||
|
flatpak_entry_signal_action
|
||||||
|
.activate(Some(&glib::Variant::from(>k_application_args[index])));
|
||||||
}
|
}
|
||||||
|
|
||||||
0
|
0
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
|
|
||||||
// Refresh button
|
// Refresh button
|
||||||
|
|
||||||
@ -551,15 +591,20 @@ pub fn build_ui(app: &Application) {
|
|||||||
window.present();
|
window.present();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => todo!()
|
_ => todo!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_content_button(window_adw_stack: >k::Stack, active: bool, name: String, title: String, null_toggle_button: >k::ToggleButton) -> gtk::ToggleButton {
|
fn add_content_button(
|
||||||
|
window_adw_stack: >k::Stack,
|
||||||
|
active: bool,
|
||||||
|
name: String,
|
||||||
|
title: String,
|
||||||
|
null_toggle_button: >k::ToggleButton,
|
||||||
|
) -> gtk::ToggleButton {
|
||||||
let toggle_button = gtk::ToggleButton::builder()
|
let toggle_button = gtk::ToggleButton::builder()
|
||||||
.group(null_toggle_button)
|
.group(null_toggle_button)
|
||||||
.label(&title)
|
.label(&title)
|
||||||
@ -571,10 +616,14 @@ fn add_content_button(window_adw_stack: >k::Stack, active: bool, name: String,
|
|||||||
.valign(gtk::Align::Start)
|
.valign(gtk::Align::Start)
|
||||||
.build();
|
.build();
|
||||||
toggle_button.add_css_class("flat");
|
toggle_button.add_css_class("flat");
|
||||||
toggle_button.connect_clicked(clone!(#[weak] window_adw_stack,move |toggle_button| {
|
toggle_button.connect_clicked(clone!(
|
||||||
|
#[weak]
|
||||||
|
window_adw_stack,
|
||||||
|
move |toggle_button| {
|
||||||
if toggle_button.is_active() {
|
if toggle_button.is_active() {
|
||||||
window_adw_stack.set_visible_child_name(&name);
|
window_adw_stack.set_visible_child_name(&name);
|
||||||
}
|
}
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
toggle_button
|
toggle_button
|
||||||
}
|
}
|
@ -1,39 +1,19 @@
|
|||||||
use crate::apt_package_row::AptPackageRow;
|
|
||||||
use adw::gio::SimpleAction;
|
use adw::gio::SimpleAction;
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use apt_deb822_tools::Deb822Repository;
|
use gtk::glib::clone;
|
||||||
use libflatpak::builders::RemoteRefBuilder;
|
|
||||||
use regex::{bytes, Regex};
|
|
||||||
use gtk::glib::{property::PropertyGet, clone, BoxedAnyObject};
|
|
||||||
use gtk::*;
|
use gtk::*;
|
||||||
use std::cell::Ref;
|
|
||||||
use std::ops::Deref;
|
|
||||||
use pika_unixsocket_tools::pika_unixsocket_tools::*;
|
|
||||||
use rust_apt::cache::*;
|
|
||||||
use rust_apt::new_cache;
|
|
||||||
use rust_apt::records::RecordField;
|
|
||||||
use std::cell::RefCell;
|
|
||||||
use std::process::Command;
|
|
||||||
use std::rc::Rc;
|
|
||||||
use std::thread;
|
|
||||||
use tokio::runtime::Runtime;
|
|
||||||
use libflatpak::prelude::*;
|
|
||||||
use libflatpak::InstalledRef;
|
|
||||||
|
|
||||||
pub fn add_dialog_fn(
|
pub fn add_dialog_fn(
|
||||||
window: adw::ApplicationWindow,
|
window: adw::ApplicationWindow,
|
||||||
reload_action: &gio::SimpleAction,
|
reload_action: &gio::SimpleAction,
|
||||||
flatpak_retry_signal_action: &SimpleAction,
|
flatpak_retry_signal_action: &SimpleAction,
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
let flatpak_remote_add_dialog_child_box = Box::builder()
|
let flatpak_remote_add_dialog_child_box = Box::builder()
|
||||||
.hexpand(true)
|
.hexpand(true)
|
||||||
.orientation(Orientation::Vertical)
|
.orientation(Orientation::Vertical)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let flatpak_remote_add_name_entry = gtk::Entry::builder()
|
let flatpak_remote_add_name_entry = gtk::Entry::builder().placeholder_text("Flathub").build();
|
||||||
.placeholder_text("Flathub")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let flatpak_remote_add_name_prefrencesgroup = adw::PreferencesGroup::builder()
|
let flatpak_remote_add_name_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||||
.title(t!("flatpak_remote_add_name_prefrencesgroup_title"))
|
.title(t!("flatpak_remote_add_name_prefrencesgroup_title"))
|
||||||
@ -121,15 +101,15 @@ pub fn add_dialog_fn(
|
|||||||
let flatpak_remote_add_name_entry_clone0 = flatpak_remote_add_name_entry.clone();
|
let flatpak_remote_add_name_entry_clone0 = flatpak_remote_add_name_entry.clone();
|
||||||
let flatpak_remote_add_url_entry_clone0 = flatpak_remote_add_url_entry.clone();
|
let flatpak_remote_add_url_entry_clone0 = flatpak_remote_add_url_entry.clone();
|
||||||
|
|
||||||
|
|
||||||
let add_button_update_state = move || {
|
let add_button_update_state = move || {
|
||||||
if
|
if !flatpak_remote_add_name_entry_clone0.text().is_empty()
|
||||||
!flatpak_remote_add_name_entry_clone0.text().is_empty() &&
|
&& !flatpak_remote_add_url_entry_clone0.text().is_empty()
|
||||||
!flatpak_remote_add_url_entry_clone0.text().is_empty()
|
|
||||||
{
|
{
|
||||||
flatpak_remote_add_dialog_clone0.set_response_enabled("flatpak_remote_add_dialog_add", true);
|
flatpak_remote_add_dialog_clone0
|
||||||
|
.set_response_enabled("flatpak_remote_add_dialog_add", true);
|
||||||
} else {
|
} else {
|
||||||
flatpak_remote_add_dialog_clone0.set_response_enabled("flatpak_remote_add_dialog_add", false);
|
flatpak_remote_add_dialog_clone0
|
||||||
|
.set_response_enabled("flatpak_remote_add_dialog_add", false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -142,12 +122,10 @@ pub fn add_dialog_fn(
|
|||||||
entry.connect_text_notify(clone!(
|
entry.connect_text_notify(clone!(
|
||||||
#[strong]
|
#[strong]
|
||||||
add_button_update_state,
|
add_button_update_state,
|
||||||
move |_|
|
move |_| {
|
||||||
{
|
|
||||||
add_button_update_state();
|
add_button_update_state();
|
||||||
}
|
}
|
||||||
)
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -162,13 +140,14 @@ pub fn add_dialog_fn(
|
|||||||
let reload_action_clone0 = reload_action.clone();
|
let reload_action_clone0 = reload_action.clone();
|
||||||
let flatpak_retry_signal_action_clone0 = flatpak_retry_signal_action.clone();
|
let flatpak_retry_signal_action_clone0 = flatpak_retry_signal_action.clone();
|
||||||
|
|
||||||
flatpak_remote_add_dialog.clone()
|
flatpak_remote_add_dialog
|
||||||
|
.clone()
|
||||||
.choose(None::<&gio::Cancellable>, move |choice| {
|
.choose(None::<&gio::Cancellable>, move |choice| {
|
||||||
match choice.as_str() {
|
match choice.as_str() {
|
||||||
"flatpak_remote_add_dialog_add" => {
|
"flatpak_remote_add_dialog_add" => {
|
||||||
let cancellable_no = libflatpak::gio::Cancellable::NONE;
|
/*let cancellable_no = libflatpak::gio::Cancellable::NONE;
|
||||||
|
|
||||||
/*let flatpak_installation = match flatpak_remote_system_togglebutton.is_active() {
|
let flatpak_installation = match flatpak_remote_system_togglebutton.is_active() {
|
||||||
true => libflatpak::Installation::new_system(cancellable_no).unwrap(),
|
true => libflatpak::Installation::new_system(cancellable_no).unwrap(),
|
||||||
false => libflatpak::Installation::new_user(cancellable_no).unwrap(),
|
false => libflatpak::Installation::new_user(cancellable_no).unwrap(),
|
||||||
};
|
};
|
||||||
@ -204,12 +183,22 @@ pub fn add_dialog_fn(
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
let flatpak_installation = match flatpak_remote_system_togglebutton.is_active() {
|
let flatpak_installation = match flatpak_remote_system_togglebutton.is_active()
|
||||||
|
{
|
||||||
true => "--system",
|
true => "--system",
|
||||||
false => "--user"
|
false => "--user",
|
||||||
};
|
};
|
||||||
|
|
||||||
match duct::cmd!("flatpak", "remote-add", "--if-not-exists", &flatpak_installation, &flatpak_remote_add_name_entry.text(), &flatpak_remote_add_url_entry.text()).run() {
|
match duct::cmd!(
|
||||||
|
"flatpak",
|
||||||
|
"remote-add",
|
||||||
|
"--if-not-exists",
|
||||||
|
&flatpak_installation,
|
||||||
|
&flatpak_remote_add_name_entry.text(),
|
||||||
|
&flatpak_remote_add_url_entry.text()
|
||||||
|
)
|
||||||
|
.run()
|
||||||
|
{
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
reload_action_clone0.activate(None);
|
reload_action_clone0.activate(None);
|
||||||
flatpak_retry_signal_action_clone0.activate(None);
|
flatpak_retry_signal_action_clone0.activate(None);
|
||||||
|
@ -1,37 +1,24 @@
|
|||||||
use crate::apt_package_row::AptPackageRow;
|
|
||||||
use adw::gio::SimpleAction;
|
use adw::gio::SimpleAction;
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use apt_deb822_tools::Deb822Repository;
|
use configparser::ini::Ini;
|
||||||
use libflatpak::builders::RemoteRefBuilder;
|
use gtk::glib::{clone, MainContext};
|
||||||
use regex::{bytes, Regex};
|
|
||||||
use gtk::glib::{property::PropertyGet, clone, BoxedAnyObject, MainContext};
|
|
||||||
use gtk::*;
|
use gtk::*;
|
||||||
use std::cell::Ref;
|
use libflatpak::prelude::*;
|
||||||
use std::ops::Deref;
|
use pretty_bytes::converter::convert;
|
||||||
use pika_unixsocket_tools::pika_unixsocket_tools::*;
|
|
||||||
use rust_apt::cache::*;
|
|
||||||
use rust_apt::new_cache;
|
|
||||||
use rust_apt::records::RecordField;
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
use std::fs::OpenOptions;
|
||||||
|
use std::io::Write;
|
||||||
|
use std::ops::Deref;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use tokio::runtime::Runtime;
|
|
||||||
use libflatpak::prelude::*;
|
|
||||||
use std::io::Write;
|
|
||||||
use libflatpak::InstalledRef;
|
|
||||||
use std::fs::OpenOptions;
|
|
||||||
use pretty_bytes::converter::convert;
|
|
||||||
use configparser::ini::Ini;
|
|
||||||
|
|
||||||
|
|
||||||
pub fn install_ref_dialog_fn(
|
pub fn install_ref_dialog_fn(
|
||||||
window: adw::ApplicationWindow,
|
window: adw::ApplicationWindow,
|
||||||
reload_action: &gio::SimpleAction,
|
reload_action: &gio::SimpleAction,
|
||||||
flatpak_retry_signal_action: &SimpleAction,
|
flatpak_retry_signal_action: &SimpleAction,
|
||||||
flatpak_ref_entry_action: &SimpleAction,
|
flatpak_ref_entry_action: &SimpleAction,
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
let flatpak_ref_install_dialog_child_box = Box::builder()
|
let flatpak_ref_install_dialog_child_box = Box::builder()
|
||||||
.hexpand(true)
|
.hexpand(true)
|
||||||
.orientation(Orientation::Vertical)
|
.orientation(Orientation::Vertical)
|
||||||
@ -43,8 +30,12 @@ pub fn install_ref_dialog_fn(
|
|||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
let flatpak_ref_install_flatref_path_file_dialog = gtk::FileChooserNative::builder()
|
let flatpak_ref_install_flatref_path_file_dialog = gtk::FileChooserNative::builder()
|
||||||
.title(t!("flatpak_ref_install_flatref_path_file_dialog_title"))
|
.title(t!("flatpak_ref_install_flatref_path_file_dialog_title"))
|
||||||
.accept_label(t!("flatpak_ref_install_flatref_path_file_dialog_accept_label"))
|
.accept_label(t!(
|
||||||
.cancel_label(t!("flatpak_ref_install_flatref_path_file_dialog_cancel_label"))
|
"flatpak_ref_install_flatref_path_file_dialog_accept_label"
|
||||||
|
))
|
||||||
|
.cancel_label(t!(
|
||||||
|
"flatpak_ref_install_flatref_path_file_dialog_cancel_label"
|
||||||
|
))
|
||||||
.action(gtk::FileChooserAction::Open)
|
.action(gtk::FileChooserAction::Open)
|
||||||
.filter(&flatpak_ref_install_flatref_path_file_dialog_filter)
|
.filter(&flatpak_ref_install_flatref_path_file_dialog_filter)
|
||||||
.build();
|
.build();
|
||||||
@ -57,15 +48,16 @@ pub fn install_ref_dialog_fn(
|
|||||||
flatpak_ref_entry_action.connect_activate(clone!(
|
flatpak_ref_entry_action.connect_activate(clone!(
|
||||||
#[strong]
|
#[strong]
|
||||||
flatpak_ref_install_flatref_path_entry,
|
flatpak_ref_install_flatref_path_entry,
|
||||||
move |_ , param|
|
move |_, param| {
|
||||||
{
|
flatpak_ref_install_flatref_path_entry
|
||||||
flatpak_ref_install_flatref_path_entry.set_text(¶m.unwrap().get::<String>().unwrap());
|
.set_text(¶m.unwrap().get::<String>().unwrap());
|
||||||
}
|
}
|
||||||
)
|
));
|
||||||
);
|
|
||||||
|
|
||||||
let flatpak_ref_install_flatref_path_entry_open_file_dialog = gtk::Button::builder()
|
let flatpak_ref_install_flatref_path_entry_open_file_dialog = gtk::Button::builder()
|
||||||
.tooltip_text(t!("flatpak_ref_install_flatref_path_entry_open_file_dialog_text"))
|
.tooltip_text(t!(
|
||||||
|
"flatpak_ref_install_flatref_path_entry_open_file_dialog_text"
|
||||||
|
))
|
||||||
.halign(gtk::Align::End)
|
.halign(gtk::Align::End)
|
||||||
.icon_name("document-open-symbolic")
|
.icon_name("document-open-symbolic")
|
||||||
.build();
|
.build();
|
||||||
@ -85,36 +77,34 @@ pub fn install_ref_dialog_fn(
|
|||||||
));
|
));
|
||||||
|
|
||||||
flatpak_ref_install_flatref_path_entry_box.append(&flatpak_ref_install_flatref_path_entry);
|
flatpak_ref_install_flatref_path_entry_box.append(&flatpak_ref_install_flatref_path_entry);
|
||||||
flatpak_ref_install_flatref_path_entry_box.append(&flatpak_ref_install_flatref_path_entry_open_file_dialog);
|
flatpak_ref_install_flatref_path_entry_box
|
||||||
|
.append(&flatpak_ref_install_flatref_path_entry_open_file_dialog);
|
||||||
|
|
||||||
let flatpak_ref_install_flatref_path_prefrencesgroup = adw::PreferencesGroup::builder()
|
let flatpak_ref_install_flatref_path_prefrencesgroup = adw::PreferencesGroup::builder()
|
||||||
.title(t!("flatpak_ref_install_flatref_path_prefrencesgroup_title"))
|
.title(t!("flatpak_ref_install_flatref_path_prefrencesgroup_title"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
flatpak_ref_install_flatref_path_file_dialog.connect_response(
|
flatpak_ref_install_flatref_path_file_dialog.connect_response(clone!(
|
||||||
clone!(
|
|
||||||
#[weak]
|
#[weak]
|
||||||
flatpak_ref_install_flatref_path_entry,
|
flatpak_ref_install_flatref_path_entry,
|
||||||
move |dialog, response|
|
move |dialog, response| {
|
||||||
{
|
|
||||||
if response == gtk::ResponseType::Accept {
|
if response == gtk::ResponseType::Accept {
|
||||||
match dialog.file() {
|
match dialog.file() {
|
||||||
Some(f) => {
|
Some(f) => match f.path() {
|
||||||
match f.path() {
|
Some(p) => {
|
||||||
Some(p) => flatpak_ref_install_flatref_path_entry.set_text(p.to_str().unwrap()),
|
flatpak_ref_install_flatref_path_entry.set_text(p.to_str().unwrap())
|
||||||
|
}
|
||||||
None => {}
|
None => {}
|
||||||
}
|
},
|
||||||
|
|
||||||
}
|
|
||||||
None => {}
|
None => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
));
|
||||||
);
|
|
||||||
|
|
||||||
flatpak_ref_install_flatref_path_prefrencesgroup.add(&flatpak_ref_install_flatref_path_entry_box);
|
flatpak_ref_install_flatref_path_prefrencesgroup
|
||||||
|
.add(&flatpak_ref_install_flatref_path_entry_box);
|
||||||
|
|
||||||
let flatpak_ref_install_box2 = gtk::Box::builder()
|
let flatpak_ref_install_box2 = gtk::Box::builder()
|
||||||
.margin_top(10)
|
.margin_top(10)
|
||||||
@ -163,7 +153,8 @@ pub fn install_ref_dialog_fn(
|
|||||||
.height_request(400)
|
.height_request(400)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
flatpak_ref_install_flatref_path_file_dialog.set_transient_for(Some(&flatpak_ref_install_dialog));
|
flatpak_ref_install_flatref_path_file_dialog
|
||||||
|
.set_transient_for(Some(&flatpak_ref_install_dialog));
|
||||||
|
|
||||||
flatpak_ref_install_dialog.add_response(
|
flatpak_ref_install_dialog.add_response(
|
||||||
"flatpak_ref_install_dialog_add",
|
"flatpak_ref_install_dialog_add",
|
||||||
@ -190,7 +181,8 @@ pub fn install_ref_dialog_fn(
|
|||||||
//
|
//
|
||||||
|
|
||||||
let flatpak_ref_install_dialog_clone0 = flatpak_ref_install_dialog.clone();
|
let flatpak_ref_install_dialog_clone0 = flatpak_ref_install_dialog.clone();
|
||||||
let flatpak_ref_install_flatref_path_entry_clone0 = flatpak_ref_install_flatref_path_entry.clone();
|
let flatpak_ref_install_flatref_path_entry_clone0 =
|
||||||
|
flatpak_ref_install_flatref_path_entry.clone();
|
||||||
let flatpak_ref_install_label0_clone0 = flatpak_ref_install_label0.clone();
|
let flatpak_ref_install_label0_clone0 = flatpak_ref_install_label0.clone();
|
||||||
|
|
||||||
let tbi_remote_name = Rc::new(RefCell::new(None));
|
let tbi_remote_name = Rc::new(RefCell::new(None));
|
||||||
@ -200,8 +192,9 @@ pub fn install_ref_dialog_fn(
|
|||||||
let tbi_remote_url_clone0 = tbi_remote_url.clone();
|
let tbi_remote_url_clone0 = tbi_remote_url.clone();
|
||||||
|
|
||||||
let add_button_update_state = move || {
|
let add_button_update_state = move || {
|
||||||
if
|
if !flatpak_ref_install_flatref_path_entry_clone0
|
||||||
!flatpak_ref_install_flatref_path_entry_clone0.text().is_empty()
|
.text()
|
||||||
|
.is_empty()
|
||||||
{
|
{
|
||||||
match std::fs::read_to_string(flatpak_ref_install_flatref_path_entry_clone0.text()) {
|
match std::fs::read_to_string(flatpak_ref_install_flatref_path_entry_clone0.text()) {
|
||||||
Ok(t) => {
|
Ok(t) => {
|
||||||
@ -209,67 +202,67 @@ pub fn install_ref_dialog_fn(
|
|||||||
match flatref_file.read(t) {
|
match flatref_file.read(t) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
let ref_name = flatref_file.get("Flatpak Ref", "Name");
|
let ref_name = flatref_file.get("Flatpak Ref", "Name");
|
||||||
let ref_remote_name = flatref_file.get("Flatpak Ref", "SuggestRemoteName");
|
let ref_remote_name =
|
||||||
|
flatref_file.get("Flatpak Ref", "SuggestRemoteName");
|
||||||
let ref_remote_url = flatref_file.get("Flatpak Ref", "RuntimeRepo");
|
let ref_remote_url = flatref_file.get("Flatpak Ref", "RuntimeRepo");
|
||||||
match (ref_name, ref_remote_name.clone()) {
|
match (ref_name, ref_remote_name.clone()) {
|
||||||
(Some(name), Some(remote_name)) => {
|
(Some(name), Some(remote_name)) => {
|
||||||
flatpak_ref_install_label0_clone0.set_label(&strfmt::strfmt(
|
flatpak_ref_install_label0_clone0.set_label(
|
||||||
|
&strfmt::strfmt(
|
||||||
&t!("flatpak_ref_install_label").to_string(),
|
&t!("flatpak_ref_install_label").to_string(),
|
||||||
&std::collections::HashMap::from([
|
&std::collections::HashMap::from([
|
||||||
(
|
("NAME".to_string(), name),
|
||||||
"NAME".to_string(),
|
("REMOTE".to_string(), remote_name),
|
||||||
name,
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"REMOTE".to_string(),
|
|
||||||
remote_name,
|
|
||||||
),
|
|
||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
.unwrap());
|
.unwrap(),
|
||||||
|
);
|
||||||
{
|
{
|
||||||
*tbi_remote_name_clone0.borrow_mut() = ref_remote_name;
|
*tbi_remote_name_clone0.borrow_mut() = ref_remote_name;
|
||||||
*tbi_remote_url_clone0.borrow_mut() = ref_remote_url;
|
*tbi_remote_url_clone0.borrow_mut() = ref_remote_url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(_, _) => {
|
(_, _) => {
|
||||||
flatpak_ref_install_dialog_clone0.set_response_enabled("flatpak_ref_install_dialog_add", false);
|
flatpak_ref_install_dialog_clone0.set_response_enabled(
|
||||||
|
"flatpak_ref_install_dialog_add",
|
||||||
|
false,
|
||||||
|
);
|
||||||
flatpak_ref_install_label0_clone0.set_label("");
|
flatpak_ref_install_label0_clone0.set_label("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
flatpak_ref_install_dialog_clone0.set_response_enabled("flatpak_ref_install_dialog_add", true);
|
flatpak_ref_install_dialog_clone0
|
||||||
|
.set_response_enabled("flatpak_ref_install_dialog_add", true);
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
flatpak_ref_install_dialog_clone0.set_response_enabled("flatpak_ref_install_dialog_add", false);
|
flatpak_ref_install_dialog_clone0
|
||||||
|
.set_response_enabled("flatpak_ref_install_dialog_add", false);
|
||||||
flatpak_ref_install_label0_clone0.set_label("");
|
flatpak_ref_install_label0_clone0.set_label("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
flatpak_ref_install_dialog_clone0.set_response_enabled("flatpak_ref_install_dialog_add", false);
|
flatpak_ref_install_dialog_clone0
|
||||||
|
.set_response_enabled("flatpak_ref_install_dialog_add", false);
|
||||||
flatpak_ref_install_label0_clone0.set_label("");
|
flatpak_ref_install_label0_clone0.set_label("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
flatpak_ref_install_dialog_clone0.set_response_enabled("flatpak_ref_install_dialog_add", false);
|
flatpak_ref_install_dialog_clone0
|
||||||
|
.set_response_enabled("flatpak_ref_install_dialog_add", false);
|
||||||
flatpak_ref_install_label0_clone0.set_label("");
|
flatpak_ref_install_label0_clone0.set_label("");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
for entry in [
|
for entry in [&flatpak_ref_install_flatref_path_entry] {
|
||||||
&flatpak_ref_install_flatref_path_entry,
|
|
||||||
] {
|
|
||||||
entry.connect_text_notify(clone!(
|
entry.connect_text_notify(clone!(
|
||||||
#[strong]
|
#[strong]
|
||||||
add_button_update_state,
|
add_button_update_state,
|
||||||
move |_|
|
move |_| {
|
||||||
{
|
|
||||||
add_button_update_state();
|
add_button_update_state();
|
||||||
}
|
}
|
||||||
)
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -283,28 +276,49 @@ pub fn install_ref_dialog_fn(
|
|||||||
|
|
||||||
let reload_action_clone0 = reload_action.clone();
|
let reload_action_clone0 = reload_action.clone();
|
||||||
let flatpak_retry_signal_action_clone0 = flatpak_retry_signal_action.clone();
|
let flatpak_retry_signal_action_clone0 = flatpak_retry_signal_action.clone();
|
||||||
let flatpak_ref_install_flatref_path_entry_clone0 = flatpak_ref_install_flatref_path_entry.clone();
|
let flatpak_ref_install_flatref_path_entry_clone0 =
|
||||||
|
flatpak_ref_install_flatref_path_entry.clone();
|
||||||
let tbi_remote_name_clone0 = tbi_remote_name.clone();
|
let tbi_remote_name_clone0 = tbi_remote_name.clone();
|
||||||
let tbi_remote_url_clone0 = tbi_remote_url.clone();
|
let tbi_remote_url_clone0 = tbi_remote_url.clone();
|
||||||
|
|
||||||
flatpak_ref_install_dialog.clone()
|
flatpak_ref_install_dialog.clone().choose(
|
||||||
.choose(None::<&gio::Cancellable>, move |choice| {
|
None::<&gio::Cancellable>,
|
||||||
match choice.as_str() {
|
move |choice| match choice.as_str() {
|
||||||
"flatpak_ref_install_dialog_add" => {
|
"flatpak_ref_install_dialog_add" => {
|
||||||
match (tbi_remote_name_clone0.borrow().deref(), tbi_remote_url_clone0.borrow().deref()) {
|
match (
|
||||||
|
tbi_remote_name_clone0.borrow().deref(),
|
||||||
|
tbi_remote_url_clone0.borrow().deref(),
|
||||||
|
) {
|
||||||
(Some(remote_name), Some(remote_url)) => {
|
(Some(remote_name), Some(remote_url)) => {
|
||||||
add_flatpakref_remote(&reload_action_clone0, &remote_name, &remote_url, flatpak_remote_system_togglebutton.is_active());
|
add_flatpakref_remote(
|
||||||
|
&reload_action_clone0,
|
||||||
|
&remote_name,
|
||||||
|
&remote_url,
|
||||||
|
flatpak_remote_system_togglebutton.is_active(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
(_,_) => {}
|
(_, _) => {}
|
||||||
}
|
}
|
||||||
run_flatpak_ref_install_transaction(&flatpak_retry_signal_action_clone0, &reload_action_clone0, flatpak_remote_system_togglebutton.is_active(), window, &flatpak_ref_install_flatref_path_entry_clone0.text());
|
run_flatpak_ref_install_transaction(
|
||||||
|
&flatpak_retry_signal_action_clone0,
|
||||||
|
&reload_action_clone0,
|
||||||
|
flatpak_remote_system_togglebutton.is_active(),
|
||||||
|
window,
|
||||||
|
&flatpak_ref_install_flatref_path_entry_clone0.text(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
},
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run_flatpak_ref_install_transaction(flatpak_retry_signal_action: &gio::SimpleAction, retry_signal_action: &gio::SimpleAction, is_system: bool, window: adw::ApplicationWindow, flatref_path: &str) {
|
pub fn run_flatpak_ref_install_transaction(
|
||||||
|
flatpak_retry_signal_action: &gio::SimpleAction,
|
||||||
|
retry_signal_action: &gio::SimpleAction,
|
||||||
|
is_system: bool,
|
||||||
|
window: adw::ApplicationWindow,
|
||||||
|
flatref_path: &str,
|
||||||
|
) {
|
||||||
let (transaction_percent_sender, transaction_percent_receiver) =
|
let (transaction_percent_sender, transaction_percent_receiver) =
|
||||||
async_channel::unbounded::<u32>();
|
async_channel::unbounded::<u32>();
|
||||||
let transaction_percent_sender = transaction_percent_sender.clone();
|
let transaction_percent_sender = transaction_percent_sender.clone();
|
||||||
@ -312,7 +326,7 @@ pub fn run_flatpak_ref_install_transaction(flatpak_retry_signal_action: &gio::Si
|
|||||||
async_channel::unbounded::<String>();
|
async_channel::unbounded::<String>();
|
||||||
let transaction_status_sender = transaction_status_sender.clone();
|
let transaction_status_sender = transaction_status_sender.clone();
|
||||||
|
|
||||||
let flatref_path_clone0 = flatref_path.clone().to_owned();
|
let flatref_path_clone0 = flatref_path.to_owned();
|
||||||
|
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
let cancellable_no = libflatpak::gio::Cancellable::NONE;
|
let cancellable_no = libflatpak::gio::Cancellable::NONE;
|
||||||
@ -321,30 +335,63 @@ pub fn run_flatpak_ref_install_transaction(flatpak_retry_signal_action: &gio::Si
|
|||||||
let transaction_percent_sender0 = transaction_percent_sender.clone();
|
let transaction_percent_sender0 = transaction_percent_sender.clone();
|
||||||
|
|
||||||
let transaction_run_closure =
|
let transaction_run_closure =
|
||||||
move |transaction: &libflatpak::Transaction,
|
move |_: &libflatpak::Transaction,
|
||||||
transaction_operation: &libflatpak::TransactionOperation,
|
transaction_operation: &libflatpak::TransactionOperation,
|
||||||
transaction_progress: &libflatpak::TransactionProgress| {
|
transaction_progress: &libflatpak::TransactionProgress| {
|
||||||
let transaction_status_sender = transaction_status_sender0.clone();
|
let transaction_status_sender = transaction_status_sender0.clone();
|
||||||
let transaction_percent_sender = transaction_percent_sender0.clone();
|
let transaction_percent_sender = transaction_percent_sender0.clone();
|
||||||
transaction_progress.connect_changed(clone!(@strong transaction_progress, @strong transaction_operation => move |_| {
|
transaction_progress.connect_changed(clone!(
|
||||||
let status_message = format!("{}: {}\n{}: {}\n{}: {}/{}\n{}: {}", t!("flatpak_ref"), transaction_operation.get_ref().unwrap_or(libflatpak::glib::GString::from_string_unchecked("Unknown".to_owned())), t!("flatpak_status") ,transaction_progress.status().unwrap_or(libflatpak::glib::GString::from_string_unchecked("Unknown".to_owned())), t!("flatpak_transaction_bytes_transferred"), convert(transaction_progress.bytes_transferred() as f64), convert(transaction_operation.download_size() as f64), t!("flatpak_transaction_installed_size"), convert(transaction_operation.installed_size() as f64));
|
#[strong]
|
||||||
transaction_status_sender.send_blocking(status_message).expect("transaction_status_receiver closed!");
|
transaction_progress,
|
||||||
transaction_percent_sender.send_blocking(transaction_progress.progress().try_into().unwrap_or(0)).expect("transaction_percent_receiver closed!");
|
#[strong]
|
||||||
}));
|
transaction_operation,
|
||||||
|
move |_| {
|
||||||
|
let status_message = format!(
|
||||||
|
"{}: {}\n{}: {}\n{}: {}/{}\n{}: {}",
|
||||||
|
t!("flatpak_ref"),
|
||||||
|
transaction_operation.get_ref().unwrap_or(
|
||||||
|
libflatpak::glib::GString::from_string_unchecked(
|
||||||
|
"Unknown".to_owned()
|
||||||
|
)
|
||||||
|
),
|
||||||
|
t!("flatpak_status"),
|
||||||
|
transaction_progress.status().unwrap_or(
|
||||||
|
libflatpak::glib::GString::from_string_unchecked(
|
||||||
|
"Unknown".to_owned()
|
||||||
|
)
|
||||||
|
),
|
||||||
|
t!("flatpak_transaction_bytes_transferred"),
|
||||||
|
convert(transaction_progress.bytes_transferred() as f64),
|
||||||
|
convert(transaction_operation.download_size() as f64),
|
||||||
|
t!("flatpak_transaction_installed_size"),
|
||||||
|
convert(transaction_operation.installed_size() as f64)
|
||||||
|
);
|
||||||
|
transaction_status_sender
|
||||||
|
.send_blocking(status_message)
|
||||||
|
.expect("transaction_status_receiver closed!");
|
||||||
|
transaction_percent_sender
|
||||||
|
.send_blocking(transaction_progress.progress().try_into().unwrap_or(0))
|
||||||
|
.expect("transaction_percent_receiver closed!");
|
||||||
|
}
|
||||||
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
let (flatpak_installation, flatpak_transaction) = match is_system {
|
let flatpak_transaction = match is_system {
|
||||||
true => {
|
true => {
|
||||||
let installation = libflatpak::Installation::new_system(cancellable_no).unwrap();
|
let installation = libflatpak::Installation::new_system(cancellable_no).unwrap();
|
||||||
let transaction = libflatpak::Transaction::for_installation(&installation, cancellable_no).unwrap();
|
let transaction =
|
||||||
(installation, transaction)
|
libflatpak::Transaction::for_installation(&installation, cancellable_no)
|
||||||
|
.unwrap();
|
||||||
|
transaction
|
||||||
}
|
}
|
||||||
false => {
|
false => {
|
||||||
let installation = libflatpak::Installation::new_user(cancellable_no).unwrap();
|
let installation = libflatpak::Installation::new_user(cancellable_no).unwrap();
|
||||||
let transaction = libflatpak::Transaction::for_installation(&installation, cancellable_no).unwrap();
|
let transaction =
|
||||||
(installation, transaction)
|
libflatpak::Transaction::for_installation(&installation, cancellable_no)
|
||||||
|
.unwrap();
|
||||||
|
transaction
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -419,8 +466,7 @@ pub fn run_flatpak_ref_install_transaction(flatpak_retry_signal_action: &gio::Si
|
|||||||
flatpak_transaction_dialog_child_box.append(&flatpak_transaction_dialog_spinner);
|
flatpak_transaction_dialog_child_box.append(&flatpak_transaction_dialog_spinner);
|
||||||
flatpak_transaction_dialog_child_box.append(&flatpak_transaction_dialog_progress_bar);
|
flatpak_transaction_dialog_child_box.append(&flatpak_transaction_dialog_progress_bar);
|
||||||
|
|
||||||
let flatpak_transaction_dialog =
|
let flatpak_transaction_dialog = adw::MessageDialog::builder()
|
||||||
adw::MessageDialog::builder()
|
|
||||||
.transient_for(&window)
|
.transient_for(&window)
|
||||||
.extra_child(&flatpak_transaction_dialog_child_box)
|
.extra_child(&flatpak_transaction_dialog_child_box)
|
||||||
.heading(t!("flatpak_transaction_dialog_heading"))
|
.heading(t!("flatpak_transaction_dialog_heading"))
|
||||||
@ -556,13 +602,27 @@ fn get_data_from_filepath(filepath: &str) -> Result<libflatpak::glib::Bytes, std
|
|||||||
Ok(glib_bytes)
|
Ok(glib_bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_flatpakref_remote(reload_action: &gio::SimpleAction, remote_name: &str, remote_url: &str, is_system: bool) {
|
fn add_flatpakref_remote(
|
||||||
|
reload_action: &gio::SimpleAction,
|
||||||
|
remote_name: &str,
|
||||||
|
remote_url: &str,
|
||||||
|
is_system: bool,
|
||||||
|
) {
|
||||||
let flatpak_installation = match is_system {
|
let flatpak_installation = match is_system {
|
||||||
true => "--system",
|
true => "--system",
|
||||||
false => "--user"
|
false => "--user",
|
||||||
};
|
};
|
||||||
|
|
||||||
match duct::cmd!("flatpak", "remote-add", "--if-not-exists", &flatpak_installation, remote_name, remote_url).run() {
|
match duct::cmd!(
|
||||||
|
"flatpak",
|
||||||
|
"remote-add",
|
||||||
|
"--if-not-exists",
|
||||||
|
&flatpak_installation,
|
||||||
|
remote_name,
|
||||||
|
remote_url
|
||||||
|
)
|
||||||
|
.run()
|
||||||
|
{
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
reload_action.activate(None);
|
reload_action.activate(None);
|
||||||
}
|
}
|
||||||
|
@ -1,34 +1,19 @@
|
|||||||
use crate::apt_package_row::AptPackageRow;
|
|
||||||
use add_dialog::add_dialog_fn;
|
|
||||||
use adw::gio::SimpleAction;
|
use adw::gio::SimpleAction;
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use apt_deb822_tools::Deb822Repository;
|
use gtk::glib::{clone, BoxedAnyObject};
|
||||||
use gtk::glib::{property::PropertyGet, clone, BoxedAnyObject};
|
|
||||||
use gtk::*;
|
|
||||||
use std::cell::Ref;
|
|
||||||
use std::ops::Deref;
|
|
||||||
use pika_unixsocket_tools::pika_unixsocket_tools::*;
|
|
||||||
use rust_apt::cache::*;
|
|
||||||
use rust_apt::new_cache;
|
|
||||||
use rust_apt::records::RecordField;
|
|
||||||
use std::cell::RefCell;
|
|
||||||
use std::process::Command;
|
|
||||||
use std::rc::Rc;
|
|
||||||
use std::thread;
|
|
||||||
use tokio::runtime::Runtime;
|
|
||||||
use crate::flatpak_ref_row::FlatpakRefRow;
|
|
||||||
use adw::prelude::*;
|
|
||||||
use gtk::glib::*;
|
|
||||||
use gtk::*;
|
use gtk::*;
|
||||||
use libflatpak::prelude::*;
|
use libflatpak::prelude::*;
|
||||||
use libflatpak::InstalledRef;
|
use std::cell::Ref;
|
||||||
|
use std::cell::RefCell;
|
||||||
|
use std::ops::Deref;
|
||||||
|
use std::rc::Rc;
|
||||||
|
|
||||||
mod add_dialog;
|
mod add_dialog;
|
||||||
mod install_ref_dialog;
|
mod install_ref_dialog;
|
||||||
|
|
||||||
enum FlatpakRemote {
|
enum FlatpakRemote {
|
||||||
System(libflatpak::Remote),
|
System(libflatpak::Remote),
|
||||||
User(libflatpak::Remote)
|
User(libflatpak::Remote),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn flatpak_manage_page(
|
pub fn flatpak_manage_page(
|
||||||
@ -69,7 +54,8 @@ pub fn flatpak_manage_page(
|
|||||||
.margin_end(15)
|
.margin_end(15)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let flatpak_remotes_selection_model_rc: Rc<RefCell<gtk::SingleSelection>> = Rc::new(RefCell::default());
|
let flatpak_remotes_selection_model_rc: Rc<RefCell<gtk::SingleSelection>> =
|
||||||
|
Rc::new(RefCell::default());
|
||||||
|
|
||||||
let flatpak_remotes_selection_model_rc_clone0 = Rc::clone(&flatpak_remotes_selection_model_rc);
|
let flatpak_remotes_selection_model_rc_clone0 = Rc::clone(&flatpak_remotes_selection_model_rc);
|
||||||
|
|
||||||
@ -83,35 +69,44 @@ pub fn flatpak_manage_page(
|
|||||||
#[strong]
|
#[strong]
|
||||||
cancellable_no,
|
cancellable_no,
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
|
|
||||||
let flatpak_system_installation =
|
let flatpak_system_installation =
|
||||||
libflatpak::Installation::new_system(cancellable_no).unwrap();
|
libflatpak::Installation::new_system(cancellable_no).unwrap();
|
||||||
let flatpak_user_installation =
|
let flatpak_user_installation =
|
||||||
libflatpak::Installation::new_user(cancellable_no).unwrap();
|
libflatpak::Installation::new_user(cancellable_no).unwrap();
|
||||||
|
|
||||||
let system_remotes = match libflatpak::Installation::list_remotes(&flatpak_system_installation, cancellable_no) {
|
let system_remotes = match libflatpak::Installation::list_remotes(
|
||||||
|
&flatpak_system_installation,
|
||||||
|
cancellable_no,
|
||||||
|
) {
|
||||||
Ok(t) => t,
|
Ok(t) => t,
|
||||||
Err(_) => Vec::new()
|
Err(_) => Vec::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let user_remotes = match libflatpak::Installation::list_remotes(&flatpak_user_installation, cancellable_no) {
|
let user_remotes = match libflatpak::Installation::list_remotes(
|
||||||
|
&flatpak_user_installation,
|
||||||
|
cancellable_no,
|
||||||
|
) {
|
||||||
Ok(t) => t,
|
Ok(t) => t,
|
||||||
Err(_) => Vec::new()
|
Err(_) => Vec::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let flatpak_remotes_list_store = gio::ListStore::new::<BoxedAnyObject>();
|
let flatpak_remotes_list_store = gio::ListStore::new::<BoxedAnyObject>();
|
||||||
|
|
||||||
for remote in system_remotes {
|
for remote in system_remotes {
|
||||||
flatpak_remotes_list_store.append(&BoxedAnyObject::new(FlatpakRemote::System(remote)));
|
flatpak_remotes_list_store
|
||||||
};
|
.append(&BoxedAnyObject::new(FlatpakRemote::System(remote)));
|
||||||
|
}
|
||||||
|
|
||||||
for remote in user_remotes {
|
for remote in user_remotes {
|
||||||
flatpak_remotes_list_store.append(&BoxedAnyObject::new(FlatpakRemote::User(remote)));
|
flatpak_remotes_list_store
|
||||||
};
|
.append(&BoxedAnyObject::new(FlatpakRemote::User(remote)));
|
||||||
|
}
|
||||||
|
|
||||||
let flatpak_remotes_selection_model = SingleSelection::new(Some(flatpak_remotes_list_store));
|
let flatpak_remotes_selection_model =
|
||||||
|
SingleSelection::new(Some(flatpak_remotes_list_store));
|
||||||
|
|
||||||
(*flatpak_remotes_selection_model_rc_clone0.borrow_mut() = flatpak_remotes_selection_model.clone());
|
(*flatpak_remotes_selection_model_rc_clone0.borrow_mut() =
|
||||||
|
flatpak_remotes_selection_model.clone());
|
||||||
|
|
||||||
let flatpak_remotes_columnview = ColumnView::builder()
|
let flatpak_remotes_columnview = ColumnView::builder()
|
||||||
.vexpand(true)
|
.vexpand(true)
|
||||||
@ -124,9 +119,7 @@ pub fn flatpak_manage_page(
|
|||||||
|
|
||||||
flatpak_remotes_columnview_factory0.connect_setup(move |_factory, item| {
|
flatpak_remotes_columnview_factory0.connect_setup(move |_factory, item| {
|
||||||
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
|
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
|
||||||
let row = Label::builder()
|
let row = Label::builder().halign(Align::Start).build();
|
||||||
.halign(Align::Start)
|
|
||||||
.build();
|
|
||||||
item.set_child(Some(&row));
|
item.set_child(Some(&row));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -136,12 +129,8 @@ pub fn flatpak_manage_page(
|
|||||||
let entry: BoxedAnyObject = item.item().and_downcast::<BoxedAnyObject>().unwrap();
|
let entry: BoxedAnyObject = item.item().and_downcast::<BoxedAnyObject>().unwrap();
|
||||||
let entry_borrow = entry.borrow::<FlatpakRemote>();
|
let entry_borrow = entry.borrow::<FlatpakRemote>();
|
||||||
let remote_name = match entry_borrow.deref() {
|
let remote_name = match entry_borrow.deref() {
|
||||||
FlatpakRemote::System(remote) => {
|
FlatpakRemote::System(remote) => remote.name().unwrap_or_default(),
|
||||||
remote.name().unwrap_or_default()
|
FlatpakRemote::User(remote) => remote.name().unwrap_or_default(),
|
||||||
}
|
|
||||||
FlatpakRemote::User(remote) => {
|
|
||||||
remote.name().unwrap_or_default()
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
child.set_label(&remote_name);
|
child.set_label(&remote_name);
|
||||||
});
|
});
|
||||||
@ -157,9 +146,7 @@ pub fn flatpak_manage_page(
|
|||||||
|
|
||||||
flatpak_remotes_columnview_factory1.connect_setup(move |_factory, item| {
|
flatpak_remotes_columnview_factory1.connect_setup(move |_factory, item| {
|
||||||
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
|
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
|
||||||
let row = Label::builder()
|
let row = Label::builder().halign(Align::Start).build();
|
||||||
.halign(Align::Start)
|
|
||||||
.build();
|
|
||||||
item.set_child(Some(&row));
|
item.set_child(Some(&row));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -169,12 +156,8 @@ pub fn flatpak_manage_page(
|
|||||||
let entry: BoxedAnyObject = item.item().and_downcast::<BoxedAnyObject>().unwrap();
|
let entry: BoxedAnyObject = item.item().and_downcast::<BoxedAnyObject>().unwrap();
|
||||||
let entry_borrow = entry.borrow::<FlatpakRemote>();
|
let entry_borrow = entry.borrow::<FlatpakRemote>();
|
||||||
let remote_title = match entry_borrow.deref() {
|
let remote_title = match entry_borrow.deref() {
|
||||||
FlatpakRemote::System(remote) => {
|
FlatpakRemote::System(remote) => remote.title().unwrap_or_default(),
|
||||||
remote.title().unwrap_or_default()
|
FlatpakRemote::User(remote) => remote.title().unwrap_or_default(),
|
||||||
}
|
|
||||||
FlatpakRemote::User(remote) => {
|
|
||||||
remote.title().unwrap_or_default()
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
child.set_label(&remote_title);
|
child.set_label(&remote_title);
|
||||||
});
|
});
|
||||||
@ -190,9 +173,7 @@ pub fn flatpak_manage_page(
|
|||||||
|
|
||||||
flatpak_remotes_columnview_factory2.connect_setup(move |_factory, item| {
|
flatpak_remotes_columnview_factory2.connect_setup(move |_factory, item| {
|
||||||
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
|
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
|
||||||
let row = Label::builder()
|
let row = Label::builder().halign(Align::Start).build();
|
||||||
.halign(Align::Start)
|
|
||||||
.build();
|
|
||||||
item.set_child(Some(&row));
|
item.set_child(Some(&row));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -202,12 +183,8 @@ pub fn flatpak_manage_page(
|
|||||||
let entry: BoxedAnyObject = item.item().and_downcast::<BoxedAnyObject>().unwrap();
|
let entry: BoxedAnyObject = item.item().and_downcast::<BoxedAnyObject>().unwrap();
|
||||||
let entry_borrow = entry.borrow::<FlatpakRemote>();
|
let entry_borrow = entry.borrow::<FlatpakRemote>();
|
||||||
let remote_url = match entry_borrow.deref() {
|
let remote_url = match entry_borrow.deref() {
|
||||||
FlatpakRemote::System(remote) => {
|
FlatpakRemote::System(remote) => remote.url().unwrap_or_default(),
|
||||||
remote.url().unwrap_or_default()
|
FlatpakRemote::User(remote) => remote.url().unwrap_or_default(),
|
||||||
}
|
|
||||||
FlatpakRemote::User(remote) => {
|
|
||||||
remote.url().unwrap_or_default()
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
child.set_label(&remote_url);
|
child.set_label(&remote_url);
|
||||||
});
|
});
|
||||||
@ -224,9 +201,7 @@ pub fn flatpak_manage_page(
|
|||||||
|
|
||||||
flatpak_remotes_columnview_factory3.connect_setup(move |_factory, item| {
|
flatpak_remotes_columnview_factory3.connect_setup(move |_factory, item| {
|
||||||
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
|
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
|
||||||
let row = Label::builder()
|
let row = Label::builder().halign(Align::Start).build();
|
||||||
.halign(Align::Start)
|
|
||||||
.build();
|
|
||||||
item.set_child(Some(&row));
|
item.set_child(Some(&row));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -236,10 +211,10 @@ pub fn flatpak_manage_page(
|
|||||||
let entry: BoxedAnyObject = item.item().and_downcast::<BoxedAnyObject>().unwrap();
|
let entry: BoxedAnyObject = item.item().and_downcast::<BoxedAnyObject>().unwrap();
|
||||||
let entry_borrow = entry.borrow::<FlatpakRemote>();
|
let entry_borrow = entry.borrow::<FlatpakRemote>();
|
||||||
match entry_borrow.deref() {
|
match entry_borrow.deref() {
|
||||||
FlatpakRemote::System(remote) => {
|
FlatpakRemote::System(_) => {
|
||||||
child.set_label(&t!("flatpak_remotes_columnview_system").to_string());
|
child.set_label(&t!("flatpak_remotes_columnview_system").to_string());
|
||||||
}
|
}
|
||||||
FlatpakRemote::User(remote) => {
|
FlatpakRemote::User(_) => {
|
||||||
child.set_label(&t!("flatpak_remotes_columnview_user").to_string());
|
child.set_label(&t!("flatpak_remotes_columnview_user").to_string());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -256,7 +231,8 @@ pub fn flatpak_manage_page(
|
|||||||
flatpak_remotes_columnview.append_column(&flatpak_remotes_columnview_col2);
|
flatpak_remotes_columnview.append_column(&flatpak_remotes_columnview_col2);
|
||||||
flatpak_remotes_columnview.append_column(&flatpak_remotes_columnview_col3);
|
flatpak_remotes_columnview.append_column(&flatpak_remotes_columnview_col3);
|
||||||
flatpak_remotes_columnview_bin_clone0.set_child(Some(&flatpak_remotes_columnview));
|
flatpak_remotes_columnview_bin_clone0.set_child(Some(&flatpak_remotes_columnview));
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
|
|
||||||
retry_signal_action.activate(None);
|
retry_signal_action.activate(None);
|
||||||
|
|
||||||
@ -310,17 +286,14 @@ pub fn flatpak_manage_page(
|
|||||||
retry_signal_action,
|
retry_signal_action,
|
||||||
#[strong]
|
#[strong]
|
||||||
flatpak_retry_signal_action,
|
flatpak_retry_signal_action,
|
||||||
move
|
move |_| {
|
||||||
|_|
|
|
||||||
{
|
|
||||||
add_dialog::add_dialog_fn(
|
add_dialog::add_dialog_fn(
|
||||||
window.clone(),
|
window.clone(),
|
||||||
&retry_signal_action,
|
&retry_signal_action,
|
||||||
&flatpak_retry_signal_action,
|
&flatpak_retry_signal_action,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
)
|
));
|
||||||
);
|
|
||||||
|
|
||||||
flatpak_flatref_install_button.connect_clicked(clone!(
|
flatpak_flatref_install_button.connect_clicked(clone!(
|
||||||
#[strong]
|
#[strong]
|
||||||
@ -331,18 +304,15 @@ pub fn flatpak_manage_page(
|
|||||||
flatpak_retry_signal_action,
|
flatpak_retry_signal_action,
|
||||||
#[strong]
|
#[strong]
|
||||||
flatpak_ref_entry_action,
|
flatpak_ref_entry_action,
|
||||||
move
|
move |_| {
|
||||||
|_|
|
|
||||||
{
|
|
||||||
install_ref_dialog::install_ref_dialog_fn(
|
install_ref_dialog::install_ref_dialog_fn(
|
||||||
window.clone(),
|
window.clone(),
|
||||||
&retry_signal_action,
|
&retry_signal_action,
|
||||||
&flatpak_retry_signal_action,
|
&flatpak_retry_signal_action,
|
||||||
&flatpak_ref_entry_action
|
&flatpak_ref_entry_action,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
)
|
));
|
||||||
);
|
|
||||||
|
|
||||||
flatpak_remote_remove_button.connect_clicked(clone!(
|
flatpak_remote_remove_button.connect_clicked(clone!(
|
||||||
#[strong]
|
#[strong]
|
||||||
@ -357,7 +327,7 @@ pub fn flatpak_manage_page(
|
|||||||
|_|
|
|_|
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
let (mut installation, mut remote_name, mut cmd_installation): (libflatpak::Installation, libflatpak::glib::GString, String);
|
let (installation, remote_name, cmd_installation): (libflatpak::Installation, libflatpak::glib::GString, String);
|
||||||
{
|
{
|
||||||
let flatpak_remotes_selection_model = flatpak_remotes_selection_model_rc.borrow();
|
let flatpak_remotes_selection_model = flatpak_remotes_selection_model_rc.borrow();
|
||||||
let selection = flatpak_remotes_selection_model.selected_item().unwrap();
|
let selection = flatpak_remotes_selection_model.selected_item().unwrap();
|
||||||
|
@ -96,12 +96,12 @@ impl ObjectImpl for FlatpakRefRow {
|
|||||||
let flatref_ref_name = obj.flatref_ref_name();
|
let flatref_ref_name = obj.flatref_ref_name();
|
||||||
let flatref_summary = obj.flatref_summary();
|
let flatref_summary = obj.flatref_summary();
|
||||||
let flatref_remote_name = obj.flatref_remote_name();
|
let flatref_remote_name = obj.flatref_remote_name();
|
||||||
let flatref_installed_size_installed = obj.flatref_installed_size_installed();
|
//let flatref_installed_size_installed = obj.flatref_installed_size_installed();
|
||||||
let flatref_installed_size_remote = obj.flatref_installed_size_remote();
|
let flatref_installed_size_remote = obj.flatref_installed_size_remote();
|
||||||
let flatref_download_size = obj.flatref_download_size();
|
let flatref_download_size = obj.flatref_download_size();
|
||||||
let flatref_ref_format = obj.flatref_download_size();
|
//let flatref_ref_format = obj.flatref_download_size();
|
||||||
let flatref_is_system = obj.flatref_is_system();
|
let flatref_is_system = obj.flatref_is_system();
|
||||||
let flatref_marked = obj.flatref_marked();
|
//let flatref_marked = obj.flatref_marked();
|
||||||
//
|
//
|
||||||
create_prefix_content(
|
create_prefix_content(
|
||||||
&prefix_box,
|
&prefix_box,
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
mod process;
|
mod process;
|
||||||
|
|
||||||
use crate::apt_package_row::AptPackageRow;
|
|
||||||
use crate::flatpak_ref_row::FlatpakRefRow;
|
use crate::flatpak_ref_row::FlatpakRefRow;
|
||||||
use adw::gio::SimpleAction;
|
use adw::gio::SimpleAction;
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use gtk::glib::*;
|
use gtk::glib::*;
|
||||||
use gtk::*;
|
use gtk::*;
|
||||||
use libflatpak::prelude::*;
|
use libflatpak::prelude::*;
|
||||||
use libflatpak::InstalledRef;
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::process::Command;
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
@ -42,7 +39,6 @@ pub fn flatpak_update_page(
|
|||||||
let (appstream_sync_status_sender, appstream_sync_status_receiver) =
|
let (appstream_sync_status_sender, appstream_sync_status_receiver) =
|
||||||
async_channel::unbounded::<String>();
|
async_channel::unbounded::<String>();
|
||||||
let appstream_sync_status_sender = appstream_sync_status_sender.clone();
|
let appstream_sync_status_sender = appstream_sync_status_sender.clone();
|
||||||
let appstream_sync_status_sender_clone0 = appstream_sync_status_sender.clone();
|
|
||||||
|
|
||||||
let system_refs_for_upgrade_vec: Rc<RefCell<Vec<FlatpakRefRow>>> =
|
let system_refs_for_upgrade_vec: Rc<RefCell<Vec<FlatpakRefRow>>> =
|
||||||
Rc::new(RefCell::new(Vec::new()));
|
Rc::new(RefCell::new(Vec::new()));
|
||||||
@ -551,8 +547,7 @@ pub fn flatpak_update_page(
|
|||||||
|
|
||||||
packages_boxedlist.append(&flatpak_row);
|
packages_boxedlist.append(&flatpak_row);
|
||||||
(*flatpak_update_count.borrow_mut() += 1);
|
(*flatpak_update_count.borrow_mut() += 1);
|
||||||
if flatref_struct.is_system && flatref_struct.is_last
|
if flatref_struct.is_system && flatref_struct.is_last {
|
||||||
{
|
|
||||||
system_last_triggered = true
|
system_last_triggered = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -705,8 +700,7 @@ pub fn flatpak_update_page(
|
|||||||
);
|
);
|
||||||
packages_boxedlist.append(&flatpak_row);
|
packages_boxedlist.append(&flatpak_row);
|
||||||
(*flatpak_update_count.borrow_mut() += 1);
|
(*flatpak_update_count.borrow_mut() += 1);
|
||||||
if !flatref_struct.is_system && flatref_struct.is_last
|
if !flatref_struct.is_system && flatref_struct.is_last {
|
||||||
{
|
|
||||||
user_last_triggered = true
|
user_last_triggered = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -715,7 +709,9 @@ pub fn flatpak_update_page(
|
|||||||
}
|
}
|
||||||
if user_last_triggered && system_last_triggered {
|
if user_last_triggered && system_last_triggered {
|
||||||
packages_boxedlist.set_sensitive(true);
|
packages_boxedlist.set_sensitive(true);
|
||||||
update_sys_tray.activate(Some(&glib::Variant::array_from_fixed_array(&[*apt_update_count.borrow(),*flatpak_update_count.borrow()])));
|
update_sys_tray.activate(Some(&glib::Variant::array_from_fixed_array(
|
||||||
|
&[*apt_update_count.borrow(), *flatpak_update_count.borrow()],
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
flatpak_update_dialog.close();
|
flatpak_update_dialog.close();
|
||||||
}
|
}
|
||||||
@ -733,7 +729,8 @@ pub fn flatpak_update_page(
|
|||||||
));
|
));
|
||||||
flatpak_update_dialog
|
flatpak_update_dialog
|
||||||
.set_response_enabled("flatpak_update_dialog_retry", true);
|
.set_response_enabled("flatpak_update_dialog_retry", true);
|
||||||
flatpak_update_dialog.set_response_enabled("flatpak_update_dialog_ignore", true);
|
flatpak_update_dialog
|
||||||
|
.set_response_enabled("flatpak_update_dialog_ignore", true);
|
||||||
}
|
}
|
||||||
_ => flatpak_update_dialog.set_body(&state),
|
_ => flatpak_update_dialog.set_body(&state),
|
||||||
}
|
}
|
||||||
|
@ -4,19 +4,12 @@ use adw::prelude::*;
|
|||||||
use gtk::glib::*;
|
use gtk::glib::*;
|
||||||
use gtk::*;
|
use gtk::*;
|
||||||
use libflatpak::prelude::*;
|
use libflatpak::prelude::*;
|
||||||
use libflatpak::Transaction;
|
|
||||||
use pretty_bytes::converter::convert;
|
use pretty_bytes::converter::convert;
|
||||||
use serde::Serialize;
|
|
||||||
use serde_json::Value;
|
|
||||||
use std::cell::RefCell;
|
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::rc::Rc;
|
|
||||||
use std::sync::{Arc, Mutex};
|
|
||||||
use std::{fs, thread};
|
use std::{fs, thread};
|
||||||
use tokio::runtime::Runtime;
|
|
||||||
|
|
||||||
struct FlatpakChangesInfo {
|
struct FlatpakChangesInfo {
|
||||||
system_flatref_count: u64,
|
system_flatref_count: u64,
|
||||||
@ -58,7 +51,6 @@ pub fn flatpak_process_update(
|
|||||||
window: adw::ApplicationWindow,
|
window: adw::ApplicationWindow,
|
||||||
retry_signal_action: &SimpleAction,
|
retry_signal_action: &SimpleAction,
|
||||||
) {
|
) {
|
||||||
let cancellable = libflatpak::gio::Cancellable::NONE;
|
|
||||||
// Emulate Flatpak Full Upgrade to get transaction info
|
// Emulate Flatpak Full Upgrade to get transaction info
|
||||||
let mut flatpak_changes_struct = FlatpakChangesInfo {
|
let mut flatpak_changes_struct = FlatpakChangesInfo {
|
||||||
system_flatref_count: 0,
|
system_flatref_count: 0,
|
||||||
@ -248,16 +240,45 @@ fn flatpak_run_transactions(
|
|||||||
let transaction_percent_sender0 = transaction_percent_sender.clone();
|
let transaction_percent_sender0 = transaction_percent_sender.clone();
|
||||||
|
|
||||||
let transaction_run_closure =
|
let transaction_run_closure =
|
||||||
move |transaction: &libflatpak::Transaction,
|
move |_: &libflatpak::Transaction,
|
||||||
transaction_operation: &libflatpak::TransactionOperation,
|
transaction_operation: &libflatpak::TransactionOperation,
|
||||||
transaction_progress: &libflatpak::TransactionProgress| {
|
transaction_progress: &libflatpak::TransactionProgress| {
|
||||||
let transaction_status_sender = transaction_status_sender0.clone();
|
let transaction_status_sender = transaction_status_sender0.clone();
|
||||||
let transaction_percent_sender = transaction_percent_sender0.clone();
|
let transaction_percent_sender = transaction_percent_sender0.clone();
|
||||||
transaction_progress.connect_changed(clone!(@strong transaction_progress, @strong transaction_operation => move |_| {
|
transaction_progress.connect_changed(clone!(
|
||||||
let status_message = format!("{}: {}\n{}: {}\n{}: {}/{}\n{}: {}", t!("flatpak_ref"), transaction_operation.get_ref().unwrap_or(libflatpak::glib::GString::from_string_unchecked("Unknown".to_owned())), t!("flatpak_status") ,transaction_progress.status().unwrap_or(libflatpak::glib::GString::from_string_unchecked("Unknown".to_owned())), t!("flatpak_transaction_bytes_transferred"), convert(transaction_progress.bytes_transferred() as f64), convert(transaction_operation.download_size() as f64), t!("flatpak_transaction_installed_size"), convert(transaction_operation.installed_size() as f64));
|
#[strong]
|
||||||
transaction_status_sender.send_blocking(status_message).expect("transaction_status_receiver closed!");
|
transaction_progress,
|
||||||
transaction_percent_sender.send_blocking(transaction_progress.progress().try_into().unwrap_or(0)).expect("transaction_percent_receiver closed!");
|
#[strong]
|
||||||
}));
|
transaction_operation,
|
||||||
|
move |_| {
|
||||||
|
let status_message = format!(
|
||||||
|
"{}: {}\n{}: {}\n{}: {}/{}\n{}: {}",
|
||||||
|
t!("flatpak_ref"),
|
||||||
|
transaction_operation.get_ref().unwrap_or(
|
||||||
|
libflatpak::glib::GString::from_string_unchecked(
|
||||||
|
"Unknown".to_owned()
|
||||||
|
)
|
||||||
|
),
|
||||||
|
t!("flatpak_status"),
|
||||||
|
transaction_progress.status().unwrap_or(
|
||||||
|
libflatpak::glib::GString::from_string_unchecked(
|
||||||
|
"Unknown".to_owned()
|
||||||
|
)
|
||||||
|
),
|
||||||
|
t!("flatpak_transaction_bytes_transferred"),
|
||||||
|
convert(transaction_progress.bytes_transferred() as f64),
|
||||||
|
convert(transaction_operation.download_size() as f64),
|
||||||
|
t!("flatpak_transaction_installed_size"),
|
||||||
|
convert(transaction_operation.installed_size() as f64)
|
||||||
|
);
|
||||||
|
transaction_status_sender
|
||||||
|
.send_blocking(status_message)
|
||||||
|
.expect("transaction_status_receiver closed!");
|
||||||
|
transaction_percent_sender
|
||||||
|
.send_blocking(transaction_progress.progress().try_into().unwrap_or(0))
|
||||||
|
.expect("transaction_percent_receiver closed!");
|
||||||
|
}
|
||||||
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
|
mod apt_manage_page;
|
||||||
mod apt_package_row;
|
mod apt_package_row;
|
||||||
mod apt_update_page;
|
mod apt_update_page;
|
||||||
mod apt_manage_page;
|
|
||||||
mod build_ui;
|
mod build_ui;
|
||||||
mod config;
|
mod config;
|
||||||
|
mod flatpak_manage_page;
|
||||||
mod flatpak_ref_row;
|
mod flatpak_ref_row;
|
||||||
mod flatpak_update_page;
|
mod flatpak_update_page;
|
||||||
mod flatpak_manage_page;
|
|
||||||
|
|
||||||
use crate::config::APP_ID;
|
use crate::config::APP_ID;
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
@ -33,7 +33,8 @@ fn main() {
|
|||||||
None => panic!("$LANG is not set"),
|
None => panic!("$LANG is not set"),
|
||||||
};
|
};
|
||||||
rust_i18n::set_locale(¤t_locale);
|
rust_i18n::set_locale(¤t_locale);
|
||||||
let application = adw::Application::new(Some(APP_ID), gio::ApplicationFlags::HANDLES_COMMAND_LINE);
|
let application =
|
||||||
|
adw::Application::new(Some(APP_ID), gio::ApplicationFlags::HANDLES_COMMAND_LINE);
|
||||||
application.connect_startup(|app| {
|
application.connect_startup(|app| {
|
||||||
// The CSS "magic" happens here.
|
// The CSS "magic" happens here.
|
||||||
let provider = CssProvider::new();
|
let provider = CssProvider::new();
|
||||||
|
Loading…
Reference in New Issue
Block a user