[gnote] Do not use Preferences for export to HTML own settings



commit 5346f97cec31b91e5a1540a6b448a18d35b64d1e
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Dec 20 12:57:54 2020 +0200

    Do not use Preferences for export to HTML own settings

 src/addins/exporttohtml/exporttohtml.desktop.in.in |  2 +-
 src/addins/exporttohtml/exporttohtmldialog.cpp     | 18 ++++++++----------
 src/addins/exporttohtml/exporttohtmldialog.hpp     |  4 +++-
 3 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/src/addins/exporttohtml/exporttohtml.desktop.in.in 
b/src/addins/exporttohtml/exporttohtml.desktop.in.in
index 5b7d4cd5..0847e991 100644
--- a/src/addins/exporttohtml/exporttohtml.desktop.in.in
+++ b/src/addins/exporttohtml/exporttohtml.desktop.in.in
@@ -4,7 +4,7 @@ _Name=Export to HTML
 _Description=Exports individual notes to HTML.
 _Authors=Hubert Figuiere and the Tomboy Project
 Category=Tools
-Version=0.8
+Version=0.9
 DefaultEnabled=false
 Module=libexporttohtml
 LibgnoteRelease=@LIBGNOTE_RELEASE@
diff --git a/src/addins/exporttohtml/exporttohtmldialog.cpp b/src/addins/exporttohtml/exporttohtmldialog.cpp
index bb707490..011a9afd 100644
--- a/src/addins/exporttohtml/exporttohtmldialog.cpp
+++ b/src/addins/exporttohtml/exporttohtmldialog.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2011-2012,2017,2019 Aurimas Cernius
+ * Copyright (C) 2011-2012,2017,2019-2020 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -28,7 +28,6 @@
 #include "sharp/files.hpp"
 #include "exporttohtmldialog.hpp"
 #include "ignote.hpp"
-#include "preferences.hpp"
 
 namespace exporttohtml {
 
@@ -44,6 +43,7 @@ ExportToHtmlDialog::ExportToHtmlDialog(gnote::IGnote & ignote, const Glib::ustri
   , m_gnote(ignote)
   , m_export_linked(_("Export linked notes"))
   , m_export_linked_all(_("Include all other linked notes"))
+  , m_settings(Gio::Settings::create(SCHEMA_EXPORTHTML))
 {
   add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
@@ -96,25 +96,23 @@ void ExportToHtmlDialog::set_export_linked_all(bool value)
 void ExportToHtmlDialog::save_preferences()
 {
   Glib::ustring dir = sharp::file_dirname(get_filename());
-  Glib::RefPtr<Gio::Settings> settings = m_gnote.preferences().get_schema_settings(SCHEMA_EXPORTHTML);
-  settings->set_string(EXPORTHTML_LAST_DIRECTORY, dir);
-  settings->set_boolean(EXPORTHTML_EXPORT_LINKED, get_export_linked());
-  settings->set_boolean(EXPORTHTML_EXPORT_LINKED_ALL, get_export_linked_all());
+  m_settings->set_string(EXPORTHTML_LAST_DIRECTORY, dir);
+  m_settings->set_boolean(EXPORTHTML_EXPORT_LINKED, get_export_linked());
+  m_settings->set_boolean(EXPORTHTML_EXPORT_LINKED_ALL, get_export_linked_all());
 }
 
 
 void ExportToHtmlDialog::load_preferences(const Glib::ustring & default_file)
 {
-  Glib::RefPtr<Gio::Settings> settings = m_gnote.preferences().get_schema_settings(SCHEMA_EXPORTHTML);
-  Glib::ustring last_dir = settings->get_string(EXPORTHTML_LAST_DIRECTORY);
+  Glib::ustring last_dir = m_settings->get_string(EXPORTHTML_LAST_DIRECTORY);
   if (last_dir.empty()) {
     last_dir = Glib::get_home_dir();
   }
   set_current_folder (last_dir);
   set_current_name(default_file);
 
-  set_export_linked(settings->get_boolean(EXPORTHTML_EXPORT_LINKED));
-  set_export_linked_all(settings->get_boolean(EXPORTHTML_EXPORT_LINKED_ALL));
+  set_export_linked(m_settings->get_boolean(EXPORTHTML_EXPORT_LINKED));
+  set_export_linked_all(m_settings->get_boolean(EXPORTHTML_EXPORT_LINKED_ALL));
 }
 
 
diff --git a/src/addins/exporttohtml/exporttohtmldialog.hpp b/src/addins/exporttohtml/exporttohtmldialog.hpp
index 4aea1d33..1d07e5c8 100644
--- a/src/addins/exporttohtml/exporttohtmldialog.hpp
+++ b/src/addins/exporttohtml/exporttohtmldialog.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2017,2019 Aurimas Cernius
+ * Copyright (C) 2017,2019-2020 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -22,6 +22,7 @@
 #ifndef __EXPORT_TO_HTML_DIALOG_HPP_
 #define __EXPORT_TO_HTML_DIALOG_HPP_
 
+#include <giomm/settings.h>
 #include <gtkmm/checkbutton.h>
 #include <gtkmm/filechooserdialog.h>
 
@@ -51,6 +52,7 @@ private:
   gnote::IGnote & m_gnote;
   Gtk::CheckButton m_export_linked;
   Gtk::CheckButton m_export_linked_all;
+  Glib::RefPtr<Gio::Settings> m_settings;
 };
 
 


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