[niepce] rust: move the capi module to the npc-fwk crate



commit e64a9c6ce97fd304db6000c04f08a80c0c98bd16
Author: Hubert Figuière <hub figuiere net>
Date:   Sun Oct 20 15:06:57 2019 -0400

    rust: move the capi module to the npc-fwk crate

 Cargo.lock                          |  1 -
 Cargo.toml                          |  1 -
 {src => crates/npc-fwk/src}/capi.rs |  0
 crates/npc-fwk/src/lib.rs           | 10 ++++++++++
 src/Makefile.am                     |  2 +-
 src/lib.rs                          |  6 ++----
 6 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/Cargo.lock b/Cargo.lock
index 32f52ce..2b953b8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -508,7 +508,6 @@ dependencies = [
  "multimap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "npc-fwk 0.1.0",
  "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
- "rexiv2 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rusqlite 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "try_opt 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
diff --git a/Cargo.toml b/Cargo.toml
index 7c5f55f..481230d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,7 +16,6 @@ gtk-sys = { version = "*", features = ["v3_16"] }
 gtk = "^0.7.0"
 libc = "0.2.39"
 multimap = "0.4.0"
-rexiv2 = "^0.7.0"
 rusqlite = { version = "0.14.0", features = ["functions"] }
 try_opt = "0.1.1"
 #gphoto = "0.1.1"
diff --git a/src/capi.rs b/crates/npc-fwk/src/capi.rs
similarity index 100%
rename from src/capi.rs
rename to crates/npc-fwk/src/capi.rs
diff --git a/crates/npc-fwk/src/lib.rs b/crates/npc-fwk/src/lib.rs
index 31e69d2..31e2367 100644
--- a/crates/npc-fwk/src/lib.rs
+++ b/crates/npc-fwk/src/lib.rs
@@ -33,6 +33,7 @@ extern crate try_opt;
 
 #[macro_use]
 pub mod base;
+pub mod capi;
 pub mod utils;
 pub mod toolkit;
 
@@ -80,3 +81,12 @@ pub unsafe extern "C" fn fwk_fraction_to_decimal(cvalue: *const c_char) -> f64 {
     }
     f64::NAN
 }
+
+///
+/// Init funtion because rexiv2 need one.
+///
+/// Make sure to call it after gtk::init()
+///
+pub fn init() {
+    rexiv2::initialize().expect("Unable to initialize rexiv2");
+}
diff --git a/src/Makefile.am b/src/Makefile.am
index 324b74d..267c6a7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,7 +8,6 @@ RUST_SOURCES = \
        @top_srcdir@/build.rs \
        @top_srcdir@/Cargo.toml \
        @top_srcdir@/Cargo.lock \
-       @top_srcdir@/src/capi.rs \
        @top_srcdir@/src/engine/db/filebundle.rs \
        @top_srcdir@/src/engine/db/fsfile.rs \
        @top_srcdir@/src/engine/db/keyword.rs \
@@ -25,6 +24,7 @@ RUST_SOURCES = \
        @top_srcdir@/src/engine/mod.rs \
        @top_srcdir@/crates/npc-fwk/Cargo.toml \
        @top_srcdir@/crates/npc-fwk/build.rs \
+       @top_srcdir@/crates/npc-fwk/src/capi.rs \
        @top_srcdir@/crates/npc-fwk/src/base/date.rs \
        @top_srcdir@/crates/npc-fwk/src/base/debug.rs \
        @top_srcdir@/crates/npc-fwk/src/base/fractions.rs \
diff --git a/src/lib.rs b/src/lib.rs
index a36bba9..be9bd1a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -28,7 +28,6 @@ extern crate gtk;
 extern crate gtk_sys;
 extern crate libc;
 extern crate multimap;
-extern crate rexiv2;
 extern crate rusqlite;
 #[macro_use]
 extern crate try_opt;
@@ -37,7 +36,6 @@ extern crate try_opt;
 #[macro_use]
 extern crate npc_fwk;
 
-pub mod capi;
 pub mod engine;
 pub mod libraryclient;
 pub mod niepce;
@@ -46,13 +44,13 @@ include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
 
 use std::sync::Once;
 
-/// Call this to initialize rexiv2 and the gtk-rs bindings
+/// Call this to initialize npc-fwk the gtk-rs bindings
 #[no_mangle]
 pub extern "C" fn niepce_init() {
     static START: Once = Once::new();
 
     START.call_once(|| {
         gtk::init().unwrap();
-        rexiv2::initialize().expect("Unable to initialize rexiv2");
+        npc_fwk::init();
     });
 }


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