[PATCH 1/7] Hide application add-ins initialization behind function.



Signed-off-by: Łukasz Krotowski <lukasz krotowski gmail com>
---
 src/addinmanager.cpp |    9 +++++++++
 src/addinmanager.hpp |    1 +
 src/gnote.cpp        |    9 ++-------
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/addinmanager.cpp b/src/addinmanager.cpp
index fc2039d..721cb6c 100644
--- a/src/addinmanager.cpp
+++ b/src/addinmanager.cpp
@@ -310,6 +310,15 @@ namespace gnote {
     sharp::map_get_values(m_import_addins, l);
   }
 
+  void AddinManager::initialize_application_addins() const
+  {
+    for(AppAddinMap::const_iterator iter = m_app_addins.begin();
+        iter != m_app_addins.end(); ++iter) {
+      ApplicationAddin * addin = iter->second;
+      addin->initialize();
+    }
+  }
+
 
   Gtk::Widget * AddinManager::create_addin_preference_widget(const std::string & id)
   {
diff --git a/src/addinmanager.hpp b/src/addinmanager.hpp
index e1a5149..7e241bc 100644
--- a/src/addinmanager.hpp
+++ b/src/addinmanager.hpp
@@ -61,6 +61,7 @@ public:
   void get_application_addins(std::list<ApplicationAddin*> &) const;
   void get_preference_tab_addins(std::list<PreferenceTabAddin *> &) const;
   void get_import_addins(std::list<ImportAddin*> &) const;
+  void initialize_application_addins() const;
 
   const sharp::ModuleList & get_modules() const
     { 
diff --git a/src/gnote.cpp b/src/gnote.cpp
index 2d6042c..1d80eec 100644
--- a/src/gnote.cpp
+++ b/src/gnote.cpp
@@ -111,13 +111,8 @@ namespace gnote {
     am.load_interface();
     register_remote_control(*m_manager);
     setup_global_actions();
-    
-    std::list<ApplicationAddin*> addins;
-    m_manager->get_addin_manager().get_application_addins(addins);
-    for(std::list<ApplicationAddin*>::const_iterator iter = addins.begin();
-        iter != addins.end(); ++iter) {
-      (*iter)->initialize();
-    }
+
+    m_manager->get_addin_manager().initialize_application_addins();
 
 #ifndef ENABLE_DBUS
     if(cmd_line.needs_execute()) {
-- 
1.7.1



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