[gnote: 10/21] Add ctor to FileSystemSyncServer to accept client id as arg



commit 39c72dfda79dd158d87a68d35ebb6fea1affc086
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Apr 9 17:00:35 2017 +0300

    Add ctor to FileSystemSyncServer to accept client id as arg

 src/synchronization/filesystemsyncserver.cpp |   21 +++++++++++++++++++++
 src/synchronization/filesystemsyncserver.hpp |    3 +++
 2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/synchronization/filesystemsyncserver.cpp b/src/synchronization/filesystemsyncserver.cpp
index 504ef56..14fc2ce 100644
--- a/src/synchronization/filesystemsyncserver.cpp
+++ b/src/synchronization/filesystemsyncserver.cpp
@@ -58,10 +58,31 @@ SyncServer::Ptr FileSystemSyncServer::create(const Glib::ustring & path)
 }
 
 
+SyncServer::Ptr FileSystemSyncServer::create(const Glib::ustring & path, const Glib::ustring & client_id)
+{
+  return SyncServer::Ptr(new FileSystemSyncServer(path, client_id));
+}
+
+
 FileSystemSyncServer::FileSystemSyncServer(const Glib::ustring & localSyncPath)
   : m_server_path(localSyncPath)
   , m_cache_path(Glib::build_filename(Glib::get_tmp_dir(), Glib::get_user_name(), "gnote"))
 {
+  common_ctor();
+}
+
+
+FileSystemSyncServer::FileSystemSyncServer(const Glib::ustring & localSyncPath, const Glib::ustring & 
client_id)
+  : m_server_path(localSyncPath)
+  , m_cache_path(Glib::build_filename(Glib::get_tmp_dir(), Glib::get_user_name(), "gnote"))
+  , m_sync_lock(client_id)
+{
+  common_ctor();
+}
+
+
+void FileSystemSyncServer::common_ctor()
+{
   if(!sharp::directory_exists(m_server_path)) {
     throw std::invalid_argument(("Directory not found: " + m_server_path).c_str());
   }
diff --git a/src/synchronization/filesystemsyncserver.hpp b/src/synchronization/filesystemsyncserver.hpp
index 29f5b79..fb65f0f 100644
--- a/src/synchronization/filesystemsyncserver.hpp
+++ b/src/synchronization/filesystemsyncserver.hpp
@@ -36,6 +36,7 @@ class FileSystemSyncServer
 {
 public:
   static SyncServer::Ptr create(const Glib::ustring & path);
+  static SyncServer::Ptr create(const Glib::ustring & path, const Glib::ustring & client_id);
   virtual bool begin_sync_transaction() override;
   virtual bool commit_sync_transaction() override;
   virtual bool cancel_sync_transaction() override;
@@ -49,6 +50,8 @@ public:
   virtual bool updates_available_since(int revision) override;
 private:
   explicit FileSystemSyncServer(const Glib::ustring & path);
+  FileSystemSyncServer(const Glib::ustring & path, const Glib::ustring & client_id);
+  void common_ctor();
 
   Glib::ustring get_revision_dir_path(int rev);
   void cleanup_old_sync(const SyncLockInfo & syncLockInfo);


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