[gnote] Pass IconManager as an argument
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Pass IconManager as an argument
- Date: Sun, 15 Dec 2019 12:10:45 +0000 (UTC)
commit 621dc07b8d48100b34ceaa031ec21d2875a19ca0
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Dec 15 14:06:02 2019 +0200
Pass IconManager as an argument
src/notebooks/specialnotebooks.cpp | 16 ++++++++--------
src/notebooks/specialnotebooks.hpp | 13 ++++++++-----
src/searchnoteswidget.cpp | 2 +-
3 files changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/src/notebooks/specialnotebooks.cpp b/src/notebooks/specialnotebooks.cpp
index 6decf5be..a5c17d4d 100644
--- a/src/notebooks/specialnotebooks.cpp
+++ b/src/notebooks/specialnotebooks.cpp
@@ -66,9 +66,9 @@ bool AllNotesNotebook::add_note(const Note::Ptr &)
return false;
}
-Glib::RefPtr<Gdk::Pixbuf> AllNotesNotebook::get_icon()
+Glib::RefPtr<Gdk::Pixbuf> AllNotesNotebook::get_icon(IconManager & m)
{
- return IGnote::obj().icon_manager().get_icon(IconManager::FILTER_NOTE_ALL, 22);
+ return m.get_icon(IconManager::FILTER_NOTE_ALL, 22);
}
@@ -97,9 +97,9 @@ bool UnfiledNotesNotebook::add_note(const Note::Ptr & note)
return true;
}
-Glib::RefPtr<Gdk::Pixbuf> UnfiledNotesNotebook::get_icon()
+Glib::RefPtr<Gdk::Pixbuf> UnfiledNotesNotebook::get_icon(IconManager & m)
{
- return IGnote::obj().icon_manager().get_icon(IconManager::FILTER_NOTE_UNFILED, 22);
+ return m.get_icon(IconManager::FILTER_NOTE_UNFILED, 22);
}
@@ -124,9 +124,9 @@ bool PinnedNotesNotebook::add_note(const Note::Ptr & note)
return true;
}
-Glib::RefPtr<Gdk::Pixbuf> PinnedNotesNotebook::get_icon()
+Glib::RefPtr<Gdk::Pixbuf> PinnedNotesNotebook::get_icon(IconManager & m)
{
- return IGnote::obj().icon_manager().get_icon(IconManager::PIN_DOWN, 22);
+ return m.get_icon(IconManager::PIN_DOWN, 22);
}
@@ -160,9 +160,9 @@ bool ActiveNotesNotebook::add_note(const Note::Ptr & note)
return true;
}
-Glib::RefPtr<Gdk::Pixbuf> ActiveNotesNotebook::get_icon()
+Glib::RefPtr<Gdk::Pixbuf> ActiveNotesNotebook::get_icon(IconManager & m)
{
- return IGnote::obj().icon_manager().get_icon(IconManager::ACTIVE_NOTES, 22);
+ return m.get_icon(IconManager::ACTIVE_NOTES, 22);
}
void ActiveNotesNotebook::on_note_deleted(const NoteBase::Ptr & note)
diff --git a/src/notebooks/specialnotebooks.hpp b/src/notebooks/specialnotebooks.hpp
index 735be240..43a6c3a3 100644
--- a/src/notebooks/specialnotebooks.hpp
+++ b/src/notebooks/specialnotebooks.hpp
@@ -31,6 +31,9 @@
namespace gnote {
+
+class IconManager;
+
namespace notebooks {
@@ -40,7 +43,7 @@ class SpecialNotebook
public:
typedef std::shared_ptr<SpecialNotebook> Ptr;
- virtual Glib::RefPtr<Gdk::Pixbuf> get_icon() = 0;
+ virtual Glib::RefPtr<Gdk::Pixbuf> get_icon(IconManager & m) = 0;
protected:
SpecialNotebook(NoteManager & m, const Glib::ustring &s)
: Notebook(m, s, true)
@@ -60,7 +63,7 @@ public:
virtual Glib::ustring get_normalized_name() const override;
virtual bool contains_note(const Note::Ptr & note, bool include_system = false) override;
virtual bool add_note(const Note::Ptr &) override;
- virtual Glib::RefPtr<Gdk::Pixbuf> get_icon() override;
+ virtual Glib::RefPtr<Gdk::Pixbuf> get_icon(IconManager & m) override;
};
@@ -73,7 +76,7 @@ public:
virtual Glib::ustring get_normalized_name() const override;
virtual bool contains_note(const Note::Ptr & note, bool include_system = false) override;
virtual bool add_note(const Note::Ptr &) override;
- virtual Glib::RefPtr<Gdk::Pixbuf> get_icon() override;
+ virtual Glib::RefPtr<Gdk::Pixbuf> get_icon(IconManager & m) override;
};
@@ -86,7 +89,7 @@ public:
virtual Glib::ustring get_normalized_name() const override;
virtual bool contains_note(const Note::Ptr & note, bool include_system = false) override;
virtual bool add_note(const Note::Ptr &) override;
- virtual Glib::RefPtr<Gdk::Pixbuf> get_icon() override;
+ virtual Glib::RefPtr<Gdk::Pixbuf> get_icon(IconManager & m) override;
};
@@ -99,7 +102,7 @@ public:
virtual Glib::ustring get_normalized_name() const override;
virtual bool contains_note(const Note::Ptr & note, bool include_system = false) override;
virtual bool add_note(const Note::Ptr &) override;
- virtual Glib::RefPtr<Gdk::Pixbuf> get_icon() override;
+ virtual Glib::RefPtr<Gdk::Pixbuf> get_icon(IconManager & m) override;
bool empty();
sigc::signal<void> signal_size_changed;
private:
diff --git a/src/searchnoteswidget.cpp b/src/searchnoteswidget.cpp
index 561d6eda..399ead32 100644
--- a/src/searchnoteswidget.cpp
+++ b/src/searchnoteswidget.cpp
@@ -298,7 +298,7 @@ void SearchNotesWidget::notebook_pixbuf_cell_data_func(Gtk::CellRenderer * rende
Gtk::CellRendererPixbuf *crp = dynamic_cast<Gtk::CellRendererPixbuf*>(renderer);
notebooks::SpecialNotebook::Ptr special_nb =
std::dynamic_pointer_cast<notebooks::SpecialNotebook>(notebook);
if(special_nb) {
- crp->property_pixbuf() = special_nb->get_icon();
+ crp->property_pixbuf() = special_nb->get_icon(m_gnote.icon_manager());
}
else {
crp->property_pixbuf() = m_gnote.icon_manager().get_icon(IconManager::NOTEBOOK, 22);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]