[gnote] Move semantics for register_main_window_search_callback



commit d10f209bf53c3d9e62eccb72e3b126fda0eb364b
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Feb 20 18:36:21 2022 +0200

    Move semantics for register_main_window_search_callback

 src/actionmanager.cpp  | 4 ++--
 src/actionmanager.hpp  | 2 +-
 src/iactionmanager.hpp | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 8c457a9d..bd9200d0 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -157,12 +157,12 @@ namespace gnote {
     return std::find(m_non_modifying_actions.begin(), m_non_modifying_actions.end(), action) == 
m_non_modifying_actions.end();
   }
 
-  void ActionManager::register_main_window_search_callback(const Glib::ustring & id, const Glib::ustring & 
action,
+  void ActionManager::register_main_window_search_callback(Glib::ustring && id, Glib::ustring && action,
                                                     sigc::slot<void, const Glib::VariantBase&> callback)
   {
     DBG_ASSERT(m_main_window_search_actions.find(id) == m_main_window_search_actions.end(), "Duplicate 
callback for main window search");
 
-    m_main_window_search_actions[id] = std::make_pair(action, callback);
+    m_main_window_search_actions.insert(std::make_pair(std::move(id), std::make_pair(std::move(action), 
callback)));
     signal_main_window_search_actions_changed();
   }
 
diff --git a/src/actionmanager.hpp b/src/actionmanager.hpp
index f12a9cd2..1796fec7 100644
--- a/src/actionmanager.hpp
+++ b/src/actionmanager.hpp
@@ -49,7 +49,7 @@ public:
   virtual std::map<Glib::ustring, const Glib::VariantType*> get_main_window_actions() const override;
   virtual bool is_modifying_main_window_action(const Glib::ustring & action) const override;
 
-  virtual void register_main_window_search_callback(const Glib::ustring & id, const Glib::ustring & action,
+  virtual void register_main_window_search_callback(Glib::ustring && id, Glib::ustring && action,
                                                     sigc::slot<void, const Glib::VariantBase&> callback) 
override;
   virtual void unregister_main_window_search_callback(const Glib::ustring & id) override;
   virtual std::map<Glib::ustring, sigc::slot<void, const Glib::VariantBase&>> 
get_main_window_search_callbacks() override;
diff --git a/src/iactionmanager.hpp b/src/iactionmanager.hpp
index 0cf02d73..c9909ec5 100644
--- a/src/iactionmanager.hpp
+++ b/src/iactionmanager.hpp
@@ -40,7 +40,7 @@ public:
   virtual std::map<Glib::ustring, const Glib::VariantType*> get_main_window_actions() const = 0;
   virtual bool is_modifying_main_window_action(const Glib::ustring & action) const = 0;
 
-  virtual void register_main_window_search_callback(const Glib::ustring & id, const Glib::ustring & action,
+  virtual void register_main_window_search_callback(Glib::ustring && id, Glib::ustring && action,
                                                     sigc::slot<void, const Glib::VariantBase&> callback) = 0;
   virtual void unregister_main_window_search_callback(const Glib::ustring & id) = 0;
   virtual std::map<Glib::ustring, sigc::slot<void, const Glib::VariantBase&>> 
get_main_window_search_callbacks() = 0;


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