Add desktop integration files and window state persistence
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" width="128" height="128">
|
||||
<defs>
|
||||
<linearGradient id="bg" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0%" stop-color="#3584e4"/>
|
||||
<stop offset="100%" stop-color="#1a73e8"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<!-- Background circle -->
|
||||
<circle cx="64" cy="64" r="60" fill="url(#bg)"/>
|
||||
<!-- Wallet body -->
|
||||
<rect x="24" y="38" width="72" height="52" rx="8" fill="#ffffff" opacity="0.95"/>
|
||||
<!-- Wallet flap -->
|
||||
<path d="M24 50 Q24 38 36 38 L88 38 Q96 38 96 46 L96 50 Z" fill="#e8e8e8"/>
|
||||
<!-- Coin circle -->
|
||||
<circle cx="82" cy="64" r="14" fill="#f5c211" stroke="#e0a800" stroke-width="2"/>
|
||||
<!-- Dollar sign on coin -->
|
||||
<text x="82" y="70" font-family="sans-serif" font-size="18" font-weight="bold" fill="#8b6914" text-anchor="middle">$</text>
|
||||
<!-- Arrow out (expense indicator) -->
|
||||
<path d="M40 64 L54 54 L54 58 L66 58 L66 70 L54 70 L54 74 Z" fill="#2ec27e" opacity="0.9"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1015 B |
9
outlay-gtk/data/io.github.outlay.desktop
Normal file
9
outlay-gtk/data/io.github.outlay.desktop
Normal file
@@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Name=Outlay
|
||||
Comment=Personal income and expense logger
|
||||
Exec=outlay-gtk
|
||||
Icon=io.github.outlay
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Office;Finance;
|
||||
Keywords=expense;budget;money;finance;income;
|
||||
14
outlay-gtk/data/io.github.outlay.gschema.xml
Normal file
14
outlay-gtk/data/io.github.outlay.gschema.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schemalist>
|
||||
<schema id="io.github.outlay" path="/io/github/outlay/">
|
||||
<key name="window-width" type="i">
|
||||
<default>900</default>
|
||||
</key>
|
||||
<key name="window-height" type="i">
|
||||
<default>600</default>
|
||||
</key>
|
||||
<key name="window-maximized" type="b">
|
||||
<default>false</default>
|
||||
</key>
|
||||
</schema>
|
||||
</schemalist>
|
||||
@@ -1,4 +1,5 @@
|
||||
use adw::prelude::*;
|
||||
use gtk::glib;
|
||||
use outlay_core::db::Database;
|
||||
use std::rc::Rc;
|
||||
|
||||
@@ -120,14 +121,52 @@ impl MainWindow {
|
||||
split_view.set_sidebar(Some(&sidebar_page));
|
||||
split_view.set_content(Some(&content_page));
|
||||
|
||||
// Restore window size from settings
|
||||
let saved_width: i32 = db
|
||||
.get_setting("window_width")
|
||||
.ok()
|
||||
.flatten()
|
||||
.and_then(|s| s.parse().ok())
|
||||
.unwrap_or(900);
|
||||
let saved_height: i32 = db
|
||||
.get_setting("window_height")
|
||||
.ok()
|
||||
.flatten()
|
||||
.and_then(|s| s.parse().ok())
|
||||
.unwrap_or(600);
|
||||
let saved_maximized: bool = db
|
||||
.get_setting("window_maximized")
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|s| s == "true")
|
||||
.unwrap_or(false);
|
||||
|
||||
let window = adw::ApplicationWindow::builder()
|
||||
.application(app)
|
||||
.title("Outlay")
|
||||
.default_width(900)
|
||||
.default_height(600)
|
||||
.default_width(saved_width)
|
||||
.default_height(saved_height)
|
||||
.content(&split_view)
|
||||
.build();
|
||||
|
||||
if saved_maximized {
|
||||
window.maximize();
|
||||
}
|
||||
|
||||
// Save window size on close
|
||||
{
|
||||
let db_ref = db.clone();
|
||||
window.connect_close_request(move |win| {
|
||||
let (width, height) = win.default_size();
|
||||
db_ref.set_setting("window_width", &width.to_string()).ok();
|
||||
db_ref.set_setting("window_height", &height.to_string()).ok();
|
||||
db_ref
|
||||
.set_setting("window_maximized", if win.is_maximized() { "true" } else { "false" })
|
||||
.ok();
|
||||
glib::Propagation::Proceed
|
||||
});
|
||||
}
|
||||
|
||||
MainWindow {
|
||||
window,
|
||||
split_view,
|
||||
|
||||
Reference in New Issue
Block a user