update ui
This commit is contained in:
		@@ -3,7 +3,7 @@
 | 
				
			|||||||
    <template class="MemoryCardsEditScene" parent="GtkApplicationWindow">
 | 
					    <template class="MemoryCardsEditScene" parent="GtkApplicationWindow">
 | 
				
			||||||
        <property name="title">Memory cards edit</property>
 | 
					        <property name="title">Memory cards edit</property>
 | 
				
			||||||
        <property name="height-request">1000</property>
 | 
					        <property name="height-request">1000</property>
 | 
				
			||||||
        <property name="width-request">200</property>
 | 
					        <property name="width-request">500</property>
 | 
				
			||||||
        <child>
 | 
					        <child>
 | 
				
			||||||
            <object class="GtkBox" id="content">
 | 
					            <object class="GtkBox" id="content">
 | 
				
			||||||
                <property name="orientation">vertical</property>
 | 
					                <property name="orientation">vertical</property>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,9 +2,15 @@
 | 
				
			|||||||
<interface>
 | 
					<interface>
 | 
				
			||||||
    <template class="CardDisplay" parent="GtkWidget">
 | 
					    <template class="CardDisplay" parent="GtkWidget">
 | 
				
			||||||
        <child>
 | 
					        <child>
 | 
				
			||||||
            <object class="GtkPicture" id="picture">
 | 
					            <object class="GtkImage" id="image">
 | 
				
			||||||
                <property name="halign">GTK_ALIGN_CENTER</property>
 | 
					                <property name="halign">GTK_ALIGN_CENTER</property>
 | 
				
			||||||
                <property name="valign">GTK_ALIGN_CENTER</property>
 | 
					                <property name="valign">GTK_ALIGN_CENTER</property>
 | 
				
			||||||
 | 
					                <property name="vexpand-set">true</property>
 | 
				
			||||||
 | 
					                <property name="vexpand">true</property>
 | 
				
			||||||
 | 
					                <property name="hexpand-set">true</property>
 | 
				
			||||||
 | 
					                <property name="hexpand">true</property>
 | 
				
			||||||
 | 
					                <property name="width-request">512</property>
 | 
				
			||||||
 | 
					                <property name="height-request">512</property>
 | 
				
			||||||
            </object>
 | 
					            </object>
 | 
				
			||||||
        </child>
 | 
					        </child>
 | 
				
			||||||
        <child>
 | 
					        <child>
 | 
				
			||||||
@@ -17,7 +23,7 @@
 | 
				
			|||||||
            <object class="GtkEntry" id="answer_entry">
 | 
					            <object class="GtkEntry" id="answer_entry">
 | 
				
			||||||
                <property name="halign">GTK_ALIGN_CENTER</property>
 | 
					                <property name="halign">GTK_ALIGN_CENTER</property>
 | 
				
			||||||
                <property name="valign">GTK_ALIGN_START</property>
 | 
					                <property name="valign">GTK_ALIGN_START</property>
 | 
				
			||||||
                <property name="placeholder-text">Type kana that picture means</property>
 | 
					                <property name="placeholder-text">Type kana that image means</property>
 | 
				
			||||||
            </object>
 | 
					            </object>
 | 
				
			||||||
        </child>
 | 
					        </child>
 | 
				
			||||||
    </template>
 | 
					    </template>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,32 +2,29 @@
 | 
				
			|||||||
