[gnote] Move semantics for NoteManager



commit 29bed75741acdffeefbfbe5ceef456eeb1dcda3b
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun May 29 18:59:14 2022 +0300

    Move semantics for NoteManager

 src/notebooks/notebook.cpp                         |  7 ++--
 src/notemanager.cpp                                | 26 ++++++-------
 src/notemanager.hpp                                |  9 ++---
 src/notemanagerbase.cpp                            | 43 ++++++++++------------
 src/notemanagerbase.hpp                            | 17 ++++-----
 src/notewindow.cpp                                 |  6 +--
 .../notedirectorywatcherapplicationaddin.cpp       |  4 +-
 src/plugins/noteoftheday/noteoftheday.cpp          |  8 ++--
 .../stickynoteimport/stickynoteimportnoteaddin.cpp |  4 +-
 src/synchronization/syncdialog.cpp                 |  6 +--
 src/synchronization/syncdialog.hpp                 |  4 +-
 src/test/unit/syncmanagerutests.cpp                |  7 ++--
 12 files changed, 65 insertions(+), 76 deletions(-)
---
diff --git a/src/notebooks/notebook.cpp b/src/notebooks/notebook.cpp
index 91863ee1..39c14024 100644
--- a/src/notebooks/notebook.cpp
+++ b/src/notebooks/notebook.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010-2014,2017,2019 Aurimas Cernius
+ * Copyright (C) 2010-2014,2017,2019,2022 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -138,7 +138,8 @@ namespace notebooks {
         auto tag_notes = m_tag->get_notes();
         title = m_note_manager.get_unique_name(title);
       }
-      note = m_note_manager.create(title, NoteManager::get_note_template_content (title));
+      auto content = NoteManager::get_note_template_content(title);
+      note = m_note_manager.create(std::move(title), std::move(content));
           
       // Select the initial text
       NoteBuffer::Ptr buffer = std::static_pointer_cast<Note>(note)->get_buffer();
