[gnote] Do not statically access IGnote in AddinsTreeModel
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Do not statically access IGnote in AddinsTreeModel
- Date: Fri, 1 Nov 2019 21:41:31 +0000 (UTC)
commit dcb61dac33a6528639aa73cc845825662adf6680
Author: Aurimas Černius <aurisc4 gmail com>
Date: Fri Nov 1 23:37:25 2019 +0200
Do not statically access IGnote in AddinsTreeModel
src/preferencesdialog.cpp | 2 +-
src/sharp/addinstreemodel.cpp | 10 +++++-----
src/sharp/addinstreemodel.hpp | 13 ++++++++++---
3 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/src/preferencesdialog.cpp b/src/preferencesdialog.cpp
index 6bfd477b..904d50dc 100644
--- a/src/preferencesdialog.cpp
+++ b/src/preferencesdialog.cpp
@@ -599,7 +599,7 @@ namespace gnote {
// TreeView of Add-ins
m_addin_tree = manage(new Gtk::TreeView ());
- m_addin_tree_model = sharp::AddinsTreeModel::create(m_addin_tree);
+ m_addin_tree_model = sharp::AddinsTreeModel::create(IGnote::obj().icon_manager(), m_addin_tree);
m_addin_tree->show ();
diff --git a/src/sharp/addinstreemodel.cpp b/src/sharp/addinstreemodel.cpp
index 5b727c15..46e09a1e 100644
--- a/src/sharp/addinstreemodel.cpp
+++ b/src/sharp/addinstreemodel.cpp
@@ -30,15 +30,14 @@
#include "sharp/addinstreemodel.hpp"
#include "abstractaddin.hpp"
#include "iconmanager.hpp"
-#include "ignote.hpp"
namespace sharp {
- AddinsTreeModel::Ptr AddinsTreeModel::create(Gtk::TreeView * treeview)
+ AddinsTreeModel::Ptr AddinsTreeModel::create(gnote::IconManager & icon_manager, Gtk::TreeView *treeview)
{
- AddinsTreeModel::Ptr p(new AddinsTreeModel());
+ AddinsTreeModel::Ptr p(new AddinsTreeModel(icon_manager));
if(treeview) {
treeview->set_model(p);
p->set_columns(treeview);
@@ -46,8 +45,9 @@ namespace sharp {
return p;
}
- AddinsTreeModel::AddinsTreeModel()
+ AddinsTreeModel::AddinsTreeModel(gnote::IconManager & icon_manager)
: Gtk::TreeStore()
+ , m_icon_manager(icon_manager)
{
set_column_types(m_columns);
}
@@ -99,7 +99,7 @@ namespace sharp {
Gtk::CellRendererPixbuf *icon_renderer = dynamic_cast<Gtk::CellRendererPixbuf*>(renderer);
Glib::RefPtr<Gdk::Pixbuf> icon;
if(get_module_id(iter) != "") {
- icon = gnote::IGnote::obj().icon_manager().get_icon(gnote::IconManager::EMBLEM_PACKAGE, 22);
+ icon = m_icon_manager.get_icon(gnote::IconManager::EMBLEM_PACKAGE, 22);
}
icon_renderer->property_pixbuf() = icon;
}
diff --git a/src/sharp/addinstreemodel.hpp b/src/sharp/addinstreemodel.hpp
index dd12e957..62dacd75 100644
--- a/src/sharp/addinstreemodel.hpp
+++ b/src/sharp/addinstreemodel.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2010,2012-2013,2017 Aurimas Cernius
+ * Copyright (C) 2010,2012-2013,2017,2019 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,6 +35,11 @@
#include "addininfo.hpp"
#include "sharp/dynamicmodule.hpp"
+namespace gnote {
+ class IconManager;
+}
+
+
namespace sharp {
class AddinsTreeModel
@@ -42,7 +47,7 @@ class AddinsTreeModel
{
public:
typedef Glib::RefPtr<AddinsTreeModel> Ptr;
- static Ptr create(Gtk::TreeView * treeview);
+ static Ptr create(gnote::IconManager & icon_manager, Gtk::TreeView *treeview);
Glib::ustring get_module_id(const Gtk::TreeIter &);
sharp::DynamicModule * get_module(const Gtk::TreeIter &);
@@ -72,11 +77,13 @@ public:
static Glib::ustring get_addin_category_name(gnote::AddinCategory category);
protected:
- AddinsTreeModel();
+ AddinsTreeModel(gnote::IconManager & icon_manager);
void set_columns(Gtk::TreeView *v);
private:
void name_cell_data_func(Gtk::CellRenderer * renderer, const Gtk::TreeIter & iter);
void name_pixbuf_cell_data_func(Gtk::CellRenderer * renderer, const Gtk::TreeIter & iter);
+
+ gnote::IconManager & m_icon_manager;
};
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]