<interface>
 | 
					<interface>
 | 
				
			||||||
    <template class="CardEntry" parent="GtkWidget">
 | 
					    <template class="CardEntry" parent="GtkWidget">
 | 
				
			||||||
        <child>
 | 
					        <child>
 | 
				
			||||||
            <object class="GtkGrid">
 | 
					            <object class="GtkImage" id="image">
 | 
				
			||||||
                <child>
 | 
					 | 
				
			||||||
                    <object class="GtkPicture" id="picture">
 | 
					 | 
				
			||||||
                <property name="halign">GTK_ALIGN_START</property>
 | 
					                <property name="halign">GTK_ALIGN_START</property>
 | 
				
			||||||
                <property name="valign">GTK_ALIGN_CENTER</property>
 | 
					                <property name="valign">GTK_ALIGN_CENTER</property>
 | 
				
			||||||
                        <layout>
 | 
					                <property name="vexpand">true</property>
 | 
				
			||||||
                            <property name="column">0</property>
 | 
					                <property name="vexpand">true</property>
 | 
				
			||||||
                        </layout>
 | 
					                <property name="height-request">128</property>
 | 
				
			||||||
 | 
					                <property name="width-request">128</property>
 | 
				
			||||||
            </object>
 | 
					            </object>
 | 
				
			||||||
        </child>
 | 
					        </child>
 | 
				
			||||||
        <child>
 | 
					        <child>
 | 
				
			||||||
            <object class="GtkLabel" id="hieroglyph_label">
 | 
					            <object class="GtkLabel" id="hieroglyph_label">
 | 
				
			||||||
                <property name="halign">GTK_ALIGN_START</property>
 | 
					                <property name="halign">GTK_ALIGN_START</property>
 | 
				
			||||||
                <property name="valign">GTK_ALIGN_CENTER</property>
 | 
					                <property name="valign">GTK_ALIGN_CENTER</property>
 | 
				
			||||||
                        <layout>
 | 
					                <property name="margin-start">50</property>
 | 
				
			||||||
                            <property name="column">1</property>
 | 
					 | 
				
			||||||
                        </layout>
 | 
					 | 
				
			||||||
            </object>
 | 
					            </object>
 | 
				
			||||||
        </child>
 | 
					        </child>
 | 
				
			||||||
        <child>
 | 
					        <child>
 | 
				
			||||||
            <object class="GtkLabel" id="reading_label">
 | 
					            <object class="GtkLabel" id="reading_label">
 | 
				
			||||||
                        <property name="halign">GTK_ALIGN_START</property>
 | 
					                <property name="halign">GTK_ALIGN_END</property>
 | 
				
			||||||
                <property name="valign">GTK_ALIGN_CENTER</property>
 | 
					                <property name="valign">GTK_ALIGN_CENTER</property>
 | 
				
			||||||
                        <layout>
 | 
					                <property name="margin-end">50</property>
 | 
				
			||||||
                            <property name="column">2</property>
 | 
					                <property name="hexpand-set">true</property>
 | 
				
			||||||
                        </layout>
 | 
					                <property name="hexpand">true</property>
 | 
				
			||||||
            </object>
 | 
					            </object>
 | 
				
			||||||
        </child>
 | 
					        </child>
 | 
				
			||||||
        <child>
 | 
					        <child>
 | 
				
			||||||
