[gnote] Rename NotebookManager::instance() to obj()
- From: Aurimas Äernius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Rename NotebookManager::instance() to obj()
- Date: Sat, 19 Jan 2013 16:47:39 +0000 (UTC)
commit 11a3524780e7b617a7eed9856c7ca1033c3857bf
Author: Aurimas Äernius <aurisc4 gmail com>
Date: Sun Jan 6 18:46:44 2013 +0200
Rename NotebookManager::instance() to obj()
For compatibility wiht other singletons.
src/note.cpp | 7 +++----
src/notebooks/createnotebookdialog.cpp | 4 ++--
src/notebooks/notebook.cpp | 7 +++----
src/notebooks/notebookapplicationaddin.cpp | 13 ++++++-------
src/notebooks/notebookmanager.cpp | 9 ++++-----
src/notebooks/notebookmanager.hpp | 4 ++--
src/notebooks/notebookmenuitem.cpp | 4 ++--
src/notebooks/notebooknoteaddin.cpp | 14 +++++++-------
src/notemanager.cpp | 2 +-
src/notewindow.cpp | 4 ++--
src/searchnoteswidget.cpp | 20 ++++++++++----------
11 files changed, 42 insertions(+), 46 deletions(-)
---
diff --git a/src/note.cpp b/src/note.cpp
index e187de7..c75fcff 100644
--- a/src/note.cpp
+++ b/src/note.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2010-2012 Aurimas Cernius
+ * Copyright (C) 2010-2013 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -37,7 +37,6 @@
#include <gtkmm/button.h>
#include <gtkmm/stock.h>
-#include "gnote.hpp"
#include "note.hpp"
#include "notemanager.hpp"
#include "noterenamedialog.hpp"
@@ -1040,7 +1039,7 @@ namespace gnote {
m_note_window_embedded = true;
}
- notebooks::NotebookManager::instance().active_notes_notebook()->add_note(shared_from_this());
+ notebooks::NotebookManager::obj().active_notes_notebook()->add_note(shared_from_this());
}
bool Note::is_special() const
@@ -1087,7 +1086,7 @@ namespace gnote {
}
}
settings->set_string(Preferences::MENU_PINNED_NOTES, new_pinned);
- notebooks::NotebookManager::instance().signal_note_pin_status_changed(*this, pinned);
+ notebooks::NotebookManager::obj().signal_note_pin_status_changed(*this, pinned);
}
void Note::get_tags(std::list<Tag::Ptr> & l) const
diff --git a/src/notebooks/createnotebookdialog.cpp b/src/notebooks/createnotebookdialog.cpp
index 9eeb625..652a2a1 100644
--- a/src/notebooks/createnotebookdialog.cpp
+++ b/src/notebooks/createnotebookdialog.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2012 Aurimas Cernius
+ * Copyright (C) 2012-2013 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -93,7 +93,7 @@ namespace gnote {
void CreateNotebookDialog::on_name_entry_changed()
{
bool nameTaken = false;
- if (NotebookManager::instance().notebook_exists (get_notebook_name())) {
+ if(NotebookManager::obj().notebook_exists(get_notebook_name())) {
m_errorLabel.show ();
nameTaken = true;
}
diff --git a/src/notebooks/notebook.cpp b/src/notebooks/notebook.cpp
index 6922a6b..11bf491 100644
--- a/src/notebooks/notebook.cpp
+++ b/src/notebooks/notebook.cpp
@@ -24,7 +24,6 @@
#include <glibmm/i18n.h>
#include "sharp/string.hpp"
-#include "gnote.hpp"
#include "iconmanager.hpp"
#include "notemanager.hpp"
#include "notebooks/notebook.hpp"
@@ -189,7 +188,7 @@ namespace notebooks {
bool Notebook::add_note(const Note::Ptr & note)
{
- NotebookManager::instance().move_note_to_notebook(note, shared_from_this());
+ NotebookManager::obj().move_note_to_notebook(note, shared_from_this());
return true;
}
@@ -256,13 +255,13 @@ namespace notebooks {
bool UnfiledNotesNotebook::contains_note(const Note::Ptr & note)
{
- return !notebooks::NotebookManager::instance().get_notebook_from_note(note);
+ return !notebooks::NotebookManager::obj().get_notebook_from_note(note);
}
bool UnfiledNotesNotebook::add_note(const Note::Ptr & note)
{
- NotebookManager::instance().move_note_to_notebook(note, Notebook::Ptr());
+ NotebookManager::obj().move_note_to_notebook(note, Notebook::Ptr());
return true;
}
diff --git a/src/notebooks/notebookapplicationaddin.cpp b/src/notebooks/notebookapplicationaddin.cpp
index 232d74a..df7cc5a 100644
--- a/src/notebooks/notebookapplicationaddin.cpp
+++ b/src/notebooks/notebookapplicationaddin.cpp
@@ -38,7 +38,6 @@
#include "notebooks/notebook.hpp"
#include "actionmanager.hpp"
#include "debug.hpp"
-#include "gnote.hpp"
#include "iconmanager.hpp"
#include "notemanager.hpp"
@@ -179,7 +178,7 @@ namespace gnote {
NotebookNewNoteMenuItem *item;
- Glib::RefPtr<Gtk::TreeModel> model = NotebookManager::instance().get_notebooks();
+ Glib::RefPtr<Gtk::TreeModel> model = NotebookManager::obj().get_notebooks();
Gtk::TreeIter iter;
// Add in the "New Notebook..." menu item
@@ -238,7 +237,7 @@ namespace gnote {
void NotebookApplicationAddin::on_tag_added(const Note & note, const Tag::Ptr& tag)
{
- if (NotebookManager::instance().is_adding_notebook()) {
+ if (NotebookManager::obj().is_adding_notebook()) {
return;
}
@@ -252,9 +251,9 @@ namespace gnote {
sharp::string_substring(tag->name(), megaPrefix.size());
Notebook::Ptr notebook =
- NotebookManager::instance().get_or_create_notebook (notebookName);
+ NotebookManager::obj().get_or_create_notebook (notebookName);
- NotebookManager::instance().signal_note_added_to_notebook() (note, notebook);
+ NotebookManager::obj().signal_note_added_to_notebook() (note, notebook);
}
@@ -273,12 +272,12 @@ namespace gnote {
sharp::string_substring(normalizedTagName, megaPrefix.size());
Notebook::Ptr notebook =
- NotebookManager::instance().get_notebook (normalizedNotebookName);
+ NotebookManager::obj().get_notebook (normalizedNotebookName);
if (!notebook) {
return;
}
- NotebookManager::instance().signal_note_removed_from_notebook() (*note, notebook);
+ NotebookManager::obj().signal_note_removed_from_notebook() (*note, notebook);
}
void NotebookApplicationAddin::on_note_added(const Note::Ptr & note)
diff --git a/src/notebooks/notebookmanager.cpp b/src/notebooks/notebookmanager.cpp
index 92c78e4..f6ca292 100644
--- a/src/notebooks/notebookmanager.cpp
+++ b/src/notebooks/notebookmanager.cpp
@@ -311,7 +311,7 @@ namespace gnote {
if (response != Gtk::RESPONSE_OK)
return Notebook::Ptr();
- Notebook::Ptr notebook = instance().get_or_create_notebook (notebookName);
+ Notebook::Ptr notebook = obj().get_or_create_notebook (notebookName);
if (!notebook) {
DBG_OUT ("Could not create notebook: %s", notebookName.c_str());
}
@@ -323,7 +323,7 @@ namespace gnote {
// Move all the specified notesToAdd into the new notebook
for(Note::List::const_iterator iter = notesToAdd.begin();
iter != notesToAdd.end(); ++iter) {
- NotebookManager::instance().move_note_to_notebook (*iter, notebook);
+ obj().move_note_to_notebook (*iter, notebook);
}
}
}
@@ -361,12 +361,11 @@ namespace gnote {
// Grab the template note before removing all the notebook tags
Note::Ptr templateNote = notebook->get_template_note ();
- instance().delete_notebook (notebook);
+ obj().delete_notebook (notebook);
// Delete the template note
if (templateNote) {
- NoteManager & noteManager(Gnote::obj().default_note_manager());
- noteManager.delete_note (templateNote);
+ Gnote::obj().default_note_manager().delete_note(templateNote);
}
}
diff --git a/src/notebooks/notebookmanager.hpp b/src/notebooks/notebookmanager.hpp
index c515714..6b58c6c 100644
--- a/src/notebooks/notebookmanager.hpp
+++ b/src/notebooks/notebookmanager.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2012 Aurimas Cernius
+ * Copyright (C) 2012-2013 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -42,7 +42,7 @@ class NotebookManager
{
public:
- static NotebookManager & instance()
+ static NotebookManager & obj()
{
static NotebookManager *s_instance = new NotebookManager();
return *s_instance;
diff --git a/src/notebooks/notebookmenuitem.cpp b/src/notebooks/notebookmenuitem.cpp
index 1965088..dc6679e 100644
--- a/src/notebooks/notebookmenuitem.cpp
+++ b/src/notebooks/notebookmenuitem.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2010 Aurimas Cernius
+ * Copyright (C) 2010,2013 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -46,7 +46,7 @@ namespace gnote {
return;
}
- NotebookManager::instance().move_note_to_notebook(m_note, m_notebook);
+ NotebookManager::obj().move_note_to_notebook(m_note, m_notebook);
}
// the menu item is comparable.
diff --git a/src/notebooks/notebooknoteaddin.cpp b/src/notebooks/notebooknoteaddin.cpp
index 7a1765d..5cd53d8 100644
--- a/src/notebooks/notebooknoteaddin.cpp
+++ b/src/notebooks/notebooknoteaddin.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2010-2012 Aurimas Cernius
+ * Copyright (C) 2010-2013 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -79,9 +79,9 @@ namespace notebooks {
add_tool_item(m_toolButton, -1);
update_notebook_button_label();
- m_note_added_cid = NotebookManager::instance().signal_note_added_to_notebook()
+ m_note_added_cid = NotebookManager::obj().signal_note_added_to_notebook()
.connect(sigc::mem_fun(*this, &NotebookNoteAddin::on_note_added_to_notebook));
- m_note_removed_cid = NotebookManager::instance().signal_note_removed_from_notebook()
+ m_note_removed_cid = NotebookManager::obj().signal_note_removed_from_notebook()
.connect(sigc::mem_fun(*this, &NotebookNoteAddin::on_note_removed_from_notebook));
get_note()->signal_tag_added()
@@ -167,14 +167,14 @@ namespace notebooks {
{
Note::List noteList;
noteList.push_back(get_note());
- NotebookManager::instance().prompt_create_new_notebook(
+ NotebookManager::obj().prompt_create_new_notebook(
dynamic_cast<Gtk::Window*>(get_note()->get_window()->host()), noteList);
}
void NotebookNoteAddin::update_notebook_button_label()
{
- Notebook::Ptr currentNotebook = NotebookManager::instance().get_notebook_from_note(get_note());
+ Notebook::Ptr currentNotebook = NotebookManager::obj().get_notebook_from_note(get_note());
update_notebook_button_label(currentNotebook);
}
@@ -224,7 +224,7 @@ namespace notebooks {
m_menu_items.push_back(noNotebookMenuItem);
NotebookMenuItem *active_menu_item = noNotebookMenuItem;
- Notebook::Ptr current_notebook = NotebookManager::instance().get_notebook_from_note(get_note());
+ Notebook::Ptr current_notebook = NotebookManager::obj().get_notebook_from_note(get_note());
// Add in all the real notebooks
std::list<NotebookMenuItem*> notebookMenuItems;
@@ -252,7 +252,7 @@ namespace notebooks {
void NotebookNoteAddin::get_notebook_menu_items(std::list<NotebookMenuItem*>& items)
{
- Glib::RefPtr<Gtk::TreeModel> model = NotebookManager::instance().get_notebooks();
+ Glib::RefPtr<Gtk::TreeModel> model = NotebookManager::obj().get_notebooks();
Gtk::TreeIter iter;
items.clear();
diff --git a/src/notemanager.cpp b/src/notemanager.cpp
index 8a7fcfc..016cdfd 100644
--- a/src/notemanager.cpp
+++ b/src/notemanager.cpp
@@ -587,7 +587,7 @@ namespace gnote {
template_tag->get_notes(notes);
for (std::list<Note*>::iterator iter = notes.begin(); iter != notes.end(); ++iter) {
Note::Ptr note = (*iter)->shared_from_this();
- if (!notebooks::NotebookManager::instance().get_notebook_from_note (note)) {
+ if (!notebooks::NotebookManager::obj().get_notebook_from_note(note)) {
template_note = note;
break;
}
diff --git a/src/notewindow.cpp b/src/notewindow.cpp
index a370a1c..9d3beb9 100644
--- a/src/notewindow.cpp
+++ b/src/notewindow.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2011-2012 Aurimas Cernius
+ * Copyright (C) 2011-2013 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -385,7 +385,7 @@ namespace gnote {
m_pin_button = manage(new Gtk::ToolButton(*m_pin_image, _("Pin")));
m_pin_button->signal_clicked().connect(sigc::mem_fun(*this, &NoteWindow::on_pin_button_clicked));
tb->insert(*m_pin_button, -1);
- notebooks::NotebookManager::instance().signal_note_pin_status_changed
+ notebooks::NotebookManager::obj().signal_note_pin_status_changed
.connect(sigc::mem_fun(*this, &NoteWindow::on_pin_status_changed));
m_link_button = manage(new Gtk::ToolButton(
diff --git a/src/searchnoteswidget.cpp b/src/searchnoteswidget.cpp
index 0e8da72..30e9812 100644
--- a/src/searchnoteswidget.cpp
+++ b/src/searchnoteswidget.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2010-2012 Aurimas Cernius
+ * Copyright (C) 2010-2013 Aurimas Cernius
* Copyright (C) 2010 Debarshi Ray
* Copyright (C) 2009 Hubert Figuiere
*
@@ -141,11 +141,11 @@ SearchNotesWidget::SearchNotesWidget(NoteManager & m)
// Watch when notes are added to notebooks so the search
// results will be updated immediately instead of waiting
// until the note's queue_save () kicks in.
- notebooks::NotebookManager::instance().signal_note_added_to_notebook()
+ notebooks::NotebookManager::obj().signal_note_added_to_notebook()
.connect(sigc::mem_fun(*this, &SearchNotesWidget::on_note_added_to_notebook));
- notebooks::NotebookManager::instance().signal_note_removed_from_notebook()
+ notebooks::NotebookManager::obj().signal_note_removed_from_notebook()
.connect(sigc::mem_fun(*this, &SearchNotesWidget::on_note_removed_from_notebook));
- notebooks::NotebookManager::instance().signal_note_pin_status_changed
+ notebooks::NotebookManager::obj().signal_note_pin_status_changed
.connect(sigc::mem_fun(*this, &SearchNotesWidget::on_note_pin_status_changed));
// Set the focus chain for the top-most containers
@@ -352,7 +352,7 @@ Gtk::Widget *SearchNotesWidget::make_notebooks_pane()
{
m_notebooksTree = Gtk::manage(
new notebooks::NotebooksTreeView(m_manager,
- notebooks::NotebookManager::instance()
+ notebooks::NotebookManager::obj()
.get_notebooks_with_special_items()));
m_notebooksTree->get_selection()->set_mode(Gtk::SELECTION_SINGLE);
@@ -508,26 +508,26 @@ void SearchNotesWidget::notebook_text_cell_data_func(Gtk::CellRenderer * rendere
void SearchNotesWidget::on_notebook_row_edited(const Glib::ustring& /*tree_path*/,
const Glib::ustring& new_text)
{
- if(notebooks::NotebookManager::instance().notebook_exists(new_text) || new_text == "") {
+ if(notebooks::NotebookManager::obj().notebook_exists(new_text) || new_text == "") {
return;
}
notebooks::Notebook::Ptr old_notebook = this->get_selected_notebook();
if(std::tr1::dynamic_pointer_cast<notebooks::SpecialNotebook>(old_notebook)) {
return;
}
- notebooks::Notebook::Ptr new_notebook = notebooks::NotebookManager::instance()
+ notebooks::Notebook::Ptr new_notebook = notebooks::NotebookManager::obj()
.get_or_create_notebook(new_text);
DBG_OUT("Renaming notebook '{%s}' to '{%s}'", old_notebook->get_name().c_str(),
new_text.c_str());
std::list<Note *> notes;
old_notebook->get_tag()->get_notes(notes);
for(std::list<Note *>::const_iterator note = notes.begin(); note != notes.end(); ++note) {
- notebooks::NotebookManager::instance().move_note_to_notebook(
+ notebooks::NotebookManager::obj().move_note_to_notebook(
(*note)->shared_from_this(), new_notebook);
}
- notebooks::NotebookManager::instance().delete_notebook(old_notebook);
+ notebooks::NotebookManager::obj().delete_notebook(old_notebook);
Gtk::TreeIter iter;
- if(notebooks::NotebookManager::instance().get_notebook_iter(new_notebook, iter)) {
+ if(notebooks::NotebookManager::obj().get_notebook_iter(new_notebook, iter)) {
m_notebooksTree->get_selection()->select(iter);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]