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

Commit

Permalink
Merge pull request #134 from Susurrus/master
Browse files Browse the repository at this point in the history
Add signal_handler_*block()
  • Loading branch information
gkoz committed Jul 5, 2016
2 parents 765192e + b20bd7e commit 9f77b36
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/lib.rs
Expand Up @@ -86,6 +86,8 @@ pub use object::{
ObjectExt,
};
pub use signal::{
signal_handler_block,
signal_handler_unblock,
signal_stop_emission,
signal_stop_emission_by_name
};
Expand Down
14 changes: 13 additions & 1 deletion src/signal.rs
Expand Up @@ -4,7 +4,7 @@

//! `IMPL` Low level signal support.

use libc::{c_void, c_uint};
use libc::{c_void, c_uint, c_ulong};

use gobject_ffi::{self, GCallback};
use glib_ffi::GQuark;
Expand All @@ -21,6 +21,18 @@ pub unsafe fn connect(receiver: *mut gobject_ffi::GObject, signal_name: &str, tr
handle
}

pub fn signal_handler_block<T: IsA<Object>>(instance: &T, handler_id: u64) {
unsafe {
gobject_ffi::g_signal_handler_block(instance.to_glib_none().0, handler_id as c_ulong);
}
}

pub fn signal_handler_unblock<T: IsA<Object>>(instance: &T, handler_id: u64) {
unsafe {
gobject_ffi::g_signal_handler_unblock(instance.to_glib_none().0, handler_id as c_ulong);
}
}

pub fn signal_stop_emission<T: IsA<Object>>(instance: &T, signal_id: u32, detail: GQuark) {
unsafe {
gobject_ffi::g_signal_stop_emission(instance.to_glib_none().0, signal_id as c_uint, detail);
Expand Down

0 comments on commit 9f77b36

Please sign in to comment.