Compare commits

..

32 Commits

Author SHA1 Message Date
lashman c5fb69121f Add Makefile with install target for distro packaging 2026-03-04 23:44:00 +02:00
lashman d78a27bbf5 Change app ID to com.outlay.app, add AppStream metadata, fix toast visibility 2026-03-03 22:15:59 +02:00
lashman a38779c664 Bust icon cache in README 2026-03-03 21:35:50 +02:00
lashman 949ef66a95 Add emojis to README section headers 2026-03-03 21:33:56 +02:00
lashman 9566a37c2f Fix icon exports to have transparent background instead of checkerboard 2026-03-03 21:31:05 +02:00
lashman 9498de28e6 Add project README with full feature documentation 2026-03-03 21:26:07 +02:00
lashman 577cd54a9e Add feature batch 2, subscription/recurring sync, smooth charts, and app icon 2026-03-03 21:18:37 +02:00
lashman f9e293c30e Add AppImage build script 2026-03-02 00:59:27 +02:00
lashman 893acd6437 Add desktop integration files and window state persistence 2026-03-02 00:58:21 +02:00
lashman 92d4d7b234 Add settings view with theme, categories, export, and backup 2026-03-02 00:57:05 +02:00
lashman f6edf9cd55 Add full state backup and restore with ZIP archives 2026-03-02 00:53:17 +02:00
lashman 1ef238648f Add PDF monthly report generation 2026-03-02 00:51:31 +02:00
lashman 225554d222 Add JSON export for full data dump 2026-03-02 00:43:23 +02:00
lashman 4b444d9437 Add CSV export for transactions with date filtering 2026-03-02 00:41:34 +02:00
lashman b3f6180ce8 Add recurring transactions view and launch catch-up 2026-03-02 00:37:30 +02:00
lashman 8c4b5a8b4d Add recurring transaction logic with catch-up generation 2026-03-02 00:34:34 +02:00
lashman b0e42e426b Add desktop notifications for budget threshold crossings 2026-03-02 00:28:43 +02:00
lashman 9a70f89ef5 Add budgets view with progress bars and management 2026-03-02 00:26:09 +02:00
lashman 1105793d88 Add budget CRUD operations and progress calculation 2026-03-02 00:24:08 +02:00
lashman 47affa37f0 Add charts view with pie, bar, and line charts 2026-03-02 00:22:19 +02:00
lashman 1239dda32e Add currency selection with live exchange rate fetching 2026-03-02 00:16:47 +02:00
lashman 1d45fec9ef Add exchange rate service with caching and fallback API 2026-03-02 00:14:50 +02:00
lashman 0eb0496c06 Add edit and delete for transactions in history view 2026-03-02 00:13:04 +02:00
lashman f7d4939116 Add history view with day-grouped transaction list 2026-03-02 00:09:21 +02:00
lashman 678c748672 Wire log view to database for transaction persistence 2026-03-02 00:07:39 +02:00
lashman 657ea5fe76 Add log view UI with transaction entry form 2026-03-02 00:05:10 +02:00
lashman 7af27c06c1 Add main window with sidebar navigation 2026-03-02 00:02:53 +02:00
lashman 64e44da4d6 Add minimal AdwApplication with empty window 2026-03-01 23:59:43 +02:00
lashman 1543d56304 Add CRUD operations for transactions, categories, and aggregation queries 2026-03-01 23:59:15 +02:00
lashman 177dd4b8b8 Add database layer with schema creation and default categories 2026-03-01 23:57:37 +02:00
lashman cae05847af Add core data models for transactions, categories, budgets 2026-03-01 23:56:41 +02:00
lashman dfb19b8327 Scaffold cargo workspace with core and gtk crates 2026-03-01 23:54:45 +02:00
29 changed files with 91 additions and 2378 deletions
-65
View File
@@ -1,65 +0,0 @@
# This file
.gitignore
# Build artifacts
/target/
outlay-core/target/
outlay-gtk/target/
# Rust
**/*.rs.bk
*.pdb
# AppImage build artifacts
AppDir/
*.AppImage
linuxdeploy-*
linuxdeploy-plugin-*
# IDE
.idea/
.vscode/
*.swp
*.swo
*~
# Trash
.trash/
# OS
.DS_Store
Thumbs.db
# Docs/plans (local only)
docs/
# LLM/AI/agent files and directories
.claude/
.cursor/
.copilot/
.github/copilot/
.aider*
.continue/
.codeium/
.tabnine/
.sourcery/
.windsurf/
.cody/
.supermaven/
.codex/
.replit/
.bolt/
.v0/
.devin/
.idx/
.ai/
.llm/
.agent/
.agents/
.prompts/
AGENTS.md
CLAUDE.md
.cursorrules
.cursorignore
copilot-instructions.md
.github/copilot-instructions.md
+58
View File
@@ -0,0 +1,58 @@
PREFIX ?= /usr/local
DESTDIR ?=
BINDIR = $(PREFIX)/bin
DATADIR = $(PREFIX)/share
ICON_DATA = outlay-gtk/data/icons
DESKTOP_FILE = outlay-gtk/data/com.outlay.app.desktop
METAINFO_FILE = outlay-gtk/data/com.outlay.app.metainfo.xml
SCHEMA_FILE = outlay-gtk/data/com.outlay.app.gschema.xml
.PHONY: build install uninstall
build:
cargo build --release -p outlay-gtk
install: build
install -Dm755 target/release/outlay-gtk $(DESTDIR)$(BINDIR)/outlay-gtk
# Desktop file
install -Dm644 $(DESKTOP_FILE) $(DESTDIR)$(DATADIR)/applications/com.outlay.app.desktop
# AppStream metainfo
install -Dm644 $(METAINFO_FILE) $(DESTDIR)$(DATADIR)/metainfo/com.outlay.app.metainfo.xml
# GSettings schema
install -Dm644 $(SCHEMA_FILE) $(DESTDIR)$(DATADIR)/glib-2.0/schemas/com.outlay.app.gschema.xml
# App icons (raster sizes)
for size_dir in $(ICON_DATA)/hicolor/*/apps; do \
size=$$(basename "$$(dirname "$$size_dir")"); \
for icon in "$$size_dir"/com.outlay.app.*; do \
[ -f "$$icon" ] || continue; \
install -Dm644 "$$icon" $(DESTDIR)$(DATADIR)/icons/hicolor/$$size/apps/$$(basename "$$icon"); \
done; \
done
# Scalable action icons (outlay custom + tabler)
for svg in $(ICON_DATA)/hicolor/scalable/actions/outlay-*.svg \
$(ICON_DATA)/hicolor/scalable/actions/tabler-*.svg; do \
[ -f "$$svg" ] || continue; \
install -Dm644 "$$svg" $(DESTDIR)$(DATADIR)/icons/hicolor/scalable/actions/$$(basename "$$svg"); \
done
# Bundled fonts
for ttf in outlay-gtk/data/fonts/*.ttf; do \
[ -f "$$ttf" ] || continue; \
install -Dm644 "$$ttf" $(DESTDIR)$(DATADIR)/fonts/outlay/$$(basename "$$ttf"); \
done
uninstall:
rm -f $(DESTDIR)$(BINDIR)/outlay-gtk
rm -f $(DESTDIR)$(DATADIR)/applications/com.outlay.app.desktop
rm -f $(DESTDIR)$(DATADIR)/metainfo/com.outlay.app.metainfo.xml
rm -f $(DESTDIR)$(DATADIR)/glib-2.0/schemas/com.outlay.app.gschema.xml
rm -rf $(DESTDIR)$(DATADIR)/icons/hicolor/*/apps/com.outlay.app.*
rm -rf $(DESTDIR)$(DATADIR)/icons/hicolor/scalable/actions/outlay-*.svg
rm -rf $(DESTDIR)$(DATADIR)/icons/hicolor/scalable/actions/tabler-*.svg
rm -rf $(DESTDIR)$(DATADIR)/fonts/outlay
+33 -33
View File
@@ -32,19 +32,19 @@ Released into the public domain under CC0. Take it, use it, change it, share it.
---
## Table of Contents
## Table of contents
- [Features at a Glance](#-features-at-a-glance)
- [Features at a glance](#-features-at-a-glance)
- [Installation](#-installation)
- [Building from Source](#%EF%B8%8F-building-from-source)
- [Views and Functionality](#-views-and-functionality)
- [Import and Export](#-import-and-export)
- [Multi-Currency Support](#-multi-currency-support)
- [Building from source](#%EF%B8%8F-building-from-source)
- [Views and functionality](#-views-and-functionality)
- [Import and export](#-import-and-export)
- [Multi-currency support](#-multi-currency-support)
- [Notifications](#-notifications)
- [System Tray](#-system-tray)
- [Keyboard and Workflow](#%EF%B8%8F-keyboard-and-workflow)
- [System tray](#-system-tray)
- [Keyboard and workflow](#%EF%B8%8F-keyboard-and-workflow)
- [Architecture](#-architecture)
- [Data Storage](#-data-storage)
- [Data storage](#-data-storage)
- [Packaging](#-packaging)
- [Contributing](#-contributing)
- [License](#-license)
@@ -59,7 +59,7 @@ The goal is simple: give people a tool that is genuinely useful for managing the
---
## ✨ Features at a Glance
## ✨ Features at a glance
| Area | What it does |
|---|---|
@@ -89,7 +89,7 @@ The goal is simple: give people a tool that is genuinely useful for managing the
## 📦 Installation
### AppImage (Recommended)
### AppImage (recommended)
Download the latest AppImage from the releases page, make it executable, and run:
@@ -100,13 +100,13 @@ chmod +x Outlay-*.AppImage
No installation required. It carries everything it needs. Works on any modern Linux distribution.
### From Source
### From source
See [Building from Source](#-building-from-source) below.
See [Building from source](#-building-from-source) below.
---
## 🛠️ Building from Source
## 🛠️ Building from source
### Dependencies
@@ -136,7 +136,7 @@ On Arch:
sudo pacman -S gtk4 libadwaita sqlite pkg-config
```
### Build and Run
### Build and run
```bash
git clone https://git.lashman.live/lashman/outlay.git
@@ -145,7 +145,7 @@ cargo build --release
./target/release/outlay-gtk
```
### Demo Data
### Demo data
To populate the app with two years of realistic sample data for testing:
@@ -157,9 +157,9 @@ This wipes the existing database and creates a fresh one filled with transaction
---
## 🖥 Views and Functionality
## 🖥 Views and functionality
### 📝 Log View
### 📝 Log view
The default view. A quick-entry form for logging transactions.
@@ -223,7 +223,7 @@ Set spending limits per category and track progress through the month.
Budgets are a tool for self-awareness, not punishment. The pace indicator in particular is useful - it tells you "at your current rate, here is where you will end up" so you can make informed choices about the rest of the month.
### 🔄 Recurring Transactions
### 🔄 Recurring transactions
Automate regular income and expenses.
@@ -254,7 +254,7 @@ Track your subscription services separately from raw recurring transactions.
The subscription view gives you a clear answer to "how much am I paying per month for services?" - a number that tends to creep up quietly if nobody is watching.
### 🎯 Savings Goals
### 🎯 Savings goals
Set targets and track your progress toward them.
@@ -267,7 +267,7 @@ Set targets and track your progress toward them.
Goals work as a simple ledger - you set a target, and manually update your saved amount as you make progress. This keeps it flexible enough for any kind of saving, whether it is a vacation fund, an emergency cushion, or pooling resources with others for a shared purpose.
### 💳 Credit Cards
### 💳 Credit cards
Keep tabs on credit card balances and utilization.
@@ -304,7 +304,7 @@ Project your future cash flow based on existing patterns.
The forecast makes no assumptions about growth or lifestyle inflation. It simply extends your current patterns forward so you can see where things are heading and adjust if needed.
### 🏆 Insights and Achievements
### 🏆 Insights and achievements
Analytics and light gamification to encourage healthy financial habits.
@@ -339,7 +339,7 @@ Analytics and light gamification to encourage healthy financial habits.
The achievements are meant to be encouraging without being manipulative. There are no daily login rewards, no streaks designed to create anxiety, and no leaderboards. Just quiet recognition when you hit a milestone that matters to you.
### 📅 Calendar Heatmap
### 📅 Calendar heatmap
A visual grid showing daily spending intensity.
@@ -364,11 +364,11 @@ Configure Outlay to work the way you need.
---
## 📤 Import and Export
## 📤 Import and export
Outlay believes your data should flow freely. No lock-in, no proprietary formats, no friction for leaving.
### Export Formats
### Export formats
| Format | Description |
|--------|-------------|
@@ -378,7 +378,7 @@ Outlay believes your data should flow freely. No lock-in, no proprietary formats
| **QIF** | Quicken Interchange Format. Legacy compatibility with older financial software. |
| **PDF** | Formatted monthly financial report with summary, category breakdown, top expenses, and budget comparison. |
### Import Formats
### Import formats
| Format | Description |
|--------|-------------|
@@ -388,7 +388,7 @@ Outlay believes your data should flow freely. No lock-in, no proprietary formats
| **QIF** | Import from Quicken or other apps that export QIF. |
| **PDF** | Extract transactions from PDF bank statements using text parsing. Multi-page support. |
### Full Backup
### Full backup
The `.outlay` backup format is a ZIP archive containing:
@@ -400,7 +400,7 @@ Create a backup, copy it to another machine, restore it, and you have an exact r
---
## 🌍 Multi-Currency Support
## 🌍 Multi-currency support
Outlay supports 40+ currencies with automatic exchange rate conversion.
@@ -488,7 +488,7 @@ Notifications are de-duplicated (you will not get the same budget warning twice)
---
## 🗔 System Tray
## 🗔 System tray
Outlay integrates with the freedesktop.org system tray specification via DBus.
@@ -504,7 +504,7 @@ The Quick Add popup is designed for those moments when you just bought something
---
## ⌨️ Keyboard and Workflow
## ⌨️ Keyboard and workflow
The interface follows standard GTK4 and GNOME conventions.
@@ -585,7 +585,7 @@ outlay/
plans/ # Design documentation
```
### Key Technical Decisions
### Key technical decisions
- **Raw GTK4 bindings** instead of a framework like Relm4. More verbose, but no hidden abstractions.
- **SQLite with WAL mode** for reliable concurrent reads during UI updates.
@@ -619,7 +619,7 @@ The core dependencies, all freely licensed:
---
## 💾 Data Storage
## 💾 Data storage
All data lives in a single SQLite file:
@@ -656,7 +656,7 @@ Build it yourself:
The resulting AppImage is a single file that runs on any modern Linux distribution without installation. Download it, make it executable, run it. When a new version comes out, replace the file. No package managers, no repositories, no gatekeepers.
### Environment Variables
### Environment variables
The AppImage sets:
- `GDK_BACKEND=wayland,x11` - Wayland-first with X11 fallback
@@ -1,234 +0,0 @@
# Feature Batch 2 Design - 16 Features
Date: 2026-03-03
## Overview
16 features sourced from Reddit community research on personal finance app wishlists, filtered against Outlay's existing feature set.
## Features
### 5. Custom Budget Cycle
Users can choose how budget periods are defined:
- **Calendar month** (default, current behavior): 1st to last day of month
- **Payday offset**: budget runs from day X to day X-1 of next month (e.g. 15th to 14th)
- **Rolling N-day**: budget period is a fixed window of N days from a configurable start date
New settings: `budget_cycle_mode` (calendar/payday/rolling), `budget_cycle_start_day` (1-31), `budget_cycle_days` (e.g. 30).
Affects: Budgets view period labels ("Mar 15 - Apr 14"), navigation step size, all budget queries, safe-to-spend calculation, and budget threshold notifications. Charts and History remain calendar-month based to avoid confusion.
Cycle configuration accessible via a gear icon popover next to the month nav in Budgets view.
### 6. Bulk Transaction Operations
Selection mode in History view:
- "Select" button in header bar activates selection mode
- Checkboxes appear on each transaction row
- Long-press also enters selection mode
- Action bar: "Delete (N)", "Recategorize", "Tag", "Select All", "Cancel"
- Delete shows confirmation dialog with count
- Recategorize opens a category picker, applies to all selected
- Tag opens a multi-select tag picker, applies to all selected
### 7. Monthly/Yearly Recap
Part of the new Insights view (see below). Toggle between "This Month" and "This Year".
Monthly recap: total income, expenses, net, transaction count. Per-category rows showing amount, percentage of total, and change vs previous month with directional arrows.
Yearly recap: month-by-month summary with sparklines, year-over-year comparison.
"Share as PDF" button reuses existing PDF export.
### 8. Natural Language Entry
Dedicated smart entry bar at the top of Log view and in Quick Add popup.
`adw::EntryRow` titled "Quick entry" with placeholder "e.g. Coffee 4.50 at Starbucks".
Parser (`outlay-core/src/nlp.rs`):
- `parse_transaction(input, categories) -> Option<ParsedTransaction>`
- Extracts amount (required), category (fuzzy match), note, payee (after "at"/"from"/"to")
- Patterns: "Coffee 4.50", "Lunch 12.50 at Subway", "4.50 groceries milk", "$25 gas"
Preview row shows parsed result below the entry. Press Enter to save. Existing detailed form remains below for manual entry.
### 9. Sankey Diagram
New section in Charts view after existing charts. Title: "Money Flow".
Cairo-drawn Sankey layout:
- Left nodes: income categories
- Right nodes: expense categories
- Center node: "Available" (net)
- Flow widths proportional to amounts
- Income flows colored green, expense flows use category colors
- Hover shows amount labels
Layout computation in `outlay-core/src/sankey.rs`:
- `compute_sankey_layout(income_sources, expense_categories) -> SankeyLayout`
- Returns node positions and bezier curve control points
Month navigation synced with other charts.
### 10. What-If / Sandbox Mode
Toggle button in Budgets view header bar.
When active:
- Header tinted amber, label shows "Sandbox Mode"
- All budget amounts become inline-editable
- Changes stored in temporary `HashMap<i64, f64>`, NOT written to DB
- Progress bars and safe-to-spend recalculate live
- Modified rows get a visual indicator
- "Apply Changes" button writes sandbox values to DB
- "Discard" button exits sandbox, reverts to real data
### 11. Tags UI
Database tables already exist (`tags`, `transaction_tags`). Need GTK surfaces:
- History view: tag chips in FlowBox alongside category chips (different visual style - outlined vs filled). Clicking a tag chip filters to transactions with that tag.
- Log view: tags already have an entry field. Ensure it works with `get_or_create_tag()` and `set_transaction_tags()`.
- Edit dialog: show and edit tags on existing transactions.
- Bulk operations: "Tag" action in selection mode.
### 12. Transaction Splits UI
Database tables already exist (`transaction_splits`). Need GTK surfaces:
- Log view / Edit dialog: "Split" toggle button next to category row
- When enabled: category row replaced by split list
- Each split row: category dropdown + amount entry + optional note
- "Add Split" button for more rows
- Validation: split total must equal transaction amount ("Remaining: X.XX" label)
- On save: `insert_splits()` called after transaction insert
- Edit dialog: if `has_splits()`, pre-fills split rows
### 13. Transaction Templates UI
Database tables already exist (`transaction_templates`). Need GTK surfaces:
- Log view: "Templates" icon button in header opens a popover
- Lists saved templates as `adw::ActionRow` items (name, amount, category icon, type badge)
- Tapping a template fills the log form
- "Save as Template" button at bottom of form when amount + category are filled
- Opens dialog for template name, saves via `insert_template()`
### 14. Auto-Categorization Rules UI
Database tables already exist (`categorization_rules`). Need GTK surface in Settings:
- New "Categorization Rules" `adw::PreferencesGroup` between Categories and Import/Export
- Each rule: `adw::ActionRow` showing field (Note/Payee), pattern, target category
- "Add Rule" button opens dialog: field dropdown, pattern entry, category dropdown, priority spinner
- Delete button per row
- Rules applied during import and optionally during manual entry
### 15. Searchable Category Picker
Replace all `adw::ComboRow` category dropdowns with a searchable version:
- Custom `gtk::FilterListModel` backed by `gtk::StringFilter`
- Search entry at top of dropdown popup
- Typing filters category list in real-time
- Shared utility: `fn make_searchable_category_combo(...) -> adw::ComboRow`
- Used in: log view, edit dialog, budget dialog, quick add, split rows, rules dialog
### 16. PDF Bank Statement Import
New "PDF" import button in Settings alongside existing importers.
Two-phase extraction (`outlay-core/src/import_pdf.rs`):
1. Text extraction via `pdf-extract` crate - look for tabular date/description/amount patterns
2. If no extractable text found, fall back to existing Tesseract OCR pipeline
Preview dialog shows extracted transactions in an editable list. Each row: date, description, amount, category (auto-matched via categorization rules, fallback "Uncategorized"). Import All / Import Selected buttons. Merge/replace mode toggle.
New dependency: `pdf-extract` crate.
### 17. Spending Streaks / Gamification
Dedicated Insights view (new sidebar item) with three sections:
**Streaks:**
- No-spend streak: consecutive days with zero expenses, flame icon, "Best: X days"
- Under-budget streak: consecutive months staying under total budget cap
- Savings streak: consecutive months with goal contributions
**Achievements:**
- Grid of achievement badges, earned ones colored, unearned dimmed
- Starter set: "First Transaction", "7-Day No-Spend", "30-Day No-Spend", "Month Under Budget", "3 Months Under Budget", "First Goal Completed", "100 Transactions", "Budget Streak 6mo"
- Checked and awarded on app launch
New tables: `streaks`, `achievements`.
### 18. Financial Goal Projections
Enhance existing Goals view:
- Each active goal row gets subtitle: "At current rate, reachable by [date]"
- Based on average monthly contributions over last 3 months
- States: "On track - X months ahead", "Behind schedule - need X.XX/month", "Start contributing to see projection"
- Expandable section per goal: mini line chart showing saved amount over time with projected line to target
### 19. Credit Card Billing Cycle Tracking
Dedicated Credit Cards view (new sidebar item).
**Summary card:** total balance, total limit, utilization bar, next due date.
**Card list:** each card is `adw::ExpanderRow`:
- Collapsed: name, balance, due countdown, utilization mini-bar
- Expanded: statement close date, minimum payment, payment history (last 3 months)
- Actions: "Record Payment" (creates expense transaction, reduces balance), Edit, Delete
New table: `credit_cards` (name, credit_limit, statement_close_day, due_day, min_payment_pct, current_balance, currency, color, active).
### 24. Spending Anomaly Alerts in UI
Surface existing `detect_anomalies()` in two places:
- **History view:** `adw::Banner` at top when anomalies exist for the displayed month: "N spending insights for this month". Tapping navigates to Insights view.
- **Insights view:** Anomaly Alerts section renders each anomaly as `adw::ActionRow` with warning/info icons. Clickable to navigate to category in History.
- **Startup:** toast on first launch of the day if current month has insights.
## Schema Migration (v8 -> v9)
New table: `credit_cards` - see feature #19 above.
New table: `streaks` - see feature #17 above.
New table: `achievements` - see feature #17 above.
New settings: `budget_cycle_mode`, `budget_cycle_start_day`, `budget_cycle_days`.
## New Files
- `outlay-core/src/nlp.rs` - natural language transaction parser
- `outlay-core/src/import_pdf.rs` - PDF statement import
- `outlay-core/src/sankey.rs` - Sankey layout computation
- `outlay-gtk/src/insights_view.rs` - Insights view (streaks, achievements, recap, anomalies)
- `outlay-gtk/src/credit_cards_view.rs` - Credit Cards view
## New Dependencies
- `pdf-extract` crate for PDF text extraction
## Modified Files
- `outlay-core/src/db.rs` - migration v9, new CRUD methods for credit cards / streaks / achievements / recap queries / budget period computation
- `outlay-core/src/models.rs` - new structs (CreditCard, Achievement, Streak, ParsedTransaction, SankeyLayout, etc.)
- `outlay-core/src/lib.rs` - register new modules
- `outlay-gtk/src/main.rs` - register new views, startup achievement checks
- `outlay-gtk/src/window.rs` - add Insights and Credit Cards to sidebar navigation
- `outlay-gtk/src/history_view.rs` - bulk operations, tag chips, anomaly banner
- `outlay-gtk/src/log_view.rs` - NL entry bar, templates button, split toggle
- `outlay-gtk/src/edit_dialog.rs` - splits editing, tags editing
- `outlay-gtk/src/budgets_view.rs` - custom cycle, what-if sandbox
- `outlay-gtk/src/charts_view.rs` - Sankey diagram section
- `outlay-gtk/src/goals_view.rs` - projection subtitles and mini charts
- `outlay-gtk/src/settings_view.rs` - categorization rules section, PDF import button
- `outlay-gtk/src/quick_add.rs` - NL entry bar, searchable category
- `outlay-gtk/Cargo.toml` - add pdf-extract dependency
File diff suppressed because it is too large Load Diff
-5
View File
@@ -67,11 +67,9 @@ pub fn create_backup(db: &Database, output_path: &Path) -> Result<BackupMeta, Ba
rusqlite::params![temp_db_path.to_str().unwrap()],
)?;
// Read the vacuumed database
let db_bytes = std::fs::read(&temp_db_path)?;
std::fs::remove_file(&temp_db_path)?;
// Gather metadata
let txn_count: i64 = db.conn.query_row(
"SELECT COUNT(*) FROM transactions",
[],
@@ -94,7 +92,6 @@ pub fn create_backup(db: &Database, output_path: &Path) -> Result<BackupMeta, Ba
let meta_json = serde_json::to_string_pretty(&meta)?;
// Create ZIP archive
let file = std::fs::File::create(output_path)?;
let mut zip = zip::ZipWriter::new(file);
let options = SimpleFileOptions::default()
@@ -141,7 +138,6 @@ pub fn restore_backup(backup_path: &Path, db_path: &Path) -> Result<BackupMeta,
meta
};
// Extract database
let mut db_file = archive.by_name("outlay.db").map_err(|_| {
BackupError::InvalidBackup("outlay.db not found in backup".to_string())
})?;
@@ -149,7 +145,6 @@ pub fn restore_backup(backup_path: &Path, db_path: &Path) -> Result<BackupMeta,
let mut db_bytes = Vec::new();
db_file.read_to_end(&mut db_bytes)?;
// Write the restored database
if let Some(parent) = db_path.parent() {
std::fs::create_dir_all(parent)?;
}
-16
View File
@@ -352,7 +352,6 @@ impl Database {
}
if self.get_schema_version()? < 7 {
// Add is_bill and reminder_days to recurring_transactions
let has_is_bill: bool = self.conn
.prepare("SELECT is_bill FROM recurring_transactions LIMIT 0")
.is_ok();
@@ -998,14 +997,12 @@ impl Database {
pub fn get_safe_to_spend(&self, month: &str) -> SqlResult<(f64, f64, i32)> {
use chrono::{Datelike, Local, NaiveDate};
// Total budget for this month
let total_budget: f64 = self.conn.query_row(
"SELECT COALESCE(SUM(amount), 0.0) FROM budgets WHERE month = ?1",
params![month],
|row| row.get(0),
)?;
// Total spent this month
let total_spent: f64 = self.conn.query_row(
"SELECT COALESCE(SUM(amount * exchange_rate), 0.0) FROM transactions
WHERE date LIKE ?1 AND type = 'expense'",
@@ -1013,12 +1010,10 @@ impl Database {
|row| row.get(0),
)?;
// Compute days left in the month
let today = Local::now().date_naive();
let year: i32 = month[..4].parse().unwrap_or(today.year());
let mon: u32 = month[5..7].parse().unwrap_or(today.month());
// Last day of month
let last_day = if mon == 12 {
NaiveDate::from_ymd_opt(year + 1, 1, 1)
} else {
@@ -1118,7 +1113,6 @@ impl Database {
"UPDATE recurring_transactions SET active = ?1, resume_date = NULL WHERE id = ?2",
params![active, id],
)?;
// Sync linked subscription
self.conn.execute(
"UPDATE subscriptions SET active = ?1 WHERE recurring_id = ?2",
params![active, id],
@@ -1131,7 +1125,6 @@ impl Database {
"UPDATE recurring_transactions SET active = 0, resume_date = ?1 WHERE id = ?2",
params![resume_date.map(|d| d.format("%Y-%m-%d").to_string()), id],
)?;
// Sync linked subscription
self.conn.execute(
"UPDATE subscriptions SET active = 0 WHERE recurring_id = ?1",
params![id],
@@ -1722,7 +1715,6 @@ impl Database {
"UPDATE transactions SET recurring_id = NULL WHERE recurring_id = ?1",
params![id],
)?;
// Delete linked subscriptions
self.conn.execute(
"DELETE FROM subscriptions WHERE recurring_id = ?1",
params![id],
@@ -1741,7 +1733,6 @@ impl Database {
(SELECT id FROM recurring_transactions WHERE subscription_id = ?1)",
params![id],
)?;
// Delete linked recurring transactions
self.conn.execute(
"DELETE FROM recurring_transactions WHERE subscription_id = ?1",
params![id],
@@ -1759,10 +1750,8 @@ impl Database {
sub_cat_id: i64,
name: &str,
) -> SqlResult<i64> {
// Insert the recurring transaction first
let rec_id = self.insert_recurring(rec)?;
// Create a matching subscription linked to it
let sub = NewSubscription {
name: name.to_string(),
amount: rec.amount,
@@ -1776,7 +1765,6 @@ impl Database {
};
let sub_id = self.insert_subscription(&sub)?;
// Link back: recurring -> subscription
self.conn.execute(
"UPDATE recurring_transactions SET subscription_id = ?1 WHERE id = ?2",
params![sub_id, rec_id],
@@ -1790,10 +1778,8 @@ impl Database {
sub: &NewSubscription,
expense_cat_id: i64,
) -> SqlResult<i64> {
// Insert the subscription first
let sub_id = self.insert_subscription(sub)?;
// Create a matching recurring transaction linked to it
let rec = NewRecurringTransaction {
amount: sub.amount,
transaction_type: TransactionType::Expense,
@@ -1809,7 +1795,6 @@ impl Database {
};
let rec_id = self.insert_recurring(&rec)?;
// Link back: subscription -> recurring
self.conn.execute(
"UPDATE subscriptions SET recurring_id = ?1 WHERE id = ?2",
params![rec_id, sub_id],
@@ -3526,7 +3511,6 @@ mod tests {
db.set_budget(cat_id, "2026-03", 500.0, false).unwrap();
// Add some expenses
let txn = NewTransaction {
amount: 200.0,
transaction_type: TransactionType::Expense,
-2
View File
@@ -40,13 +40,11 @@ impl<'a> ExchangeRateService<'a> {
}
}
// Fetch fresh rates
let rates = match self.fetch_from_primary(&base_lower).await {
Ok(r) => r,
Err(_) => self.fetch_from_fallback(&base_lower).await?,
};
// Cache all fetched rates
self.db.cache_rates(&base_lower, &rates)?;
rates
-2
View File
@@ -67,7 +67,6 @@ pub fn export_ofx<W: Write>(
.flatten()
.unwrap_or_else(|| "USD".to_string());
// OFX SGML headers
writeln!(writer, "OFXHEADER:100")?;
writeln!(writer, "DATA:OFXSGML")?;
writeln!(writer, "VERSION:160")?;
@@ -79,7 +78,6 @@ pub fn export_ofx<W: Write>(
writeln!(writer, "NEWFILEUID:NONE")?;
writeln!(writer)?;
// OFX body
writeln!(writer, "<OFX>")?;
writeln!(writer, "<SIGNONMSGSRSV1>")?;
writeln!(writer, "<SONRS>")?;
-12
View File
@@ -77,7 +77,6 @@ pub fn generate_monthly_report(
decorator.set_margins(15);
doc.set_page_decorator(decorator);
// Title
let title = format!(
"Outlay - {} {} Report",
month_name(month),
@@ -86,14 +85,12 @@ pub fn generate_monthly_report(
doc.push(elements::Paragraph::new(&title).styled(style::Style::new().bold().with_font_size(18)));
doc.push(elements::Break::new(1.5));
// Fetch data
let month_str = format!("{:04}-{:02}", year, month);
let transactions = db.list_transactions_by_month(year, month)?;
let mut total_income = 0.0_f64;
let mut total_expenses = 0.0_f64;
// Category breakdown
let mut category_totals: std::collections::HashMap<i64, (String, f64)> =
std::collections::HashMap::new();
@@ -118,7 +115,6 @@ pub fn generate_monthly_report(
let net = total_income - total_expenses;
// Summary section
doc.push(elements::Paragraph::new("Summary").styled(style::Style::new().bold().with_font_size(14)));
doc.push(elements::Break::new(0.5));
@@ -136,7 +132,6 @@ pub fn generate_monthly_report(
)));
doc.push(elements::Break::new(1.0));
// Category breakdown table
if !category_totals.is_empty() {
doc.push(elements::Paragraph::new("Expense Breakdown by Category").styled(
style::Style::new().bold().with_font_size(14),
@@ -146,7 +141,6 @@ pub fn generate_monthly_report(
let mut table = elements::TableLayout::new(vec![3, 2, 1]);
table.set_cell_decorator(elements::FrameCellDecorator::new(true, true, false));
// Header
table
.row()
.element(elements::Paragraph::new("Category").styled(style::Style::new().bold()))
@@ -177,7 +171,6 @@ pub fn generate_monthly_report(
doc.push(elements::Break::new(1.0));
}
// Top 5 expenses
let mut expense_txns: Vec<_> = transactions
.iter()
.filter(|t| t.transaction_type == TransactionType::Expense)
@@ -227,7 +220,6 @@ pub fn generate_monthly_report(
doc.push(elements::Break::new(1.0));
}
// Budget vs actual
let budgets = db.list_budgets_for_month(&month_str)?;
if !budgets.is_empty() {
doc.push(elements::Paragraph::new("Budget vs Actual").styled(
@@ -269,7 +261,6 @@ pub fn generate_monthly_report(
doc.push(table);
}
// Footer
doc.push(elements::Break::new(1.5));
doc.push(
elements::Paragraph::new(format!("Generated by Outlay on {}", chrono::Local::now().format("%Y-%m-%d %H:%M")))
@@ -301,7 +292,6 @@ mod tests {
let cats = db.list_categories(Some(TransactionType::Expense)).unwrap();
let income_cats = db.list_categories(Some(TransactionType::Income)).unwrap();
// Add sample transactions
let txns = vec![
NewTransaction {
amount: 45.0,
@@ -342,7 +332,6 @@ mod tests {
db.insert_transaction(txn).unwrap();
}
// Set a budget
db.set_budget(cats[0].id, "2026-03", 200.0, false).unwrap();
let tmp = std::env::temp_dir().join("outlay_test_report.pdf");
@@ -352,7 +341,6 @@ mod tests {
let metadata = std::fs::metadata(&tmp).unwrap();
assert!(metadata.len() > 100); // PDF should be non-trivial size
// Cleanup
std::fs::remove_file(&tmp).ok();
}
-3
View File
@@ -105,7 +105,6 @@ pub fn parse_transaction(input: &str, categories: &[Category]) -> Option<ParsedT
fn fuzzy_match_category<'a>(query: &str, categories: &'a [Category]) -> Option<&'a Category> {
let query_lower = query.to_lowercase();
// Exact match
if let Some(cat) = categories
.iter()
.find(|c| c.name.to_lowercase() == query_lower)
@@ -113,7 +112,6 @@ fn fuzzy_match_category<'a>(query: &str, categories: &'a [Category]) -> Option<&
return Some(cat);
}
// Prefix match
if let Some(cat) = categories
.iter()
.find(|c| c.name.to_lowercase().starts_with(&query_lower))
@@ -121,7 +119,6 @@ fn fuzzy_match_category<'a>(query: &str, categories: &'a [Category]) -> Option<&
return Some(cat);
}
// Contains match
if let Some(cat) = categories
.iter()
.find(|c| c.name.to_lowercase().contains(&query_lower))
-5
View File
@@ -17,7 +17,6 @@ pub fn compute_sankey_layout(
let padding = 4.0;
// Layout left (income) nodes
let mut left_nodes = Vec::new();
let mut y = 0.0;
let income_count = income_sources.len().max(1);
@@ -35,7 +34,6 @@ pub fn compute_sankey_layout(
y += h + padding;
}
// Layout right (expense) nodes
let mut right_nodes = Vec::new();
y = 0.0;
let expense_count = expense_categories.len().max(1);
@@ -53,11 +51,9 @@ pub fn compute_sankey_layout(
y += h + padding;
}
// Center node (net/available)
let center_height = (total_income / max_side) * available_left;
let center_y = 0.0;
// Flows from income -> center
let mut flows_in = Vec::new();
let mut from_y_cursor = 0.0;
let mut to_y_cursor = 0.0;
@@ -75,7 +71,6 @@ pub fn compute_sankey_layout(
to_y_cursor += w;
}
// Flows from center -> expenses
let mut flows_out = Vec::new();
let mut from_y_cursor = 0.0;
let mut to_y_cursor = 0.0;
-9
View File
@@ -142,17 +142,14 @@ impl BudgetsView {
nav_box.append(&next_btn);
nav_box.append(&cycle_btn);
// Summary
let summary_label = gtk::Label::new(None);
summary_label.add_css_class("dim-label");
summary_label.set_halign(gtk::Align::Center);
// Budget list
let budget_group = adw::PreferencesGroup::builder()
.title("BUDGETS")
.build();
// Add budget button
let add_btn = gtk::Button::with_label("Add Budget");
add_btn.add_css_class("suggested-action");
add_btn.add_css_class("pill");
@@ -453,7 +450,6 @@ impl BudgetsView {
});
}
// Add budget button
{
let db_ref = db.clone();
let year_ref = current_year.clone();
@@ -822,7 +818,6 @@ impl BudgetsView {
year: i32,
month: u32,
) {
// Clear existing rows
let mut rows = Vec::new();
Self::collect_action_rows(group.upcast_ref(), &mut rows);
for row in &rows {
@@ -1134,7 +1129,6 @@ impl BudgetsView {
content.set_margin_start(16);
content.set_margin_end(16);
// Category selector
let cats = db
.list_categories(Some(TransactionType::Expense))
.unwrap_or_default();
@@ -1292,7 +1286,6 @@ impl BudgetsView {
toolbar.set_content(Some(&content));
dialog.set_child(Some(&toolbar));
// Save
{
let db_ref = db.clone();
let dialog_ref = dialog.clone();
@@ -1328,7 +1321,6 @@ impl BudgetsView {
});
}
// Delete
{
let db_ref = db.clone();
let dialog_ref = dialog.clone();
@@ -1384,7 +1376,6 @@ impl BudgetsView {
if cap <= 0.0 {
label.set_label("No monthly cap set");
bar.set_value(0.0);
// Remove old warning/error classes
bar.remove_css_class("warning");
bar.remove_css_class("error");
return;
-1
View File
@@ -66,7 +66,6 @@ pub fn calendar_heatmap(db: &Database, year: i32, month: u32) -> gtk::Box {
container.append(&grid);
// Legend
let legend = gtk::Box::new(gtk::Orientation::Horizontal, 4);
legend.set_halign(gtk::Align::Center);
legend.set_margin_top(4);
-32
View File
@@ -1170,22 +1170,18 @@ impl ChartsView {
bx = bx.max(4.0);
by = by.max(4.0);
// Shadow
Self::rounded_rect(cr, bx + 2.0, by + 3.0, box_w, box_h, r);
cr.set_source_rgba(0.0, 0.0, 0.0, 0.18);
cr.fill().ok();
// Background
Self::rounded_rect(cr, bx, by, box_w, box_h, r);
cr.set_source_rgba(tc.tooltip_bg.0, tc.tooltip_bg.1, tc.tooltip_bg.2, tc.tooltip_bg.3);
cr.fill_preserve().ok();
// Border
cr.set_source_rgba(tc.tooltip_border.0, tc.tooltip_border.1, tc.tooltip_border.2, tc.tooltip_border.3);
cr.set_line_width(1.0);
cr.stroke().ok();
// Text
cr.set_source_rgb(tc.tooltip_text.0, tc.tooltip_text.1, tc.tooltip_text.2);
for (i, line) in lines.iter().enumerate() {
cr.move_to(bx + pad_x, by + pad_y + (i as f64 + 1.0) * line_height - 4.0);
@@ -1284,7 +1280,6 @@ impl ChartsView {
let gap_angle = 1.5_f64.to_radians();
// Draw segments
let mut start = -PI / 2.0;
for (idx, seg) in data.iter().enumerate() {
let frac = seg.value / total;
@@ -1355,7 +1350,6 @@ impl ChartsView {
start2 += sweep2;
}
// Center text
cr.select_font_face("JetBrains Mono", cairo::FontSlant::Normal, cairo::FontWeight::Bold);
cr.set_font_size(22.0);
cr.set_source_rgb(tc.text.0, tc.text.1, tc.text.2);
@@ -1364,7 +1358,6 @@ impl ChartsView {
cr.move_to(cx - ext.width() / 2.0, cy + ext.height() / 2.0);
cr.show_text(&total_str).ok();
// Legend
cr.select_font_face("JetBrains Mono", cairo::FontSlant::Normal, cairo::FontWeight::Normal);
cr.set_font_size(13.0);
@@ -1388,7 +1381,6 @@ impl ChartsView {
cr.show_text(&label).ok();
}
// Tooltip on hover
if hover_idx >= 0 && (hover_idx as usize) < data.len() && hover_progress > 0.1 {
let seg = &data[hover_idx as usize];
let pct = seg.value / total * 100.0;
@@ -1450,7 +1442,6 @@ impl ChartsView {
cr.select_font_face("JetBrains Mono", cairo::FontSlant::Normal, cairo::FontWeight::Normal);
// Grid lines
cr.set_font_size(13.0);
cr.set_line_width(0.5);
for i in 0..=4 {
@@ -1520,7 +1511,6 @@ impl ChartsView {
(center_x - bar_w - gap / 2.0, center_x + gap / 2.0)
};
// Income bar
let bh_inc = (bar.income / y_max * chart_h * progress).max(0.0);
let bx_inc = bx_inc_offset;
let by_inc = margin_top + chart_h - bh_inc;
@@ -1535,7 +1525,6 @@ impl ChartsView {
cr.set_source_rgba(0.0, 0.0, 0.0, 0.10);
cr.fill().ok();
// Income bar with gradient
Self::rounded_top_rect(cr, bx_inc, by_inc, bar_w, bh_inc, corner_r);
if bh_inc > 1.0 {
let grad = cairo::LinearGradient::new(0.0, by_inc, 0.0, margin_top + chart_h);
@@ -1548,7 +1537,6 @@ impl ChartsView {
}
cr.fill().ok();
// Expense bar
let bh_exp = (bar.expense / y_max * chart_h * progress).max(0.0);
let bx_exp = bx_exp_offset;
let by_exp = margin_top + chart_h - bh_exp;
@@ -1563,7 +1551,6 @@ impl ChartsView {
cr.set_source_rgba(0.0, 0.0, 0.0, 0.10);
cr.fill().ok();
// Expense bar with gradient
Self::rounded_top_rect(cr, bx_exp, by_exp, bar_w, bh_exp, corner_r);
if bh_exp > 1.0 {
let grad = cairo::LinearGradient::new(0.0, by_exp, 0.0, margin_top + chart_h);
@@ -1576,7 +1563,6 @@ impl ChartsView {
}
cr.fill().ok();
// X-axis label
cr.set_font_size(14.0);
cr.set_source_rgb(tc.text.0, tc.text.1, tc.text.2);
let ext = cr.text_extents(&bar.label).unwrap();
@@ -1584,7 +1570,6 @@ impl ChartsView {
cr.show_text(&bar.label).ok();
}
// Legend
let legend_y = h - PAD - 2.0;
cr.set_font_size(13.0);
let mut lx = margin_left;
@@ -1615,7 +1600,6 @@ impl ChartsView {
cr.show_text("Prev Year").ok();
}
// Tooltip
if let Some((idx, is_expense, is_cmp)) = hovered {
let src = if is_cmp { compare.unwrap_or(data) } else { data };
let bar = &src[idx];
@@ -1693,7 +1677,6 @@ impl ChartsView {
cr.select_font_face("JetBrains Mono", cairo::FontSlant::Normal, cairo::FontWeight::Normal);
cr.set_font_size(13.0);
// Grid
cr.set_line_width(0.5);
for i in 0..=4 {
let frac = i as f64 / 4.0;
@@ -1712,7 +1695,6 @@ impl ChartsView {
cr.show_text(&label).ok();
}
// Zero line
if y_min < 0.0 && y_max > 0.0 {
let zy = to_y(0.0);
cr.set_source_rgba(tc.text.0, tc.text.1, tc.text.2, 0.35);
@@ -1724,7 +1706,6 @@ impl ChartsView {
cr.set_dash(&[], 0.0);
}
// X-axis labels
{
cr.set_font_size(13.0);
let step = if x_range > 20.0 { 5.0 } else if x_range > 10.0 { 2.0 } else { 1.0 };
@@ -1765,7 +1746,6 @@ impl ChartsView {
let accent = tc.income;
let zero_y = to_y(0.0).clamp(margin_top, margin_top + chart_h);
// Gradient fill
{
cr.new_path();
let first_x = to_x(data[0].day);
@@ -1788,7 +1768,6 @@ impl ChartsView {
cr.fill().ok();
}
// Line
{
// Glow/shadow under the line
cr.new_path();
@@ -1811,7 +1790,6 @@ impl ChartsView {
cr.stroke().ok();
}
// Data dots
let mut hovered_pt: Option<usize> = None;
let (mx, my) = mouse;
for (i, p) in data.iter().enumerate() {
@@ -1839,7 +1817,6 @@ impl ChartsView {
cr.restore().ok();
// Tooltip (drawn after clip restore)
if let Some(idx) = hovered_pt {
let p = &data[idx];
let l1 = format!("Day {}", p.day as i32);
@@ -2013,7 +1990,6 @@ impl ChartsView {
let n = data.len();
let step = if n > 1 { chart_w / (n - 1) as f64 } else { chart_w };
// Grid lines
cr.set_source_rgb(tc.grid.0, tc.grid.1, tc.grid.2);
cr.set_line_width(0.5);
for i in 0..5 {
@@ -2031,7 +2007,6 @@ impl ChartsView {
cr.set_source_rgb(tc.grid.0, tc.grid.1, tc.grid.2);
}
// Zero line
let zero_y = val_to_y(0.0);
if zero_y >= chart_top && zero_y <= chart_bottom {
cr.set_source_rgb(tc.text_secondary.0, tc.text_secondary.1, tc.text_secondary.2);
@@ -2041,14 +2016,12 @@ impl ChartsView {
let _ = cr.stroke();
}
// Compute points
let points: Vec<(f64, f64)> = data.iter().enumerate().map(|(i, p)| {
let x = chart_left + i as f64 * step;
let y = val_to_y(p.value * progress);
(x, y)
}).collect();
// Fill area between smooth curve and zero
if points.len() >= 2 {
let zy = val_to_y(0.0).clamp(chart_top, chart_bottom);
let smooth = Self::monotone_subdivide(&points, 16);
@@ -2070,7 +2043,6 @@ impl ChartsView {
let _ = cr.close_path();
let _ = cr.fill();
// Draw smooth line stroke
cr.set_line_width(2.5);
if net_sum >= 0.0 {
cr.set_source_rgb(tc.income.0, tc.income.1, tc.income.2);
@@ -2083,7 +2055,6 @@ impl ChartsView {
}
let _ = cr.stroke();
// Draw points
for (i, &(x, y)) in points.iter().enumerate() {
let val = data[i].value;
if val >= 0.0 {
@@ -2096,7 +2067,6 @@ impl ChartsView {
}
}
// X-axis labels
cr.set_font_size(12.0);
cr.set_source_rgb(tc.text_secondary.0, tc.text_secondary.1, tc.text_secondary.2);
for (i, p) in data.iter().enumerate() {
@@ -2105,7 +2075,6 @@ impl ChartsView {
let _ = cr.show_text(&p.label);
}
// Tooltip on hover
if mouse.0 >= chart_left && mouse.0 <= chart_right && mouse.1 >= chart_top && mouse.1 <= chart_bottom {
let idx = ((mouse.0 - chart_left) / step + 0.5) as usize;
if idx < data.len() {
@@ -2121,7 +2090,6 @@ impl ChartsView {
let tx = (px - tw / 2.0).clamp(chart_left, chart_right - tw);
let ty = py - th - 10.0;
// Background
Self::rounded_rect(cr, tx, ty, tw, th, 6.0);
cr.set_source_rgba(tc.tooltip_bg.0, tc.tooltip_bg.1, tc.tooltip_bg.2, tc.tooltip_bg.3);
let _ = cr.fill_preserve();
-9
View File
@@ -22,7 +22,6 @@ impl CreditCardsView {
inner.set_margin_top(20);
inner.set_margin_bottom(20);
// Summary card
let summary_group = adw::PreferencesGroup::builder()
.title("SUMMARY")
.build();
@@ -61,18 +60,15 @@ impl CreditCardsView {
summary_group.add(&total_limit_row);
summary_group.add(&utilization_row);
// Cards list
let cards_group = adw::PreferencesGroup::builder()
.title("CARDS")
.build();
// Populate
Self::populate_cards(
&db, &cards_group, &toast_overlay,
&balance_label, &limit_label, &util_bar, &util_label,
);
// Add card button
let add_btn = gtk::Button::with_label("Add Card");
add_btn.add_css_class("pill");
add_btn.set_halign(gtk::Align::Center);
@@ -120,7 +116,6 @@ impl CreditCardsView {
util_bar: &gtk::LevelBar,
util_label: &gtk::Label,
) {
// Remove existing rows
while let Some(child) = group.first_child() {
if let Some(inner) = child.first_child() {
if let Some(listbox) = inner.downcast_ref::<gtk::ListBox>() {
@@ -242,7 +237,6 @@ impl CreditCardsView {
btn_row.set_child(Some(&btn_box));
expander.add_row(&btn_row);
// Wire payment
{
let card_id = card.id;
let card_name = card.name.clone();
@@ -261,7 +255,6 @@ impl CreditCardsView {
});
}
// Wire edit
{
let card_id = card.id;
let db_ref = db.clone();
@@ -279,7 +272,6 @@ impl CreditCardsView {
});
}
// Wire delete
{
let card_id = card.id;
let db_ref = db.clone();
@@ -321,7 +313,6 @@ impl CreditCardsView {
group.add(&expander);
}
// Update summary
balance_label.set_label(&format!("{:.2}", total_balance));
limit_label.set_label(&format!("{:.2}", total_limit));
let util = if total_limit > 0.0 { total_balance / total_limit } else { 0.0 };
-10
View File
@@ -47,7 +47,6 @@ pub fn show_edit_dialog(
.subtitle(type_label)
.build();
// Amount
let amount_row = adw::EntryRow::builder()
.title("Amount")
.text(&format!("{:.2}", txn.amount))
@@ -55,7 +54,6 @@ pub fn show_edit_dialog(
amount_row.set_input_purpose(gtk::InputPurpose::Number);
crate::numpad::attach_numpad(&amount_row);
// Category selector
let cat_model = gtk::StringList::new(&[]);
let mut cat_ids: Vec<i64> = Vec::new();
let mut cat_selected: u32 = 0;
@@ -82,7 +80,6 @@ pub fn show_edit_dialog(
cat_row.set_list_factory(Some(&make_category_factory()));
let cat_ids = Rc::new(cat_ids);
// Date
let date_fmt = db.get_date_format_string();
let selected_date = Rc::new(Cell::new(txn.date));
let date_label = gtk::Label::new(Some(&txn.date.format(&date_fmt).to_string()));
@@ -134,19 +131,16 @@ pub fn show_edit_dialog(
popover_ref.popdown();
});
// Payee
let payee_row = adw::EntryRow::builder()
.title("Payee (optional)")
.text(txn.payee.as_deref().unwrap_or(""))
.build();
// Note
let note_row = adw::EntryRow::builder()
.title("Note (optional)")
.text(txn.note.as_deref().unwrap_or(""))
.build();
// Tags
let existing_tags = db.get_transaction_tags(txn_id)
.unwrap_or_default()
.iter()
@@ -246,7 +240,6 @@ pub fn show_edit_dialog(
form_group.add(&note_row);
form_group.add(&tags_row);
// Buttons
let btn_box = gtk::Box::new(gtk::Orientation::Horizontal, 12);
btn_box.set_halign(gtk::Align::Center);
btn_box.set_margin_top(8);
@@ -496,7 +489,6 @@ pub fn show_edit_dialog(
let on_changed = Rc::new(on_changed);
// Wire save
{
let db_ref = db.clone();
let dialog_ref = dialog.clone();
@@ -564,7 +556,6 @@ pub fn show_edit_dialog(
match db_ref.update_transaction(&updated) {
Ok(()) => {
// Save tags
let mut tag_ids = Vec::new();
for name in &tag_names {
if let Ok(tid) = db_ref.get_or_create_tag(name) {
@@ -573,7 +564,6 @@ pub fn show_edit_dialog(
}
let _ = db_ref.set_transaction_tags(txn_clone.id, &tag_ids);
// Save splits
let _ = db_ref.delete_splits(txn_clone.id);
let entries = split_entries_ref.borrow();
if !entries.is_empty() {
-2
View File
@@ -24,7 +24,6 @@ impl ForecastView {
.ok().flatten()
.unwrap_or_else(|| "USD".to_string());
// Forecast summary card
let summary_card = gtk::Box::new(gtk::Orientation::Vertical, 4);
summary_card.add_css_class("card");
summary_card.set_margin_start(4);
@@ -47,7 +46,6 @@ impl ForecastView {
summary_card.append(&summary_title);
summary_card.append(&summary_detail);
// Monthly forecast table
let forecast_group = adw::PreferencesGroup::builder()
.title("MONTHLY PROJECTION")
.build();
-6
View File
@@ -20,18 +20,15 @@ impl GoalsView {
inner.set_margin_top(20);
inner.set_margin_bottom(20);
// Active goals group
let active_group = adw::PreferencesGroup::builder()
.title("SAVINGS GOALS")
.build();
// Completed goals group
let completed_group = adw::PreferencesGroup::builder()
.title("COMPLETED")
.build();
completed_group.set_visible(false);
// Add goal button
let add_btn = gtk::Button::with_label("Add Goal");
add_btn.add_css_class("suggested-action");
add_btn.add_css_class("pill");
@@ -74,7 +71,6 @@ impl GoalsView {
completed_group: &adw::PreferencesGroup,
toast_overlay: &adw::ToastOverlay,
) {
// Clear existing rows
Self::clear_group(active_group);
Self::clear_group(completed_group);
@@ -484,7 +480,6 @@ impl GoalsView {
toolbar.set_content(Some(&content));
dialog.set_child(Some(&toolbar));
// Save
{
let db_ref = db.clone();
let dialog_ref = dialog.clone();
@@ -529,7 +524,6 @@ impl GoalsView {
});
}
// Delete
{
let db_ref = db.clone();
let dialog_ref = dialog.clone();
-2
View File
@@ -808,7 +808,6 @@ impl HistoryView {
action_bar: Option<&gtk::ActionBar>,
action_count_label: Option<&gtk::Label>,
) {
// Clear existing children
while let Some(child) = list_container.first_child() {
list_container.remove(&child);
}
@@ -1200,7 +1199,6 @@ impl HistoryView {
updating: &Rc<Cell<bool>>,
no_results_page: &adw::StatusPage,
) {
// Clear existing chips
while let Some(child) = chips_box.first_child() {
chips_box.remove(&child);
}
-1
View File
@@ -381,7 +381,6 @@ impl InsightsView {
header.add_css_class("property");
list.append(&header);
// Category breakdown
for cat in &recap.categories {
let icon_name = cat.category_icon.as_deref().unwrap_or("folder-symbolic");
let row = adw::ActionRow::builder()
-8
View File
@@ -428,7 +428,6 @@ impl LogView {
form_group.add(&category_row);
// Currency
let currency_labels: Vec<String> = currencies
.iter()
.map(|(code, name)| format!("{} - {}", code, name))
@@ -450,7 +449,6 @@ impl LogView {
rate_label.set_margin_start(16);
rate_label.set_visible(false);
// Date picker
let date_fmt = db.get_date_format_string();
let today_date = chrono::Local::now().date_naive();
let selected_date = Rc::new(Cell::new(today_date));
@@ -537,25 +535,21 @@ impl LogView {
form_group.add(&date_row);
// Payee
let payee_row = adw::EntryRow::builder()
.title("Payee (optional)")
.build();
form_group.add(&payee_row);
// Note
let note_row = adw::EntryRow::builder()
.title("Note (optional)")
.build();
form_group.add(&note_row);
// Tags
let tags_row = adw::EntryRow::builder()
.title("Tags (comma-separated)")
.build();
form_group.add(&tags_row);
// Split toggle
let split_switch = adw::SwitchRow::builder()
.title("Split across categories")
.build();
@@ -1202,7 +1196,6 @@ impl LogView {
}
pending_do.borrow_mut().clear();
// Save tags
if !tag_names.is_empty() {
let mut tag_ids = Vec::new();
for name in &tag_names {
@@ -1213,7 +1206,6 @@ impl LogView {
let _ = db_ref.set_transaction_tags(new_id, &tag_ids);
}
// Save splits
if !splits.is_empty() {
let _ = db_ref.insert_splits(new_id, &splits);
}
-10
View File
@@ -30,7 +30,6 @@ pub fn show_quick_add(db: &Rc<Database>, parent_window: Option<&impl IsA<gtk::Wi
content.set_margin_top(12);
content.set_margin_bottom(16);
// Type toggle
let is_income = Rc::new(Cell::new(false));
let type_box = gtk::Box::new(gtk::Orientation::Horizontal, 0);
type_box.set_halign(gtk::Align::Center);
@@ -52,7 +51,6 @@ pub fn show_quick_add(db: &Rc<Database>, parent_window: Option<&impl IsA<gtk::Wi
});
}
// Amount entry
let amount_group = adw::PreferencesGroup::new();
let amount_row = adw::EntryRow::builder()
.title("Amount")
@@ -61,7 +59,6 @@ pub fn show_quick_add(db: &Rc<Database>, parent_window: Option<&impl IsA<gtk::Wi
amount_group.add(&amount_row);
content.append(&amount_group);
// Category
let cat_group = adw::PreferencesGroup::new();
let expense_cats = db
.list_categories(Some(TransactionType::Expense))
@@ -123,7 +120,6 @@ pub fn show_quick_add(db: &Rc<Database>, parent_window: Option<&impl IsA<gtk::Wi
});
}
// Note entry
let note_group = adw::PreferencesGroup::new();
let note_row = adw::EntryRow::builder()
.title("Note (optional)")
@@ -131,7 +127,6 @@ pub fn show_quick_add(db: &Rc<Database>, parent_window: Option<&impl IsA<gtk::Wi
note_group.add(&note_row);
content.append(&note_group);
// Save button
let save_btn = gtk::Button::with_label("Save");
save_btn.add_css_class("suggested-action");
save_btn.add_css_class("pill");
@@ -252,7 +247,6 @@ pub fn show_quick_add_popup(db: &Rc<Database>, app: &adw::Application) {
content.set_margin_top(12);
content.set_margin_bottom(16);
// Type toggle
let is_income = Rc::new(Cell::new(false));
let type_box = gtk::Box::new(gtk::Orientation::Horizontal, 0);
type_box.set_halign(gtk::Align::Center);
@@ -274,7 +268,6 @@ pub fn show_quick_add_popup(db: &Rc<Database>, app: &adw::Application) {
});
}
// Amount entry
let amount_group = adw::PreferencesGroup::new();
let amount_row = adw::EntryRow::builder()
.title("Amount")
@@ -283,7 +276,6 @@ pub fn show_quick_add_popup(db: &Rc<Database>, app: &adw::Application) {
amount_group.add(&amount_row);
content.append(&amount_group);
// Category
let cat_group = adw::PreferencesGroup::new();
let expense_cats = db
.list_categories(Some(TransactionType::Expense))
@@ -345,7 +337,6 @@ pub fn show_quick_add_popup(db: &Rc<Database>, app: &adw::Application) {
});
}
// Note entry
let note_group = adw::PreferencesGroup::new();
let note_row = adw::EntryRow::builder()
.title("Note (optional)")
@@ -353,7 +344,6 @@ pub fn show_quick_add_popup(db: &Rc<Database>, app: &adw::Application) {
note_group.add(&note_row);
content.append(&note_group);
// Save button
let save_btn = gtk::Button::with_label("Save");
save_btn.add_css_class("suggested-action");
save_btn.add_css_class("pill");
-17
View File
@@ -35,19 +35,16 @@ impl RecurringView {
inner.set_margin_top(20);
inner.set_margin_bottom(20);
// Active section
let active_group = adw::PreferencesGroup::builder()
.title("ACTIVE")
.build();
// Paused section
let paused_group = adw::PreferencesGroup::builder()
.title("PAUSED")
.build();
let on_change: ChangeCb = Rc::new(RefCell::new(None));
// Add button
let add_btn = gtk::Button::with_label("Add Recurring");
add_btn.add_css_class("suggested-action");
add_btn.add_css_class("pill");
@@ -56,7 +53,6 @@ impl RecurringView {
Self::load_recurring(&db, &active_group, &paused_group, &toast_overlay, &on_change);
// Wire add button
{
let db_ref = db.clone();
let active_ref = active_group.clone();
@@ -288,7 +284,6 @@ impl RecurringView {
step1.set_margin_start(16);
step1.set_margin_end(16);
// Type toggle
let type_box = gtk::Box::new(gtk::Orientation::Horizontal, 0);
type_box.add_css_class("linked");
type_box.set_halign(gtk::Align::Center);
@@ -306,7 +301,6 @@ impl RecurringView {
let form1 = adw::PreferencesGroup::new();
// Amount
let amount_row = adw::EntryRow::builder()
.title("Amount")
.build();
@@ -314,7 +308,6 @@ impl RecurringView {
crate::numpad::attach_numpad(&amount_row);
form1.add(&amount_row);
// Category
let category_model = gtk::StringList::new(&[]);
let category_ids: Rc<RefCell<Vec<i64>>> = Rc::new(RefCell::new(Vec::new()));
let category_row = adw::ComboRow::builder()
@@ -326,7 +319,6 @@ impl RecurringView {
Self::populate_categories(db, &category_model, &category_ids, TransactionType::Expense);
form1.add(&category_row);
// Frequency
let freq_labels = ["Daily", "Weekly", "Biweekly", "Monthly", "Yearly"];
let freq_model = gtk::StringList::new(&freq_labels);
let freq_row = adw::ComboRow::builder()
@@ -385,7 +377,6 @@ impl RecurringView {
let form2 = adw::PreferencesGroup::new();
// Currency
let base_currency = db
.get_setting("base_currency")
.ok()
@@ -419,7 +410,6 @@ impl RecurringView {
let (end_row, end_date_label) = crate::date_picker::make_date_row("End Date (optional)", "");
form2.add(&end_row);
// Note
let note_row = adw::EntryRow::builder()
.title("Note (optional)")
.build();
@@ -544,7 +534,6 @@ impl RecurringView {
toolbar.set_content(Some(&scroll));
dialog.set_child(Some(&toolbar));
// Wire save
{
let db_ref = db.clone();
let dialog_ref = dialog.clone();
@@ -704,7 +693,6 @@ impl RecurringView {
let form = adw::PreferencesGroup::new();
// Amount
let amount_row = adw::EntryRow::builder()
.title("Amount")
.text(&format!("{:.2}", rec.amount))
@@ -713,7 +701,6 @@ impl RecurringView {
crate::numpad::attach_numpad(&amount_row);
form.add(&amount_row);
// Frequency
let freq_labels = ["Daily", "Weekly", "Biweekly", "Monthly", "Yearly"];
let freq_model = gtk::StringList::new(&freq_labels);
let freq_idx = match rec.frequency {
@@ -740,7 +727,6 @@ impl RecurringView {
let (end_row, end_date_label) = crate::date_picker::make_date_row("End Date (optional)", &end_str);
form.add(&end_row);
// Note
let note_row = adw::EntryRow::builder()
.title("Note (optional)")
.text(rec.note.as_deref().unwrap_or(""))
@@ -772,7 +758,6 @@ impl RecurringView {
});
}
// Buttons
let btn_box = gtk::Box::new(gtk::Orientation::Horizontal, 12);
btn_box.set_halign(gtk::Align::Center);
@@ -797,7 +782,6 @@ impl RecurringView {
toolbar.set_content(Some(&content));
dialog.set_child(Some(&toolbar));
// Save
{
let db_ref = db.clone();
let dialog_ref = dialog.clone();
@@ -1034,7 +1018,6 @@ impl RecurringView {
});
}
// Delete
{
let db_ref = db.clone();
let dialog_ref = dialog.clone();
-21
View File
@@ -1244,14 +1244,12 @@ impl SettingsView {
let form = adw::PreferencesGroup::new();
// Name row
let name_row = adw::EntryRow::builder()
.title("Name")
.text(&cat.name)
.build();
form.add(&name_row);
// Icon row
let selected_icon: Rc<RefCell<Option<String>>> = Rc::new(RefCell::new(cat.icon.clone()));
let initial_icon = icon_theme::resolve_category_icon(&cat.icon, &cat.color)
@@ -1287,7 +1285,6 @@ impl SettingsView {
}
form.add(&icon_row);
// Color row
let current_color = cat.color.as_deref()
.and_then(|hex| {
let hex = hex.trim_start_matches('#');
@@ -1401,7 +1398,6 @@ impl SettingsView {
let form = adw::PreferencesGroup::new();
// Name row
let name_row = adw::EntryRow::builder()
.title("Name")
.build();
@@ -2059,11 +2055,9 @@ impl SettingsView {
db.execute_raw(&format!("VACUUM INTO '{}'", path_str.replace('\'', "''")))
.map_err(|e| format!("Backup failed: {}", e))?;
// Update last backup timestamp
let _ = db.set_setting("auto_backup_last", &now.format("%Y-%m-%d %H:%M").to_string());
let _ = db.set_setting("last_backup_date", &now.format("%Y-%m-%d").to_string());
// Prune old backups
let retention = db.get_setting("auto_backup_retention")
.ok().flatten()
.and_then(|v| v.parse::<usize>().ok())
@@ -2779,7 +2773,6 @@ impl SettingsView {
group: &adw::PreferencesGroup,
toast_overlay: &adw::ToastOverlay,
) {
// Remove existing rows
let mut rows_to_remove = Vec::new();
let mut child = group.first_child();
while let Some(widget) = child {
@@ -2860,7 +2853,6 @@ impl SettingsView {
let form = adw::PreferencesGroup::new();
// Type selector
let type_model = gtk::StringList::new(&["Expense", "Income"]);
let type_row = adw::ComboRow::builder()
.title("Type")
@@ -2876,13 +2868,11 @@ impl SettingsView {
.build();
form.add(&field_row);
// Pattern
let pattern_row = adw::EntryRow::builder()
.title("Contains text")
.build();
form.add(&pattern_row);
// Category
let cat_model = gtk::StringList::new(&[]);
let cat_ids: Rc<RefCell<Vec<i64>>> = Rc::new(RefCell::new(Vec::new()));
if let Ok(cats) = db.list_categories(Some(TransactionType::Expense)) {
@@ -2995,7 +2985,6 @@ impl SettingsView {
group: &adw::PreferencesGroup,
toast_overlay: &adw::ToastOverlay,
) {
// Remove existing rows
let mut rows_to_remove = Vec::new();
let mut child = group.first_child();
while let Some(widget) = child {
@@ -3082,13 +3071,11 @@ impl SettingsView {
let form = adw::PreferencesGroup::new();
// Name
let name_row = adw::EntryRow::builder()
.title("Template name")
.build();
form.add(&name_row);
// Type
let type_model = gtk::StringList::new(&["Expense", "Income"]);
let type_row = adw::ComboRow::builder()
.title("Type")
@@ -3096,7 +3083,6 @@ impl SettingsView {
.build();
form.add(&type_row);
// Amount (optional)
let amount_row = adw::EntryRow::builder()
.title("Amount (optional)")
.build();
@@ -3104,7 +3090,6 @@ impl SettingsView {
crate::numpad::attach_numpad(&amount_row);
form.add(&amount_row);
// Category
let cat_model = gtk::StringList::new(&[]);
let cat_ids: Rc<RefCell<Vec<i64>>> = Rc::new(RefCell::new(Vec::new()));
if let Ok(cats) = db.list_categories(Some(TransactionType::Expense)) {
@@ -3137,7 +3122,6 @@ impl SettingsView {
} else {
TransactionType::Income
};
// Clear existing
let n = cat_model.n_items();
if n > 0 {
cat_model.splice(0, n, &[] as &[&str]);
@@ -3157,13 +3141,11 @@ impl SettingsView {
});
}
// Payee (optional)
let payee_row = adw::EntryRow::builder()
.title("Payee (optional)")
.build();
form.add(&payee_row);
// Note (optional)
let note_row = adw::EntryRow::builder()
.title("Note (optional)")
.build();
@@ -3340,13 +3322,11 @@ impl SettingsView {
let form = adw::PreferencesGroup::new();
// Name
let name_row = adw::EntryRow::builder()
.title("Name")
.build();
form.add(&name_row);
// Icon
let icon_row = adw::ActionRow::builder()
.title("Icon")
.subtitle("None")
@@ -3369,7 +3349,6 @@ impl SettingsView {
}
form.add(&icon_row);
// Color
let color_btn = gtk::ColorDialogButton::new(Some(gtk::ColorDialog::new()));
color_btn.set_valign(gtk::Align::Center);
let default_color = gdk::RGBA::parse("#95a5a6").unwrap_or(gdk::RGBA::BLACK);
-3
View File
@@ -42,7 +42,6 @@ pub fn sparkline_widget(data: &[f64], width: i32, height: i32) -> gtk::DrawingAr
(0.42, 0.75, 0.45) // Green-ish for expenses going down
};
// Build points
let step = if data.len() > 1 { chart_w / (data.len() - 1) as f64 } else { chart_w };
let points: Vec<(f64, f64)> = data.iter().enumerate().map(|(i, &val)| {
let x = padding + i as f64 * step;
@@ -50,7 +49,6 @@ pub fn sparkline_widget(data: &[f64], width: i32, height: i32) -> gtk::DrawingAr
(x, y)
}).collect();
// Fill area under curve
ctx.move_to(points[0].0, h - padding);
for &(x, y) in &points {
ctx.line_to(x, y);
@@ -60,7 +58,6 @@ pub fn sparkline_widget(data: &[f64], width: i32, height: i32) -> gtk::DrawingAr
ctx.set_source_rgba(r, g, b, 0.15);
let _ = ctx.fill();
// Draw line
ctx.move_to(points[0].0, points[0].1);
for &(x, y) in points.iter().skip(1) {
ctx.line_to(x, y);
-22
View File
@@ -72,12 +72,10 @@ impl SubscriptionsView {
cost_card.append(&monthly_label);
cost_card.append(&yearly_label);
// Active subscriptions group
let active_group = adw::PreferencesGroup::builder()
.title("ACTIVE SUBSCRIPTIONS")
.build();
// Paused subscriptions group
let paused_group = adw::PreferencesGroup::builder()
.title("PAUSED SUBSCRIPTIONS")
.build();
@@ -90,7 +88,6 @@ impl SubscriptionsView {
&toast_overlay, &on_change,
);
// Add button
let add_btn = gtk::Button::with_label("Add Subscription");
add_btn.add_css_class("suggested-action");
add_btn.add_css_class("pill");
@@ -265,7 +262,6 @@ impl SubscriptionsView {
equiv_label.add_css_class("dim-label");
suffix_box.append(&equiv_label);
// Pause/resume button
let pause_btn = if sub.active {
let btn = gtk::Button::from_icon_name("tabler-player-pause");
btn.set_tooltip_text(Some("Pause"));
@@ -298,7 +294,6 @@ impl SubscriptionsView {
}
suffix_box.append(&pause_btn);
// Edit button
let edit_btn = gtk::Button::from_icon_name("tabler-edit");
edit_btn.add_css_class("flat");
edit_btn.set_tooltip_text(Some("Edit"));
@@ -322,7 +317,6 @@ impl SubscriptionsView {
}
suffix_box.append(&edit_btn);
// Delete button
let del_btn = gtk::Button::from_icon_name("tabler-trash");
del_btn.add_css_class("flat");
del_btn.set_tooltip_text(Some("Delete"));
@@ -386,13 +380,11 @@ impl SubscriptionsView {
let form1 = adw::PreferencesGroup::new();
// Name
let name_row = adw::EntryRow::builder()
.title("Name")
.build();
form1.add(&name_row);
// Amount
let amount_row = adw::EntryRow::builder()
.title("Amount")
.build();
@@ -400,7 +392,6 @@ impl SubscriptionsView {
crate::numpad::attach_numpad(&amount_row);
form1.add(&amount_row);
// Category
let cat_model = gtk::StringList::new(&[]);
let cat_ids: Rc<RefCell<Vec<i64>>> = Rc::new(RefCell::new(Vec::new()));
if let Ok(cats) = db.list_subscription_categories() {
@@ -422,7 +413,6 @@ impl SubscriptionsView {
cat_row.set_list_factory(Some(&Self::make_category_factory()));
form1.add(&cat_row);
// Frequency
let freq_labels = ["Daily", "Weekly", "Biweekly", "Monthly", "Yearly"];
let freq_model = gtk::StringList::new(&freq_labels);
let freq_row = adw::ComboRow::builder()
@@ -454,7 +444,6 @@ impl SubscriptionsView {
let form2 = adw::PreferencesGroup::new();
// Currency
let base_cur = db.get_setting("base_currency")
.ok().flatten()
.unwrap_or_else(|| "USD".to_string());
@@ -477,18 +466,15 @@ impl SubscriptionsView {
.build();
form2.add(&currency_row);
// Start date
let today_str = chrono::Local::now().date_naive().format("%Y-%m-%d").to_string();
let (start_row, start_date_label) = crate::date_picker::make_date_row("Start date", &today_str);
form2.add(&start_row);
// Note (optional)
let note_row = adw::EntryRow::builder()
.title("Note (optional)")
.build();
form2.add(&note_row);
// URL (optional)
let url_row = adw::EntryRow::builder()
.title("URL (optional)")
.build();
@@ -688,14 +674,12 @@ impl SubscriptionsView {
let form = adw::PreferencesGroup::new();
// Name
let name_row = adw::EntryRow::builder()
.title("Name")
.text(&sub.name)
.build();
form.add(&name_row);
// Amount
let amount_row = adw::EntryRow::builder()
.title("Amount")
.text(&format!("{:.2}", sub.amount))
@@ -704,7 +688,6 @@ impl SubscriptionsView {
crate::numpad::attach_numpad(&amount_row);
form.add(&amount_row);
// Currency
let mut currencies = ExchangeRateService::supported_currencies();
let base_cur = db.get_setting("base_currency")
.ok().flatten()
@@ -728,7 +711,6 @@ impl SubscriptionsView {
.build();
form.add(&currency_row);
// Frequency
let freq_labels = ["Daily", "Weekly", "Biweekly", "Monthly", "Yearly"];
let freq_model = gtk::StringList::new(&freq_labels);
let selected_freq = match sub.frequency {
@@ -745,7 +727,6 @@ impl SubscriptionsView {
.build();
form.add(&freq_row);
// Category
let cat_model = gtk::StringList::new(&[]);
let cat_ids: Rc<RefCell<Vec<i64>>> = Rc::new(RefCell::new(Vec::new()));
let mut selected_cat = 0u32;
@@ -772,19 +753,16 @@ impl SubscriptionsView {
cat_row.set_list_factory(Some(&Self::make_category_factory()));
form.add(&cat_row);
// Start date
let start_str = sub.start_date.format("%Y-%m-%d").to_string();
let (start_row, start_date_label) = crate::date_picker::make_date_row("Start date", &start_str);
form.add(&start_row);
// Note (optional)
let note_row = adw::EntryRow::builder()
.title("Note (optional)")
.text(sub.note.as_deref().unwrap_or(""))
.build();
form.add(&note_row);
// URL (optional)
let url_row = adw::EntryRow::builder()
.title("URL (optional)")
.text(sub.url.as_deref().unwrap_or(""))
-12
View File
@@ -83,7 +83,6 @@ impl MainWindow {
let content_stack = gtk::Stack::new();
content_stack.set_transition_type(gtk::StackTransitionType::Crossfade);
// Log view
let log_view = Rc::new(LogView::new(db.clone(), app));
let log_scroll = gtk::ScrolledWindow::builder()
.hscrollbar_policy(gtk::PolicyType::Never)
@@ -92,7 +91,6 @@ impl MainWindow {
log_view.toast_overlay.set_child(Some(&log_scroll));
content_stack.add_named(&log_view.toast_overlay, Some("log"));
// History view
let history_view = HistoryView::new(db.clone());
let history_scroll = gtk::ScrolledWindow::builder()
.hscrollbar_policy(gtk::PolicyType::Never)
@@ -100,23 +98,18 @@ impl MainWindow {
.build();
content_stack.add_named(&history_scroll, Some("history"));
// Charts view
let charts_view = ChartsView::new(db.clone());
content_stack.add_named(&charts_view.container, Some("charts"));
// Budgets view
let budgets_view = BudgetsView::new(db.clone());
content_stack.add_named(&budgets_view.container, Some("budgets"));
// Goals view
let goals_view = GoalsView::new(db.clone());
content_stack.add_named(&goals_view.container, Some("goals"));
// Recurring view
let recurring_view = Rc::new(RecurringView::new(db.clone()));
content_stack.add_named(&recurring_view.container, Some("recurring"));
// Subscriptions view
let subscriptions_view = Rc::new(SubscriptionsView::new(db.clone()));
content_stack.add_named(&subscriptions_view.container, Some("subscriptions"));
@@ -134,23 +127,18 @@ impl MainWindow {
});
}
// Wishlist view
let wishlist_view = WishlistView::new(db.clone());
content_stack.add_named(&wishlist_view.container, Some("wishlist"));
// Forecast view
let forecast_view = ForecastView::new(db.clone());
content_stack.add_named(&forecast_view.container, Some("forecast"));
// Insights view
let insights_view = InsightsView::new(db.clone());
content_stack.add_named(&insights_view.container, Some("insights"));
// Credit Cards view
let credit_cards_view = CreditCardsView::new(db.clone());
content_stack.add_named(&credit_cards_view.container, Some("creditcards"));
// Settings view
let settings_view = SettingsView::new(db.clone(), app);
content_stack.add_named(&settings_view.container, Some("settings"));
-4
View File
@@ -22,7 +22,6 @@ impl WishlistView {
inner.set_margin_top(20);
inner.set_margin_bottom(20);
// Total card
let total_card = gtk::Box::new(gtk::Orientation::Vertical, 4);
total_card.add_css_class("card");
total_card.set_margin_start(4);
@@ -49,19 +48,16 @@ impl WishlistView {
total_card.append(&total_title);
total_card.append(&total_label);
// Active items
let active_group = adw::PreferencesGroup::builder()
.title("WANTED")
.build();
// Purchased items
let purchased_group = adw::PreferencesGroup::builder()
.title("PURCHASED")
.build();
Self::load_items(&db, &active_group, &purchased_group, &total_label, &base_currency, &toast_overlay);
// Add button
let add_btn = gtk::Button::with_label("Add Item");
add_btn.add_css_class("suggested-action");
add_btn.add_css_class("pill");