[gnote] Fix exit in status icon mode on close window



commit ecf7ecd89542c1046ceb052bb96f679aa0e47718
Author: Aurimas Äernius <aurisc4 gmail com>
Date:   Sat Sep 15 19:30:16 2012 +0300

    Fix exit in status icon mode on close window
    
    Make sure Gnote does not exit when last window is closed.

 src/gnote.cpp |    9 +++++++++
 src/gnote.hpp |    1 +
 2 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/gnote.cpp b/src/gnote.cpp
index 6f9cc1b..00e5f44 100644
--- a/src/gnote.cpp
+++ b/src/gnote.cpp
@@ -138,6 +138,15 @@ namespace gnote {
   }
 
 
+  void Gnote::on_window_removed(Gtk::Window *window)
+  {
+    // Do not remove last window if background or status icon mode
+    if(windowed() || get_windows().size() > 1) {
+      Gtk::Application::on_window_removed(window);
+    }
+  }
+
+
   void Gnote::common_init()
   {
     std::string note_path = get_note_path(cmd_line.note_path());
diff --git a/src/gnote.hpp b/src/gnote.hpp
index 69159bc..d982525 100644
--- a/src/gnote.hpp
+++ b/src/gnote.hpp
@@ -166,6 +166,7 @@ protected:
   virtual void on_activate();
   virtual int on_command_line(const Glib::RefPtr<Gio::ApplicationCommandLine> & command_line);
   virtual void on_startup();
+  virtual void on_window_removed(Gtk::Window *window);
 private:
   static Gnote *s_obj;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]