[gnote] Add present_ui method to SyncUI



commit cac122301dac11affb5a04384979625138310943
Author: Aurimas Äernius <aurisc4 gmail com>
Date:   Sun Jan 6 19:25:52 2013 +0200

    Add present_ui method to SyncUI
    
    To remove the check in SyncManager.

 src/gnote.hpp                       |    4 ----
 src/synchronization/silentui.cpp    |    7 ++++++-
 src/synchronization/silentui.hpp    |    3 ++-
 src/synchronization/syncdialog.cpp  |    6 ++++++
 src/synchronization/syncdialog.hpp  |    1 +
 src/synchronization/syncmanager.cpp |    5 +----
 src/synchronization/syncui.hpp      |    3 ++-
 7 files changed, 18 insertions(+), 11 deletions(-)
---
diff --git a/src/gnote.hpp b/src/gnote.hpp
index 1df243a..1d770f0 100644
--- a/src/gnote.hpp
+++ b/src/gnote.hpp
@@ -160,10 +160,6 @@ public:
     }
   sigc::signal<void> signal_quit;
   static void register_remote_control(NoteManager & manager, RemoteControlProxy::slot_name_acquire_finish on_finish);
-  sync::SyncDialog::Ptr sync_dialog()
-    {
-      return m_sync_dlg;
-    }
   void open_note(const Note::Ptr & note);
 protected:
   virtual int on_command_line(const Glib::RefPtr<Gio::ApplicationCommandLine> & command_line);
diff --git a/src/synchronization/silentui.cpp b/src/synchronization/silentui.cpp
index 08570a0..19a1565 100644
--- a/src/synchronization/silentui.cpp
+++ b/src/synchronization/silentui.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012 Aurimas Cernius
+ * Copyright (C) 2012-2013 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
@@ -88,6 +88,11 @@ namespace sync {
   }
 
 
+  void SilentUI::present_ui()
+  {
+  }
+
+
   void SilentUI::on_connecting()
   {
     m_manager.read_only(true);
diff --git a/src/synchronization/silentui.hpp b/src/synchronization/silentui.hpp
index 947a060..7662ca3 100644
--- a/src/synchronization/silentui.hpp
+++ b/src/synchronization/silentui.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012 Aurimas Cernius
+ * Copyright (C) 2012-2013 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
@@ -43,6 +43,7 @@ namespace sync {
                                         const Note::Ptr & localConflictNote,
                                         NoteUpdate remoteNote,
                                         const std::list<std::string> & noteUpdateTitles);
+    virtual void present_ui();
     void on_connecting();
     void on_idle();
 
diff --git a/src/synchronization/syncdialog.cpp b/src/synchronization/syncdialog.cpp
index 76b5ef8..9b81235 100644
--- a/src/synchronization/syncdialog.cpp
+++ b/src/synchronization/syncdialog.cpp
@@ -474,6 +474,12 @@ void SyncDialog::on_row_activated(const Gtk::TreeModel::Path & path, Gtk::TreeVi
 }
 
 
+void SyncDialog::present_ui()
+{
+  present();
+}
+
+
 void SyncDialog::header_text(const std::string & value)
 {
   m_header_label->set_markup(str(boost::format("<span size=\"large\" weight=\"bold\">%1%</span>") % value));
diff --git a/src/synchronization/syncdialog.hpp b/src/synchronization/syncdialog.hpp
index c679d5a..661a01c 100644
--- a/src/synchronization/syncdialog.hpp
+++ b/src/synchronization/syncdialog.hpp
@@ -51,6 +51,7 @@ namespace sync {
                                         const Note::Ptr & localConflictNote,
                                         NoteUpdate remoteNote,
                                         const std::list<std::string> & noteUpdateTitles);
+    virtual void present_ui();
     void header_text(const std::string &);
     void message_text(const std::string &);
     std::string progress_text() const;
diff --git a/src/synchronization/syncmanager.cpp b/src/synchronization/syncmanager.cpp
index 234816c..1af636a 100644
--- a/src/synchronization/syncmanager.cpp
+++ b/src/synchronization/syncmanager.cpp
@@ -172,10 +172,7 @@ namespace sync {
     if(m_sync_thread != NULL) {
       // A synchronization thread is already running
       // TODO: Start new sync if existing dlg is for finished sync
-      // TODO: ISyncUI-ize this somehow
-      if(m_sync_ui == Gnote::obj().sync_dialog()) {
-        Gnote::obj().sync_dialog()->present();
-      }
+      m_sync_ui->present_ui();
       return;
     }
 
diff --git a/src/synchronization/syncui.hpp b/src/synchronization/syncui.hpp
index 812da5e..7ffa882 100644
--- a/src/synchronization/syncui.hpp
+++ b/src/synchronization/syncui.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012 Aurimas Cernius
+ * Copyright (C) 2012-2013 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
@@ -49,6 +49,7 @@ namespace sync {
                                         const Note::Ptr & localConflictNote,
                                         NoteUpdate remoteNote,
                                         const std::list<std::string> & noteUpdateTitles) = 0;
+    virtual void present_ui() = 0;
 
     sigc::connection signal_connecting_connect(const SlotConnecting & slot);
     void signal_connecting_emit();



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