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



commit 28f1bc27a46e5434271b0a8e322ddd62de486b7d
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Feb 12 16:24:05 2017 +0200

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

 src/addins/statistics/statisticswidget.cpp |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/addins/statistics/statisticswidget.cpp b/src/addins/statistics/statisticswidget.cpp
index 01439f3..0c829e3 100644
--- a/src/addins/statistics/statisticswidget.cpp
+++ b/src/addins/statistics/statisticswidget.cpp
@@ -61,8 +61,8 @@ private:
         add(m_value);
       }
   private:
-    Gtk::TreeModelColumn<std::string> m_stat;
-    Gtk::TreeModelColumn<std::string> m_value;
+    Gtk::TreeModelColumn<Glib::ustring> m_stat;
+    Gtk::TreeModelColumn<Glib::ustring> m_value;
   };
   StatisticsRecord m_columns;
 
@@ -86,7 +86,7 @@ private:
       gnote::NoteBase::List notes = m_note_manager.get_notes();
 
       Gtk::TreeIter iter = append();
-      std::string stat = _("Total Notes:");
+      Glib::ustring stat = _("Total Notes:");
       iter->set_value(0, stat);
       iter->set_value(1, TO_STRING(notes.size()));
 
@@ -114,17 +114,17 @@ private:
           }
         }
       }
-      std::map<std::string, int> notebook_stats;
+      std::map<Glib::ustring, int> notebook_stats;
       for(std::map<gnote::notebooks::Notebook::Ptr, int>::iterator nb = notebook_notes.begin();
           nb != notebook_notes.end(); ++nb) {
         notebook_stats[nb->first->get_name()] = nb->second;
       }
-      for(std::map<std::string, int>::iterator nb = notebook_stats.begin(); nb != notebook_stats.end(); 
++nb) {
+      for(auto nb : notebook_stats) {
         Gtk::TreeIter nb_stat = append(iter->children());
-        nb_stat->set_value(0, nb->first);
+        nb_stat->set_value(0, nb.first);
         // TRANSLATORS: %1 is the format placeholder for the number of notes.
-        char *fmt = ngettext("%1 note", "%1 notes", nb->second);
-        nb_stat->set_value(1, Glib::ustring::compose(fmt, nb->second));
+        char *fmt = ngettext("%1 note", "%1 notes", nb.second);
+        nb_stat->set_value(1, Glib::ustring::compose(fmt, nb.second));
       }
 
       DBG_OUT("Statistics updated");
@@ -187,14 +187,14 @@ void StatisticsWidget::background()
 
 void StatisticsWidget::col1_data_func(Gtk::CellRenderer *renderer, const Gtk::TreeIter & iter)
 {
-  std::string val;
+  Glib::ustring val;
   iter->get_value(0, val);
   static_cast<Gtk::CellRendererText*>(renderer)->property_markup() = "<b>" + val + "</b>";
 }
 
 void StatisticsWidget::col2_data_func(Gtk::CellRenderer *renderer, const Gtk::TreeIter & iter)
 {
-  std::string val;
+  Glib::ustring val;
   iter->get_value(1, val);
   static_cast<Gtk::CellRendererText*>(renderer)->property_text() = val;
 }


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