[gnote] Regactor passing reference to Gnote



commit 02c1525f23f66e16b7a7268c9b28297f56603b1b
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Tue Mar 2 23:01:01 2021 +0200

    Regactor passing reference to Gnote

 src/gnote.cpp              |  3 +--
 src/remotecontrolproxy.cpp | 11 +++++------
 src/remotecontrolproxy.hpp |  5 ++---
 3 files changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/src/gnote.cpp b/src/gnote.cpp
index d577ceec..22a61320 100644
--- a/src/gnote.cpp
+++ b/src/gnote.cpp
@@ -61,7 +61,6 @@ namespace gnote {
     , m_sync_manager(NULL)
     , m_is_background(false)
     , m_is_shell_search(false)
-    , m_remote_control(*this)
     , m_prefsdlg(NULL)
     , m_cmd_line(*this)
   {
@@ -203,7 +202,7 @@ namespace gnote {
 
   void Gnote::register_object()
   {
-    m_remote_control.register_object(Gio::DBus::Connection::get_sync(Gio::DBus::BUS_TYPE_SESSION), 
default_note_manager(), sigc::mem_fun(*this, &Gnote::end_main));
+    m_remote_control.register_object(Gio::DBus::Connection::get_sync(Gio::DBus::BUS_TYPE_SESSION), *this, 
default_note_manager(), sigc::mem_fun(*this, &Gnote::end_main));
   }
 
 
diff --git a/src/remotecontrolproxy.cpp b/src/remotecontrolproxy.cpp
index 23128b39..15c10b77 100644
--- a/src/remotecontrolproxy.cpp
+++ b/src/remotecontrolproxy.cpp
@@ -59,9 +59,8 @@ const char *RemoteControlProxy::GNOTE_SEARCH_PROVIDER_PATH = "/org/gnome/Gnote/S
 const char *RemoteControlProxy::GNOTE_SEARCH_PROVIDER_INTERFACE_NAME = "org.gnome.Shell.SearchProvider2";
 
 
-RemoteControlProxy::RemoteControlProxy(IGnote & g)
-  : m_gnote(g)
-  , m_remote_control(NULL)
+RemoteControlProxy::RemoteControlProxy()
+  : m_remote_control(NULL)
   , m_search_provider(NULL)
 {
 }
@@ -72,13 +71,13 @@ RemoteControl *RemoteControlProxy::get_remote_control()
 }
 
 
-void RemoteControlProxy::register_object(const Glib::RefPtr<Gio::DBus::Connection> & conn, NoteManagerBase & 
manager,
+void RemoteControlProxy::register_object(const Glib::RefPtr<Gio::DBus::Connection> & conn, IGnote & g, 
NoteManagerBase & manager,
                                          const slot_name_acquire_finish & on_finish)
 {
   load_introspection_xml();
-  m_remote_control = new RemoteControl(conn, m_gnote, manager, GNOTE_SERVER_PATH, GNOTE_INTERFACE_NAME, 
m_gnote_interface);
+  m_remote_control = new RemoteControl(conn, g, manager, GNOTE_SERVER_PATH, GNOTE_INTERFACE_NAME, 
m_gnote_interface);
   m_search_provider = new org::gnome::Gnote::SearchProvider(conn, GNOTE_SEARCH_PROVIDER_PATH,
-                                                            m_search_provider_interface, m_gnote, manager);
+                                                            m_search_provider_interface, g, manager);
   on_finish(true, true);
 }
 
diff --git a/src/remotecontrolproxy.hpp b/src/remotecontrolproxy.hpp
index cbea2e98..1467f558 100644
--- a/src/remotecontrolproxy.hpp
+++ b/src/remotecontrolproxy.hpp
@@ -51,15 +51,14 @@ public:
   typedef sigc::slot<void, bool, bool> slot_name_acquire_finish;
   typedef sigc::slot<void> slot_connected;
 
-  explicit RemoteControlProxy(IGnote & g);
+  RemoteControlProxy();
 
   RemoteControl *get_remote_control();
-  void register_object(const Glib::RefPtr<Gio::DBus::Connection> & conn, NoteManagerBase & manager,
+  void register_object(const Glib::RefPtr<Gio::DBus::Connection> & conn, IGnote & g, NoteManagerBase & 
manager,
                        const slot_name_acquire_finish & on_finish);
 private:
   void load_introspection_xml();
 
-  IGnote & m_gnote;
   RemoteControl *m_remote_control;
   org::gnome::Gnote::SearchProvider *m_search_provider;
   Glib::RefPtr<Gio::DBus::InterfaceInfo> m_gnote_interface;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]