[gnote] Do not use static IGnote in specialnotes



commit 497396f6767d11f473724987fdadd6a58c20a62f
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Oct 27 17:22:11 2019 +0200

    Do not use static IGnote in specialnotes

 src/addins/specialnotes/specialnotesapplicationaddin.cpp | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/addins/specialnotes/specialnotesapplicationaddin.cpp 
b/src/addins/specialnotes/specialnotesapplicationaddin.cpp
index d4e917aa..157397d7 100644
--- a/src/addins/specialnotes/specialnotesapplicationaddin.cpp
+++ b/src/addins/specialnotes/specialnotesapplicationaddin.cpp
@@ -35,8 +35,9 @@ namespace {
     : public gnote::notebooks::SpecialNotebook
   {
   public:
-    SpecialNotesNotebook(gnote::NoteManager & nm)
+    SpecialNotesNotebook(gnote::IGnote & g, gnote::NoteManager & nm)
       : SpecialNotebook(nm, _("Special Notes"))
+      , m_gnote(g)
       {}
 
     virtual Glib::ustring get_normalized_name() const override
@@ -56,8 +57,10 @@ namespace {
 
     virtual Glib::RefPtr<Gdk::Pixbuf> get_icon() override
       {
-        return gnote::IGnote::obj().icon_manager().get_icon(gnote::IconManager::SPECIAL_NOTES, 22);
+        return m_gnote.icon_manager().get_icon(gnote::IconManager::SPECIAL_NOTES, 22);
       }
+  private:
+    gnote::IGnote & m_gnote;
   };
 }
 
@@ -89,15 +92,15 @@ void SpecialNotesApplicationAddin::initialize()
   if(!m_initialized) {
     m_initialized = true;
 
-    m_notebook = Notebook::Ptr(new SpecialNotesNotebook(note_manager()));
-    gnote::IGnote::obj().notebook_manager().add_notebook(m_notebook);
+    m_notebook = Notebook::Ptr(new SpecialNotesNotebook(ignote(), note_manager()));
+    ignote().notebook_manager().add_notebook(m_notebook);
   }
 }
 
 void SpecialNotesApplicationAddin::shutdown()
 {
   if(m_notebook != NULL) {
-    gnote::IGnote::obj().notebook_manager().delete_notebook(m_notebook);
+    ignote().notebook_manager().delete_notebook(m_notebook);
     m_notebook.reset();
     m_initialized = false;
   }


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