[gnote] Add add_notebook method to NotebookManager
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Add add_notebook method to NotebookManager
- Date: Sun, 4 Aug 2013 19:53:57 +0000 (UTC)
commit e78bc7917a547244ef1f78f1c898e47eccfdc8c3
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Aug 4 22:33:34 2013 +0300
Add add_notebook method to NotebookManager
src/notebooks/notebookmanager.cpp | 12 ++++++++++++
src/notebooks/notebookmanager.hpp | 1 +
2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/notebooks/notebookmanager.cpp b/src/notebooks/notebookmanager.cpp
index f05bd27..afc7d5a 100644
--- a/src/notebooks/notebookmanager.cpp
+++ b/src/notebooks/notebookmanager.cpp
@@ -154,6 +154,18 @@ namespace gnote {
return notebook;
}
+ bool NotebookManager::add_notebook(const Notebook::Ptr & notebook)
+ {
+ if(m_notebookMap.find(notebook->get_normalized_name()) != m_notebookMap.end()) {
+ return false;
+ }
+
+ Gtk::TreeIter iter = m_notebooks->append();
+ iter->set_value(0, notebook);
+ m_notebookMap[notebook->get_normalized_name()] = iter;
+ return true;
+ }
+
void NotebookManager::delete_notebook(const Notebook::Ptr & notebook)
{
if (!notebook)
diff --git a/src/notebooks/notebookmanager.hpp b/src/notebooks/notebookmanager.hpp
index a37e529..0da5bdf 100644
--- a/src/notebooks/notebookmanager.hpp
+++ b/src/notebooks/notebookmanager.hpp
@@ -75,6 +75,7 @@ public:
Notebook::Ptr get_notebook(const std::string & notebookName) const;
bool notebook_exists(const std::string & notebookName) const;
Notebook::Ptr get_or_create_notebook(const std::string &);
+ bool add_notebook(const Notebook::Ptr &);
void delete_notebook(const Notebook::Ptr &);
bool get_notebook_iter(const Notebook::Ptr &, Gtk::TreeIter & );
Notebook::Ptr get_notebook_from_note(const Note::Ptr &);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]