summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2024-12-22 18:28:32 +0000
committerJoe Carstairs <me@joeac.net>2024-12-22 18:28:32 +0000
commitab3e0439e12dee592a8f6fe2a968e4bb429a60f8 (patch)
treeaff750c6f2eac8a2d6b703a3a75a45cfa52ec0b3
parent4b3821e8bffb6a8e98525ee0a0bc860e5de7da05 (diff)
Adds other views
-rw-r--r--schist_gtk4_gui/resources/resources.gresource.xml3
-rw-r--r--schist_gtk4_gui/resources/ui/balances_view.ui10
-rw-r--r--schist_gtk4_gui/resources/ui/category_transfers_view.ui10
-rw-r--r--schist_gtk4_gui/resources/ui/transactions_view.ui10
-rw-r--r--schist_gtk4_gui/resources/ui/window.ui39
-rw-r--r--schist_gtk4_gui/src/balances_view.rs56
-rw-r--r--schist_gtk4_gui/src/category_transfers_view.rs56
-rw-r--r--schist_gtk4_gui/src/lib.rs3
-rw-r--r--schist_gtk4_gui/src/transactions_view.rs56
-rw-r--r--schist_gtk4_gui/src/window.rs15
10 files changed, 257 insertions, 1 deletions
diff --git a/schist_gtk4_gui/resources/resources.gresource.xml b/schist_gtk4_gui/resources/resources.gresource.xml
index 4b1b90d..350a77d 100644
--- a/schist_gtk4_gui/resources/resources.gresource.xml
+++ b/schist_gtk4_gui/resources/resources.gresource.xml
@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/net/joeac/schist/">
+ <file compressed="true" preprocess="xml-stripblanks">ui/balances_view.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/categories_view.ui</file>
+ <file compressed="true" preprocess="xml-stripblanks">ui/category_transfers_view.ui</file>
+ <file compressed="true" preprocess="xml-stripblanks">ui/transactions_view.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/window.ui</file>
<file compressed="true">css/styles.css</file>
<file compressed="true">css/window.css</file>
diff --git a/schist_gtk4_gui/resources/ui/balances_view.ui b/schist_gtk4_gui/resources/ui/balances_view.ui
new file mode 100644
index 0000000..1645119
--- /dev/null
+++ b/schist_gtk4_gui/resources/ui/balances_view.ui
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <template class="SchistBalancesView" parent="GtkBox">
+ <child>
+ <object class="GtkLabel">
+ <property name="label">Hello, balances!</property>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/schist_gtk4_gui/resources/ui/category_transfers_view.ui b/schist_gtk4_gui/resources/ui/category_transfers_view.ui
new file mode 100644
index 0000000..5a31335
--- /dev/null
+++ b/schist_gtk4_gui/resources/ui/category_transfers_view.ui
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <template class="SchistCategoryTransfersView" parent="GtkBox">
+ <child>
+ <object class="GtkLabel">
+ <property name="label">Hello, category transfers!</property>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/schist_gtk4_gui/resources/ui/transactions_view.ui b/schist_gtk4_gui/resources/ui/transactions_view.ui
new file mode 100644
index 0000000..ca864f2
--- /dev/null
+++ b/schist_gtk4_gui/resources/ui/transactions_view.ui
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <template class="SchistTransactionsView" parent="GtkBox">
+ <child>
+ <object class="GtkLabel">
+ <property name="label">Hello, transactions!</property>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/schist_gtk4_gui/resources/ui/window.ui b/schist_gtk4_gui/resources/ui/window.ui
index 2dcf4c8..54ce2a5 100644
--- a/schist_gtk4_gui/resources/ui/window.ui
+++ b/schist_gtk4_gui/resources/ui/window.ui
@@ -28,6 +28,45 @@
</property>
</object>
</child>
+
+ <child>
+ <object class="GtkStackPage">
+ <property name="name">balances</property>
+ <property name="title">Balances</property>
+ <property name="child">
+ <object
+ class="SchistBalancesView"
+ id="balances_view"
+ />
+ </property>
+ </object>
+ </child>
+
+ <child>
+ <object class="GtkStackPage">
+ <property name="name">transactions</property>
+ <property name="title">Transactions</property>
+ <property name="child">
+ <object
+ class="SchistTransactionsView"
+ id="transactions_view"
+ />
+ </property>
+ </object>
+ </child>
+
+ <child>
+ <object class="GtkStackPage">
+ <property name="name">category_transfers</property>
+ <property name="title">Category Transfers</property>
+ <property name="child">
+ <object
+ class="SchistCategoryTransfersView"
+ id="category_transfers_view"
+ />
+ </property>
+ </object>
+ </child>
</object>
</child>
</template>
diff --git a/schist_gtk4_gui/src/balances_view.rs b/schist_gtk4_gui/src/balances_view.rs
new file mode 100644
index 0000000..5afb192
--- /dev/null
+++ b/schist_gtk4_gui/src/balances_view.rs
@@ -0,0 +1,56 @@
+use gtk::{
+ glib::{
+ self,
+ subclass::{
+ object::{ObjectImpl, ObjectImplExt},
+ types::ObjectSubclass,
+ InitializingObject,
+ },
+ Object,
+ },
+ subclass::{
+ box_::BoxImpl,
+ widget::{CompositeTemplateClass, CompositeTemplateInitializingExt, WidgetImpl},
+ },
+};
+
+glib::wrapper! {
+ pub struct SchistBalancesView(ObjectSubclass<SchistBalancesViewImpl>)
+ @extends gtk::Box, gtk::Widget,
+ @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
+}
+
+impl SchistBalancesView {
+ pub fn new() -> Self {
+ Object::builder().build()
+ }
+}
+
+#[derive(gtk::CompositeTemplate, Default)]
+#[template(resource = "/net/joeac/schist/ui/balances_view.ui")]
+pub struct SchistBalancesViewImpl {}
+
+#[glib::object_subclass]
+impl ObjectSubclass for SchistBalancesViewImpl {
+ const NAME: &'static str = "SchistBalancesView";
+ type Type = SchistBalancesView;
+ type ParentType = gtk::Box;
+
+ fn class_init(klass: &mut Self::Class) {
+ klass.bind_template();
+ }
+
+ fn instance_init(obj: &InitializingObject<Self>) {
+ obj.init_template();
+ }
+}
+
+impl ObjectImpl for SchistBalancesViewImpl {
+ fn constructed(&self) {
+ self.parent_constructed();
+ }
+}
+
+impl WidgetImpl for SchistBalancesViewImpl {}
+
+impl BoxImpl for SchistBalancesViewImpl {}
diff --git a/schist_gtk4_gui/src/category_transfers_view.rs b/schist_gtk4_gui/src/category_transfers_view.rs
new file mode 100644
index 0000000..286a20c
--- /dev/null
+++ b/schist_gtk4_gui/src/category_transfers_view.rs
@@ -0,0 +1,56 @@
+use gtk::{
+ glib::{
+ self,
+ subclass::{
+ object::{ObjectImpl, ObjectImplExt},
+ types::ObjectSubclass,
+ InitializingObject,
+ },
+ Object,
+ },
+ subclass::{
+ box_::BoxImpl,
+ widget::{CompositeTemplateClass, CompositeTemplateInitializingExt, WidgetImpl},
+ },
+};
+
+glib::wrapper! {
+ pub struct SchistCategoryTransfersView(ObjectSubclass<SchistCategoryTransfersViewImpl>)
+ @extends gtk::Box, gtk::Widget,
+ @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
+}
+
+impl SchistCategoryTransfersView {
+ pub fn new() -> Self {
+ Object::builder().build()
+ }
+}
+
+#[derive(gtk::CompositeTemplate, Default)]
+#[template(resource = "/net/joeac/schist/ui/category_transfers_view.ui")]
+pub struct SchistCategoryTransfersViewImpl {}
+
+#[glib::object_subclass]
+impl ObjectSubclass for SchistCategoryTransfersViewImpl {
+ const NAME: &'static str = "SchistCategoryTransfersView";
+ type Type = SchistCategoryTransfersView;
+ type ParentType = gtk::Box;
+
+ fn class_init(klass: &mut Self::Class) {
+ klass.bind_template();
+ }
+
+ fn instance_init(obj: &InitializingObject<Self>) {
+ obj.init_template();
+ }
+}
+
+impl ObjectImpl for SchistCategoryTransfersViewImpl {
+ fn constructed(&self) {
+ self.parent_constructed();
+ }
+}
+
+impl WidgetImpl for SchistCategoryTransfersViewImpl {}
+
+impl BoxImpl for SchistCategoryTransfersViewImpl {}
diff --git a/schist_gtk4_gui/src/lib.rs b/schist_gtk4_gui/src/lib.rs
index 7455d83..10240b0 100644
--- a/schist_gtk4_gui/src/lib.rs
+++ b/schist_gtk4_gui/src/lib.rs
@@ -1,4 +1,7 @@
+mod balances_view;
mod categories_view;
+mod category_transfers_view;
+mod transactions_view;
mod window;
use gtk::{gdk::Display, gio, glib, prelude::*, Application, CssProvider};
diff --git a/schist_gtk4_gui/src/transactions_view.rs b/schist_gtk4_gui/src/transactions_view.rs
new file mode 100644
index 0000000..39a2a98
--- /dev/null
+++ b/schist_gtk4_gui/src/transactions_view.rs
@@ -0,0 +1,56 @@
+use gtk::{
+ glib::{
+ self,
+ subclass::{
+ object::{ObjectImpl, ObjectImplExt},
+ types::ObjectSubclass,
+ InitializingObject,
+ },
+ Object,
+ },
+ subclass::{
+ box_::BoxImpl,
+ widget::{CompositeTemplateClass, CompositeTemplateInitializingExt, WidgetImpl},
+ },
+};
+
+glib::wrapper! {
+ pub struct SchistTransactionsView(ObjectSubclass<SchistTransactionsViewImpl>)
+ @extends gtk::Box, gtk::Widget,
+ @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
+}
+
+impl SchistTransactionsView {
+ pub fn new() -> Self {
+ Object::builder().build()
+ }
+}
+
+#[derive(gtk::CompositeTemplate, Default)]
+#[template(resource = "/net/joeac/schist/ui/transactions_view.ui")]
+pub struct SchistTransactionsViewImpl {}
+
+#[glib::object_subclass]
+impl ObjectSubclass for SchistTransactionsViewImpl {
+ const NAME: &'static str = "SchistTransactionsView";
+ type Type = SchistTransactionsView;
+ type ParentType = gtk::Box;
+
+ fn class_init(klass: &mut Self::Class) {
+ klass.bind_template();
+ }
+
+ fn instance_init(obj: &InitializingObject<Self>) {
+ obj.init_template();
+ }
+}
+
+impl ObjectImpl for SchistTransactionsViewImpl {
+ fn constructed(&self) {
+ self.parent_constructed();
+ }
+}
+
+impl WidgetImpl for SchistTransactionsViewImpl {}
+
+impl BoxImpl for SchistTransactionsViewImpl {}
diff --git a/schist_gtk4_gui/src/window.rs b/schist_gtk4_gui/src/window.rs
index b612e92..b3cea35 100644
--- a/schist_gtk4_gui/src/window.rs
+++ b/schist_gtk4_gui/src/window.rs
@@ -19,7 +19,11 @@ use gtk::{
TemplateChild,
};
-use crate::categories_view::SchistCategoriesView;
+use crate::{
+ balances_view::SchistBalancesView, categories_view::SchistCategoriesView,
+ category_transfers_view::SchistCategoryTransfersView,
+ transactions_view::SchistTransactionsView,
+};
gtk::glib::wrapper! {
pub struct SchistWindow(ObjectSubclass<SchistWindowSubclass>)
@@ -38,7 +42,16 @@ impl SchistWindow {
#[template(resource = "/net/joeac/schist/ui/window.ui")]
pub struct SchistWindowSubclass {
#[template_child]
+ pub balances_view: TemplateChild<SchistBalancesView>,
+
+ #[template_child]
pub categories_view: TemplateChild<SchistCategoriesView>,
+
+ #[template_child]
+ pub category_transfers_view: TemplateChild<SchistCategoryTransfersView>,
+
+ #[template_child]
+ pub transactions_view: TemplateChild<SchistTransactionsView>,
}
#[glib::object_subclass]