[gnote] Do not use static IGnote in RemoteControl



commit 624712d33b5f62fd69fc4020667c561e3b8c4a0b
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Nov 17 17:56:50 2019 +0200

    Do not use static IGnote in RemoteControl

 src/dbus/remotecontrol.cpp | 7 ++++---
 src/dbus/remotecontrol.hpp | 4 +++-
 src/remotecontrolproxy.cpp | 2 +-
 3 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/dbus/remotecontrol.cpp b/src/dbus/remotecontrol.cpp
index 6c49c700..19babb06 100644
--- a/src/dbus/remotecontrol.cpp
+++ b/src/dbus/remotecontrol.cpp
@@ -36,10 +36,11 @@
 namespace gnote {
 
 
-  RemoteControl::RemoteControl(const Glib::RefPtr<Gio::DBus::Connection> & cnx, NoteManagerBase & manager,
+  RemoteControl::RemoteControl(const Glib::RefPtr<Gio::DBus::Connection> & cnx, IGnote & g, NoteManagerBase 
& manager,
                                const char * path, const char * interface_name,
                                const Glib::RefPtr<Gio::DBus::InterfaceInfo> & gnote_interface)
     : IRemoteControl(cnx, path, interface_name, gnote_interface)
+    , m_gnote(g)
     , m_manager(manager)
   {
     DBG_OUT("initialized remote control");
@@ -137,13 +138,13 @@ namespace gnote {
 
   void RemoteControl::DisplaySearch()
   {
-    IGnote::obj().open_search_all().present();
+    m_gnote.open_search_all().present();
   }
 
 
   void RemoteControl::DisplaySearchWithText(const Glib::ustring& search_text)
   {
-    MainWindow & recent_changes = IGnote::obj().get_main_window();
+    MainWindow & recent_changes = m_gnote.get_main_window();
     recent_changes.set_search_text(search_text);
     recent_changes.present();
     recent_changes.show_search_bar();
diff --git a/src/dbus/remotecontrol.hpp b/src/dbus/remotecontrol.hpp
index ac63b0bb..a186d8af 100644
--- a/src/dbus/remotecontrol.hpp
+++ b/src/dbus/remotecontrol.hpp
@@ -32,13 +32,14 @@
 
 namespace gnote {
 
+class IGnote;
 class NoteManagerBase;
 
 class RemoteControl
   : public IRemoteControl
 {
 public:
-  RemoteControl(const Glib::RefPtr<Gio::DBus::Connection> &, gnote::NoteManagerBase&, const char *, const 
char *,
+  RemoteControl(const Glib::RefPtr<Gio::DBus::Connection> &, IGnote&, NoteManagerBase&, const char *, const 
char *,
                 const Glib::RefPtr<Gio::DBus::InterfaceInfo> &);
   virtual ~RemoteControl();
 
@@ -76,6 +77,7 @@ private:
   void on_note_saved(const NoteBase::Ptr &);
   MainWindow & present_note(const NoteBase::Ptr &);
 
+  IGnote & m_gnote;
   NoteManagerBase & m_manager;
 };
 
diff --git a/src/remotecontrolproxy.cpp b/src/remotecontrolproxy.cpp
index ccc85058..dfc32208 100644
--- a/src/remotecontrolproxy.cpp
+++ b/src/remotecontrolproxy.cpp
@@ -126,7 +126,7 @@ void RemoteControlProxy::register_object(const Glib::RefPtr<Gio::DBus::Connectio
                                          const slot_name_acquire_finish & on_finish)
 {
   load_introspection_xml();
-  m_remote_control = new RemoteControl(conn, manager, GNOTE_SERVER_PATH, GNOTE_INTERFACE_NAME, 
m_gnote_interface);
+  m_remote_control = new RemoteControl(conn, m_gnote, 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, manager);
   on_finish(true, true);


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