Start remove app
This commit is contained in:
parent
9bc67682ad
commit
bc4e44d9c8
|
@ -66,6 +66,7 @@ name = "config-manager-client"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"f-uuid",
|
"f-uuid",
|
||||||
|
"gio",
|
||||||
"glib-build-tools",
|
"glib-build-tools",
|
||||||
"gtk4",
|
"gtk4",
|
||||||
"libadwaita",
|
"libadwaita",
|
||||||
|
@ -239,9 +240,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gio"
|
name = "gio"
|
||||||
version = "0.18.1"
|
version = "0.18.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7884cba6b1c5db1607d970cadf44b14a43913d42bc68766eea6a5e2fe0891524"
|
checksum = "57052f84e8e5999b258e8adf8f5f2af0ac69033864936b8b6838321db2f759b1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
|
|
|
@ -8,6 +8,7 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
adw = { version = "0.5.2", package = "libadwaita", features = ["v1_3"] }
|
adw = { version = "0.5.2", package = "libadwaita", features = ["v1_3"] }
|
||||||
f-uuid = { version = "1.0.0", registry = "gitea" }
|
f-uuid = { version = "1.0.0", registry = "gitea" }
|
||||||
|
gio = { version = "0.18.2", features = ["v2_74"] }
|
||||||
gtk = { version = "0.7.1", package = "gtk4", features = ["v4_10"] }
|
gtk = { version = "0.7.1", package = "gtk4", features = ["v4_10"] }
|
||||||
log = { version = "0.4", features = ["max_level_debug", "release_max_level_info"] }
|
log = { version = "0.4", features = ["max_level_debug", "release_max_level_info"] }
|
||||||
simplelog = "^0.12.0"
|
simplelog = "^0.12.0"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use adw::glib;
|
use adw::glib;
|
||||||
use glib::subclass::InitializingObject;
|
use glib::subclass::InitializingObject;
|
||||||
use gtk::{Button, CompositeTemplate};
|
use gtk::{Button, CompositeTemplate, template_callbacks};
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
use gtk::subclass::prelude::*;
|
use gtk::subclass::prelude::*;
|
||||||
use crate::ui::objects::app::AppObject;
|
use crate::ui::objects::app::AppObject;
|
||||||
|
@ -15,6 +15,14 @@ pub struct AppView {
|
||||||
pub application: RefCell<Option<AppObject>>
|
pub application: RefCell<Option<AppObject>>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[template_callbacks]
|
||||||
|
impl AppView {
|
||||||
|
#[template_callback]
|
||||||
|
fn handle_remove_button_clicked(&self, button: &Button) {
|
||||||
|
println!("Clicked!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[glib::object_subclass]
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for AppView {
|
impl ObjectSubclass for AppView {
|
||||||
const NAME: &'static str = "CmAppView";
|
const NAME: &'static str = "CmAppView";
|
||||||
|
|
|
@ -124,6 +124,21 @@ impl Window {
|
||||||
dialog.present();
|
dialog.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn remove_application(&self, id: &str) {
|
||||||
|
let apps = self.imp().apps.get().unwrap();
|
||||||
|
let index = apps.find_with_equal_func(|obj| -> bool {
|
||||||
|
let id_prop = obj
|
||||||
|
.downcast_ref::<AppObject>()
|
||||||
|
.expect("The object should be of type 'AppObject'")
|
||||||
|
.property_value("id");
|
||||||
|
|
||||||
|
let app_id = id_prop.get::<String>().expect("AppObject 'id' property should be a string");
|
||||||
|
app_id == id
|
||||||
|
});
|
||||||
|
|
||||||
|
dbg!(index);
|
||||||
|
}
|
||||||
|
|
||||||
fn restore_data(&self) {
|
fn restore_data(&self) {
|
||||||
let data = vec!(
|
let data = vec!(
|
||||||
AppData {
|
AppData {
|
||||||
|
|
Loading…
Reference in New Issue