implemented delete card entry

This commit is contained in:
2024-04-06 07:04:19 +03:00
parent fa260bb8f5
commit 193db81657
4 changed files with 42 additions and 27 deletions

View File

@@ -1,9 +1,7 @@
use std::cell::RefCell;
use std::path::Path;
use glib::subclass::InitializingObject;
use glib::Properties;
use gtk::gio::File;
use gtk::subclass::prelude::*;
use gtk::{glib, prelude::*, Button, CompositeTemplate, Label, Picture};
@@ -18,9 +16,9 @@ pub struct CardEntry {
#[template_child]
pub reading_label: TemplateChild<Label>,
#[template_child]
pub edit_button: TemplateChild<Button>,
pub delete_button: TemplateChild<Button>,
#[property(get, set)]
imagepath: RefCell<String>,
pub imagepath: RefCell<String>,
#[property(get, set)]
hieroglyph: RefCell<String>,
#[property(get, set)]
@@ -47,12 +45,6 @@ impl ObjectImpl for CardEntry {
fn constructed(&self) {
self.parent_constructed();
let picture_binding: &Picture = self.picture.as_ref();
let picture_file: File =
File::for_path(Path::new(&String::from(&*self.imagepath.borrow())));
picture_binding.set_file(glib::bitflags::__private::core::option::Option::Some(
&picture_file,
));
let hieroglyph_label_binding: &Label = self.hieroglyph_label.as_ref();
self.obj()
@@ -65,6 +57,7 @@ impl ObjectImpl for CardEntry {
.bind_property("reading", reading_label_binding, "label")
.sync_create()
.build();
}
fn dispose(&self) {