fix flatpak add
This commit is contained in:
parent
ed72fab6d1
commit
ac17a93abf
@ -127,9 +127,10 @@
|
|||||||
"apt_src_create_error_dialog_ok_label": "OK",
|
"apt_src_create_error_dialog_ok_label": "OK",
|
||||||
"flatpak_manage_page_title": "Flatpak Settings",
|
"flatpak_manage_page_title": "Flatpak Settings",
|
||||||
"system_mirror_save_button_tooltip_text": "Save Changes",
|
"system_mirror_save_button_tooltip_text": "Save Changes",
|
||||||
"flatpak_remotes_columnview_col0_title": "Remote Title",
|
"flatpak_remotes_columnview_col0_title": "Remote Name",
|
||||||
"flatpak_remotes_columnview_col1_title": "Remote URL",
|
"flatpak_remotes_columnview_col1_title": "Remote Title",
|
||||||
"flatpak_remotes_columnview_col2_title": "Remote Installation Type",
|
"flatpak_remotes_columnview_col2_title": "Remote URL",
|
||||||
|
"flatpak_remotes_columnview_col3_title": "Remote Installation Type",
|
||||||
"flatpak_remotes_label": "Flatpak Remotes",
|
"flatpak_remotes_label": "Flatpak Remotes",
|
||||||
"flatpak_remotes_label1_label": "These Remotes Are for Software Provided via Flatpak. They May Present a Security Risk. Only Add Remotes That You Trust.",
|
"flatpak_remotes_label1_label": "These Remotes Are for Software Provided via Flatpak. They May Present a Security Risk. Only Add Remotes That You Trust.",
|
||||||
"flatpak_remotes_columnview_system": "System",
|
"flatpak_remotes_columnview_system": "System",
|
||||||
|
@ -164,9 +164,9 @@ pub fn add_dialog_fn(
|
|||||||
.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(),
|
||||||
};
|
};
|
||||||
@ -200,6 +200,28 @@ pub fn add_dialog_fn(
|
|||||||
&t!("flatpak_remote_add_error_dialog_ok_label").to_string(),
|
&t!("flatpak_remote_add_error_dialog_ok_label").to_string(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
let flatpak_installation = match flatpak_remote_system_togglebutton.is_active() {
|
||||||
|
true => "--system",
|
||||||
|
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() {
|
||||||
|
Ok(_) => {
|
||||||
|
reload_action_clone0.activate(None);
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
let flatpak_remote_add_error_dialog = adw::MessageDialog::builder()
|
||||||
|
.heading(t!("flatpak_remote_add_error_dialog_heading"))
|
||||||
|
.body(e.to_string())
|
||||||
|
.build();
|
||||||
|
flatpak_remote_add_error_dialog.add_response(
|
||||||
|
"flatpak_remote_add_error_dialog_ok",
|
||||||
|
&t!("flatpak_remote_add_error_dialog_ok_label").to_string(),
|
||||||
|
);
|
||||||
|
flatpak_remote_add_error_dialog.present();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
@ -207,6 +229,7 @@ pub fn add_dialog_fn(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
fn get_data_from_url(url: &str) -> Result<libflatpak::glib::Bytes, reqwest::Error> {
|
fn get_data_from_url(url: &str) -> Result<libflatpak::glib::Bytes, reqwest::Error> {
|
||||||
let data = reqwest::blocking::get(url)?
|
let data = reqwest::blocking::get(url)?
|
||||||
.text()
|
.text()
|
||||||
@ -216,4 +239,4 @@ fn get_data_from_url(url: &str) -> Result<libflatpak::glib::Bytes, reqwest::Erro
|
|||||||
|
|
||||||
let glib_bytes = libflatpak::glib::Bytes::from(bytes);
|
let glib_bytes = libflatpak::glib::Bytes::from(bytes);
|
||||||
Ok(glib_bytes)
|
Ok(glib_bytes)
|
||||||
}
|
}*/
|
@ -131,18 +131,18 @@ pub fn flatpak_manage_page(
|
|||||||
let child = item.child().and_downcast::<Label>().unwrap();
|
let child = item.child().and_downcast::<Label>().unwrap();
|
||||||
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_name = match entry_borrow.deref() {
|
||||||
FlatpakRemote::System(remote) => {
|
FlatpakRemote::System(remote) => {
|
||||||
remote.title().unwrap_or_default()
|
remote.name().unwrap_or_default()
|
||||||
}
|
}
|
||||||
FlatpakRemote::User(remote) => {
|
FlatpakRemote::User(remote) => {
|
||||||
remote.title().unwrap_or_default()
|
remote.name().unwrap_or_default()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
child.set_label(&remote_title);
|
child.set_label(&remote_name);
|
||||||
});
|
});
|
||||||
|
|
||||||
let flatpak_remotes_columnview_col0 = gtk::ColumnViewColumn::builder()
|
let flatpak_remotes_columnview_col1 = gtk::ColumnViewColumn::builder()
|
||||||
.title(t!("flatpak_remotes_columnview_col0_title"))
|
.title(t!("flatpak_remotes_columnview_col0_title"))
|
||||||
.factory(&flatpak_remotes_columnview_factory0)
|
.factory(&flatpak_remotes_columnview_factory0)
|
||||||
.build();
|
.build();
|
||||||
@ -164,21 +164,20 @@ pub fn flatpak_manage_page(
|
|||||||
let child = item.child().and_downcast::<Label>().unwrap();
|
let child = item.child().and_downcast::<Label>().unwrap();
|
||||||
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_title = match entry_borrow.deref() {
|
||||||
FlatpakRemote::System(remote) => {
|
FlatpakRemote::System(remote) => {
|
||||||
remote.url().unwrap_or_default()
|
remote.title().unwrap_or_default()
|
||||||
}
|
}
|
||||||
FlatpakRemote::User(remote) => {
|
FlatpakRemote::User(remote) => {
|
||||||
remote.url().unwrap_or_default()
|
remote.title().unwrap_or_default()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
child.set_label(&remote_url);
|
child.set_label(&remote_title);
|
||||||
});
|
});
|
||||||
|
|
||||||
let flatpak_remotes_columnview_col1 = gtk::ColumnViewColumn::builder()
|
let flatpak_remotes_columnview_col0 = gtk::ColumnViewColumn::builder()
|
||||||
.title(t!("flatpak_remotes_columnview_col1_title"))
|
.title(t!("flatpak_remotes_columnview_col1_title"))
|
||||||
.factory(&flatpak_remotes_columnview_factory1)
|
.factory(&flatpak_remotes_columnview_factory1)
|
||||||
.expand(true)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -194,6 +193,40 @@ pub fn flatpak_manage_page(
|
|||||||
});
|
});
|
||||||
|
|
||||||
flatpak_remotes_columnview_factory2.connect_bind(move |_factory, item| {
|
flatpak_remotes_columnview_factory2.connect_bind(move |_factory, item| {
|
||||||
|
let item: &ListItem = item.downcast_ref::<gtk::ListItem>().unwrap();
|
||||||
|
let child = item.child().and_downcast::<Label>().unwrap();
|
||||||
|
let entry: BoxedAnyObject = item.item().and_downcast::<BoxedAnyObject>().unwrap();
|
||||||
|
let entry_borrow = entry.borrow::<FlatpakRemote>();
|
||||||
|
let remote_url = match entry_borrow.deref() {
|
||||||
|
FlatpakRemote::System(remote) => {
|
||||||
|
remote.url().unwrap_or_default()
|
||||||
|
}
|
||||||
|
FlatpakRemote::User(remote) => {
|
||||||
|
remote.url().unwrap_or_default()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
child.set_label(&remote_url);
|
||||||
|
});
|
||||||
|
|
||||||
|
let flatpak_remotes_columnview_col2 = gtk::ColumnViewColumn::builder()
|
||||||
|
.title(t!("flatpak_remotes_columnview_col2_title"))
|
||||||
|
.factory(&flatpak_remotes_columnview_factory2)
|
||||||
|
.expand(true)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
let flatpak_remotes_columnview_factory3 = gtk::SignalListItemFactory::new();
|
||||||
|
|
||||||
|
flatpak_remotes_columnview_factory3.connect_setup(move |_factory, item| {
|
||||||
|
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
|
||||||
|
let row = Label::builder()
|
||||||
|
.halign(Align::Start)
|
||||||
|
.build();
|
||||||
|
item.set_child(Some(&row));
|
||||||
|
});
|
||||||
|
|
||||||
|
flatpak_remotes_columnview_factory3.connect_bind(move |_factory, item| {
|
||||||
let item: &ListItem = item.downcast_ref::<gtk::ListItem>().unwrap();
|
let item: &ListItem = item.downcast_ref::<gtk::ListItem>().unwrap();
|
||||||
let child = item.child().and_downcast::<Label>().unwrap();
|
let child = item.child().and_downcast::<Label>().unwrap();
|
||||||
let entry: BoxedAnyObject = item.item().and_downcast::<BoxedAnyObject>().unwrap();
|
let entry: BoxedAnyObject = item.item().and_downcast::<BoxedAnyObject>().unwrap();
|
||||||
@ -208,15 +241,16 @@ pub fn flatpak_manage_page(
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
let flatpak_remotes_columnview_col2 = gtk::ColumnViewColumn::builder()
|
let flatpak_remotes_columnview_col3 = gtk::ColumnViewColumn::builder()
|
||||||
.title(t!("flatpak_remotes_columnview_col2_title"))
|
.title(t!("flatpak_remotes_columnview_col3_title"))
|
||||||
.factory(&flatpak_remotes_columnview_factory2)
|
.factory(&flatpak_remotes_columnview_factory3)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
//
|
//
|
||||||
flatpak_remotes_columnview.append_column(&flatpak_remotes_columnview_col0);
|
flatpak_remotes_columnview.append_column(&flatpak_remotes_columnview_col0);
|
||||||
flatpak_remotes_columnview.append_column(&flatpak_remotes_columnview_col1);
|
flatpak_remotes_columnview.append_column(&flatpak_remotes_columnview_col1);
|
||||||
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_bin_clone0.set_child(Some(&flatpak_remotes_columnview));
|
flatpak_remotes_columnview_bin_clone0.set_child(Some(&flatpak_remotes_columnview));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -379,22 +379,12 @@ pub fn flatpak_update_page(
|
|||||||
let flatpak_system_updates = flatpak_system_installation
|
let flatpak_system_updates = flatpak_system_installation
|
||||||
.list_installed_refs_for_update(cancellable_no)
|
.list_installed_refs_for_update(cancellable_no)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let flatpak_system_transaction = libflatpak::Transaction::for_installation(
|
|
||||||
&flatpak_system_installation,
|
|
||||||
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 flatpak_user_updates = flatpak_user_installation
|
let flatpak_user_updates = flatpak_user_installation
|
||||||
.list_installed_refs_for_update(cancellable_no)
|
.list_installed_refs_for_update(cancellable_no)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let flatpak_user_transaction = libflatpak::Transaction::for_installation(
|
|
||||||
&flatpak_user_installation,
|
|
||||||
cancellable_no,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
//
|
//
|
||||||
let mut system_last_triggered = false;
|
let mut system_last_triggered = false;
|
||||||
let mut user_last_triggered = false;
|
let mut user_last_triggered = false;
|
||||||
@ -405,7 +395,7 @@ pub fn flatpak_update_page(
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
if !flatpak_system_updates.is_empty() {
|
if !flatpak_system_updates.is_empty() {
|
||||||
let mut flatpak_system_updates_iter =
|
let flatpak_system_updates_iter =
|
||||||
&mut flatpak_system_updates.iter().peekable();
|
&mut flatpak_system_updates.iter().peekable();
|
||||||
//
|
//
|
||||||
while let Some(flatpak_ref) = flatpak_system_updates_iter.next() {
|
while let Some(flatpak_ref) = flatpak_system_updates_iter.next() {
|
||||||
@ -559,7 +549,7 @@ pub fn flatpak_update_page(
|
|||||||
system_last_triggered = true
|
system_last_triggered = true
|
||||||
}
|
}
|
||||||
if !flatpak_user_updates.is_empty() {
|
if !flatpak_user_updates.is_empty() {
|
||||||
let mut flatpak_user_updates_iter =
|
let flatpak_user_updates_iter =
|
||||||
&mut flatpak_user_updates.iter().peekable();
|
&mut flatpak_user_updates.iter().peekable();
|
||||||
//
|
//
|
||||||
while let Some(flatpak_ref) = flatpak_user_updates_iter.next() {
|
while let Some(flatpak_ref) = flatpak_user_updates_iter.next() {
|
||||||
|
Loading…
Reference in New Issue
Block a user