[gnote] Move semantics for popoverwidgets
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Move semantics for popoverwidgets
- Date: Sun, 19 Jun 2022 15:46:23 +0000 (UTC)
commit 35599f7fc9c4cee0c4ca81750eccef2591fe9fa7
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Jun 19 17:46:28 2022 +0300
Move semantics for popoverwidgets
src/actionmanager.cpp | 2 +-
src/plugins/backlinks/backlinksnoteaddin.cpp | 4 ++--
.../tableofcontents/tableofcontentsnoteaddin.cpp | 4 ++--
src/popoverwidgets.cpp | 18 +++++++++---------
src/popoverwidgets.hpp | 12 ++++++------
5 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index b9e9a096..afb6d1ee 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -184,7 +184,7 @@ namespace gnote {
void ActionManager::add_app_menu_items(std::vector<PopoverWidget> & widgets)
{
for(auto& iter : m_app_menu_items) {
- widgets.push_back(PopoverWidget(iter.first, iter.second.order,
utils::create_popover_button(iter.second.action_def, iter.second.label)));
+ widgets.push_back(PopoverWidget(iter.first, iter.second.order,
utils::create_popover_button(iter.second.action_def, Glib::ustring(iter.second.label))));
}
}
diff --git a/src/plugins/backlinks/backlinksnoteaddin.cpp b/src/plugins/backlinks/backlinksnoteaddin.cpp
index 4d4e1f0f..bf083804 100644
--- a/src/plugins/backlinks/backlinksnoteaddin.cpp
+++ b/src/plugins/backlinks/backlinksnoteaddin.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2010-2011,2013-2014,2016-2017,2019-2021 Aurimas Cernius
+ * Copyright (C) 2010-2011,2013-2014,2016-2017,2019-2022 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -110,7 +110,7 @@ std::vector<Gtk::Widget*> BacklinksNoteAddin::get_backlink_menu_items() const
gnote::NoteBase::List notes = get_note()->manager().get_notes_linking_to(get_note()->get_title());
for(const gnote::NoteBase::Ptr & note : notes) {
if(note != get_note()) { // don't match ourself
- auto button = manage(gnote::utils::create_popover_button("win.backlinks-open-note",
note->get_title()));
+ auto button = manage(gnote::utils::create_popover_button("win.backlinks-open-note",
Glib::ustring(note->get_title())));
gtk_actionable_set_action_target_value(GTK_ACTIONABLE(button->gobj()),
Glib::Variant<Glib::ustring>::create(note->uri()).gobj());
items.push_back(button);
diff --git a/src/plugins/tableofcontents/tableofcontentsnoteaddin.cpp
b/src/plugins/tableofcontents/tableofcontentsnoteaddin.cpp
index 7e9bb885..e3d52809 100644
--- a/src/plugins/tableofcontents/tableofcontentsnoteaddin.cpp
+++ b/src/plugins/tableofcontents/tableofcontentsnoteaddin.cpp
@@ -3,7 +3,7 @@
* It lists note's table of contents in a menu.
*
* Copyright (C) 2013 Luc Pionchon <pionchon luc gmail com>
- * Copyright (C) 2013,2015-2017,2019-2021 Aurimas Cernius <aurisc4 gmail com>
+ * Copyright (C) 2013,2015-2017,2019-2022 Aurimas Cernius <aurisc4 gmail com>
*
* 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
@@ -348,7 +348,7 @@ void TableofcontentsNoteAddin::get_toc_popover_items(std::vector<Gtk::Widget*> &
if(toc_item.heading_level == Heading::Level_2) {
toc_item.heading = "→ " + toc_item.heading;
}
- auto item =
dynamic_cast<Gtk::ModelButton*>(gnote::utils::create_popover_button("win.tableofcontents-goto-heading",
toc_item.heading));
+ auto item =
dynamic_cast<Gtk::ModelButton*>(gnote::utils::create_popover_button("win.tableofcontents-goto-heading",
Glib::ustring(toc_item.heading)));
gtk_actionable_set_action_target_value(GTK_ACTIONABLE(item->gobj()),
g_variant_new_int32(toc_item.heading_position));
item->property_role() = Gtk::BUTTON_ROLE_NORMAL;
item->property_inverted() = true;
diff --git a/src/popoverwidgets.cpp b/src/popoverwidgets.cpp
index bc3c635e..0ab2fdfb 100644
--- a/src/popoverwidgets.cpp
+++ b/src/popoverwidgets.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2019,2021 Aurimas Cernius
+ * Copyright (C) 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
@@ -30,9 +30,9 @@ namespace gnote {
, public PopoverSubmenu
{
public:
- PopoverSubmenuBox(const Glib::ustring & submenu)
+ PopoverSubmenuBox(Glib::ustring && submenu)
: Gtk::Box(Gtk::ORIENTATION_VERTICAL)
- , PopoverSubmenu(submenu)
+ , PopoverSubmenu(std::move(submenu))
{
utils::set_common_popover_widget_props(*this);
}
@@ -81,29 +81,29 @@ PopoverWidget PopoverWidget::create_custom_section(Gtk::Widget *w)
namespace utils {
- Gtk::Widget * create_popover_button(const Glib::ustring & action, const Glib::ustring & label)
+ Gtk::Widget *create_popover_button(const Glib::ustring & action, Glib::ustring && label)
{
Gtk::ModelButton *item = new Gtk::ModelButton;
gtk_actionable_set_action_name(GTK_ACTIONABLE(item->gobj()), action.c_str());
- item->set_label(label);
+ item->set_label(std::move(label));
set_common_popover_button_props(*item);
return item;
}
- Gtk::Widget * create_popover_submenu_button(const Glib::ustring & submenu, const Glib::ustring & label)
+ Gtk::Widget *create_popover_submenu_button(const Glib::ustring & submenu, Glib::ustring && label)
{
Gtk::ModelButton *button = new Gtk::ModelButton;
button->property_menu_name() = submenu;
- button->set_label(label);
+ button->set_label(std::move(label));
set_common_popover_button_props(*button);
return button;
}
- Gtk::Box * create_popover_submenu(const Glib::ustring & name)
+ Gtk::Box *create_popover_submenu(Glib::ustring && name)
{
- return new PopoverSubmenuBox(name);
+ return new PopoverSubmenuBox(std::move(name));
}
diff --git a/src/popoverwidgets.hpp b/src/popoverwidgets.hpp
index 82910356..fc9872ed 100644
--- a/src/popoverwidgets.hpp
+++ b/src/popoverwidgets.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2019 Aurimas Cernius
+ * Copyright (C) 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
@@ -83,8 +83,8 @@ struct PopoverWidget
class PopoverSubmenu
{
public:
- PopoverSubmenu(const Glib::ustring & name)
- : m_name(name)
+ PopoverSubmenu(Glib::ustring && name)
+ : m_name(std::move(name))
{}
const Glib::ustring & name() const
@@ -97,9 +97,9 @@ private:
namespace utils {
- Gtk::Widget * create_popover_button(const Glib::ustring & action, const Glib::ustring & label);
- Gtk::Widget * create_popover_submenu_button(const Glib::ustring & submenu, const Glib::ustring & label);
- Gtk::Box * create_popover_submenu(const Glib::ustring & name);
+ Gtk::Widget *create_popover_button(const Glib::ustring & action, Glib::ustring && label);
+ Gtk::Widget *create_popover_submenu_button(const Glib::ustring & submenu, Glib::ustring && label);
+ Gtk::Box *create_popover_submenu(Glib::ustring && name);
void set_common_popover_widget_props(Gtk::Widget & widget);
void set_common_popover_widget_props(Gtk::Box & widget);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]