[gnote] Do not statically access IGnote in bugzilla
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Do not statically access IGnote in bugzilla
- Date: Sat, 26 Oct 2019 19:53:02 +0000 (UTC)
commit f3c8fee13e6bc5100ac3487f25d204e9be313b1e
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sat Oct 26 22:51:57 2019 +0300
Do not statically access IGnote in bugzilla
src/addins/bugzilla/bugzillalink.cpp | 7 ++++---
src/addins/bugzilla/bugzillalink.hpp | 13 ++++++++++---
src/addins/bugzilla/bugzillanoteaddin.cpp | 4 ++--
3 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/src/addins/bugzilla/bugzillalink.cpp b/src/addins/bugzilla/bugzillalink.cpp
index 3a5a040c..46654a6b 100644
--- a/src/addins/bugzilla/bugzillalink.cpp
+++ b/src/addins/bugzilla/bugzillalink.cpp
@@ -31,7 +31,8 @@ namespace bugzilla {
#define URI_ATTRIBUTE_NAME "uri"
- BugzillaLink::BugzillaLink()
+ BugzillaLink::BugzillaLink(gnote::IGnote & ignote)
+ : m_gnote(ignote)
{
}
@@ -80,7 +81,7 @@ namespace bugzilla {
image = Gdk::Pixbuf::create_from_file(imagePath);
}
catch(...) {
- image = gnote::IGnote::obj().icon_manager().get_icon(gnote::IconManager::BUG, 16);
+ image = m_gnote.icon_manager().get_icon(gnote::IconManager::BUG, 16);
}
set_image(image);
}
@@ -94,7 +95,7 @@ namespace bugzilla {
DBG_OUT("Opening url '%s'...", get_bug_url().c_str());
try {
- gnote::utils::open_url(gnote::IGnote::obj().get_main_window(), get_bug_url());
+ gnote::utils::open_url(m_gnote.get_main_window(), get_bug_url());
}
catch (const Glib::Error & e) {
gnote::utils::show_opening_location_error(NULL,
diff --git a/src/addins/bugzilla/bugzillalink.hpp b/src/addins/bugzilla/bugzillalink.hpp
index a3fa2eb9..73980b8c 100644
--- a/src/addins/bugzilla/bugzillalink.hpp
+++ b/src/addins/bugzilla/bugzillalink.hpp
@@ -26,6 +26,11 @@
#include "noteeditor.hpp"
#include "notetag.hpp"
+namespace gnote {
+ class IGnote;
+}
+
+
namespace bugzilla {
@@ -34,11 +39,11 @@ class BugzillaLink
{
public:
typedef Glib::RefPtr<BugzillaLink> Ptr;
- static gnote::DynamicNoteTag::Ptr create()
+ static gnote::DynamicNoteTag::Ptr create(gnote::IGnote & ignote)
{
- return gnote::DynamicNoteTag::Ptr(new BugzillaLink);
+ return gnote::DynamicNoteTag::Ptr(new BugzillaLink(ignote));
}
- BugzillaLink();
+ BugzillaLink(gnote::IGnote & ignote);
Glib::ustring get_bug_url() const;
void set_bug_url(const Glib::ustring & );
protected:
@@ -48,6 +53,8 @@ protected:
virtual void on_attribute_read(const Glib::ustring &) override;
private:
void make_image();
+
+ gnote::IGnote & m_gnote;
};
}
diff --git a/src/addins/bugzilla/bugzillanoteaddin.cpp b/src/addins/bugzilla/bugzillanoteaddin.cpp
index eb8d112e..e8684da9 100644
--- a/src/addins/bugzilla/bugzillanoteaddin.cpp
+++ b/src/addins/bugzilla/bugzillanoteaddin.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2010,2012-2013,2017 Aurimas Cernius
+ * Copyright (C) 2010,2012-2013,2017,2019 Aurimas Cernius
* Copyright (C) 2010 Debarshi Ray
* Copyright (C) 2009 Hubert Figuiere
*
@@ -80,7 +80,7 @@ namespace bugzilla {
{
if(!get_note()->get_tag_table()->is_dynamic_tag_registered(TAG_NAME)) {
get_note()->get_tag_table()
- ->register_dynamic_tag(TAG_NAME, sigc::ptr_fun(&BugzillaLink::create));
+ ->register_dynamic_tag(TAG_NAME, [this]() { return BugzillaLink::create(ignote()); });
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]