[gnote] Do not statically use IGnote in table of contents
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Do not statically use IGnote in table of contents
- Date: Fri, 1 Nov 2019 12:08:47 +0000 (UTC)
commit 38ecee426a546cca5f2a0eebad5d5b12ef099a3b
Author: Aurimas Černius <aurisc4 gmail com>
Date: Fri Nov 1 14:07:56 2019 +0200
Do not statically use IGnote in table of contents
src/addins/tableofcontents/tableofcontentsmenuitem.cpp | 4 ++--
src/addins/tableofcontents/tableofcontentsmenuitem.hpp | 11 ++++++-----
src/addins/tableofcontents/tableofcontentsnoteaddin.cpp | 5 +++--
3 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/src/addins/tableofcontents/tableofcontentsmenuitem.cpp
b/src/addins/tableofcontents/tableofcontentsmenuitem.cpp
index 7bde0f0c..3bd07514 100644
--- a/src/addins/tableofcontents/tableofcontentsmenuitem.cpp
+++ b/src/addins/tableofcontents/tableofcontentsmenuitem.cpp
@@ -26,7 +26,6 @@
#include <gtkmm/stock.h>
#include "iconmanager.hpp"
-#include "ignote.hpp"
#include "notewindow.hpp"
#include "tableofcontentsmenuitem.hpp"
@@ -37,6 +36,7 @@ namespace tableofcontents {
TableofcontentsMenuItem::TableofcontentsMenuItem (
+ gnote::IconManager & icon_manager,
const gnote::Note::Ptr & note,
const Glib::ustring & heading,
Heading::Type heading_level,
@@ -59,7 +59,7 @@ TableofcontentsMenuItem::TableofcontentsMenuItem (
set_use_underline (false); //we don't want potential '_' in the heading to be used as mnemonic
if (heading_level == Heading::Title) {
- set_image(*manage(new Gtk::Image(gnote::IGnote::obj().icon_manager().get_icon(gnote::IconManager::NOTE,
16))));
+ set_image(*manage(new Gtk::Image(icon_manager.get_icon(gnote::IconManager::NOTE, 16))));
Gtk::Label *label = (Gtk::Label*)get_child();
label->set_markup("<b>" + heading + "</b>");
}
diff --git a/src/addins/tableofcontents/tableofcontentsmenuitem.hpp
b/src/addins/tableofcontents/tableofcontentsmenuitem.hpp
index 378df1a9..93918a52 100644
--- a/src/addins/tableofcontents/tableofcontentsmenuitem.hpp
+++ b/src/addins/tableofcontents/tableofcontentsmenuitem.hpp
@@ -30,17 +30,18 @@
#include "tableofcontents.hpp"
+namespace gnote {
+ class IconManager;
+}
+
namespace tableofcontents {
class TableofcontentsMenuItem : public Gtk::ImageMenuItem
{
public:
- TableofcontentsMenuItem ( const gnote::Note::Ptr & note,
- const Glib::ustring & heading,
- Heading::Type heading_level,
- int heading_position
- );
+ TableofcontentsMenuItem(gnote::IconManager & icon_manager, const gnote::Note::Ptr & note,
+ const Glib::ustring & heading, Heading::Type heading_level, int heading_position);
protected:
virtual void on_activate() override;
diff --git a/src/addins/tableofcontents/tableofcontentsnoteaddin.cpp
b/src/addins/tableofcontents/tableofcontentsnoteaddin.cpp
index 7ca9abc0..73aad584 100644
--- a/src/addins/tableofcontents/tableofcontentsnoteaddin.cpp
+++ b/src/addins/tableofcontents/tableofcontentsnoteaddin.cpp
@@ -31,6 +31,7 @@
#include "sharp/string.hpp"
#include "iactionmanager.hpp"
+#include "ignote.hpp"
#include "notemanager.hpp"
#include "notewindow.hpp"
#include "notebuffer.hpp"
@@ -315,12 +316,12 @@ std::vector<TableofcontentsMenuItem*> TableofcontentsNoteAddin::get_tableofconte
if(toc_items.size()) {
//If we have at least one heading
//we also insert an entry linked to the Note's title:
- item = manage(new TableofcontentsMenuItem(get_note(), get_note()->get_title(), Heading::Title, 0));
+ item = manage(new TableofcontentsMenuItem(ignote().icon_manager(), get_note(), get_note()->get_title(),
Heading::Title, 0));
items.push_back(item);
}
for(auto & toc_item : toc_items) {
- item = manage(new TableofcontentsMenuItem(get_note(), toc_item.heading, toc_item.heading_level,
toc_item.heading_position));
+ item = manage(new TableofcontentsMenuItem(ignote().icon_manager(), get_note(), toc_item.heading,
toc_item.heading_level, toc_item.heading_position));
items.push_back(item);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]