Wire log view to database for transaction persistence
Initialize SQLite database at XDG data directory on app startup. Categories now load from database with emoji icons. Save button validates input, inserts transaction, shows toast notification, clears the form, and refreshes the recent transactions list.
This commit is contained in:
@@ -3,6 +3,9 @@ mod window;
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::Application;
|
||||
use gtk::glib;
|
||||
use outlay_core::db::Database;
|
||||
use std::rc::Rc;
|
||||
|
||||
const APP_ID: &str = "io.github.outlay";
|
||||
|
||||
@@ -16,6 +19,13 @@ fn main() {
|
||||
}
|
||||
|
||||
fn build_ui(app: &Application) {
|
||||
let main_window = window::MainWindow::new(app);
|
||||
let data_dir = glib::user_data_dir().join("outlay");
|
||||
std::fs::create_dir_all(&data_dir).expect("Failed to create data directory");
|
||||
let db_path = data_dir.join("outlay.db");
|
||||
|
||||
let db = Database::open(&db_path).expect("Failed to open database");
|
||||
let db = Rc::new(db);
|
||||
|
||||
let main_window = window::MainWindow::new(app, db);
|
||||
main_window.window.present();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user