@@ -166,7 +167,7 @@ namespace notebooks {
     Note::Ptr note_template = get_template_note();
 
     temp_title = m_note_manager.get_unique_name(_("New Note"));
-    NoteBase::Ptr note = m_note_manager.create_note_from_template(temp_title, note_template);
+    NoteBase::Ptr note = m_note_manager.create_note_from_template(std::move(temp_title), note_template);
 
     // Add the notebook tag
     note->add_tag(m_tag);
diff --git a/src/notemanager.cpp b/src/notemanager.cpp
index 4606f515..d7816636 100644
--- a/src/notemanager.cpp
+++ b/src/notemanager.cpp
@@ -145,13 +145,11 @@ namespace gnote {
         "</note-content>");
 
     try {
-      NoteBase::Ptr start_note = create (_("Start Here"),
-                                start_note_content);
+      NoteBase::Ptr start_note = create (_("Start Here"), std::move(start_note_content));
       start_note->queue_save (CONTENT_CHANGED);
       m_preferences.start_note_uri(start_note->uri());
 
-      NoteBase::Ptr links_note = create (_("Using Links in Gnote"),
-                                links_note_content);
+      NoteBase::Ptr links_note = create (_("Using Links in Gnote"), std::move(links_note_content));
       links_note->queue_save (CONTENT_CHANGED);
     } 
     catch (const std::exception & e) {
@@ -255,10 +253,10 @@ namespace gnote {
   }
 
 
-  NoteBase::Ptr NoteManager::create_note(Glib::ustring title, Glib::ustring body, const Glib::ustring & guid)
+  NoteBase::Ptr NoteManager::create_note(Glib::ustring && title, Glib::ustring && body, Glib::ustring && 
guid)
   {
     bool select_body = body.empty();
-    auto new_note = NoteManagerBase::create_note(std::move(title), std::move(body), guid);
+    auto new_note = NoteManagerBase::create_note(std::move(title), std::move(body), std::move(guid));
     if(select_body) {
       // Select the inital text so typing will overwrite the body text
       std::static_pointer_cast<Note>(new_note)->get_buffer()->select_note_body();
@@ -267,10 +265,9 @@ namespace gnote {
   }
 
   // Create a new note with the specified Xml content
-  NoteBase::Ptr NoteManager::create_new_note(const Glib::ustring & title, const Glib::ustring & xml_content, 
-                                        const Glib::ustring & guid)
+  NoteBase::Ptr NoteManager::create_new_note(Glib::ustring && title, Glib::ustring && xml_content, 
Glib::ustring && guid)
   {
-    NoteBase::Ptr new_note = NoteManagerBase::create_new_note(title, xml_content, guid);
+    NoteBase::Ptr new_note = NoteManagerBase::create_new_note(std::move(title), std::move(xml_content), 
std::move(guid));
 
     // Load all the addins for the new note
     m_addin_mgr->load_addins_for_note(std::static_pointer_cast<Note>(new_note));
@@ -296,11 +293,10 @@ namespace gnote {
 
   // Creates a new note with the given title and guid with body based on
   // the template note.
-  NoteBase::Ptr NoteManager::create_note_from_template(const Glib::ustring & title,
-                                                       const NoteBase::Ptr & template_note,
-                                                       const Glib::ustring & guid)
+  NoteBase::Ptr NoteManager::create_note_from_template(Glib::ustring && title, const NoteBase::Ptr & 
template_note, Glib::ustring && guid)
   {
-    NoteBase::Ptr new_note = NoteManagerBase::create_note_from_template(title, template_note, guid);
+    auto title_size = title.size();
+    NoteBase::Ptr new_note = NoteManagerBase::create_note_from_template(std::move(title), template_note, 
std::move(guid));
     if(new_note == 0) {
       return new_note;
     }
@@ -335,8 +331,8 @@ namespace gnote {
         selection.forward_chars(selection_bound - template_title.size() - 1); // skip title and new line
       }
       else {
-        cursor = buffer->get_iter_at_offset(cursor_pos - template_title.size() + title.size() - 1);
-        selection = buffer->get_iter_at_offset(selection_bound - template_title.size() + title.size() - 1);
+        cursor = buffer->get_iter_at_offset(cursor_pos - template_title.size() + title_size - 1);
+        selection = buffer->get_iter_at_offset(selection_bound - template_title.size() + title_size - 1);
       }
     }
     else {
diff --git a/src/notemanager.hpp b/src/notemanager.hpp
index 21b992e3..57f130ab 100644
--- a/src/notemanager.hpp
+++ b/src/notemanager.hpp
@@ -74,12 +74,9 @@ namespace gnote {
   protected:
     virtual void post_load() override;
     virtual void migrate_notes(const Glib::ustring & old_note_dir) override;
-    virtual NoteBase::Ptr create_note_from_template(const Glib::ustring & title,
-                                                    const NoteBase::Ptr & template_note,
-                                                    const Glib::ustring & guid) override;
-    virtual NoteBase::Ptr create_note(Glib::ustring title, Glib::ustring body, const Glib::ustring & guid = 
Glib::ustring()) override;
-    virtual NoteBase::Ptr create_new_note(const Glib::ustring & title, const Glib::ustring & xml_content,
-                                          const Glib::ustring & guid) override;
+    NoteBase::Ptr create_note_from_template(Glib::ustring && title, const NoteBase::Ptr & template_note, 
Glib::ustring && guid) override;
+    NoteBase::Ptr create_note(Glib::ustring && title, Glib::ustring && body, Glib::ustring && guid = 
Glib::ustring()) override;
+    NoteBase::Ptr create_new_note(Glib::ustring && title, Glib::ustring && xml_content, Glib::ustring && 
guid) override;
     virtual NoteBase::Ptr note_create_new(Glib::ustring && title, Glib::ustring && file_name) override;
     NoteBase::Ptr note_load(Glib::ustring && file_name) override;
   private:
diff --git a/src/notemanagerbase.cpp b/src/notemanagerbase.cpp
index 720ac389..a749e1f0 100644
--- a/src/notemanagerbase.cpp
+++ b/src/notemanagerbase.cpp
@@ -231,9 +231,9 @@ NoteBase::Ptr NoteManagerBase::find_by_uri(const Glib::ustring & uri) const
   return NoteBase::Ptr();
 }
 
-NoteBase::Ptr NoteManagerBase::create_note_from_template(const Glib::ustring & title, const NoteBase::Ptr & 
template_note)
+NoteBase::Ptr NoteManagerBase::create_note_from_template(Glib::ustring && title, const NoteBase::Ptr & 
template_note)
 {
-  return create_note_from_template(title, template_note, "");
+  return create_note_from_template(std::move(title), template_note, "");
 }
 
 NoteBase::Ptr NoteManagerBase::create()
@@ -241,37 +241,34 @@ NoteBase::Ptr NoteManagerBase::create()
   return create_note("", "");
 }
 
-NoteBase::Ptr NoteManagerBase::create(const Glib::ustring & title)
+NoteBase::Ptr NoteManagerBase::create(Glib::ustring && title)
 {
   Glib::ustring body;
   auto note_title = split_title_from_content(title, body);
-  return create_note(note_title, body);
+  return create_note(std::move(note_title), std::move(body));
 }
 
-NoteBase::Ptr NoteManagerBase::create(const Glib::ustring & title, const Glib::ustring & xml_content)
+NoteBase::Ptr NoteManagerBase::create(Glib::ustring && title, Glib::ustring && xml_content)
 {
-  return create_new_note(title, xml_content, "");
+  return create_new_note(std::move(title), std::move(xml_content), "");
 }
 
 // Creates a new note with the given title and guid with body based on
 // the template note.
-NoteBase::Ptr NoteManagerBase::create_note_from_template(const Glib::ustring & title,
-                                                         const NoteBase::Ptr & template_note,
-                                                         const Glib::ustring & guid)
+NoteBase::Ptr NoteManagerBase::create_note_from_template(Glib::ustring && title, const NoteBase::Ptr & 
template_note, Glib::ustring && guid)
 {
-  Glib::ustring new_title(title);
   Tag::Ptr template_save_title = 
tag_manager().get_or_create_system_tag(ITagManager::TEMPLATE_NOTE_SAVE_TITLE_SYSTEM_TAG);
   if(template_note->contains_tag(template_save_title)) {
-    new_title = get_unique_name(template_note->get_title());
+    title = get_unique_name(template_note->get_title());
   }
 
   // Use the body from the template note
   Glib::ustring xml_content = sharp::string_replace_first(template_note->xml_content(),
                                                           
utils::XmlEncoder::encode(template_note->get_title()),
-                                                          utils::XmlEncoder::encode(new_title));
+                                                          utils::XmlEncoder::encode(title));
   xml_content = sanitize_xml_content(xml_content);
 
-  NoteBase::Ptr new_note = create_new_note(new_title, xml_content, guid);
+  NoteBase::Ptr new_note = create_new_note(std::move(title), std::move(xml_content), std::move(guid));
   return new_note;
 }
 
@@ -290,7 +287,7 @@ Glib::ustring NoteManagerBase::get_unique_name(const Glib::ustring & basename) c
   return title;
 }
 
-NoteBase::Ptr NoteManagerBase::create_note(Glib::ustring title, Glib::ustring body, const Glib::ustring & 
guid)
+NoteBase::Ptr NoteManagerBase::create_note(Glib::ustring && title, Glib::ustring && body, Glib::ustring && 
guid)
 {
   if(title.empty()) {
     title = get_unique_name(_("New Note"));
@@ -300,7 +297,7 @@ NoteBase::Ptr NoteManagerBase::create_note(Glib::ustring title, Glib::ustring bo
   if(body.empty()) {
     auto template_note = find_template_note();
     if(template_note) {
-      return create_note_from_template(title, template_note, guid);
+      return create_note_from_template(std::move(title), template_note, std::move(guid));
     }
 
     // Use a simple "Describe..." body and highlight
@@ -311,12 +308,11 @@ NoteBase::Ptr NoteManagerBase::create_note(Glib::ustring title, Glib::ustring bo
     content = get_note_content(title, body);
   }
 
-  return create_new_note(title, content, guid);
+  return create_new_note(std::move(title), std::move(content), std::move(guid));
 }
 
 // Create a new note with the specified Xml content
-NoteBase::Ptr NoteManagerBase::create_new_note(const Glib::ustring & title, const Glib::ustring & 
xml_content, 
-                                               const Glib::ustring & guid)
+NoteBase::Ptr NoteManagerBase::create_new_note(Glib::ustring && title, Glib::ustring && xml_content, 
Glib::ustring && guid)
 {
   if(title.empty())
     throw sharp::Exception("Invalid title");
@@ -330,11 +326,11 @@ NoteBase::Ptr NoteManagerBase::create_new_note(const Glib::ustring & title, cons
   else
     filename = make_new_file_name();
 
-  NoteBase::Ptr new_note = note_create_new(Glib::ustring(title), Glib::ustring(filename));
+  NoteBase::Ptr new_note = note_create_new(std::move(title), Glib::ustring(filename));
   if(new_note == 0) {
     throw sharp::Exception("Failed to create new note");
   }
-  new_note->set_xml_content(Glib::ustring(xml_content));
+  new_note->set_xml_content(std::move(xml_content));
   new_note->signal_renamed.connect(sigc::mem_fun(*this, &NoteManagerBase::on_note_rename));
   new_note->signal_saved.connect(sigc::mem_fun(*this, &NoteManagerBase::on_note_save));
 
@@ -368,7 +364,8 @@ NoteBase::Ptr NoteManagerBase::get_or_create_template_note()
     if(find(title)) {
       title = get_unique_name(title);
     }
-    template_note = create(title, get_note_template_content(title));
+    auto content = get_note_template_content(title);
+    template_note = create(std::move(title), std::move(content));
     if(template_note == 0) {
       throw sharp::Exception("Failed to create template note");
     }
@@ -496,11 +493,11 @@ NoteBase::Ptr NoteManagerBase::import_note(const Glib::ustring & file_path)
 }
 
 
-NoteBase::Ptr NoteManagerBase::create_with_guid(const Glib::ustring & title, const Glib::ustring & guid)
+NoteBase::Ptr NoteManagerBase::create_with_guid(Glib::ustring && title, Glib::ustring && guid)
 {
   Glib::ustring body;
   auto note_title = split_title_from_content(title, body);
-  return create_note(note_title, body, guid);
+  return create_note(std::move(note_title), std::move(body), std::move(guid));
 }
 
 
diff --git a/src/notemanagerbase.hpp b/src/notemanagerbase.hpp
index 0ba5fc01..ac2c5eb4 100644
--- a/src/notemanagerbase.hpp
+++ b/src/notemanagerbase.hpp
@@ -71,9 +71,9 @@ public:
   NoteBase::Ptr find_by_uri(const Glib::ustring &) const;
   NoteBase::List get_notes_linking_to(const Glib::ustring & title) const;
   NoteBase::Ptr create();
-  NoteBase::Ptr create(const Glib::ustring & title);
-  NoteBase::Ptr create(const Glib::ustring & title, const Glib::ustring & xml_content);
-  NoteBase::Ptr create_note_from_template(const Glib::ustring & title, const NoteBase::Ptr & template_note);
+  NoteBase::Ptr create(Glib::ustring && title);
+  NoteBase::Ptr create(Glib::ustring && title, Glib::ustring && xml_content);
+  NoteBase::Ptr create_note_from_template(Glib::ustring && title, const NoteBase::Ptr & template_note);
   virtual NoteBase::Ptr get_or_create_template_note();
   NoteBase::Ptr find_template_note() const;
   Glib::ustring get_unique_name(const Glib::ustring & basename) const;
@@ -81,7 +81,7 @@ public:
   // Import a note read from file_path
   // Will ensure the sanity including the unique title.
   NoteBase::Ptr import_note(const Glib::ustring & file_path);
-  NoteBase::Ptr create_with_guid(const Glib::ustring & title, const Glib::ustring & guid);
+  NoteBase::Ptr create_with_guid(Glib::ustring && title, Glib::ustring && guid);
 
   const Glib::ustring & notes_dir() const
     {
@@ -104,12 +104,9 @@ protected:
   void add_note(NoteBase::Ptr);
   void on_note_rename(const NoteBase::Ptr & note, const Glib::ustring & old_title);
   void on_note_save(const NoteBase::Ptr & note);
-  virtual NoteBase::Ptr create_note_from_template(const Glib::ustring & title,
-                                                  const NoteBase::Ptr & template_note,
-                                                  const Glib::ustring & guid);
-  virtual NoteBase::Ptr create_note(Glib::ustring title, Glib::ustring body, const Glib::ustring & guid = 
Glib::ustring());
-  virtual NoteBase::Ptr create_new_note(const Glib::ustring & title, const Glib::ustring & xml_content, 
-                                        const Glib::ustring & guid);
+  virtual NoteBase::Ptr create_note_from_template(Glib::ustring && title, const NoteBase::Ptr & 
template_note, Glib::ustring && guid);
+  virtual NoteBase::Ptr create_note(Glib::ustring && title, Glib::ustring && body, Glib::ustring && guid = 
Glib::ustring());
+  virtual NoteBase::Ptr create_new_note(Glib::ustring && title, Glib::ustring && xml_content, Glib::ustring 
&& guid);
   virtual NoteBase::Ptr note_create_new(Glib::ustring && title, Glib::ustring && file_name) = 0;
   Glib::ustring make_new_file_name() const;
   Glib::ustring make_new_file_name(const Glib::ustring & guid) const;
diff --git a/src/notewindow.cpp b/src/notewindow.cpp
index 52c14c8f..51991226 100644
--- a/src/notewindow.cpp
+++ b/src/notewindow.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2011-2021 Aurimas Cernius
+ * Copyright (C) 2011-2022 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -482,7 +482,7 @@ namespace gnote {
     NoteBase::Ptr match = m_note.manager().find(title);
     if (!match) {
       try {
-        match = m_note.manager().create(select);
+        match = m_note.manager().create(std::move(select));
       } 
       catch (const sharp::Exception & e) {
         utils::HIGMessageDialog dialog(dynamic_cast<Gtk::Window*>(host()),
@@ -988,7 +988,7 @@ namespace gnote {
     NoteBase::Ptr match = manager.find(title);
     if(!match) {
       try {
-        match = manager.create(select);
+        match = manager.create(std::move(select));
       }
       catch(const sharp::Exception & e) {
         utils::HIGMessageDialog dialog(dynamic_cast<Gtk::Window*>(m_buffer->note().get_window()->host()),
diff --git a/src/plugins/notedirectorywatcher/notedirectorywatcherapplicationaddin.cpp 
b/src/plugins/notedirectorywatcher/notedirectorywatcherapplicationaddin.cpp
index 93fd5bf5..a735aacd 100644
--- a/src/plugins/notedirectorywatcher/notedirectorywatcherapplicationaddin.cpp
+++ b/src/plugins/notedirectorywatcher/notedirectorywatcherapplicationaddin.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012-2014,2017,2021 Aurimas Cernius
+ * Copyright (C) 2012-2014,2017,2021-2022 Aurimas Cernius
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -256,7 +256,7 @@ void NoteDirectoryWatcherApplicationAddin::add_or_update_note(const Glib::ustrin
     }
 
     try {
-      note = note_manager().create_with_guid(title, note_id);
+      note = note_manager().create_with_guid(std::move(title), Glib::ustring(note_id));
       if(note == 0) {
         /* TRANSLATORS: %s is file */
         ERR_OUT(_("NoteDirectoryWatcher: Unknown error creating note from %s"), note_path.c_str());
diff --git a/src/plugins/noteoftheday/noteoftheday.cpp b/src/plugins/noteoftheday/noteoftheday.cpp
index be6fc588..0ca820e9 100644
--- a/src/plugins/noteoftheday/noteoftheday.cpp
+++ b/src/plugins/noteoftheday/noteoftheday.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2013-2014,2017,2019-2020 Aurimas Cernius
+ * Copyright (C) 2013-2014,2017,2019-2020,2022 Aurimas Cernius
  * Copyright (C) 2009-2010 Debarshi Ray
  *
  * This program is free software: you can redistribute it and/or modify
@@ -37,12 +37,12 @@ const Glib::ustring NoteOfTheDay::s_title_prefix
 gnote::NoteBase::Ptr NoteOfTheDay::create(gnote::NoteManager & manager,
                                       const Glib::Date & date)
 {
-  const Glib::ustring title = get_title(date);
-  const Glib::ustring xml = get_content(date, manager);
+  Glib::ustring title = get_title(date);
+  Glib::ustring xml = get_content(date, manager);
 
   gnote::NoteBase::Ptr notd;
   try {
-    notd = manager.create(title, xml);
+    notd = manager.create(Glib::ustring(title), std::move(xml));
   }
   catch (const sharp::Exception & e) {
     /* TRANSLATORS: first %s is note title, second is error */
diff --git a/src/plugins/stickynoteimport/stickynoteimportnoteaddin.cpp 
b/src/plugins/stickynoteimport/stickynoteimportnoteaddin.cpp
index b51e4332..b670683c 100644
--- a/src/plugins/stickynoteimport/stickynoteimportnoteaddin.cpp
+++ b/src/plugins/stickynoteimport/stickynoteimportnoteaddin.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010-2011,2013-2014,2017,2021 Aurimas Cernius
+ * Copyright (C) 2010-2011,2013-2014,2017,2021-2022 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -288,7 +288,7 @@ bool StickyNoteImportNoteAddin::create_note_from_sticky(const char * stickyTitle
                                           gnote::utils::XmlEncoder::encode(content));
 
   try {
-    gnote::NoteBase::Ptr newNote = manager.create(title, noteXml);
+    gnote::NoteBase::Ptr newNote = manager.create(Glib::ustring(title), std::move(noteXml));
     newNote->queue_save (gnote::NO_CHANGE);
     return true;
   } 
diff --git a/src/synchronization/syncdialog.cpp b/src/synchronization/syncdialog.cpp
index ea7a943f..1f7b3b2a 100644
--- a/src/synchronization/syncdialog.cpp
+++ b/src/synchronization/syncdialog.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012-2014,2016,2017,2019-2021 Aurimas Cernius
+ * Copyright (C) 2012-2014,2016,2017,2019-2022 Aurimas Cernius
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -678,7 +678,7 @@ void SyncDialog::note_conflict_detected_(
 }
 
 
-void SyncDialog::rename_note(const Note::Ptr & note, const Glib::ustring & newTitle, bool)
+void SyncDialog::rename_note(const Note::Ptr & note, Glib::ustring && newTitle, bool)
 {
   Glib::ustring oldTitle = note->get_title();
   // Rename the note (skip for now...never using updateReferencingNotes option)
@@ -704,7 +704,7 @@ void SyncDialog::rename_note(const Note::Ptr & note, const Glib::ustring & newTi
 
   // Create note with old XmlContent just in case GetCompleteNoteXml failed
   DBG_OUT("RenameNote: about to create %s", newTitle.c_str());
-  Note::Ptr renamedNote = std::static_pointer_cast<Note>(m_manager.create(newTitle, newContent));
+  Note::Ptr renamedNote = std::static_pointer_cast<Note>(m_manager.create(std::move(newTitle), 
std::move(newContent)));
   if(newCompleteContent != "") {// TODO: Anything to do if it is null?
     try {
       renamedNote->load_foreign_note_xml(newCompleteContent, OTHER_DATA_CHANGED);
diff --git a/src/synchronization/syncdialog.hpp b/src/synchronization/syncdialog.hpp
index b6e4ed20..1ab5b1ef 100644
--- a/src/synchronization/syncdialog.hpp
+++ b/src/synchronization/syncdialog.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012-2014,2017,2019-2020 Aurimas Cernius
+ * Copyright (C) 2012-2014,2017,2019-2020,2022 Aurimas Cernius
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -70,7 +70,7 @@ namespace sync {
     void treeview_col1_data_func(Gtk::CellRenderer *renderer, const Gtk::TreeIter & iter);
     void treeview_col2_data_func(Gtk::CellRenderer *renderer, const Gtk::TreeIter & iter);
     void sync_state_changed_(SyncState state);
-    void rename_note(const Note::Ptr & note, const Glib::ustring & newTitle, bool updateReferencingNotes);
+    void rename_note(const Note::Ptr & note, Glib::ustring && newTitle, bool updateReferencingNotes);
     void present_note(const Note::Ptr &);
 
     Gtk::Image *m_image;
diff --git a/src/test/unit/syncmanagerutests.cpp b/src/test/unit/syncmanagerutests.cpp
index 20b0e919..921e32f5 100644
--- a/src/test/unit/syncmanagerutests.cpp
+++ b/src/test/unit/syncmanagerutests.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2017-2020 Aurimas Cernius
+ * Copyright (C) 2017-2020,2022 Aurimas Cernius
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -116,9 +116,10 @@ SUITE(SyncManagerTests)
       return Glib::ustring::compose("<note-content><note-title>%1</note-title>\n\n%2</note-content>", title, 
body);
     }
 
-    void create_note(test::NoteManager & manager, const Glib::ustring & title, const Glib::ustring & body)
+    void create_note(test::NoteManager & manager, Glib::ustring && title, Glib::ustring && body)
     {
-      manager.create(title, make_note_content(title, body))->save();
+      auto content = make_note_content(title, body);
+      manager.create(std::move(title), std::move(content))->save();
     }
 
     bool find_note_in_files(const Glib::ustring & title)


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