[gnote] Update notedirectorywatcher prefs



commit 17e598c19317bf541c2875afe17223d59219456e
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Oct 27 17:20:03 2019 +0200

    Update notedirectorywatcher prefs

 .../notedirectorywatcher/notedirectorywatcherpreferences.cpp   |  9 ++++-----
 .../notedirectorywatcher/notedirectorywatcherpreferences.hpp   | 10 ++++++++--
 2 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/src/addins/notedirectorywatcher/notedirectorywatcherpreferences.cpp 
b/src/addins/notedirectorywatcher/notedirectorywatcherpreferences.cpp
index 8433ef28..4c4fb877 100644
--- a/src/addins/notedirectorywatcher/notedirectorywatcherpreferences.cpp
+++ b/src/addins/notedirectorywatcher/notedirectorywatcherpreferences.cpp
@@ -20,7 +20,6 @@
 
 #include <glibmm/i18n.h>
 
-#include "ignote.hpp"
 #include "notedirectorywatcherpreferences.hpp"
 #include "preferences.hpp"
 
@@ -30,8 +29,9 @@ const char *SCHEMA_NOTE_DIRECTORY_WATCHER = "org.gnome.gnote.note-directory-watc
 const char *CHECK_INTERVAL = "check-interval";
 
 
-NoteDirectoryWatcherPreferences::NoteDirectoryWatcherPreferences(gnote::NoteManager &)
+NoteDirectoryWatcherPreferences::NoteDirectoryWatcherPreferences(gnote::IGnote &, gnote::Preferences & 
preferences, gnote::NoteManager &)
   : m_check_interval(1)
+  , m_preferences(preferences)
 {
   Gtk::Label *label = manage(new Gtk::Label(_("_Directory check interval:"), true));
   attach(*label, 0, 0, 1, 1);
@@ -39,14 +39,13 @@ NoteDirectoryWatcherPreferences::NoteDirectoryWatcherPreferences(gnote::NoteMana
   m_check_interval.set_increments(1, 5);
   m_check_interval.signal_value_changed()
     .connect(sigc::mem_fun(*this, &NoteDirectoryWatcherPreferences::on_interval_changed));
-  m_check_interval.set_value(
-    
gnote::IGnote::obj().preferences().get_schema_settings(SCHEMA_NOTE_DIRECTORY_WATCHER)->get_int(CHECK_INTERVAL));
+  
m_check_interval.set_value(preferences.get_schema_settings(SCHEMA_NOTE_DIRECTORY_WATCHER)->get_int(CHECK_INTERVAL));
   attach(m_check_interval, 1, 0, 1, 1);
 }
 
 void NoteDirectoryWatcherPreferences::on_interval_changed()
 {
-  gnote::IGnote::obj().preferences().get_schema_settings(SCHEMA_NOTE_DIRECTORY_WATCHER)->set_int(
+  m_preferences.get_schema_settings(SCHEMA_NOTE_DIRECTORY_WATCHER)->set_int(
     CHECK_INTERVAL, m_check_interval.get_value_as_int());
 }
 
diff --git a/src/addins/notedirectorywatcher/notedirectorywatcherpreferences.hpp 
b/src/addins/notedirectorywatcher/notedirectorywatcherpreferences.hpp
index 6c71a8d0..f0d03350 100644
--- a/src/addins/notedirectorywatcher/notedirectorywatcherpreferences.hpp
+++ b/src/addins/notedirectorywatcher/notedirectorywatcherpreferences.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2014 Aurimas Cernius
+ * Copyright (C) 2014,2019 Aurimas Cernius
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -27,6 +27,11 @@
 #include "notemanager.hpp"
 
 
+namespace gnote {
+  class IGnote;
+  class Preferences;
+}
+
 namespace notedirectorywatcher {
 
 extern const char *SCHEMA_NOTE_DIRECTORY_WATCHER;
@@ -37,11 +42,12 @@ class NoteDirectoryWatcherPreferences
   : public Gtk::Grid
 {
 public:
-  NoteDirectoryWatcherPreferences(gnote::NoteManager &);
+  NoteDirectoryWatcherPreferences(gnote::IGnote &, gnote::Preferences &, gnote::NoteManager &);
 private:
   void on_interval_changed();
 
   Gtk::SpinButton m_check_interval;
+  gnote::Preferences & m_preferences;
 };
 
 }


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