[gnote] Make sure get_instance() has a dispatcher too.
- From: Hubert Figuière <hub src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnote] Make sure get_instance() has a dispatcher too.
- Date: Sun, 19 Jul 2009 03:29:25 +0000 (UTC)
commit efbb58d2679859c9dc2183eec6fb9be28a12f90a
Author: Hubert Figuiere <hub figuiere net>
Date: Sat Jul 18 19:51:27 2009 -0400
Make sure get_instance() has a dispatcher too.
src/remotecontrolproxy.cpp | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/remotecontrolproxy.cpp b/src/remotecontrolproxy.cpp
index e1fd0d9..1eb7bcc 100644
--- a/src/remotecontrolproxy.cpp
+++ b/src/remotecontrolproxy.cpp
@@ -30,8 +30,14 @@ namespace gnote {
const char *RemoteControlProxy::GNOTE_SERVER_NAME = "org.gnome.Gnote";
const char *RemoteControlProxy::GNOTE_SERVER_PATH = "/org/gnome/Gnote/RemoteControl";
+DBus::Glib::BusDispatcher dispatcher;
+
RemoteControlClient *RemoteControlProxy::get_instance()
{
+ if(!DBus::default_dispatcher) {
+ DBus::default_dispatcher = &dispatcher;
+ dispatcher.attach(NULL);
+ }
DBus::Connection conn = DBus::Connection::SessionBus();
if(conn.has_name(GNOTE_SERVER_NAME)) {
return new RemoteControlClient(conn, GNOTE_SERVER_PATH, GNOTE_SERVER_NAME);
@@ -41,13 +47,13 @@ RemoteControlClient *RemoteControlProxy::get_instance()
}
-DBus::Glib::BusDispatcher dispatcher;
-
RemoteControl *RemoteControlProxy::register_remote(NoteManager & manager)
{
RemoteControl *remote_control = NULL;
- DBus::default_dispatcher = &dispatcher;
- dispatcher.attach(NULL);
+ if(!DBus::default_dispatcher) {
+ DBus::default_dispatcher = &dispatcher;
+ dispatcher.attach(NULL);
+ }
DBus::Connection conn = DBus::Connection::SessionBus();
// NOTE: I find no way to check whether we connected or not
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]