From b891678dbc05f30d0a4ba2ae330c379bf70fe454 Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 6 Aug 2024 03:39:31 +0300 Subject: [PATCH] draft shutdown event --- src/app/browser.cpp | 22 +++++++++++++++++++++- src/app/browser.h | 8 ++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/app/browser.cpp b/src/app/browser.cpp index 02c97d17..c6a7b5ce 100644 --- a/src/app/browser.cpp +++ b/src/app/browser.cpp @@ -24,7 +24,7 @@ namespace app Browser::HEIGHT ); - // Init requirements + // Init components this->header = new browser::Header( this ); @@ -42,5 +42,25 @@ namespace app this->gtk ) ); + + // Connect signals + g_signal_connect( + G_APPLICATION( + this->application + ), + "shutdown", + G_CALLBACK( + _shutdown + ), + NULL + ); + } + + // Events + void Browser::_shutdown( + GtkApplication *application + ) { + // @TODO save session, clean cache, etc + g_print("Shutdown..\n"); } } diff --git a/src/app/browser.h b/src/app/browser.h index 88dfacea..64d0bb29 100644 --- a/src/app/browser.h +++ b/src/app/browser.h @@ -31,9 +31,17 @@ namespace app const guint WIDTH = 640; const guint HEIGHT = 480; + // Constructor Browser( GtkApplication *application ); + + private: + + // Events + static void _shutdown( + GtkApplication *application + ); }; };