ui changes

This commit is contained in:
leca 2024-04-09 15:06:27 +03:00
parent 1be42eb584
commit eb26ca7418
4 changed files with 45 additions and 27 deletions

View File

@ -3,7 +3,7 @@
<template class="MemoryCardsEditScene" parent="GtkApplicationWindow">
<property name="title">Memory cards edit</property>
<property name="height-request">1000</property>
<property name="width-request">1000</property>
<property name="width-request">200</property>
<child>
<object class="GtkBox" id="content">
<property name="orientation">vertical</property>
@ -43,9 +43,7 @@
<property name="orientation">vertical</property>
<property name="hexpand">true</property>
<property name="hexpand-set">true</property>
<property name="vexpand">true</property>
<property name="vexpand-set">true</property>
<property name="homogeneous">true</property>
<!-- <property name="homogeneous">true</property> -->
<property name="orientation">vertical</property>
<property name="halign">GTK_ALIGN_FILL</property>
<property name="valign">GTK_ALIGN_FILL</property>

View File

@ -6,6 +6,9 @@
<property name="width-request">512</property>
<child>
<object class="GtkBox" id="content">
<property name="orientation">vertical</property>
<property name="halign">GTK_ALIGN_CENTER</property>
<property name="valign">GTK_ALIGN_CENTER</property>
<child>
<object class="GtkPicture" id="picture">
<property name="halign">GTK_ALIGN_CENTER</property>

View File

@ -2,28 +2,46 @@
<interface>
<template class="CardEntry" parent="GtkWidget">
<child>
<object class="GtkPicture" id="picture">
<property name="halign">GTK_ALIGN_START</property>
<property name="valign">GTK_ALIGN_CENTER</property>
</object>
</child>
<child>
<object class="GtkLabel" id="hieroglyph_label">
<property name="halign">GTK_ALIGN_START</property>
<property name="valign">GTK_ALIGN_CENTER</property>
</object>
</child>
<child>
<object class="GtkLabel" id="reading_label">
<property name="halign">GTK_ALIGN_START</property>
<property name="valign">GTK_ALIGN_CENTER</property>
</object>
</child>
<child>
<object class="GtkButton" id="delete_button">
<property name="halign">GTK_ALIGN_END</property>
<property name="valign">GTK_ALIGN_CENTER</property>
<property name="label">delete</property>
<object class="GtkGrid">
<child>
<object class="GtkPicture" id="picture">
<property name="halign">GTK_ALIGN_START</property>
<property name="valign">GTK_ALIGN_CENTER</property>
<layout>
<property name="column">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="hieroglyph_label">
<property name="halign">GTK_ALIGN_START</property>
<property name="valign">GTK_ALIGN_CENTER</property>
<layout>
<property name="column">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="reading_label">
<property name="halign">GTK_ALIGN_START</property>
<property name="valign">GTK_ALIGN_CENTER</property>
<layout>
<property name="column">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="delete_button">
<property name="halign">GTK_ALIGN_END</property>
<property name="valign">GTK_ALIGN_CENTER</property>
<property name="label">delete</property>
<property name="hexpand">true</property>
<property name="hexpand-set">true</property>
<layout>
<property name="column">3</property>
</layout>
</object>
</child>
</object>
</child>
</template>

View File

@ -139,7 +139,6 @@ impl MemoryCardsEditScene {
let connection = Connection::open(get_db_path()).unwrap();
let imagepath = card.imagepath();
let imagename = &Path::new(&imagepath).file_name().unwrap().to_str().unwrap();
dbg!("removing {}", imagename);
fs::remove_file(get_images_store_path() + "/" + &imagename).expect("Could not remove file!");
connection.execute("DELETE FROM cards WHERE imagename = ?1", [&imagename]).unwrap();
self_binding.imp().query_cards(None);