[niepce: 16/29] engine+rust: Implement the library notification
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce: 16/29] engine+rust: Implement the library notification
- Date: Fri, 22 Sep 2017 00:43:04 +0000 (UTC)
commit 0510c3141d59f353c0b8cabc6e3379b955357449
Author: Hubert Figuière <hub figuiere net>
Date: Wed Aug 9 22:08:16 2017 -0400
engine+rust: Implement the library notification
-Make NotificationCenter registered and retrievable by id
Cargo.toml | 2 +-
src/engine/Makefile.am | 1 +
src/engine/db/keyword.cpp | 7 ++-
src/engine/db/keyword.hpp | 1 +
src/engine/db/library.cpp | 12 +++---
src/engine/db/library.hpp | 4 +-
src/engine/db/library.rs | 30 +++++++++---
src/engine/library/notification.cpp | 72 ++++++++++++++++++++++++++++++
src/engine/library/notification.hpp | 5 ++
src/engine/library/thumbnailcache.cpp | 11 +++--
src/engine/library/thumbnailcache.hpp | 6 +--
src/fwk/toolkit/notificationcenter.cpp | 25 ++++++++++-
src/fwk/toolkit/notificationcenter.hpp | 10 ++++-
src/libraryclient/clientimpl.cpp | 8 ++--
src/libraryclient/clientimpl.hpp | 4 +-
src/libraryclient/libraryclient.cpp | 6 +-
src/libraryclient/libraryclient.hpp | 2 +-
src/libraryclient/locallibraryserver.hpp | 4 +-
src/niepce/Makefile.am | 2 +
src/niepce/notificationcenter.cpp | 3 +-
src/niepce/notificationcenter.hpp | 12 +++++-
src/niepce/ui/niepcewindow.cpp | 4 +-
22 files changed, 185 insertions(+), 46 deletions(-)
---
diff --git a/Cargo.toml b/Cargo.toml
index 77c714f..45922a6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,7 +5,7 @@ authors = ["Hubert Figuière <hub figuiere net>"]
[dependencies]
libc = "0.2.23"
-rusqlite = "0.12.0"
+rusqlite = { version = "0.12.0", features = ["functions"] }
exempi = "2.4.3"
glib-sys = { git = "https://github.com/gtk-rs/sys" }
gio-sys = { git = "https://github.com/gtk-rs/sys" }
diff --git a/src/engine/Makefile.am b/src/engine/Makefile.am
index 9e6e83e..2824724 100644
--- a/src/engine/Makefile.am
+++ b/src/engine/Makefile.am
@@ -47,6 +47,7 @@ libniepceengine_a_SOURCES = \
db/properties.hpp db/properties.cpp \
db/properties-def.hpp \
library/clienttypes.hpp \
+ library/notification.hpp library/notification.cpp \
library/op.hpp library/op.cpp \
library/commands.hpp library/commands.cpp \
library/thumbnailcache.hpp library/thumbnailcache.cpp \
diff --git a/src/engine/db/keyword.cpp b/src/engine/db/keyword.cpp
index 9875ff6..4d500ca 100644
--- a/src/engine/db/keyword.cpp
+++ b/src/engine/db/keyword.cpp
@@ -26,8 +26,11 @@ extern "C" void engine_db_keyword_delete(eng::Keyword*);
namespace eng {
KeywordPtr keyword_new(eng::library_id_t id, const char* keyword) {
- return KeywordPtr(
- engine_db_keyword_new(id, keyword), &engine_db_keyword_delete);
+ return keyword_wrap(engine_db_keyword_new(id, keyword));
+}
+
+KeywordPtr keyword_wrap(eng::Keyword* kw) {
+ return KeywordPtr(kw, &engine_db_keyword_delete);
}
}
diff --git a/src/engine/db/keyword.hpp b/src/engine/db/keyword.hpp
index b7ea91a..4821631 100644
--- a/src/engine/db/keyword.hpp
+++ b/src/engine/db/keyword.hpp
@@ -33,6 +33,7 @@ typedef std::vector<KeywordPtr> KeywordList;
typedef std::shared_ptr<KeywordList> KeywordListPtr;
KeywordPtr keyword_new(eng::library_id_t id, const char* keyword);
+KeywordPtr keyword_wrap(Keyword*);
}
extern "C" eng::library_id_t engine_db_keyword_id(const eng::Keyword*);
diff --git a/src/engine/db/library.cpp b/src/engine/db/library.cpp
index 9c182ce..0c1e6fc 100644
--- a/src/engine/db/library.cpp
+++ b/src/engine/db/library.cpp
@@ -49,11 +49,11 @@ namespace eng {
const char * s_databaseName = "niepcelibrary.db";
-Library::Library(const std::string & dir, const NotificationCenter::Ptr & nc)
+Library::Library(const std::string & dir, uint64_t notif_id)
: m_maindir(dir),
m_dbname(m_maindir + "/" + s_databaseName),
m_dbmgr(new db::sqlite::SqliteCnxMgrDrv()),
- m_notif_center(nc),
+ m_notif_id(notif_id),
m_inited(false)
{
DBG_OUT("dir = %s", dir.c_str());
@@ -82,8 +82,9 @@ Library::~Library()
void Library::notify(LibNotification&& ln)
{
- fwk::NotificationCenter::Ptr nc(m_notif_center.lock());
- if(nc) {
+ auto wnc = fwk::NotificationCenter::get_nc(m_notif_id);
+ auto nc = wnc.lock();
+ if (nc) {
DBG_OUT("notif");
// pass the notification
fwk::Notification::Ptr n(new fwk::Notification(niepce::NOTIFICATION_LIB));
@@ -190,8 +191,7 @@ bool Library::_initDb()
m_dbdrv->execute_statement(fileUpdateTrigger);
m_dbdrv->execute_statement(xmpUpdateTrigger);
- notify(LibNotification::make<LibNotification::Type::NEW_LIBRARY_CREATED>(
- LibNotification::None{}));
+ notify(LibNotification::make<LibNotification::Type::NEW_LIBRARY_CREATED>({}));
return true;
}
diff --git a/src/engine/db/library.hpp b/src/engine/db/library.hpp
index d16c203..60de203 100644
--- a/src/engine/db/library.hpp
+++ b/src/engine/db/library.hpp
@@ -60,7 +60,7 @@ class Library
public:
typedef std::shared_ptr<Library> Ptr;
- Library(const std::string & dir, const fwk::NotificationCenter::Ptr & nc);
+ Library(const std::string & dir, uint64_t notif_id);
virtual ~Library();
bool ok() const
@@ -210,7 +210,7 @@ private:
std::string m_dbname;
db::IConnectionManagerDriver::Ptr m_dbmgr;
db::IConnectionDriver::Ptr m_dbdrv;
- std::weak_ptr<fwk::NotificationCenter> m_notif_center;
+ uint64_t m_notif_id;
bool m_inited;
};
diff --git a/src/engine/db/library.rs b/src/engine/db/library.rs
index 0b78bb7..2790ce7 100644
--- a/src/engine/db/library.rs
+++ b/src/engine/db/library.rs
@@ -37,8 +37,6 @@ use fwk;
const DB_SCHEMA_VERSION: i32 = 6;
const DATABASENAME: &str = "niepcelibrary.db";
-enum NotificationCenter {}
-
#[repr(i32)]
pub enum Managed {
NO = 0,
@@ -49,19 +47,28 @@ pub struct Library {
maindir: PathBuf,
dbpath: PathBuf,
dbconn: Option<rusqlite::Connection>,
- inited: bool
+ inited: bool,
+ notif_id: u64,
+}
+
+extern "C" {
+ pub fn lib_notification_notify_new_lib_created(notif_id: u64);
+ pub fn lib_notification_notify_xmp_needs_update(notif_id: u64);
+ pub fn lib_notification_notify_kw_added(notif_id: u64, keyword: *mut Keyword);
}
+
impl Library {
- pub fn new(dir: &Path) -> Library {
+ pub fn new(dir: &Path, notif_id: u64) -> Library {
let mut dbpath = PathBuf::from(dir);
dbpath.push(DATABASENAME);
let mut lib = Library {
maindir: PathBuf::from(dir),
dbpath: dbpath,
dbconn: None,
- inited: false
+ inited: false,
+ notif_id: notif_id
};
lib.inited = lib.init();
@@ -72,6 +79,10 @@ impl Library {
fn init(&mut self) -> bool {
let conn_attempt = rusqlite::Connection::open(self.dbpath.clone());
if let Ok(conn) = conn_attempt {
+ conn.create_scalar_function("rewrite_xmp", 0, false, |_| {
+ unsafe { lib_notification_notify_xmp_needs_update(self.notif_id); }
+ Ok(true)
+ });
self.dbconn = Some(conn);
} else {
return false;
@@ -166,7 +177,7 @@ impl Library {
SELECT rewrite_xmp();\
END", &[]).unwrap();
- //XXX self.notify();
+ unsafe { lib_notification_notify_new_lib_created(self.notif_id); }
return true;
}
false
@@ -408,8 +419,11 @@ impl Library {
if c != 1 {
return -1;
}
- return conn.last_insert_rowid();
- // XXX notification
+ let keyword_id = conn.last_insert_rowid();
+ unsafe { lib_notification_notify_kw_added(
+ self.notif_id,
+ Box::into_raw(Box::new(Keyword::new(keyword_id, keyword)))); }
+ return keyword_id;
}
}
diff --git a/src/engine/library/notification.cpp b/src/engine/library/notification.cpp
new file mode 100644
index 0000000..4444a98
--- /dev/null
+++ b/src/engine/library/notification.cpp
@@ -0,0 +1,72 @@
+/* -*- mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode:nil; -*- */
+/*
+ * niepce - engine/library/notification.cpp
+ *
+ * Copyright (C) 2017 Hubert Figuière
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "fwk/base/debug.hpp"
+#include "niepce/notifications.hpp"
+#include "engine/library/notification.hpp"
+#include "engine/db/keyword.hpp"
+#include "fwk/toolkit/notificationcenter.hpp"
+
+namespace {
+
+void notify(uint64_t notif_id, eng::LibNotification&& ln)
+{
+ auto wnc = fwk::NotificationCenter::get_nc(notif_id);
+ auto nc = wnc.lock();
+ if (nc) {
+ DBG_OUT("notif");
+ // pass the notification
+ fwk::Notification::Ptr n(new fwk::Notification(niepce::NOTIFICATION_LIB));
+ n->setData(boost::any(ln));
+ nc->post(std::move(n));
+ } else {
+ DBG_OUT("try to send a notification without notification center");
+ }
+}
+
+}
+
+// Rust glue
+extern "C" {
+
+void lib_notification_notify_new_lib_created(uint64_t notif_id)
+{
+ eng::LibNotification ln =
+ eng::LibNotification::make<eng::LibNotification::Type::NEW_LIBRARY_CREATED>({});
+ notify(notif_id, std::move(ln));
+}
+
+void lib_notification_notify_xmp_needs_update(uint64_t notif_id)
+{
+ eng::LibNotification ln =
+ eng::LibNotification::make<eng::LibNotification::Type::XMP_NEEDS_UPDATE>({});
+ notify(notif_id, std::move(ln));
+}
+
+void lib_notification_notify_kw_added(uint64_t notif_id, eng::Keyword* keyword)
+{
+ eng::KeywordPtr kw = eng::keyword_wrap(keyword);
+ eng::LibNotification ln =
+ eng::LibNotification::make<eng::LibNotification::Type::ADDED_KEYWORD>({kw});
+ notify(notif_id, std::move(ln));
+}
+
+
+}
diff --git a/src/engine/library/notification.hpp b/src/engine/library/notification.hpp
index e187c23..f124c66 100644
--- a/src/engine/library/notification.hpp
+++ b/src/engine/library/notification.hpp
@@ -23,6 +23,11 @@
#include <boost/variant.hpp>
#include "engine/library/clienttypes.hpp"
+#include "engine/db/libfolder.hpp"
+#include "engine/db/libfile.hpp"
+#include "engine/db/libmetadata.hpp"
+#include "engine/db/keyword.hpp"
+#include "engine/db/label.hpp"
namespace eng {
diff --git a/src/engine/library/thumbnailcache.cpp b/src/engine/library/thumbnailcache.cpp
index 1b728f8..0309be7 100644
--- a/src/engine/library/thumbnailcache.cpp
+++ b/src/engine/library/thumbnailcache.cpp
@@ -28,15 +28,15 @@
#include "fwk/base/debug.hpp"
#include "fwk/utils/pathutils.hpp"
#include "fwk/toolkit/thumbnail.hpp"
+#include "fwk/toolkit/notificationcenter.hpp"
#include "thumbnailcache.hpp"
#include "thumbnailnotification.hpp"
namespace eng {
-ThumbnailCache::ThumbnailCache(const std::string & dir,
- const fwk::NotificationCenter::Ptr & nc)
+ThumbnailCache::ThumbnailCache(const std::string & dir, uint64_t notif_id)
: m_cacheDir(dir),
- m_notif_center(nc)
+ m_notif_id(notif_id)
{
}
@@ -98,8 +98,9 @@ void ThumbnailCache::execute(const ptr_t & task)
if(!pix.ok()) {
return;
}
- fwk::NotificationCenter::Ptr nc(m_notif_center);
- if(nc) {
+ auto wnc = fwk::NotificationCenter::get_nc(m_notif_id);
+ auto nc = wnc.lock();
+ if (nc) {
// pass the notification
fwk::Notification::Ptr n(new fwk::Notification(niepce::NOTIFICATION_THUMBNAIL));
ThumbnailNotification tn{ engine_db_libfile_id(task->file().get()),
diff --git a/src/engine/library/thumbnailcache.hpp b/src/engine/library/thumbnailcache.hpp
index c405101..ab73e84 100644
--- a/src/engine/library/thumbnailcache.hpp
+++ b/src/engine/library/thumbnailcache.hpp
@@ -24,7 +24,6 @@
#include <memory>
#include "fwk/utils/worker.hpp"
-#include "fwk/toolkit/notificationcenter.hpp"
#include "engine/db/libfile.hpp"
namespace eng {
@@ -56,8 +55,7 @@ class ThumbnailCache
: private fwk::Worker<ThumbnailTask>
{
public:
- ThumbnailCache(const std::string & dir,
- const fwk::NotificationCenter::Ptr & nc);
+ ThumbnailCache(const std::string & dir, uint64_t notif_id);
~ThumbnailCache();
void request(const LibFileListPtr & fl);
@@ -68,7 +66,7 @@ protected:
virtual void execute(const ptr_t & task) override;
private:
std::string m_cacheDir;
- std::weak_ptr<fwk::NotificationCenter> m_notif_center;
+ uint64_t m_notif_id;
std::string path_for_thumbnail(const std::string & filename, library_id_t id, int size) const;
std::string dir_for_thumbnail(int size) const;
diff --git a/src/fwk/toolkit/notificationcenter.cpp b/src/fwk/toolkit/notificationcenter.cpp
index 0fc0aeb..e495c3e 100644
--- a/src/fwk/toolkit/notificationcenter.cpp
+++ b/src/fwk/toolkit/notificationcenter.cpp
@@ -22,6 +22,7 @@
#include <glibmm/dispatcher.h>
+#include "fwk/base/singleton.hpp"
#include "fwk/utils/mtqueue.hpp"
#include "notificationcenter.hpp"
@@ -30,24 +31,46 @@ namespace fwk {
class NotificationCenter::Priv
{
public:
+ uint64_t m_id;
Glib::Dispatcher m_dispatcher;
fwk::MtQueue< Notification::Ptr > m_notificationQueue;
std::map< int, subscription_t > m_subscribers;
};
+typedef fwk::Singleton<std::map<uint64_t, std::weak_ptr<NotificationCenter>>> NotificationCenterRegistry;
-NotificationCenter::NotificationCenter()
+std::weak_ptr<NotificationCenter> NotificationCenter::get_nc(uint64_t notif_id)
+{
+ auto iter = NotificationCenterRegistry::obj().find(notif_id);
+ if (iter == NotificationCenterRegistry::obj().end()) {
+ return NotificationCenter::Ptr();
+ }
+ return iter->second;
+}
+
+NotificationCenter::NotificationCenter(uint64_t notif_id)
: p( new Priv )
{
+ p->m_id = notif_id;
p->m_dispatcher.connect(
sigc::mem_fun(this, &NotificationCenter::_dispatch));
}
NotificationCenter::~NotificationCenter()
{
+ NotificationCenterRegistry::obj().erase(p->m_id);
delete p;
}
+void NotificationCenter::attach()
+{
+ NotificationCenterRegistry::obj()[p->m_id] = shared_from_this();
+}
+
+uint64_t NotificationCenter::id() const
+{
+ return p->m_id;
+}
void NotificationCenter::subscribe(int type, const subscriber_t & s)
{
diff --git a/src/fwk/toolkit/notificationcenter.hpp b/src/fwk/toolkit/notificationcenter.hpp
index 3983c15..f75fd2f 100644
--- a/src/fwk/toolkit/notificationcenter.hpp
+++ b/src/fwk/toolkit/notificationcenter.hpp
@@ -31,20 +31,28 @@ namespace fwk {
class NotificationCenter
: public sigc::trackable
+ , public std::enable_shared_from_this<NotificationCenter>
{
public:
typedef std::shared_ptr< NotificationCenter > Ptr;
typedef sigc::slot<void, Notification::Ptr> subscriber_t;
- NotificationCenter();
~NotificationCenter();
+ uint64_t id() const;
+
// called from out of thread
void post(Notification::Ptr && n);
void subscribe(int type, const subscriber_t & );
void unsubscribe(int type, const subscriber_t & );
+ static std::weak_ptr<NotificationCenter> get_nc(uint64_t notif_id);
+
+protected:
+ NotificationCenter(uint64_t notif_id);
+ void attach();
+
private:
typedef sigc::signal<void, Notification::Ptr> subscription_t;
diff --git a/src/libraryclient/clientimpl.cpp b/src/libraryclient/clientimpl.cpp
index 2f4101b..df41836 100644
--- a/src/libraryclient/clientimpl.cpp
+++ b/src/libraryclient/clientimpl.cpp
@@ -34,14 +34,14 @@ using eng::tid_t;
namespace libraryclient {
std::unique_ptr<ClientImpl> ClientImpl::makeClientImpl(const fwk::Moniker & moniker,
- const fwk::NotificationCenter::Ptr & nc)
+ uint64_t notif_id)
{
- return std::unique_ptr<ClientImpl>(new ClientImpl(moniker, nc));
+ return std::unique_ptr<ClientImpl>(new ClientImpl(moniker, notif_id));
}
-ClientImpl::ClientImpl(const fwk::Moniker & moniker, const fwk::NotificationCenter::Ptr & nc)
+ClientImpl::ClientImpl(const fwk::Moniker & moniker, uint64_t notif_id)
: m_moniker(moniker),
- m_localLibrary(new LocalLibraryServer(moniker.path(), nc))
+ m_localLibrary(new LocalLibraryServer(moniker.path(), notif_id))
{
DBG_OUT("creating implementation with moniker %s",
moniker.c_str());
diff --git a/src/libraryclient/clientimpl.hpp b/src/libraryclient/clientimpl.hpp
index 8592c26..69a7863 100644
--- a/src/libraryclient/clientimpl.hpp
+++ b/src/libraryclient/clientimpl.hpp
@@ -36,9 +36,9 @@ class ClientImpl
{
public:
static std::unique_ptr<ClientImpl> makeClientImpl(const fwk::Moniker & moniker,
- const fwk::NotificationCenter::Ptr & nc);
+ uint64_t notif_id);
- ClientImpl(const fwk::Moniker & moniker, const fwk::NotificationCenter::Ptr & nc);
+ ClientImpl(const fwk::Moniker & moniker, uint64_t notif_id);
virtual ~ClientImpl();
bool ok() const;
diff --git a/src/libraryclient/libraryclient.cpp b/src/libraryclient/libraryclient.cpp
index c7955b2..a41f3be 100644
--- a/src/libraryclient/libraryclient.cpp
+++ b/src/libraryclient/libraryclient.cpp
@@ -32,9 +32,9 @@ namespace libraryclient {
const char * s_thumbcacheDirname = "thumbcache";
LibraryClient::LibraryClient(const fwk::Moniker & moniker,
- const fwk::NotificationCenter::Ptr & nc)
- : m_pImpl(ClientImpl::makeClientImpl(moniker, nc))
- , m_thumbnailCache(moniker.path() + "/" + s_thumbcacheDirname, nc)
+ uint64_t notif_id)
+ : m_pImpl(ClientImpl::makeClientImpl(moniker, notif_id))
+ , m_thumbnailCache(moniker.path() + "/" + s_thumbcacheDirname, notif_id)
, m_uidataprovider(new UIDataProvider())
, m_trash_id(0)
{
diff --git a/src/libraryclient/libraryclient.hpp b/src/libraryclient/libraryclient.hpp
index 0822c29..ad17298 100644
--- a/src/libraryclient/libraryclient.hpp
+++ b/src/libraryclient/libraryclient.hpp
@@ -45,7 +45,7 @@ class LibraryClient
{
public:
NON_COPYABLE(LibraryClient);
- LibraryClient(const fwk::Moniker & moniker, const fwk::NotificationCenter::Ptr & nc);
+ LibraryClient(const fwk::Moniker & moniker, uint64_t notif_id);
virtual ~LibraryClient();
// @return false in case of error.
bool ok() const;
diff --git a/src/libraryclient/locallibraryserver.hpp b/src/libraryclient/locallibraryserver.hpp
index 62b3ce8..fbafb46 100644
--- a/src/libraryclient/locallibraryserver.hpp
+++ b/src/libraryclient/locallibraryserver.hpp
@@ -31,9 +31,9 @@ class LocalLibraryServer : public fwk::Worker<eng::Op> {
public:
/** create the local server for the library whose dir is specified */
LocalLibraryServer(const std::string& dir,
- const fwk::NotificationCenter::Ptr& nc)
+ uint64_t notif_id)
: fwk::Worker<eng::Op>()
- , m_library(eng::Library::Ptr(new eng::Library(dir, nc)))
+ , m_library(eng::Library::Ptr(new eng::Library(dir, notif_id)))
{
}
bool ok() const { return m_library && m_library->ok(); }
diff --git a/src/niepce/Makefile.am b/src/niepce/Makefile.am
index 9ae4482..1729e56 100644
--- a/src/niepce/Makefile.am
+++ b/src/niepce/Makefile.am
@@ -22,6 +22,8 @@ niepce_LDADD = \
$(top_builddir)/src/ncr/libncr.a \
$(top_builddir)/src/ext/libview/libview.a \
$(top_builddir)/target/debug/libniepce_rust.a \
+ $(top_builddir)/src/engine/libniepceengine.a \
+ $(top_builddir)/src/fwk/utils/libniepceutils.a \
@FRAMEWORK_LIBS@ \
@GPHOTO_LIBS@ \
@BABL_LIBS@ \
diff --git a/src/niepce/notificationcenter.cpp b/src/niepce/notificationcenter.cpp
index f11b16e..264bc1c 100644
--- a/src/niepce/notificationcenter.cpp
+++ b/src/niepce/notificationcenter.cpp
@@ -25,7 +25,8 @@
namespace niepce {
-NotificationCenter::NotificationCenter()
+NotificationCenter::NotificationCenter(uint64_t notif_id)
+ : fwk::NotificationCenter(notif_id)
{
subscribe(NOTIFICATION_LIB,
sigc::mem_fun(*this, &NotificationCenter::dispatch_notification));
diff --git a/src/niepce/notificationcenter.hpp b/src/niepce/notificationcenter.hpp
index 622137d..46713d8 100644
--- a/src/niepce/notificationcenter.hpp
+++ b/src/niepce/notificationcenter.hpp
@@ -37,11 +37,19 @@ class NotificationCenter
{
public:
typedef std::shared_ptr<NotificationCenter> Ptr;
- NotificationCenter();
+ static Ptr make(uint64_t notif_id)
+ {
+ Ptr nc = Ptr(new NotificationCenter(notif_id));
+ nc->attach();
+ return nc;
+ }
sigc::signal<void, const eng::LibNotification &> signal_lib_notification;
sigc::signal<void, const eng::ThumbnailNotification &> signal_thumbnail_notification;
+protected:
+ NotificationCenter(uint64_t notif_id);
+
private:
void dispatch_notification(const fwk::Notification::Ptr &n);
};
@@ -54,6 +62,8 @@ private:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0))
+ c-basic-offset: 2
+ tab-width: 2
indent-tabs-mode:nil
fill-column:99
End:
diff --git a/src/niepce/ui/niepcewindow.cpp b/src/niepce/ui/niepcewindow.cpp
index fe090e2..664b619 100644
--- a/src/niepce/ui/niepcewindow.cpp
+++ b/src/niepce/ui/niepcewindow.cpp
@@ -160,7 +160,7 @@ NiepceWindow::buildWidget()
init_actions();
- m_notifcenter.reset(new niepce::NotificationCenter());
+ m_notifcenter = niepce::NotificationCenter::make(reinterpret_cast<uint64_t>(this));
Glib::ustring name("camera-photo");
set_icon_from_theme(name);
@@ -395,7 +395,7 @@ bool NiepceWindow::open_library(const std::string & libMoniker)
{
fwk::Moniker mon = fwk::Moniker(libMoniker);
m_libClient = LibraryClientPtr(new LibraryClient(mon,
- m_notifcenter));
+ m_notifcenter->id()));
if(!m_libClient->ok()) {
m_libClient = nullptr;
return false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]