Skip to content
This repository was archived by the owner on Jun 8, 2021. It is now read-only.

Commit 866ba3b

Browse files
Merge pull request #5 from gkoz/resources
Add resources_[un]register
2 parents 6f6daba + d2a587c commit 866ba3b

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

src/lib.rs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2013-2016, The Gtk-rs Project Developers.
2+
// See the COPYRIGHT file at the top-level directory of this distribution.
3+
// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
4+
15
#[macro_use]
26
extern crate bitflags;
37
#[macro_use]
@@ -8,21 +12,26 @@ extern crate glib_sys as glib_ffi;
812
extern crate gobject_sys as gobject_ffi;
913
extern crate libc;
1014

11-
macro_rules! callback_guard {
12-
() => (
13-
let _guard = ::glib::CallbackGuard::new();
14-
)
15-
}
16-
17-
mod auto;
18-
1915
pub use glib::{
2016
Error,
2117
Object,
2218
};
2319

2420
pub use auto::*;
21+
pub use resources::{
22+
resources_register,
23+
resources_unregister,
24+
};
2525

2626
pub mod prelude {
2727
pub use auto::traits::*;
2828
}
29+
30+
macro_rules! callback_guard {
31+
() => (
32+
let _guard = ::glib::CallbackGuard::new();
33+
)
34+
}
35+
36+
mod auto;
37+
mod resources;

src/resources.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2013-2016, The Gtk-rs Project Developers.
2+
// See the COPYRIGHT file at the top-level directory of this distribution.
3+
// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
4+
5+
use Resource;
6+
use ffi;
7+
use glib::translate::*;
8+
9+
pub fn resources_register(resource: &Resource) {
10+
unsafe { ffi::g_resources_register(resource.to_glib_none().0) }
11+
}
12+
13+
pub fn resources_unregister(resource: &Resource) {
14+
unsafe { ffi::g_resources_unregister(resource.to_glib_none().0) }
15+
}

0 commit comments

Comments
 (0)