[gnote] Replace std::string by Glib::ustring in Gnote
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Replace std::string by Glib::ustring in Gnote
- Date: Mon, 30 Jan 2017 21:02:31 +0000 (UTC)
commit 336eab716b556aa94c2d760be7f2c4cc3e916bae
Author: Aurimas Černius <aurisc4 gmail com>
Date: Mon Jan 30 22:56:51 2017 +0200
Replace std::string by Glib::ustring in Gnote
src/gnote.cpp | 22 +++++++++++-----------
src/gnote.hpp | 18 ++++++++----------
2 files changed, 19 insertions(+), 21 deletions(-)
---
diff --git a/src/gnote.cpp b/src/gnote.cpp
index bf43272..b146731 100644
--- a/src/gnote.cpp
+++ b/src/gnote.cpp
@@ -133,7 +133,7 @@ namespace gnote {
void Gnote::common_init()
{
- std::string note_path = get_note_path(cmd_line.note_path());
+ Glib::ustring note_path = get_note_path(cmd_line.note_path());
//create singleton objects
new TagManager;
@@ -196,9 +196,9 @@ namespace gnote {
}
}
- std::string Gnote::get_note_path(const std::string & override_path)
+ Glib::ustring Gnote::get_note_path(const Glib::ustring & override_path)
{
- std::string note_path;
+ Glib::ustring note_path;
if(override_path.empty()) {
const char * s = getenv("GNOTE_PATH");
note_path = s?s:"";
@@ -288,7 +288,7 @@ namespace gnote {
documenters.push_back("Pierre-Yves Luyten <py luyten fr>");
documenters.push_back("Aurimas Černius <aurisc4 gmail com>");
- std::string translators(_("translator-credits"));
+ Glib::ustring translators(_("translator-credits"));
if (translators == "translator-credits")
translators = "";
@@ -638,7 +638,7 @@ namespace gnote {
void GnoteCommandLine::execute(T & remote)
{
if (m_do_new_note) {
- std::string new_uri;
+ Glib::ustring new_uri;
if (!m_new_note_name.empty()) {
new_uri = remote->FindNote (m_new_note_name);
@@ -667,7 +667,7 @@ namespace gnote {
}
if (!m_open_external_note_path.empty()) {
- std::string note_id = sharp::file_basename(m_open_external_note_path);
+ Glib::ustring note_id = sharp::file_basename(m_open_external_note_path);
if (!note_id.empty()) {
// Attempt to load the note, assuming it might already
// be part of our notes list.
@@ -675,7 +675,7 @@ namespace gnote {
sharp::StreamReader sr;
sr.init(m_open_external_note_path);
if (sr.file()) {
- std::string noteTitle;
+ Glib::ustring noteTitle;
Glib::ustring noteXml;
sr.read_to_end (noteXml);
@@ -692,12 +692,12 @@ namespace gnote {
noteTitle = NoteArchiver::obj().get_title_from_note_xml (noteXml);
if (!noteTitle.empty()) {
// Check for conflicting titles
- std::string baseTitle = noteTitle;
+ Glib::ustring baseTitle = noteTitle;
for (int i = 1; !remote->FindNote (noteTitle).empty(); i++) {
noteTitle = Glib::ustring::compose("%1 (%2)", baseTitle, i);
}
- std::string note_uri = remote->CreateNamedNote (noteTitle);
+ Glib::ustring note_uri = remote->CreateNamedNote(noteTitle);
// Update title in the note XML
noteXml = NoteArchiver::obj().get_renamed_note_xml (noteXml, baseTitle, noteTitle);
@@ -728,14 +728,14 @@ namespace gnote {
void GnoteCommandLine::print_version()
{
- // TRANSLATORS: %1%: boost format placeholder for the version string.
+ // TRANSLATORS: %1: format placeholder for the version string.
Glib::ustring version = Glib::ustring::compose(_("Version %1"), VERSION);
std::cerr << version << std::endl;
}
template <typename T>
- bool GnoteCommandLine::display_note(T & remote, std::string uri)
+ bool GnoteCommandLine::display_note(T & remote, Glib::ustring uri)
{
if (m_highlight_search) {
return remote->DisplayNoteWithSearch(uri, m_highlight_search);
diff --git a/src/gnote.hpp b/src/gnote.hpp
index 25077a6..bff5703 100644
--- a/src/gnote.hpp
+++ b/src/gnote.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2010-2016 Aurimas Cernius
+ * Copyright (C) 2010-2017 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -24,8 +24,6 @@
#ifndef _GNOTE_HPP_
#define _GNOTE_HPP_
-#include <string>
-
#include <glibmm/optioncontext.h>
#include <glibmm/ustring.h>
#include <gtkmm/icontheme.h>
@@ -74,7 +72,7 @@ public:
private:
void print_version();
template <typename T>
- bool display_note(T & remote, std::string uri);
+ bool display_note(T & remote, Glib::ustring uri);
template <typename T>
void execute(T & remote);
@@ -85,19 +83,19 @@ private:
bool m_shell_search;
gchar * m_note_path;
bool m_do_search;
- std::string m_search;
+ Glib::ustring m_search;
bool m_show_version;
bool m_do_new_note;
- std::string m_new_note_name;
+ Glib::ustring m_new_note_name;
gchar* m_open_note;
bool m_open_start_here;
gchar* m_highlight_search;
// depend on m_open_note, set in on_post_parse
- std::string m_open_note_name;
- std::string m_open_note_uri;
- std::string m_open_external_note_path;
+ Glib::ustring m_open_note_name;
+ Glib::ustring m_open_note_uri;
+ Glib::ustring m_open_external_note_path;
};
@@ -144,7 +142,7 @@ protected:
virtual void on_startup() override;
private:
Gnote();
- std::string get_note_path(const std::string & override_path);
+ Glib::ustring get_note_path(const Glib::ustring & override_path);
void common_init();
void end_main(bool bus_aquired, bool name_acquired);
void on_sync_dialog_response(int response_id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]