@@ -37,11 +34,6 @@
 | 
				
			|||||||
                <property name="label">delete</property>
 | 
					                <property name="label">delete</property>
 | 
				
			||||||
                <property name="hexpand">true</property>
 | 
					                <property name="hexpand">true</property>
 | 
				
			||||||
                <property name="hexpand-set">true</property>
 | 
					                <property name="hexpand-set">true</property>
 | 
				
			||||||
                        <layout>
 | 
					 | 
				
			||||||
                            <property name="column">3</property>
 | 
					 | 
				
			||||||
                        </layout>
 | 
					 | 
				
			||||||
                    </object>
 | 
					 | 
				
			||||||
                </child>
 | 
					 | 
				
			||||||
            </object>
 | 
					            </object>
 | 
				
			||||||
        </child>
 | 
					        </child>
 | 
				
			||||||
    </template>
 | 
					    </template>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -60,7 +60,8 @@ impl ObjectImpl for MemoryCardsEditScene {
 | 
				
			|||||||
                                        false,
 | 
					                                        false,
 | 
				
			||||||
                                        closure_local!(@strong binding => move |_b: &Button| {
 | 
					                                        closure_local!(@strong binding => move |_b: &Button| {
 | 
				
			||||||
                                        let new_win = Rc::new(MemoryCardsNewScene::new(&binding.application().unwrap()));
 | 
					                                        let new_win = Rc::new(MemoryCardsNewScene::new(&binding.application().unwrap()));
 | 
				
			||||||
                                        new_win.get_file_choose_button().connect_clicked(clone!(@strong new_win => move |_| {
 | 
					                                        new_win.get_file_choose_button().connect_clicked(clone!(@strong new_win => move |b: &Button| {
 | 
				
			||||||
 | 
					                                            b.set_visible(false);
 | 
				
			||||||
                                            gtk::glib::MainContext::default().spawn_local(file_choose_dialog(Rc::clone(&new_win)));
 | 
					                                            gtk::glib::MainContext::default().spawn_local(file_choose_dialog(Rc::clone(&new_win)));
 | 
				
			||||||
                                        }));
 | 
					                                        }));
 | 
				
			||||||
                                        new_win.get_done_button().connect_closure("clicked", true, closure_local!(@strong binding => move |_w: &Button| {
 | 
					                                        new_win.get_done_button().connect_closure("clicked", true, closure_local!(@strong binding => move |_w: &Button| {
 | 
				
			||||||
@@ -144,7 +145,7 @@ impl MemoryCardsEditScene {
 | 
				
			|||||||
                self_binding.imp().query_cards(None);
 | 
					                self_binding.imp().query_cards(None);
 | 
				
			||||||
                self_binding.imp().update_card_list();
 | 
					                self_binding.imp().update_card_list();
 | 
				
			||||||
            }));
 | 
					            }));
 | 
				
			||||||
            card.update_file_for_picture();
 | 
					            card.update_file_for_image();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -152,14 +153,17 @@ impl MemoryCardsEditScene {
 | 
				
			|||||||
async fn file_choose_dialog<W: IsA<gtk::Window>>(window: Rc<W>) {
 | 
					async fn file_choose_dialog<W: IsA<gtk::Window>>(window: Rc<W>) {
 | 
				
			||||||
    let dialog: FileDialog = gtk::FileDialog::builder().build();
 | 
					    let dialog: FileDialog = gtk::FileDialog::builder().build();
 | 
				
			||||||
    let answer = dialog.open_future(Some(&*window)).await;
 | 
					    let answer = dialog.open_future(Some(&*window)).await;
 | 
				
			||||||
    let path = answer.unwrap().path().unwrap();
 | 
					    let path = match answer {
 | 
				
			||||||
    let path: &str = path.as_path().to_str().unwrap();
 | 
					        Ok(p) => p,
 | 
				
			||||||
 | 
					        Err(_) => return
 | 
				
			||||||
 | 
					    }.path().unwrap();
 | 
				
			||||||
 | 
					    let path: String = path.as_path().to_str().unwrap().to_owned();
 | 
				
			||||||
    let w: &MemoryCardsNewScene = Into::<&Window>::into(window.upcast_ref())
 | 
					    let w: &MemoryCardsNewScene = Into::<&Window>::into(window.upcast_ref())
 | 
				
			||||||
        .downcast_ref()
 | 
					        .downcast_ref()
 | 
				
			||||||
        .unwrap(); // Weird casting from &Window as passed in func to &MemoryCardsNewScene
 | 
					        .unwrap(); // Weird casting from &Window as passed in func to &MemoryCardsNewScene
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    w.get_picture_widget()
 | 
					    w.get_picture_widget()
 | 
				
			||||||
        .set_file(Some(&gio::File::for_path(path)));
 | 
					        .set_file(Some(&gio::File::for_path(&path)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let images_store_path = get_program_home_path() + "/images";
 | 
					    let images_store_path = get_program_home_path() + "/images";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -167,24 +171,26 @@ async fn file_choose_dialog<W: IsA<gtk::Window>>(window: Rc<W>) {
 | 
				
			|||||||
        Ok(_) => {}
 | 
					        Ok(_) => {}
 | 
				
			||||||
        Err(error) => match error.kind() {
 | 
					        Err(error) => match error.kind() {
 | 
				
			||||||
            ErrorKind::AlreadyExists => {}
 | 
					            ErrorKind::AlreadyExists => {}
 | 
				
			||||||
            _ => panic!("Could not create directory for storing pictures!"),
 | 
					            _ => panic!("Could not create directory for storing images!"),
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					    println!("Setting handler");
 | 
				
			||||||
    let hash = try_digest(path).unwrap();
 | 
					 | 
				
			||||||
    let extenstion = Path::new(path).extension().unwrap().to_str().unwrap();
 | 
					 | 
				
			||||||
    let new_filename: String = hash.as_str().to_owned() + "." + extenstion;
 | 
					 | 
				
			||||||
    let stored_image_path = Path::new(&images_store_path).join(&new_filename);
 | 
					 | 
				
			||||||
    fs::copy(path, stored_image_path).expect("Error copying image to store");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    w.get_done_button().connect_closure(
 | 
					    w.get_done_button().connect_closure(
 | 
				
			||||||
        "clicked",
 | 
					        "clicked",
 | 
				
			||||||
        false,
 | 
					        false,
 | 
				
			||||||
        closure_local!(@strong w => move |_b: &Button| {
 | 
					        closure_local!(@strong w, @strong path => move |_b: &Button| {
 | 
				
			||||||
 | 
					            let hash = try_digest(&path).unwrap();
 | 
				
			||||||
 | 
					            let extenstion = Path::new(path.as_str()).extension().unwrap().to_str().unwrap();
 | 
				
			||||||
 | 
					            let new_filename: String = hash.as_str().to_owned() + "." + extenstion;
 | 
				
			||||||
 | 
					            let stored_image_path = Path::new(&images_store_path).join(&new_filename);
 | 
				
			||||||
 | 
					            fs::copy(&path, stored_image_path).expect("Error copying image to store");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            let hieroglyph = w.get_hieroglyph_input();
 | 
					            let hieroglyph = w.get_hieroglyph_input();
 | 
				
			||||||
            let reading = w.get_reading_input();
 | 
					            let reading = w.get_reading_input();
 | 
				
			||||||
            let conn = Connection::open(get_db_path()).unwrap();
 | 
					            let conn = Connection::open(get_db_path()).unwrap();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            println!("INSERTING NEW IMAGE");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            let query = "INSERT INTO cards (imagename, hieroglyph, reading) VALUES(?1, ?2, ?3)";
 | 
					            let query = "INSERT INTO cards (imagename, hieroglyph, reading) VALUES(?1, ?2, ?3)";
 | 
				
			||||||
            conn.execute(query, (&new_filename, &hieroglyph, &reading)).unwrap();      
 | 
					            conn.execute(query, (&new_filename, &hieroglyph, &reading)).unwrap();      
 | 
				
			||||||
            w.close();
 | 
					            w.close();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,14 +3,14 @@ use std::cell::RefCell;
 | 
				
			|||||||
use glib::subclass::InitializingObject;
 | 
					use glib::subclass::InitializingObject;
 | 
				
			||||||
use glib::Properties;
 | 
					use glib::Properties;
 | 
				
			||||||
use gtk::subclass::prelude::*;
 | 
					use gtk::subclass::prelude::*;
 | 
				
			||||||
use gtk::{glib, prelude::*, BoxLayout, CompositeTemplate, Entry, Label, Picture};
 | 
					use gtk::{glib, prelude::*, BoxLayout, CompositeTemplate, Entry, Label, Image};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[derive(CompositeTemplate, Properties, Default)]
 | 
					#[derive(CompositeTemplate, Properties, Default)]
 | 
				
			||||||
#[properties(wrapper_type = super::CardDisplay)]
 | 
					#[properties(wrapper_type = super::CardDisplay)]
 | 
				
			||||||
#[template(resource = "/org/foxarmy/learn-hieroglyph/widgets/card_display/template.ui.xml")]
 | 
					#[template(resource = "/org/foxarmy/learn-hieroglyph/widgets/card_display/template.ui.xml")]
 | 
				
			||||||
pub struct CardDisplay {
 | 
					pub struct CardDisplay {
 | 
				
			||||||
    #[template_child]
 | 
					    #[template_child]
 | 
				
			||||||
    pub picture: TemplateChild<Picture>,
 | 
					    pub image: TemplateChild<Image>,
 | 
				
			||||||
    #[template_child]
 | 
					    #[template_child]
 | 
				
			||||||
    pub answer_entry: TemplateChild<Entry>,
 | 
					    pub answer_entry: TemplateChild<Entry>,
 | 
				
			||||||
    #[template_child]
 | 
					    #[template_child]
 | 
				
			||||||
@@ -44,10 +44,10 @@ impl ObjectImpl for CardDisplay {
 | 
				
			|||||||
        let layout_manager: BoxLayout = BoxLayout::new(gtk::Orientation::Vertical);
 | 
					        let layout_manager: BoxLayout = BoxLayout::new(gtk::Orientation::Vertical);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.obj().set_layout_manager(Some(layout_manager));
 | 
					        self.obj().set_layout_manager(Some(layout_manager));
 | 
				
			||||||
        self.picture.set_width_request(256);
 | 
					        self.image.set_width_request(256);
 | 
				
			||||||
        self.picture.set_height_request(256);
 | 
					        self.image.set_height_request(256);
 | 
				
			||||||
        // self.picture.
 | 
					        // self.image.
 | 
				
			||||||
        // self.picture.set
 | 
					        // self.image.set
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn dispose(&self) {
 | 
					    fn dispose(&self) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@ mod imp;
 | 
				
			|||||||
use std::cell::RefCell;
 | 
					use std::cell::RefCell;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use glib::Object;
 | 
					use glib::Object;
 | 
				
			||||||
use gtk::{gio, glib::{self, subclass::types::ObjectSubclassIsExt}, prelude::*, Entry, Picture};
 | 
					use gtk::{gio, glib::{self, subclass::types::ObjectSubclassIsExt}, prelude::*, Entry, Image};
 | 
				
			||||||
use rusqlite::Connection;
 | 
					use rusqlite::Connection;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use crate::db::{get_db_path, get_images_store_path};
 | 
					use crate::db::{get_db_path, get_images_store_path};
 | 
				
			||||||
@@ -29,14 +29,14 @@ impl CardDisplay {
 | 
				
			|||||||
            .build()
 | 
					            .build()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pub fn update_file_for_picture(&self) {
 | 
					    pub fn update_file_for_image(&self) {
 | 
				
			||||||
        let picture_binding: &Picture = self.imp().picture.as_ref();
 | 
					        let image_binding: &Image = self.imp().image.as_ref();
 | 
				
			||||||
        let path: &str = &*self.imp().imagepath.borrow().clone().to_string();
 | 
					        let path: &str = &*self.imp().imagepath.borrow().clone().to_string();
 | 
				
			||||||
        if path == "" {
 | 
					        if path == "" {
 | 
				
			||||||
            self.imp().error_message.set_visible(true);
 | 
					            self.imp().error_message.set_visible(true);
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        picture_binding.set_file(Some(&gio::File::for_path(path)));
 | 
					        image_binding.set_file(Some(&path));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    pub fn generate_card(&self) -> Option<(&RefCell<String>, &RefCell<String>)> {
 | 
					    pub fn generate_card(&self) -> Option<(&RefCell<String>, &RefCell<String>)> {
 | 
				
			||||||
        let connection = Connection::open(get_db_path()).unwrap();
 | 
					        let connection = Connection::open(get_db_path()).unwrap();
 | 
				
			||||||
@@ -63,7 +63,7 @@ impl CardDisplay {
 | 
				
			|||||||
        *self.imp().imagepath.borrow_mut() = get_images_store_path() + "/" + random_card.imagename.as_str();
 | 
					        *self.imp().imagepath.borrow_mut() = get_images_store_path() + "/" + random_card.imagename.as_str();
 | 
				
			||||||
        *self.imp().hieroglyph.borrow_mut() = random_card.hieroglyph;
 | 
					        *self.imp().hieroglyph.borrow_mut() = random_card.hieroglyph;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.update_file_for_picture();
 | 
					        self.update_file_for_image();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Some((&self.imp().imagepath, &self.imp().hieroglyph))
 | 
					        Some((&self.imp().imagepath, &self.imp().hieroglyph))
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,14 +3,14 @@ use std::cell::RefCell;
 | 
				
			|||||||
use glib::subclass::InitializingObject;
 | 
					use glib::subclass::InitializingObject;
 | 
				
			||||||
use glib::Properties;
 | 
					use glib::Properties;
 | 
				
			||||||
use gtk::subclass::prelude::*;
 | 
					use gtk::subclass::prelude::*;
 | 
				
			||||||
use gtk::{glib, prelude::*, Button, CompositeTemplate, Label, Picture};
 | 
					use gtk::{glib, prelude::*, Button, CompositeTemplate, Label, Image};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[derive(CompositeTemplate, Properties, Default)]
 | 
					#[derive(CompositeTemplate, Properties, Default)]
 | 
				
			||||||
#[properties(wrapper_type = super::CardEntry)]
 | 
					#[properties(wrapper_type = super::CardEntry)]
 | 
				
			||||||
#[template(resource = "/org/foxarmy/learn-hieroglyph/widgets/card_entry/template.ui.xml")]
 | 
					#[template(resource = "/org/foxarmy/learn-hieroglyph/widgets/card_entry/template.ui.xml")]
 | 
				
			||||||
pub struct CardEntry {
 | 
					pub struct CardEntry {
 | 
				
			||||||
    #[template_child]
 | 
					    #[template_child]
 | 
				
			||||||
    pub picture: TemplateChild<Picture>,
 | 
					    pub image: TemplateChild<Image>,
 | 
				
			||||||
    #[template_child]
 | 
					    #[template_child]
 | 
				
			||||||
    pub hieroglyph_label: TemplateChild<Label>,
 | 
					    pub hieroglyph_label: TemplateChild<Label>,
 | 
				
			||||||
    #[template_child]
 | 
					    #[template_child]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ use glib::Object;
 | 
				
			|||||||
use gtk::{
 | 
					use gtk::{
 | 
				
			||||||
    gio,
 | 
					    gio,
 | 
				
			||||||
    glib::{self, subclass::types::ObjectSubclassIsExt},
 | 
					    glib::{self, subclass::types::ObjectSubclassIsExt},
 | 
				
			||||||
    Button, Picture,
 | 
					    Button, Image,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
glib::wrapper! {
 | 
					glib::wrapper! {
 | 
				
			||||||
@@ -23,17 +23,17 @@ impl CardEntry {
 | 
				
			|||||||
            .build()
 | 
					            .build()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pub fn get_picture_widget(&self) -> &Picture {
 | 
					    pub fn get_image_widget(&self) -> &Image {
 | 
				
			||||||
        self.imp().picture.as_ref()
 | 
					        self.imp().image.as_ref()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pub fn get_delete_button_widget(&self) -> &Button {
 | 
					    pub fn get_delete_button_widget(&self) -> &Button {
 | 
				
			||||||
        self.imp().delete_button.as_ref()
 | 
					        self.imp().delete_button.as_ref()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pub fn update_file_for_picture(&self) {
 | 
					    pub fn update_file_for_image(&self) {
 | 
				
			||||||
        let picture_binding: &Picture = self.imp().picture.as_ref();
 | 
					        let image_binding: &Image = self.imp().image.as_ref();
 | 
				
			||||||
        let path: &str = &*self.imp().imagepath.borrow().clone().to_string();
 | 
					        let path: &str = &*self.imp().imagepath.borrow().clone().to_string();
 | 
				
			||||||
        picture_binding.set_file(Some(&gio::File::for_path(path)));
 | 
					        image_binding.set_file(Some(&path));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user