[niepce] rust: fix initialisation of gtk and rexiv2
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] rust: fix initialisation of gtk and rexiv2
- Date: Sun, 17 Feb 2019 15:14:52 +0000 (UTC)
commit e9ae8cc3b7f861440f41e9dfcc14ac172478932d
Author: Hubert Figuière <hub figuiere net>
Date: Sat Jan 5 16:31:22 2019 -0500
rust: fix initialisation of gtk and rexiv2
src/lib.rs | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/lib.rs b/src/lib.rs
index 0638867..2f2580b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,7 +1,7 @@
/*
* niepce - lib.rs
*
- * Copyright (C) 2017 Hubert Figuière
+ * Copyright (C) 2017-2019 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
@@ -44,8 +44,15 @@ pub mod niepce;
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
-/// Call this to initialize the gtk-rs bindings
+use std::sync::{Once, ONCE_INIT};
+
+/// Call this to initialize rexiv2 and the gtk-rs bindings
#[no_mangle]
pub extern "C" fn niepce_init() {
- gtk::init().unwrap();
+ static START: Once = ONCE_INIT;
+
+ START.call_once(|| unsafe {
+ gtk::init().unwrap();
+ rexiv2::initialize().expect("Unable to initialize rexiv2");
+ });
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]