File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed
Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,8 @@ private:
4747 add_action (" about" , [this ] { m_mainWindow->showAbout (); });
4848 add_action (" quit" , [this ] { on_quit (); });
4949
50+ set_accel_for_action (" app.quit" , " <Primary>q" );
51+
5052 Glib::RefPtr<Gtk::Builder> appMenuBuilder = Gtk::Builder::create_from_resource (" /org/gnome/gimagereader/appmenu.ui" );
5153 Glib::RefPtr<Gio::MenuModel> menuModel = Glib::RefPtr<Gio::MenuModel>::cast_static (appMenuBuilder->get_object (" appmenu" ));
5254
@@ -75,6 +77,9 @@ private:
7577
7678 void on_quit () {
7779 if (m_mainWindow) {
80+ if (!m_mainWindow->canClose ()) {
81+ return ;
82+ }
7883 remove_window (*m_mainWindow->getWindow ());
7984 delete m_mainWindow;
8085 m_mainWindow = nullptr ;
Original file line number Diff line number Diff line change @@ -307,7 +307,7 @@ void MainWindow::progressUpdate() {
307307}
308308
309309bool MainWindow::closeEvent (GdkEventAny*) {
310- if (!m_outputEditor-> clear ()) {
310+ if (!canClose ()) {
311311 return true ;
312312 }
313313
@@ -321,6 +321,10 @@ bool MainWindow::closeEvent(GdkEventAny*) {
321321 return false ;
322322}
323323
324+ bool MainWindow::canClose () {
325+ return m_outputEditor->clear ();
326+ }
327+
324328void MainWindow::onSourceChanged () {
325329 std::vector<Source*> sources = m_sourceManager->getSelectedSources ();
326330 if (m_displayer->setSources (sources) && !sources.empty ()) {
Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ public:
122122 void popState ();
123123 void showProgress (ProgressMonitor* monitor, int updateInterval = 500 );
124124 void hideProgress ();
125+ bool canClose ();
125126
126127private:
127128 static void signalHandlerExec (int signal, bool tesseractCrash);
You can’t perform that action at this time.
0 commit comments