[gnote] Instance save addin prefs
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Instance save addin prefs
- Date: Wed, 15 Dec 2010 19:02:43 +0000 (UTC)
commit 53b7cebb9a36372454bdc738e7ff3cdacaab431e
Author: Aurimas Ä?ernius <aurisc4 gmail com>
Date: Wed Dec 15 20:51:12 2010 +0200
Instance save addin prefs
Save addins prefs once user enabled/disabled addin.
Fixes bug 637051.
src/addinmanager.cpp | 47 +++++++++++++++++++++++---------------------
src/addinmanager.hpp | 1 +
src/preferencesdialog.cpp | 1 +
3 files changed, 27 insertions(+), 22 deletions(-)
---
diff --git a/src/addinmanager.cpp b/src/addinmanager.cpp
index f6b4113..5e8c789 100644
--- a/src/addinmanager.cpp
+++ b/src/addinmanager.cpp
@@ -99,28 +99,6 @@ namespace gnote {
AddinManager::~AddinManager()
{
- Glib::KeyFile global_addins_prefs;
- try {
- global_addins_prefs.load_from_file(m_addins_prefs_file);
- }
- catch (Glib::Error & not_loaded_ignored) {
- }
-
- const sharp::ModuleList & list = m_module_manager.get_modules();
- for(sharp::ModuleList::const_iterator iter = list.begin();
- iter != list.end(); ++iter) {
- const sharp::DynamicModule* dmod = *iter;
- global_addins_prefs.set_boolean("Enabled", dmod->id(),
- dmod->is_enabled());
- }
-
- Glib::RefPtr<Gio::File> prefs_file = Gio::File::create_for_path(
- m_addins_prefs_file);
- Glib::RefPtr<Gio::FileOutputStream> prefs_file_stream
- = prefs_file->append_to();
- prefs_file_stream->truncate(0);
- prefs_file_stream->write(global_addins_prefs.to_data());
-
sharp::map_delete_all_second(m_app_addins);
for(NoteAddinMap::const_iterator iter = m_note_addins.begin();
iter != m_note_addins.end(); ++iter) {
@@ -370,6 +348,31 @@ namespace gnote {
}
}
+ void AddinManager::save_addins_prefs() const
+ {
+ Glib::KeyFile global_addins_prefs;
+ try {
+ global_addins_prefs.load_from_file(m_addins_prefs_file);
+ }
+ catch (Glib::Error & not_loaded_ignored) {
+ }
+
+ const sharp::ModuleList & list = m_module_manager.get_modules();
+ for(sharp::ModuleList::const_iterator iter = list.begin();
+ iter != list.end(); ++iter) {
+ const sharp::DynamicModule* dmod = *iter;
+ global_addins_prefs.set_boolean("Enabled", dmod->id(),
+ dmod->is_enabled());
+ }
+
+ Glib::RefPtr<Gio::File> prefs_file = Gio::File::create_for_path(
+ m_addins_prefs_file);
+ Glib::RefPtr<Gio::FileOutputStream> prefs_file_stream
+ = prefs_file->append_to();
+ prefs_file_stream->truncate(0);
+ prefs_file_stream->write(global_addins_prefs.to_data());
+ }
+
Gtk::Widget * AddinManager::create_addin_preference_widget(const std::string & id)
{
IdAddinPrefsMap::const_iterator iter = m_addin_prefs.find(id);
diff --git a/src/addinmanager.hpp b/src/addinmanager.hpp
index d9f6361..3309744 100644
--- a/src/addinmanager.hpp
+++ b/src/addinmanager.hpp
@@ -62,6 +62,7 @@ public:
void get_import_addins(std::list<ImportAddin*> &) const;
void initialize_application_addins() const;
void shutdown_application_addins() const;
+ void save_addins_prefs() const;
const sharp::ModuleList & get_modules() const
{
diff --git a/src/preferencesdialog.cpp b/src/preferencesdialog.cpp
index ff86aa9..f17ddfc 100644
--- a/src/preferencesdialog.cpp
+++ b/src/preferencesdialog.cpp
@@ -193,6 +193,7 @@ namespace gnote {
}
module->enabled(enable);
+ m_addin_manager.save_addins_prefs();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]