[gnote] Only initialize/shutdown built-in or enabled application add-ins
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Only initialize/shutdown built-in or enabled application add-ins
- Date: Sun, 26 Sep 2010 12:51:28 +0000 (UTC)
commit 9a19b8e39f3a0fc632d20fbd6b03f7a6b7c91514
Author: Å?ukasz Krotowski <lukasz krotowski gmail com>
Date: Sun Sep 26 14:35:49 2010 +0300
Only initialize/shutdown built-in or enabled application add-ins
Fixes: https://bugzilla.gnome.org/611731
Signed-off-by: Debarshi Ray <debarshir src gnome org>
src/addinmanager.cpp | 22 +++++++++++++++-------
src/sharp/modulemanager.cpp | 10 ++++++++++
src/sharp/modulemanager.hpp | 1 +
3 files changed, 26 insertions(+), 7 deletions(-)
---
diff --git a/src/addinmanager.cpp b/src/addinmanager.cpp
index 3caf988..f4f288d 100644
--- a/src/addinmanager.cpp
+++ b/src/addinmanager.cpp
@@ -346,7 +346,11 @@ namespace gnote {
for(AppAddinMap::const_iterator iter = m_app_addins.begin();
iter != m_app_addins.end(); ++iter) {
ApplicationAddin * addin = iter->second;
- addin->initialize();
+ const sharp::DynamicModule * dmod
+ = m_module_manager.get_module(iter->first);
+ if (!dmod || dmod->enabled()) {
+ addin->initialize();
+ }
}
}
@@ -355,12 +359,16 @@ namespace gnote {
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());
+ const sharp::DynamicModule * dmod
+ = m_module_manager.get_module(iter->first);
+ if (!dmod || dmod->enabled()) {
+ try {
+ addin->shutdown();
+ }
+ catch (const sharp::Exception & e) {
+ DBG_OUT("Error calling %s.Shutdown (): %s",
+ typeid(*addin).name(), e.what());
+ }
}
}
}
diff --git a/src/sharp/modulemanager.cpp b/src/sharp/modulemanager.cpp
index 62a4b3c..bb37670 100644
--- a/src/sharp/modulemanager.cpp
+++ b/src/sharp/modulemanager.cpp
@@ -95,4 +95,14 @@ namespace sharp {
}
}
+const DynamicModule * ModuleManager::get_module(const std::string & id) const
+{
+ for(ModuleList::const_iterator iter = m_modules.begin();
+ iter != m_modules.end(); ++iter) {
+ if (id == (*iter)->id())
+ return *iter;
+ }
+ return 0;
+}
+
}
diff --git a/src/sharp/modulemanager.hpp b/src/sharp/modulemanager.hpp
index 9817037..30ce8d1 100644
--- a/src/sharp/modulemanager.hpp
+++ b/src/sharp/modulemanager.hpp
@@ -48,6 +48,7 @@ public:
const ModuleList & get_modules() const
{ return m_modules; }
+ const DynamicModule * get_module(const std::string & id) const;
private:
std::set<std::string> m_dirs;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]