[gnote] Move note manager to SyncUI



commit e094fb66d2e3071bc7a6a01a0b2822dacba430c5
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun May 25 19:51:47 2014 +0300

    Move note manager to SyncUI
    
    Rather than having separate members in descendants, have one in SyncUI
    class. Also use NoteManagerBase instead of NoteManager.

 src/synchronization/silentui.cpp   |    6 +++---
 src/synchronization/silentui.hpp   |    7 +++----
 src/synchronization/syncdialog.cpp |    6 +++---
 src/synchronization/syncdialog.hpp |    7 +++----
 src/synchronization/syncui.cpp     |    7 ++++++-
 src/synchronization/syncui.hpp     |    6 +++++-
 6 files changed, 23 insertions(+), 16 deletions(-)
---
diff --git a/src/synchronization/silentui.cpp b/src/synchronization/silentui.cpp
index 593ef6a..f7cfd41 100644
--- a/src/synchronization/silentui.cpp
+++ b/src/synchronization/silentui.cpp
@@ -26,14 +26,14 @@
 namespace gnote {
 namespace sync {
 
-  SyncUI::Ptr SilentUI::create(NoteManager & nm)
+  SyncUI::Ptr SilentUI::create(NoteManagerBase & nm)
   {
     return SyncUI::Ptr(new SilentUI(nm));
   }
 
 
-  SilentUI::SilentUI(NoteManager & manager)
-    : m_manager(manager)
+  SilentUI::SilentUI(NoteManagerBase & manager)
+    : SyncUI(manager)
     , m_ui_disabled(false)
   {
     signal_connecting_connect(sigc::mem_fun(*this, &SilentUI::on_connecting));
diff --git a/src/synchronization/silentui.hpp b/src/synchronization/silentui.hpp
index 306cb4e..7a52fe0 100644
--- a/src/synchronization/silentui.hpp
+++ b/src/synchronization/silentui.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012-2013 Aurimas Cernius
+ * Copyright (C) 2012-2014 Aurimas Cernius
  *
  * 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
@@ -35,9 +35,9 @@ namespace sync {
     : public SyncUI
   {
   public:
-    static SyncUI::Ptr create(NoteManager &);
+    static SyncUI::Ptr create(NoteManagerBase &);
   private:
-    explicit SilentUI(NoteManager &);
+    explicit SilentUI(NoteManagerBase &);
     virtual void sync_state_changed(SyncState state) override;
     virtual void note_synchronized(const std::string & noteTitle, NoteSyncType type) override;
     virtual void note_conflict_detected(NoteManager & manager,
@@ -48,7 +48,6 @@ namespace sync {
     void on_connecting();
     void on_idle();
 
-    NoteManager & m_manager;
     bool m_ui_disabled;
   };
 
diff --git a/src/synchronization/syncdialog.cpp b/src/synchronization/syncdialog.cpp
index d4b2878..db19906 100644
--- a/src/synchronization/syncdialog.cpp
+++ b/src/synchronization/syncdialog.cpp
@@ -218,14 +218,14 @@ private:
 
 
 
-SyncDialog::Ptr SyncDialog::create(NoteManager & m)
+SyncDialog::Ptr SyncDialog::create(NoteManagerBase & m)
 {
   return SyncDialog::Ptr(new SyncDialog(m));
 }
 
 
-SyncDialog::SyncDialog(NoteManager & manager)
-  : m_manager(manager)
+SyncDialog::SyncDialog(NoteManagerBase & manager)
+  : SyncUI(manager)
 {
   m_progress_bar_timeout_id = 0;
 
diff --git a/src/synchronization/syncdialog.hpp b/src/synchronization/syncdialog.hpp
index 7467f25..1a2baa1 100644
--- a/src/synchronization/syncdialog.hpp
+++ b/src/synchronization/syncdialog.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012-2013 Aurimas Cernius
+ * Copyright (C) 2012-2014 Aurimas Cernius
  *
  * 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
@@ -42,7 +42,7 @@ namespace sync {
   public:
     typedef shared_ptr<SyncDialog> Ptr;
 
-    static Ptr create(NoteManager &);
+    static Ptr create(NoteManagerBase &);
 
     virtual void sync_state_changed(SyncState state) override;
     virtual void note_synchronized(const std::string & noteTitle, NoteSyncType type) override;
@@ -68,7 +68,7 @@ namespace sync {
                                  SyncTitleConflictResolution resolution,
                                  std::exception **mainThreadException);
 
-    SyncDialog(NoteManager &);
+    explicit SyncDialog(NoteManagerBase &);
     bool on_pulse_progress_bar();
     void on_row_activated(const Gtk::TreeModel::Path & path, Gtk::TreeViewColumn *column);
     void treeview_col1_data_func(Gtk::CellRenderer *renderer, const Gtk::TreeIter & iter);
@@ -77,7 +77,6 @@ namespace sync {
     void rename_note(const Note::Ptr & note, const std::string & newTitle, bool updateReferencingNotes);
     void present_note(const Note::Ptr &);
 
-    NoteManager & m_manager;
     Gtk::Image *m_image;
     Gtk::Label *m_header_label;
     Gtk::Label *m_message_label;
diff --git a/src/synchronization/syncui.cpp b/src/synchronization/syncui.cpp
index 6d03fb7..bb875db 100644
--- a/src/synchronization/syncui.cpp
+++ b/src/synchronization/syncui.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012-2013 Aurimas Cernius
+ * Copyright (C) 2012-2014 Aurimas Cernius
  *
  * 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
@@ -27,6 +27,11 @@
 namespace gnote {
 namespace sync {
 
+  SyncUI::SyncUI(NoteManagerBase & manager)
+    : m_manager(manager)
+  {
+  }
+
   void SyncUI::note_synchronized_th(const std::string & noteTitle, NoteSyncType type)
   {
     utils::main_context_invoke(boost::bind(
diff --git a/src/synchronization/syncui.hpp b/src/synchronization/syncui.hpp
index d0943ec..f5524d1 100644
--- a/src/synchronization/syncui.hpp
+++ b/src/synchronization/syncui.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012-2013 Aurimas Cernius
+ * Copyright (C) 2012-2014 Aurimas Cernius
  *
  * 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
@@ -53,6 +53,10 @@ namespace sync {
     void signal_connecting_emit();
     sigc::connection signal_idle_connect(const SlotIdle & slot);
     void signal_idle_emit();
+  protected:
+    explicit SyncUI(NoteManagerBase & manager);
+
+    NoteManagerBase & m_manager;
   private:
     void signal_connecting_emit_()
       {


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