[gnote] Move semantics for set_search_text



commit a9399067fe2086548c67ebd867db478641bbb5ea
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Mon Mar 28 17:33:02 2022 +0300

    Move semantics for set_search_text

 src/dbus/remotecontrol.cpp |  6 +++---
 src/mainwindow.cpp         |  6 +++---
 src/mainwindow.hpp         |  6 +++---
 src/recentchanges.cpp      | 10 +++++-----
 src/recentchanges.hpp      |  4 ++--
 5 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/src/dbus/remotecontrol.cpp b/src/dbus/remotecontrol.cpp
index 43802694..af0cb49f 100644
--- a/src/dbus/remotecontrol.cpp
+++ b/src/dbus/remotecontrol.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2011-2014,2016-2017,2019-2020 Aurimas Cernius
+ * Copyright (C) 2011-2014,2016-2017,2019-2020,2022 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -129,7 +129,7 @@ namespace gnote {
     }
 
     MainWindow & window(present_note(note));
-    window.set_search_text(search);
+    window.set_search_text(Glib::ustring(search));
     window.show_search_bar();
 
     return true;
@@ -145,7 +145,7 @@ namespace gnote {
   void RemoteControl::DisplaySearchWithText(const Glib::ustring& search_text)
   {
     MainWindow & recent_changes = m_gnote.open_search_all();
-    recent_changes.set_search_text(search_text);
+    recent_changes.set_search_text(Glib::ustring(search_text));
     recent_changes.present();
     recent_changes.show_search_bar();
   }
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 675c28a9..3b243b6f 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2013,2015-2017,2019-2021 Aurimas Cernius
+ * Copyright (C) 2013,2015-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
@@ -121,10 +121,10 @@ bool MainWindow::use_client_side_decorations(Preferences & prefs)
 }
 
 
-MainWindow::MainWindow(const Glib::ustring & title)
+MainWindow::MainWindow(Glib::ustring && title)
   : m_close_on_esc(false)
 {
-  set_title(title);
+  set_title(std::move(title));
 }
 
 }
diff --git a/src/mainwindow.hpp b/src/mainwindow.hpp
index 39616495..dd8b958f 100644
--- a/src/mainwindow.hpp
+++ b/src/mainwindow.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2013,2015-2017,2019,2021 Aurimas Cernius
+ * Copyright (C) 2013,2015-2017,2019,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
@@ -41,9 +41,9 @@ public:
   static MainWindow *present_default(IGnote & g, const Note::Ptr & note);
   static bool use_client_side_decorations(Preferences & prefs);
 
-  explicit MainWindow(const Glib::ustring & title);
+  explicit MainWindow(Glib::ustring && title);
 
-  virtual void set_search_text(const Glib::ustring & value) = 0;
+  virtual void set_search_text(Glib::ustring && value) = 0;
   virtual void show_search_bar(bool grab_focus = true) = 0;
   virtual void present_search() = 0;
   virtual void new_note() = 0;
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index f27e87a6..624b7e1b 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010-2021 Aurimas Cernius
+ * Copyright (C) 2010-2022 Aurimas Cernius
  * Copyright (C) 2010 Debarshi Ray
  * Copyright (C) 2009 Hubert Figuiere
  *
@@ -620,17 +620,17 @@ namespace gnote {
     MainWindow::on_show();
   }
 
-  void NoteRecentChanges::set_search_text(const Glib::ustring & value)
+  void NoteRecentChanges::set_search_text(Glib::ustring && value)
   {
     if(m_search_box) {
-      m_search_entry->set_text(value);
+      m_search_entry->set_text(std::move(value));
     }
     else {
       if(!m_search_text) {
-        m_search_text = new Glib::ustring(value);
+        m_search_text = new Glib::ustring(std::move(value));
       }
       else {
-        *m_search_text = value;
+        *m_search_text = std::move(value);
       }
     }
   }
diff --git a/src/recentchanges.hpp b/src/recentchanges.hpp
index a2eacfc6..edbdcf36 100644
--- a/src/recentchanges.hpp
+++ b/src/recentchanges.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010-2017,2019-2021 Aurimas Cernius
+ * Copyright (C) 2010-2017,2019-2022 Aurimas Cernius
  * Copyright (C) 2010 Debarshi Ray
  * Copyright (C) 2009 Hubert Figuiere
  *
@@ -45,7 +45,7 @@ public:
   NoteRecentChanges(IGnote & g, NoteManagerBase & m);
   virtual ~NoteRecentChanges();
   virtual void show_search_bar(bool grab_focus = true) override;
-  virtual void set_search_text(const Glib::ustring & value) override;
+  virtual void set_search_text(Glib::ustring && value) override;
   virtual void new_note() override;
   virtual void present_search() override;
   virtual void close_window() override;


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