aboutsummaryrefslogtreecommitdiff
path: root/src/gui/app.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/app.rs')
-rw-r--r--src/gui/app.rs30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/gui/app.rs b/src/gui/app.rs
index aa8359a..ab3f9c0 100644
--- a/src/gui/app.rs
+++ b/src/gui/app.rs
@@ -3,8 +3,6 @@ use gtk4 as gtk;
use anyhow::Result;
use async_channel::Sender;
use chrono::{Datelike, Duration, NaiveDate, Weekday};
-use gtk::glib::signal::Inhibit;
-use gtk::prelude::*;
use rusqlite::Connection;
use std::rc::Rc;
@@ -31,16 +29,6 @@ pub struct App {
impl App {
pub fn new(conn: Rc<Connection>, app: &gtk::Application, tx: Sender<Msg>) -> Result<Self> {
- let window = Rc::new(
- gtk::ApplicationWindow::builder()
- .application(app)
- .title("Calendrier")
- .default_width(800)
- .default_height(600)
- .visible(true)
- .build(),
- );
-
let today = chrono::offset::Local::now().naive_local().date();
// TODO: error handling
let start_date =
@@ -73,14 +61,16 @@ impl App {
// notebook.append_page(&categories, Some(&gtk::Label::new(Some("Catégories"))));
// window.set_child(Some(&notebook));
- window.set_child(Some(&calendar));
-
- window.connect_close_request(move |window| {
- if let Some(application) = window.application() {
- application.remove_window(window);
- }
- Inhibit(false)
- });
+ let window = Rc::new(
+ gtk::ApplicationWindow::builder()
+ .application(app)
+ .title("Calendrier")
+ .default_width(800)
+ .default_height(600)
+ .visible(true)
+ .child(&calendar)
+ .build(),
+ );
Ok(Self {
conn,