[gnote] Port exporttohtml addint to new Preferences
- From: Aurimas Äernius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Port exporttohtml addint to new Preferences
- Date: Mon, 27 Jun 2011 09:20:53 +0000 (UTC)
commit c18f90ded1bf302f017bb0fed66dd1eeeb71f37e
Author: Aurimas Äernius <aurisc4 gmail com>
Date: Mon Jun 27 11:42:11 2011 +0300
Port exporttohtml addint to new Preferences
Use new Preferences API with Gio::Settings.
src/addins/exporttohtml/exporttohtmldialog.cpp | 27 +++++++++++----------
src/addins/exporttohtml/exporttohtmlnoteaddin.cpp | 7 ++---
2 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/src/addins/exporttohtml/exporttohtmldialog.cpp b/src/addins/exporttohtml/exporttohtmldialog.cpp
index bec5394..15823f8 100644
--- a/src/addins/exporttohtml/exporttohtmldialog.cpp
+++ b/src/addins/exporttohtml/exporttohtmldialog.cpp
@@ -29,15 +29,17 @@
namespace exporttohtml {
+const char * SCHEMA_EXPORTHTML = "org.gnome.gnote.export-html";
+const char * EXPORTHTML_LAST_DIRECTORY = "last-directory";
+const char * EXPORTHTML_EXPORT_LINKED = "export-linked";
+const char * EXPORTHTML_EXPORT_LINKED_ALL = "export-linked-all";
-using gnote::Preferences;
ExportToHtmlDialog::ExportToHtmlDialog(const std::string & default_file)
: Gtk::FileChooserDialog(_("Destination for HTML Export"),
Gtk::FILE_CHOOSER_ACTION_SAVE)
, m_export_linked(_("Export linked notes"))
, m_export_linked_all(_("Include all other linked notes"))
-
{
add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
@@ -90,28 +92,27 @@ void ExportToHtmlDialog::set_export_linked_all(bool value)
void ExportToHtmlDialog::save_preferences()
{
std::string dir = sharp::file_dirname(get_filename());
-
- Preferences::obj().set<std::string>(Preferences::EXPORTHTML_LAST_DIRECTORY,
- dir);
-
- Preferences::obj().set<bool>(Preferences::EXPORTHTML_EXPORT_LINKED,
- get_export_linked());
- Preferences::obj().set<bool>(Preferences::EXPORTHTML_EXPORT_LINKED_ALL,
- get_export_linked_all());
+ Glib::RefPtr<Gio::Settings> settings = gnote::Preferences::obj()
+ .get_or_load_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());
}
void ExportToHtmlDialog::load_preferences(const std::string & default_file)
{
- std::string last_dir = Preferences::obj().get<std::string>(Preferences::EXPORTHTML_LAST_DIRECTORY);
+ Glib::RefPtr<Gio::Settings> settings = gnote::Preferences::obj()
+ .get_or_load_schema_settings(SCHEMA_EXPORTHTML);
+ std::string last_dir = 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(Preferences::obj().get<bool>(Preferences::EXPORTHTML_EXPORT_LINKED));
- set_export_linked_all(Preferences::obj().get<bool>(Preferences::EXPORTHTML_EXPORT_LINKED_ALL));
+ set_export_linked(settings->get_boolean(EXPORTHTML_EXPORT_LINKED));
+ set_export_linked_all(settings->get_boolean(EXPORTHTML_EXPORT_LINKED_ALL));
}
diff --git a/src/addins/exporttohtml/exporttohtmlnoteaddin.cpp b/src/addins/exporttohtml/exporttohtmlnoteaddin.cpp
index fa19077..7801006 100644
--- a/src/addins/exporttohtml/exporttohtmlnoteaddin.cpp
+++ b/src/addins/exporttohtml/exporttohtmlnoteaddin.cpp
@@ -253,10 +253,9 @@ void ExportToHtmlNoteAddin::write_html_for_note (sharp::StreamWriter & writer,
args.add_param ("export-linked-all", "", export_linked_all);
args.add_param ("root-note", "", note->get_title());
-
- if (Preferences::obj().get<bool>(Preferences::ENABLE_CUSTOM_FONT)) {
- std::string font_face
- = Preferences::obj().get<std::string>(Preferences::CUSTOM_FONT_FACE);
+ Glib::RefPtr<Gio::Settings> settings = Preferences::obj().get_schema_settings(Preferences::SCHEMA_GNOTE);
+ if (settings->get_boolean(Preferences::ENABLE_CUSTOM_FONT)) {
+ std::string font_face = settings->get_string(Preferences::CUSTOM_FONT_FACE);
Pango::FontDescription font_desc (font_face);
std::string font = str(boost::format("font-family:'%1%';")
% font_desc.get_family());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]