[gnote] Fix initializing addins from preferences
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Fix initializing addins from preferences
- Date: Sun, 27 Oct 2019 15:46:50 +0000 (UTC)
commit 418e3766228622d0b604d326627543f7245b0491
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Oct 27 17:44:21 2019 +0200
Fix initializing addins from preferences
src/preferencesdialog.cpp | 24 +++++++++++++++++-------
src/preferencesdialog.hpp | 6 +++---
2 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/src/preferencesdialog.cpp b/src/preferencesdialog.cpp
index 0fa77520..6bfd477b 100644
--- a/src/preferencesdialog.cpp
+++ b/src/preferencesdialog.cpp
@@ -186,14 +186,14 @@ namespace gnote {
m_addin_manager.erase_note_addin_info(id);
}
else {
- ApplicationAddin * const addin = m_addin_manager.get_application_addin(id);
+ ApplicationAddin *addin = m_addin_manager.get_application_addin(id);
if(addin) {
- enable_addin(addin, enable);
+ enable_app_addin(addin, enable);
}
else {
- sync::SyncServiceAddin * const sync_addin = m_addin_manager.get_sync_service_addin(id);
+ sync::SyncServiceAddin *sync_addin = m_addin_manager.get_sync_service_addin(id);
if(sync_addin) {
- enable_addin(sync_addin, enable);
+ enable_sync_addin(sync_addin, enable);
}
else {
ERR_OUT(_("Plugin %s is absent"), id.c_str());
@@ -206,11 +206,21 @@ namespace gnote {
m_addin_manager.save_addins_prefs();
}
- template <typename T>
- void PreferencesDialog::enable_addin(T *addin, bool enable)
+ void PreferencesDialog::enable_app_addin(ApplicationAddin *addin, bool enable)
{
if(enable) {
- addin->initialize();
+ addin->initialize(IGnote::obj(), m_note_manager);
+ }
+ else {
+ addin->shutdown();
+ }
+ }
+
+
+ void PreferencesDialog::enable_sync_addin(sync::SyncServiceAddin *addin, bool enable)
+ {
+ if(enable) {
+ addin->initialize(IGnote::obj(), IGnote::obj().sync_manager());
}
else {
addin->shutdown();
diff --git a/src/preferencesdialog.hpp b/src/preferencesdialog.hpp
index a0855ee0..a2494330 100644
--- a/src/preferencesdialog.hpp
+++ b/src/preferencesdialog.hpp
@@ -38,7 +38,7 @@
namespace gnote {
-class SyncServiceAddin;
+namespace sync { class SyncServiceAddin; }
class AddinManager;
class PreferencesDialog
@@ -60,8 +60,8 @@ private:
Gtk::CheckButton *make_check_button(const Glib::ustring & label_text);
void enable_addin(bool enable);
- template <typename T>
- void enable_addin(T *addin, bool enable);
+ void enable_app_addin(ApplicationAddin *addin, bool enable);
+ void enable_sync_addin(sync::SyncServiceAddin *addin, bool enable);
void open_template_button_clicked();
void on_font_button_clicked();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]