[niepce] libraryclient+rust: ClientImpl is only in Rust
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] libraryclient+rust: ClientImpl is only in Rust
- Date: Fri, 27 Oct 2017 02:03:23 +0000 (UTC)
commit d09d272be73cd1a83f60be93527265d7678885f1
Author: Hubert Figuière <hub figuiere net>
Date: Sat Oct 21 23:50:23 2017 -0400
libraryclient+rust: ClientImpl is only in Rust
src/libraryclient/Makefile.am | 1 -
src/libraryclient/clientimpl.cpp | 163 -----------------------------------
src/libraryclient/clientimpl.hpp | 84 ------------------
src/libraryclient/libraryclient.cpp | 79 ++++++++++--------
src/libraryclient/libraryclient.hpp | 2 +-
5 files changed, 45 insertions(+), 284 deletions(-)
---
diff --git a/src/libraryclient/Makefile.am b/src/libraryclient/Makefile.am
index 458a216..5fdb959 100644
--- a/src/libraryclient/Makefile.am
+++ b/src/libraryclient/Makefile.am
@@ -19,6 +19,5 @@ TEST_LIBS = \
$(NULL)
liblibraryclient_a_SOURCES = libraryclient.hpp libraryclient.cpp \
- clientimpl.hpp clientimpl.cpp \
uidataprovider.hpp uidataprovider.cpp \
$(NULL)
diff --git a/src/libraryclient/libraryclient.cpp b/src/libraryclient/libraryclient.cpp
index 5863f82..3f4ec9e 100644
--- a/src/libraryclient/libraryclient.cpp
+++ b/src/libraryclient/libraryclient.cpp
@@ -1,7 +1,7 @@
/*
* niepce - libraryclient/libraryclient.cpp
*
- * Copyright (C) 2007-2015 Hubert Figuière
+ * Copyright (C) 2007-2017 Hubert Figuière
*
* 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
@@ -19,11 +19,13 @@
#include "fwk/base/moniker.hpp"
+#include "fwk/utils/files.hpp"
#include "libraryclient.hpp"
-#include "clientimpl.hpp"
#include "uidataprovider.hpp"
+#include "rust_bindings.hpp"
+
using eng::library_id_t;
namespace libraryclient {
@@ -32,7 +34,7 @@ const char * s_thumbcacheDirname = "thumbcache";
LibraryClient::LibraryClient(const fwk::Moniker & moniker,
uint64_t notif_id)
- : m_pImpl(ClientImpl::makeClientImpl(moniker, notif_id))
+ : m_impl(ffi::libraryclient_clientimpl_new(moniker.path().c_str(), notif_id))
, m_thumbnailCache(moniker.path() + "/" + s_thumbcacheDirname, notif_id)
, m_uidataprovider(new UIDataProvider())
, m_trash_id(0)
@@ -41,104 +43,111 @@ LibraryClient::LibraryClient(const fwk::Moniker & moniker,
LibraryClient::~LibraryClient()
{
+ ffi::libraryclient_clientimpl_delete(m_impl);
}
bool LibraryClient::ok() const
{
- return m_pImpl && m_pImpl->ok();
+ return m_impl;
}
void LibraryClient::getAllKeywords()
{
- m_pImpl->getAllKeywords();
+ ffi::libraryclient_clientimpl_get_all_keywords(m_impl);
}
void LibraryClient::getAllFolders()
{
- m_pImpl->getAllFolders();
+ ffi::libraryclient_clientimpl_get_all_folders(m_impl);
}
-void LibraryClient::queryFolderContent(eng::library_id_t id)
+void LibraryClient::queryFolderContent(eng::library_id_t folder_id)
{
- m_pImpl->queryFolderContent(id);
+ ffi::libraryclient_clientimpl_query_folder_content(m_impl, folder_id);
}
-void LibraryClient::queryKeywordContent(eng::library_id_t id)
+void LibraryClient::queryKeywordContent(eng::library_id_t keyword_id)
{
- m_pImpl->queryKeywordContent(id);
+ ffi::libraryclient_clientimpl_query_keyword_content(m_impl, keyword_id);
}
-void LibraryClient::countFolder(library_id_t id)
+void LibraryClient::countFolder(library_id_t folder_id)
{
- m_pImpl->countFolder(id);
+ ffi::libraryclient_clientimpl_count_folder(m_impl, folder_id);
}
-void LibraryClient::requestMetadata(eng::library_id_t id)
+void LibraryClient::requestMetadata(eng::library_id_t file_id)
{
- m_pImpl->requestMetadata(id);
+ ffi::libraryclient_clientimpl_request_metadata(m_impl, file_id);
}
/** set the metadata */
-void LibraryClient::setMetadata(library_id_t id, fwk::PropertyIndex meta,
+void LibraryClient::setMetadata(library_id_t file_id, fwk::PropertyIndex meta,
const fwk::PropertyValuePtr & value)
{
- m_pImpl->setMetadata(id, static_cast<eng::Np>(meta), value);
+ ffi::libraryclient_clientimpl_set_metadata(m_impl, file_id, static_cast<eng::Np>(meta),
+ value.get());
}
-void LibraryClient::write_metadata(eng::library_id_t id)
+void LibraryClient::write_metadata(eng::library_id_t file_id)
{
- m_pImpl->write_metadata(id);
+ ffi::libraryclient_clientimpl_write_metadata(m_impl, file_id);
}
-void LibraryClient::moveFileToFolder(eng::library_id_t file_id, eng::library_id_t from_folder,
- eng::library_id_t to_folder)
+void LibraryClient::moveFileToFolder(eng::library_id_t file_id, eng::library_id_t from_folder_id,
+ eng::library_id_t to_folder_id)
{
- m_pImpl->moveFileToFolder(file_id, from_folder, to_folder);
+ ffi::libraryclient_clientimpl_move_file_to_folder(m_impl, file_id, from_folder_id,
+ to_folder_id);
}
void LibraryClient::getAllLabels()
{
- m_pImpl->getAllLabels();
+ ffi::libraryclient_clientimpl_get_all_labels(m_impl);
}
-void LibraryClient::createLabel(const std::string & s, const std::string & color)
+void LibraryClient::createLabel(const std::string& s, const std::string& colour)
{
- m_pImpl->createLabel(s, color);
+ ffi::libraryclient_clientimpl_create_label(m_impl, s.c_str(), colour.c_str());
}
-void LibraryClient::deleteLabel(int id)
+void LibraryClient::deleteLabel(int label_id)
{
- m_pImpl->deleteLabel(id);
+ ffi::libraryclient_clientimpl_delete_label(m_impl, label_id);
}
-void LibraryClient::updateLabel(library_id_t id, const std::string & new_name,
- const std::string & new_color)
+void LibraryClient::updateLabel(library_id_t label_id, const std::string& new_name,
+ const std::string& new_colour)
{
- m_pImpl->updateLabel(id, new_name, new_color);
+ ffi::libraryclient_clientimpl_update_label(m_impl, label_id,
+ new_name.c_str(), new_colour.c_str());
}
void LibraryClient::processXmpUpdateQueue(bool write_xmp)
{
- m_pImpl->processXmpUpdateQueue(write_xmp);
+ ffi::libraryclient_clientimpl_process_xmp_update_queue(m_impl, write_xmp);
}
-void LibraryClient::importFile(const std::string & path, eng::Managed manage)
+void LibraryClient::importFile(const std::string& path, eng::Managed manage)
{
- m_pImpl->importFile(path, manage);
+ ffi::libraryclient_clientimpl_import_file(m_impl, path.c_str(), manage);
}
-void LibraryClient::importFromDirectory(const std::string & dir, eng::Managed manage)
+void LibraryClient::importFromDirectory(const std::string& dir, eng::Managed manage)
{
- m_pImpl->importFromDirectory(dir, manage);
+ fwk::FileListPtr files;
+ files = fwk::FileList::getFilesFromDirectory(dir, &fwk::filter_none);
+
+ ffi::libraryclient_clientimpl_import_files(m_impl, dir.c_str(), files.get(), manage);
}
#if 0
-bool LibraryClient::fetchKeywordsForFile(int /*file*/,
+bool LibraryClient::fetchKeywordsForFile(int /*file*/,
eng::Keyword::IdList & /*keywords*/)
{
// TODO
diff --git a/src/libraryclient/libraryclient.hpp b/src/libraryclient/libraryclient.hpp
index a94f3bc..a76519f 100644
--- a/src/libraryclient/libraryclient.hpp
+++ b/src/libraryclient/libraryclient.hpp
@@ -105,7 +105,7 @@ public:
m_trash_id = id;
}
private:
- std::unique_ptr<ClientImpl> m_pImpl;
+ ffi::ClientImpl* m_impl;
eng::ThumbnailCache m_thumbnailCache;
std::unique_ptr<UIDataProvider> m_uidataprovider;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]