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



commit 106470fb9649925b582db3470646fe3055b0bcc5
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sat Feb 4 19:26:45 2017 +0200

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

 .../inserttimestamp/inserttimestampnoteaddin.cpp   |    4 ++--
 .../inserttimestamp/inserttimestampnoteaddin.hpp   |    4 ++--
 .../inserttimestamp/inserttimestamppreferences.cpp |   20 ++++++++------------
 .../inserttimestamp/inserttimestamppreferences.hpp |    8 ++++----
 4 files changed, 16 insertions(+), 20 deletions(-)
---
diff --git a/src/addins/inserttimestamp/inserttimestampnoteaddin.cpp 
b/src/addins/inserttimestamp/inserttimestampnoteaddin.cpp
index bb200e3..28fa524 100644
--- a/src/addins/inserttimestamp/inserttimestampnoteaddin.cpp
+++ b/src/addins/inserttimestamp/inserttimestampnoteaddin.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010-2013,2016 Aurimas Cernius
+ * Copyright (C) 2010-2013,2016-2017 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -72,7 +72,7 @@ namespace inserttimestamp {
 
   void InsertTimestampNoteAddin::on_menu_item_activated(const Glib::VariantBase&)
   {
-    std::string text = sharp::DateTime::now().to_string(m_date_format);
+    Glib::ustring text = sharp::DateTime::now().to_string(m_date_format);
     Gtk::TextIter cursor = get_buffer()->get_iter_at_mark (get_buffer()->get_insert());
     std::vector<Glib::ustring> names;
     names.push_back("datetime");
diff --git a/src/addins/inserttimestamp/inserttimestampnoteaddin.hpp 
b/src/addins/inserttimestamp/inserttimestampnoteaddin.hpp
index 0889c34..359822e 100644
--- a/src/addins/inserttimestamp/inserttimestampnoteaddin.hpp
+++ b/src/addins/inserttimestamp/inserttimestampnoteaddin.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010,2013,2016 Aurimas Cernius
+ * Copyright (C) 2010,2013,2016-2017 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -57,7 +57,7 @@ private:
   void on_menu_item_activated(const Glib::VariantBase&);
   void on_format_setting_changed(const Glib::ustring & key);
 
-  std::string    m_date_format;
+  Glib::ustring    m_date_format;
 };
 
 }
diff --git a/src/addins/inserttimestamp/inserttimestamppreferences.cpp 
b/src/addins/inserttimestamp/inserttimestamppreferences.cpp
index 33864da..51ba3e3 100644
--- a/src/addins/inserttimestamp/inserttimestamppreferences.cpp
+++ b/src/addins/inserttimestamp/inserttimestamppreferences.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2011-2013 Aurimas Cernius
+ * Copyright (C) 2011-2013,2017 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -19,8 +19,6 @@
  */
 
 
-#include <string>
-
 #include <glibmm/i18n.h>
 
 #include "sharp/datetime.hpp"
@@ -37,7 +35,7 @@ namespace inserttimestamp {
   const char * INSERT_TIMESTAMP_FORMAT = "format";
 
   bool InsertTimestampPreferences::s_static_inited = false;
-  std::vector<std::string> InsertTimestampPreferences::s_formats;
+  std::vector<Glib::ustring> InsertTimestampPreferences::s_formats;
 
   void InsertTimestampPreferences::_init_static()
   {
@@ -62,7 +60,7 @@ namespace inserttimestamp {
 
     // Get current values
     Glib::RefPtr<Gio::Settings> settings = Preferences::obj().get_schema_settings(SCHEMA_INSERT_TIMESTAMP);
-    std::string dateFormat = settings->get_string(INSERT_TIMESTAMP_FORMAT);
+    Glib::ustring dateFormat = settings->get_string(INSERT_TIMESTAMP_FORMAT);
 
     sharp::DateTime now = sharp::DateTime::now();
 
@@ -82,12 +80,10 @@ namespace inserttimestamp {
     // 2nd column (not visible): date format
     store = Gtk::ListStore::create(m_columns);
 
-    for(std::vector<std::string>::const_iterator iter = s_formats.begin();
-        iter != s_formats.end(); ++iter) {
-
+    for(auto format : s_formats) {
       Gtk::TreeIter treeiter = store->append();
-      treeiter->set_value(0, now.to_string(*iter));
-      treeiter->set_value(1, *iter);
+      treeiter->set_value(0, now.to_string(format));
+      treeiter->set_value(1, format);
     }
 
     scroll = manage(new Gtk::ScrolledWindow());
@@ -124,7 +120,7 @@ namespace inserttimestamp {
         iter != store->children().end(); ++iter) {
 
       const Gtk::TreeRow & tree_row(*iter);
-      std::string value = tree_row[m_columns.format];
+      Glib::ustring value = tree_row[m_columns.format];
       if (dateFormat == value) {
         // Found format in list
         useCustom = false;
@@ -184,7 +180,7 @@ namespace inserttimestamp {
 
     iter = tv->get_selection()->get_selected();
     if (iter) {
-      std::string format;
+      Glib::ustring format;
       iter->get_value(1, format);
       Preferences::obj().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 f0324cb..722a4d0 100644
--- a/src/addins/inserttimestamp/inserttimestamppreferences.hpp
+++ b/src/addins/inserttimestamp/inserttimestamppreferences.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2013 Aurimas Cernius
+ * Copyright (C) 2013,2017 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -51,14 +51,14 @@ private:
     FormatColumns()
       { add(formatted); add(format); }
 
-    Gtk::TreeModelColumn<std::string> formatted;
-    Gtk::TreeModelColumn<std::string> format;
+    Gtk::TreeModelColumn<Glib::ustring> formatted;
+    Gtk::TreeModelColumn<Glib::ustring> format;
   };
   void on_selected_radio_toggled();
   void on_selection_changed();
 
   static bool       s_static_inited;
-  static std::vector<std::string> s_formats;
+  static std::vector<Glib::ustring> s_formats;
   FormatColumns     m_columns;
   Gtk::RadioButton *selected_radio;
   Gtk::RadioButton *custom_radio;


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