[gnote] Replace std::string by Glib::ustring in exporttohtml



commit 5689b50bf591db328bdf36fbc82d4e3a00b0c509
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sat Feb 4 19:09:17 2017 +0200

    Replace std::string by Glib::ustring in exporttohtml

 src/addins/exporttohtml/exporttohtmldialog.cpp    |   10 +++++-----
 src/addins/exporttohtml/exporttohtmldialog.hpp    |    7 +++----
 src/addins/exporttohtml/exporttohtmlnoteaddin.cpp |   12 ++++++------
 3 files changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/src/addins/exporttohtml/exporttohtmldialog.cpp b/src/addins/exporttohtml/exporttohtmldialog.cpp
index 2372dcb..24a81c4 100644
--- a/src/addins/exporttohtml/exporttohtmldialog.cpp
+++ b/src/addins/exporttohtml/exporttohtmldialog.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2011-2012 Aurimas Cernius
+ * Copyright (C) 2011-2012,2017 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -37,7 +37,7 @@ const char * EXPORTHTML_EXPORT_LINKED = "export-linked";
 const char * EXPORTHTML_EXPORT_LINKED_ALL = "export-linked-all";
 
 
-ExportToHtmlDialog::ExportToHtmlDialog(const std::string & default_file)
+ExportToHtmlDialog::ExportToHtmlDialog(const Glib::ustring & default_file)
   : Gtk::FileChooserDialog(_("Destination for HTML Export"),
                            Gtk::FILE_CHOOSER_ACTION_SAVE)
   , m_export_linked(_("Export linked notes"))
@@ -93,7 +93,7 @@ void ExportToHtmlDialog::set_export_linked_all(bool value)
 
 void ExportToHtmlDialog::save_preferences()
 {
-  std::string dir = sharp::file_dirname(get_filename());
+  Glib::ustring dir = sharp::file_dirname(get_filename());
   Glib::RefPtr<Gio::Settings> settings = gnote::Preferences::obj().get_schema_settings(SCHEMA_EXPORTHTML);
   settings->set_string(EXPORTHTML_LAST_DIRECTORY, dir);
   settings->set_boolean(EXPORTHTML_EXPORT_LINKED, get_export_linked());
@@ -101,10 +101,10 @@ void ExportToHtmlDialog::save_preferences()
 }
 
 
-void ExportToHtmlDialog::load_preferences(const std::string & default_file)
+void ExportToHtmlDialog::load_preferences(const Glib::ustring & default_file)
 {
   Glib::RefPtr<Gio::Settings> settings = gnote::Preferences::obj().get_schema_settings(SCHEMA_EXPORTHTML);
-  std::string last_dir = settings->get_string(EXPORTHTML_LAST_DIRECTORY);
+  Glib::ustring last_dir = settings->get_string(EXPORTHTML_LAST_DIRECTORY);
   if (last_dir.empty()) {
     last_dir = Glib::get_home_dir();
   }
diff --git a/src/addins/exporttohtml/exporttohtmldialog.hpp b/src/addins/exporttohtml/exporttohtmldialog.hpp
index d27f411..a8bb034 100644
--- a/src/addins/exporttohtml/exporttohtmldialog.hpp
+++ b/src/addins/exporttohtml/exporttohtmldialog.hpp
@@ -1,6 +1,7 @@
 /*
  * gnote
  *
+ * Copyright (C) 2017 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -21,8 +22,6 @@
 #ifndef __EXPORT_TO_HTML_DIALOG_HPP_
 #define __EXPORT_TO_HTML_DIALOG_HPP_
 
-#include <string>
-
 #include <gtkmm/checkbutton.h>
 #include <gtkmm/filechooserdialog.h>
 
@@ -33,7 +32,7 @@ class ExportToHtmlDialog
   : public Gtk::FileChooserDialog
 {
 public:
-  ExportToHtmlDialog(const std::string &);
+  ExportToHtmlDialog(const Glib::ustring &);
   void save_preferences();
 
   bool get_export_linked() const;
@@ -43,7 +42,7 @@ public:
 
 private:
   void on_export_linked_toggled();
-  void load_preferences(const std::string & );
+  void load_preferences(const Glib::ustring & );
   Gtk::CheckButton m_export_linked;
   Gtk::CheckButton m_export_linked_all;
 };
diff --git a/src/addins/exporttohtml/exporttohtmlnoteaddin.cpp 
b/src/addins/exporttohtml/exporttohtmlnoteaddin.cpp
index 5dd9692..e12d5d3 100644
--- a/src/addins/exporttohtml/exporttohtmlnoteaddin.cpp
+++ b/src/addins/exporttohtml/exporttohtmlnoteaddin.cpp
@@ -88,7 +88,7 @@ void ExportToHtmlNoteAddin::export_button_clicked(const Glib::VariantBase&)
 {
   ExportToHtmlDialog dialog(get_note()->get_title() + ".html");
   int response = dialog.run();
-  std::string output_path = dialog.get_filename();
+  Glib::ustring output_path = dialog.get_filename();
 
   if (response != Gtk::RESPONSE_OK) {
     return;
@@ -98,7 +98,7 @@ void ExportToHtmlNoteAddin::export_button_clicked(const Glib::VariantBase&)
           output_path.c_str());
 
   sharp::StreamWriter writer;
-  std::string error_message;
+  Glib::ustring error_message;
 
   try {
     // FIXME: Warn about file existing.  Allow overwrite.
@@ -192,7 +192,7 @@ sharp::XslTransform & ExportToHtmlNoteAddin::get_note_xsl()
     }
 
     s_xsl = new sharp::XslTransform;
-    std::string stylesheet_file = DATADIR "/gnote/" STYLESHEET_NAME;
+    Glib::ustring stylesheet_file = DATADIR "/gnote/" STYLESHEET_NAME;
 
     if (sharp::file_exists (stylesheet_file)) {
       DBG_OUT("ExportToHTML: Using user-custom %s file.", STYLESHEET_NAME);
@@ -224,9 +224,9 @@ void ExportToHtmlNoteAddin::write_html_for_note (sharp::StreamWriter & writer,
                                                  bool export_linked, 
                                                  bool export_linked_all)
 {
-  std::string s_writer;
+  Glib::ustring s_writer;
   s_writer = gnote::NoteArchiver::write_string(note->data());
-  xmlDocPtr doc = xmlParseMemory(s_writer.c_str(), s_writer.size());
+  xmlDocPtr doc = xmlParseMemory(s_writer.c_str(), s_writer.bytes());
 
   sharp::XsltArgumentList args;
   args.add_param ("export-linked", "", export_linked);
@@ -235,7 +235,7 @@ void ExportToHtmlNoteAddin::write_html_for_note (sharp::StreamWriter & writer,
 
   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);
+    Glib::ustring font_face = settings->get_string(Preferences::CUSTOM_FONT_FACE);
     Pango::FontDescription font_desc (font_face);
     Glib::ustring font = Glib::ustring::compose("font-family:'%1';", font_desc.get_family());
 


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