[PATCH 2/7] Hide application add-ins shutdown behind function.



Signed-off-by: Łukasz Krotowski <lukasz krotowski gmail com>
---
 src/addinmanager.cpp |   15 +++++++++++++++
 src/addinmanager.hpp |    1 +
 src/notemanager.cpp  |   16 +---------------
 3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/src/addinmanager.cpp b/src/addinmanager.cpp
index 721cb6c..6c56cba 100644
--- a/src/addinmanager.cpp
+++ b/src/addinmanager.cpp
@@ -319,6 +319,21 @@ namespace gnote {
     }
   }
 
+  void AddinManager::shutdown_application_addins() const
+  {
+    for(AppAddinMap::const_iterator iter = m_app_addins.begin();
+        iter != m_app_addins.end(); ++iter) {
+      ApplicationAddin * addin = iter->second;
+      try {
+        addin->shutdown();
+      }
+      catch (const sharp::Exception & e) {
+        DBG_OUT("Error calling %s.Shutdown (): %s",
+                typeid(*addin).name(), e.what());
+      }
+    }
+  }
+
 
   Gtk::Widget * AddinManager::create_addin_preference_widget(const std::string & id)
   {
diff --git a/src/addinmanager.hpp b/src/addinmanager.hpp
index 7e241bc..6a87a08 100644
--- a/src/addinmanager.hpp
+++ b/src/addinmanager.hpp
@@ -62,6 +62,7 @@ public:
   void get_preference_tab_addins(std::list<PreferenceTabAddin *> &) const;
   void get_import_addins(std::list<ImportAddin*> &) const;
   void initialize_application_addins() const;
+  void shutdown_application_addins() const;
 
   const sharp::ModuleList & get_modules() const
     { 
diff --git a/src/notemanager.cpp b/src/notemanager.cpp
index c6e4849..f63e43d 100644
--- a/src/notemanager.cpp
+++ b/src/notemanager.cpp
@@ -411,21 +411,7 @@ namespace gnote {
 
   bool NoteManager::on_exiting_event()
   {
-    // Call ApplicationAddin.Shutdown () on all the known ApplicationAddins
-    std::list<ApplicationAddin*> app_addins;
-    m_addin_mgr->get_application_addins (app_addins);
-    for(std::list<ApplicationAddin*>::const_iterator iter = app_addins.begin();
-        iter != app_addins.end(); ++iter) {
-      ApplicationAddin* addin = *iter;
-      try {
-        addin->shutdown ();
-      } 
-      catch (const sharp::Exception & e) {
-        DBG_OUT("Error calling %s.Shutdown (): %s",
-                typeid(*addin).name(), e.what());
-      }
-    }
-
+	m_addin_mgr->shutdown_application_addins();
 
     DBG_OUT("Saving unsaved notes...");
       
-- 
1.7.1



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