[gnote] Replace std::list with std::vector in notebooknoteaddin
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Replace std::list with std::vector in notebooknoteaddin
- Date: Sun, 28 Apr 2019 16:30:01 +0000 (UTC)
commit 664dbf7a4e3584719d95e9e5e30213bdb0676214
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Apr 28 17:21:51 2019 +0300
Replace std::list with std::vector in notebooknoteaddin
src/notebooks/notebooknoteaddin.cpp | 10 +++++-----
src/notebooks/notebooknoteaddin.hpp | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/notebooks/notebooknoteaddin.cpp b/src/notebooks/notebooknoteaddin.cpp
index 8faa9a32..5adc3f18 100644
--- a/src/notebooks/notebooknoteaddin.cpp
+++ b/src/notebooks/notebooknoteaddin.cpp
@@ -155,8 +155,7 @@ namespace notebooks {
menu->add(*no_notebook_item);
// Add in all the real notebooks
- std::list<Gtk::ModelButton*> notebook_menu_items;
- get_notebook_menu_items(notebook_menu_items);
+ auto notebook_menu_items = get_notebook_menu_items();
if(!notebook_menu_items.empty()) {
for(Gtk::ModelButton *item : notebook_menu_items) {
menu->add(*item);
@@ -171,13 +170,12 @@ namespace notebooks {
}
- void NotebookNoteAddin::get_notebook_menu_items(std::list<Gtk::ModelButton*>& items) const
+ std::vector<Gtk::ModelButton*> NotebookNoteAddin::get_notebook_menu_items() const
{
+ std::vector<Gtk::ModelButton*> items;
Glib::RefPtr<Gtk::TreeModel> model = NotebookManager::obj().get_notebooks();
Gtk::TreeIter iter;
- items.clear();
-
iter = model->children().begin();
for(iter = model->children().begin(); iter != model->children().end(); ++iter) {
Notebook::Ptr notebook;
@@ -187,6 +185,8 @@ namespace notebooks {
gtk_actionable_set_action_target_value(GTK_ACTIONABLE(item->gobj()),
g_variant_new_string(notebook->get_name().c_str()));
items.push_back(item);
}
+
+ return items;
}
diff --git a/src/notebooks/notebooknoteaddin.hpp b/src/notebooks/notebooknoteaddin.hpp
index 70f6f952..be0f9061 100644
--- a/src/notebooks/notebooknoteaddin.hpp
+++ b/src/notebooks/notebooknoteaddin.hpp
@@ -51,7 +51,7 @@ namespace notebooks {
void on_new_notebook_menu_item(const Glib::VariantBase&) const;
void on_move_to_notebook(const Glib::VariantBase &);
void on_notebooks_changed();
- void get_notebook_menu_items(std::list<Gtk::ModelButton*> &) const;
+ std::vector<Gtk::ModelButton*> get_notebook_menu_items() const;
void update_menu(Gtk::Box *) const;
sigc::connection m_new_notebook_cid;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]