Add Launch and Uninstall buttons to detail view header
This commit is contained in:
@@ -143,11 +143,47 @@ pub fn build_detail_page(record: &AppImageRecord, db: &Rc<Database>) -> adw::Nav
|
||||
);
|
||||
});
|
||||
|
||||
header.pack_start(&launch_button);
|
||||
|
||||
// Uninstall button
|
||||
let uninstall_button = gtk::Button::builder()
|
||||
.icon_name("user-trash-symbolic")
|
||||
.tooltip_text("Uninstall this AppImage")
|
||||
.build();
|
||||
uninstall_button.add_css_class("flat");
|
||||
uninstall_button.update_property(&[
|
||||
gtk::accessible::Property::Label("Uninstall application"),
|
||||
]);
|
||||
let record_for_uninstall = record.clone();
|
||||
let db_uninstall = db.clone();
|
||||
let toast_uninstall = toast_overlay.clone();
|
||||
let is_integrated_header = record.integrated;
|
||||
uninstall_button.connect_clicked(move |_btn| {
|
||||
let fp = footprint::get_footprint(&db_uninstall, record_for_uninstall.id, record_for_uninstall.size_bytes as u64);
|
||||
let fp_paths: Vec<(String, String, u64)> = fp.paths.iter()
|
||||
.filter(|p| p.exists)
|
||||
.map(|p| (
|
||||
p.path.to_string_lossy().to_string(),
|
||||
p.path_type.label().to_string(),
|
||||
p.size_bytes,
|
||||
))
|
||||
.collect();
|
||||
show_uninstall_dialog(
|
||||
&toast_uninstall,
|
||||
&record_for_uninstall,
|
||||
&db_uninstall,
|
||||
is_integrated_header,
|
||||
&fp_paths,
|
||||
);
|
||||
});
|
||||
header.pack_end(&uninstall_button);
|
||||
|
||||
// Check for Update button
|
||||
let update_button = gtk::Button::builder()
|
||||
.icon_name("software-update-available-symbolic")
|
||||
.tooltip_text("Check for updates")
|
||||
.build();
|
||||
update_button.add_css_class("flat");
|
||||
update_button.update_property(&[
|
||||
gtk::accessible::Property::Label("Check for updates"),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user