[gnote] Update inserttimestamp prefs



commit b562d00b317644241c5bce87fb7584e990a4496e
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Oct 27 17:18:12 2019 +0200

    Update inserttimestamp prefs

 src/addins/inserttimestamp/inserttimestamppreferences.cpp |  9 ++++-----
 src/addins/inserttimestamp/inserttimestamppreferences.hpp | 11 +++++++++--
 2 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/src/addins/inserttimestamp/inserttimestamppreferences.cpp 
b/src/addins/inserttimestamp/inserttimestamppreferences.cpp
index 01886414..f895b8aa 100644
--- a/src/addins/inserttimestamp/inserttimestamppreferences.cpp
+++ b/src/addins/inserttimestamp/inserttimestamppreferences.cpp
@@ -24,7 +24,6 @@
 #include "sharp/datetime.hpp"
 #include "sharp/propertyeditor.hpp"
 
-#include "ignote.hpp"
 #include "preferences.hpp"
 #include "inserttimestamppreferences.hpp"
  
@@ -50,7 +49,8 @@ namespace inserttimestamp {
   }
 
 
-  InsertTimestampPreferences::InsertTimestampPreferences(gnote::NoteManager &)
+  InsertTimestampPreferences::InsertTimestampPreferences(gnote::IGnote &, gnote::Preferences & preferences, 
gnote::NoteManager &)
+    : m_preferences(preferences)
   {
     _init_static();
 
@@ -58,7 +58,7 @@ namespace inserttimestamp {
     int row = 0;
 
     // Get current values
-    Glib::RefPtr<Gio::Settings> settings = 
gnote::IGnote::obj().preferences().get_schema_settings(SCHEMA_INSERT_TIMESTAMP);
+    Glib::RefPtr<Gio::Settings> settings = preferences.get_schema_settings(SCHEMA_INSERT_TIMESTAMP);
     Glib::ustring dateFormat = settings->get_string(INSERT_TIMESTAMP_FORMAT);
 
     sharp::DateTime now = sharp::DateTime::now();
@@ -181,8 +181,7 @@ namespace inserttimestamp {
     if (iter) {
       Glib::ustring format;
       iter->get_value(1, format);
-      gnote::IGnote::obj().preferences().get_schema_settings(SCHEMA_INSERT_TIMESTAMP)->set_string(
-          INSERT_TIMESTAMP_FORMAT, format);
+      m_preferences.get_schema_settings(SCHEMA_INSERT_TIMESTAMP)->set_string(INSERT_TIMESTAMP_FORMAT, 
format);
     }
   }
 
diff --git a/src/addins/inserttimestamp/inserttimestamppreferences.hpp 
b/src/addins/inserttimestamp/inserttimestamppreferences.hpp
index 722a4d0c..227d0845 100644
--- a/src/addins/inserttimestamp/inserttimestamppreferences.hpp
+++ b/src/addins/inserttimestamp/inserttimestamppreferences.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2013,2017 Aurimas Cernius
+ * Copyright (C) 2013,2017,2019 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -32,6 +32,12 @@
 
 #include "notemanager.hpp"
 
+namespace gnote {
+  class IGnote;
+  class Preferences;
+}
+
+
 namespace inserttimestamp {
 
 extern const char * SCHEMA_INSERT_TIMESTAMP;
@@ -41,7 +47,7 @@ class InsertTimestampPreferences
   : public Gtk::Grid
 {
 public:
-  InsertTimestampPreferences(gnote::NoteManager &);
+  InsertTimestampPreferences(gnote::IGnote &, gnote::Preferences &, gnote::NoteManager &);
 private:
   static void _init_static();
   class FormatColumns
@@ -67,6 +73,7 @@ private:
   Gtk::TreeView               *tv;
   Glib::RefPtr<Gtk::ListStore> store;
   Gtk::Entry                  *custom_entry;
+  gnote::Preferences         & m_preferences;
 };
 
 


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