Commit 21dd25d3 authored by Julian Sparber's avatar Julian Sparber

bump gtk version to 0.8.0

parent 329fd91a
......@@ -2,9 +2,9 @@
pkg-config = "0.3.7"
[dependencies]
glib-sys = "0.7.0"
gobject-sys = "0.7.0"
gtk-sys = "0.7.0"
glib-sys = "0.8.0"
gobject-sys = "0.8.0"
gtk-sys = "0.8.0"
libc = "0.2"
[dev-dependencies]
......@@ -26,4 +26,4 @@ license = "GPL-3.0-or-later"
links = "gspell"
name = "gspell-sys"
repository = "https://gitlab.gnome.org/World/Rust/gspell-rs"
version = "0.1.0"
version = "0.2.0"
// This file was generated by gir (https://github.com/gtk-rs/gir @ 1ae7210)
// from gir-files (https://github.com/gtk-rs/gir-files @ 02dfee2)
// DO NOT EDIT
extern crate pkg_config;
use pkg_config::{Config, Error};
......@@ -20,6 +24,9 @@ fn find() -> Result<(), Error> {
"1.6"
};
if let Ok(inc_dir) = env::var("GTK_INCLUDE_DIR") {
println!("cargo:include={}", inc_dir);
}
if let Ok(lib_dir) = env::var("GTK_LIB_DIR") {
for lib_ in shared_libs.iter() {
println!("cargo:rustc-link-lib=dylib={}", lib_);
......@@ -39,6 +46,9 @@ fn find() -> Result<(), Error> {
}
match config.probe(package_name) {
Ok(library) => {
if let Ok(paths) = std::env::join_paths(library.include_paths) {
println!("cargo:include={}", paths.to_string_lossy());
}
if hardcode_shared_libs {
for lib_ in shared_libs.iter() {
println!("cargo:rustc-link-lib=dylib={}", lib_);
......
// This file was generated by gir (https://github.com/gtk-rs/gir @ f5fca82)
// from gir-files (https://github.com/gtk-rs/gir-files @ 62f3bf0)
// This file was generated by gir (https://github.com/gtk-rs/gir @ 1ae7210)
// from gir-files (https://github.com/gtk-rs/gir-files @ 02dfee2)
// DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
#![cfg_attr(feature = "cargo-clippy", allow(approx_constant, type_complexity, unreadable_literal))]
#![allow(clippy::approx_constant, clippy::type_complexity, clippy::unreadable_literal)]
extern crate libc;
extern crate gtk_sys as gtk;
......@@ -47,14 +47,17 @@ impl ::std::fmt::Debug for GspellCheckerClass {
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct GspellCheckerDialogClass {
_truncated_record_marker: c_void,
// /*Ignored*/field parent_class has incomplete type
pub parent_class: gtk::GtkDialogClass,
pub padding: [gpointer; 8],
}
impl ::std::fmt::Debug for GspellCheckerDialogClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GspellCheckerDialogClass @ {:?}", self as *const _))
.field("parent_class", &self.parent_class)
.field("padding", &self.padding)
.finish()
}
}
......@@ -98,27 +101,33 @@ impl ::std::fmt::Debug for GspellLanguage {
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct GspellLanguageChooserButtonClass {
_truncated_record_marker: c_void,
// /*Ignored*/field parent_class has incomplete type
pub parent_class: gtk::GtkButtonClass,
pub padding: [gpointer; 8],
}
impl ::std::fmt::Debug for GspellLanguageChooserButtonClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GspellLanguageChooserButtonClass @ {:?}", self as *const _))
.field("parent_class", &self.parent_class)
.field("padding", &self.padding)
.finish()
}
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct GspellLanguageChooserDialogClass {
_truncated_record_marker: c_void,
// /*Ignored*/field parent_class has incomplete type
pub parent_class: gtk::GtkDialogClass,
pub padding: [gpointer; 8],
}
impl ::std::fmt::Debug for GspellLanguageChooserDialogClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GspellLanguageChooserDialogClass @ {:?}", self as *const _))
.field("parent_class", &self.parent_class)
.field("padding", &self.padding)
.finish()
}
}
......
// This file was generated by gir (https://github.com/gtk-rs/gir @ f5fca82)
// from gir-files (https://github.com/gtk-rs/gir-files @ 62f3bf0)
// This file was generated by gir (https://github.com/gtk-rs/gir @ 1ae7210)
// from gir-files (https://github.com/gtk-rs/gir-files @ 02dfee2)
// DO NOT EDIT
extern crate gspell_sys;
......@@ -227,18 +227,28 @@ fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Erro
&abi_cmd, &output).into());
}
Ok(str::from_utf8(&output.stdout)?.trim().to_owned())
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") ||
!output.ends_with("###gir test###") {
return Err(format!("command {:?} return invalid output, {:?}",
&abi_cmd, &output).into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
("GspellChecker", Layout {size: size_of::<GspellChecker>(), alignment: align_of::<GspellChecker>()}),
("GspellCheckerClass", Layout {size: size_of::<GspellCheckerClass>(), alignment: align_of::<GspellCheckerClass>()}),
("GspellCheckerDialog", Layout {size: size_of::<GspellCheckerDialog>(), alignment: align_of::<GspellCheckerDialog>()}),
("GspellCheckerDialogClass", Layout {size: size_of::<GspellCheckerDialogClass>(), alignment: align_of::<GspellCheckerDialogClass>()}),
("GspellCheckerError", Layout {size: size_of::<GspellCheckerError>(), alignment: align_of::<GspellCheckerError>()}),
("GspellEntryBufferClass", Layout {size: size_of::<GspellEntryBufferClass>(), alignment: align_of::<GspellEntryBufferClass>()}),
("GspellEntryClass", Layout {size: size_of::<GspellEntryClass>(), alignment: align_of::<GspellEntryClass>()}),
("GspellLanguageChooserButton", Layout {size: size_of::<GspellLanguageChooserButton>(), alignment: align_of::<GspellLanguageChooserButton>()}),
("GspellLanguageChooserButtonClass", Layout {size: size_of::<GspellLanguageChooserButtonClass>(), alignment: align_of::<GspellLanguageChooserButtonClass>()}),
("GspellLanguageChooserDialog", Layout {size: size_of::<GspellLanguageChooserDialog>(), alignment: align_of::<GspellLanguageChooserDialog>()}),
("GspellLanguageChooserDialogClass", Layout {size: size_of::<GspellLanguageChooserDialogClass>(), alignment: align_of::<GspellLanguageChooserDialogClass>()}),
("GspellLanguageChooserInterface", Layout {size: size_of::<GspellLanguageChooserInterface>(), alignment: align_of::<GspellLanguageChooserInterface>()}),
("GspellNavigatorInterface", Layout {size: size_of::<GspellNavigatorInterface>(), alignment: align_of::<GspellNavigatorInterface>()}),
("GspellNavigatorTextView", Layout {size: size_of::<GspellNavigatorTextView>(), alignment: align_of::<GspellNavigatorTextView>()}),
......@@ -249,8 +259,8 @@ const RUST_LAYOUTS: &[(&str, Layout)] = &[
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
("GSPELL_CHECKER_ERROR_DICTIONARY", "0"),
("GSPELL_CHECKER_ERROR_NO_LANGUAGE_SET", "1"),
("(gint) GSPELL_CHECKER_ERROR_DICTIONARY", "0"),
("(gint) GSPELL_CHECKER_ERROR_NO_LANGUAGE_SET", "1"),
];
// This file was generated by gir (https://github.com/gtk-rs/gir @ f5fca82)
// from gir-files (https://github.com/gtk-rs/gir-files @ 62f3bf0)
// This file was generated by gir (https://github.com/gtk-rs/gir @ 1ae7210)
// from gir-files (https://github.com/gtk-rs/gir-files @ 02dfee2)
// DO NOT EDIT
#include "manual.h"
......@@ -7,21 +7,21 @@
int main() {
printf(_Generic((ABI_CONSTANT_NAME),
char *: "%s",
const char *: "%s",
char: "%c",
signed char: "%hhd",
unsigned char: "%hhu",
short int: "%hd",
unsigned short int: "%hu",
int: "%d",
unsigned int: "%u",
long: "%ld",
unsigned long: "%lu",
long long: "%lld",
unsigned long long: "%llu",
double: "%f",
long double: "%ld"),
char *: "###gir test###%s###gir test###\n",
const char *: "###gir test###%s###gir test###\n",
char: "###gir test###%c###gir test###\n",
signed char: "###gir test###%hhd###gir test###\n",
unsigned char: "###gir test###%hhu###gir test###\n",
short int: "###gir test###%hd###gir test###\n",
unsigned short int: "###gir test###%hu###gir test###\n",
int: "###gir test###%d###gir test###\n",
unsigned int: "###gir test###%u###gir test###\n",
long: "###gir test###%ld###gir test###\n",
unsigned long: "###gir test###%lu###gir test###\n",
long long: "###gir test###%lld###gir test###\n",
unsigned long long: "###gir test###%llu###gir test###\n",
double: "###gir test###%f###gir test###\n",
long double: "###gir test###%ld###gir test###\n"),
ABI_CONSTANT_NAME);
return 0;
}
// This file was generated by gir (https://github.com/gtk-rs/gir @ f5fca82)
// from gir-files (https://github.com/gtk-rs/gir-files @ 62f3bf0)
// This file was generated by gir (https://github.com/gtk-rs/gir @ 1ae7210)
// from gir-files (https://github.com/gtk-rs/gir-files @ 02dfee2)
// DO NOT EDIT
#include "manual.h"
......
......@@ -2,7 +2,7 @@
name = "gspell"
authors = ["Julian Sparber <julian@sparber.net>", "Christopher Davis <christopherdavis@gnome.org>", "Jordan Petridis <jpetridis@gnome.org>"]
keywords = ["gspell", "gtk-rs", "gnome"]
version = "0.1.0"
version = "0.2.0"
description = "Rust bindings for gspell"
repository = "https://gitlab.gnome.org/World/Rust/gspell-rs"
license = "GPL-3.0-or-later"
......@@ -13,19 +13,19 @@ exclude = [
[dependencies]
libc = "0.2"
glib-sys = "0.7.0"
glib = "0.6.1"
gtk-sys = "0.7.0"
gobject-sys = "0.7.0"
gio = "0.5.1"
gdk = "0.9.0"
gio-sys = "0.7.0"
gdk-sys = "0.7.0"
glib-sys = "0.8.0"
glib = "0.7.1"
gtk-sys = "0.8.0"
gobject-sys = "0.8.0"
gio = "0.6.0"
gdk = "0.10.0"
gio-sys = "0.8.0"
gdk-sys = "0.8.0"
[dependencies.gtk]
version = "0.5.0"
version = "0.6.0"
features = [ "v3_20" ]
[dependencies.gspell-sys]
version = "0.1.0"
version = "0.2.0"
path = "../gspell-sys"
......@@ -3,41 +3,39 @@
// DO NOT EDIT
use Language;
use ffi;
use glib;
use glib::object::Downcast;
use glib::GString;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::signal::connect_raw;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use glib_sys;
use gspell_sys;
use libc;
use std::boxed::Box as Box_;
use std::mem;
use std::fmt;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct Checker(Object<ffi::GspellChecker, ffi::GspellCheckerClass>);
pub struct Checker(Object<gspell_sys::GspellChecker, gspell_sys::GspellCheckerClass, CheckerClass>);
match fn {
get_type => || ffi::gspell_checker_get_type(),
get_type => || gspell_sys::gspell_checker_get_type(),
}
}
impl Checker {
pub fn new<'a, P: Into<Option<&'a Language>>>(language: P) -> Checker {
pub fn new(language: Option<&Language>) -> Checker {
assert_initialized_main_thread!();
let language = language.into();
let language = language.to_glib_none();
unsafe {
from_glib_full(ffi::gspell_checker_new(language.0))
from_glib_full(gspell_sys::gspell_checker_new(language.to_glib_none().0))
}
}
}
pub trait CheckerExt {
pub const NONE_CHECKER: Option<&Checker> = None;
pub trait CheckerExt: 'static {
fn add_word_to_personal(&self, word: &str);
fn add_word_to_session(&self, word: &str);
......@@ -50,11 +48,11 @@ pub trait CheckerExt {
fn get_language(&self) -> Option<Language>;
fn get_suggestions(&self, word: &str) -> Vec<String>;
fn get_suggestions(&self, word: &str) -> Vec<GString>;
fn set_correction(&self, word: &str, replacement: &str);
fn set_language<'a, P: Into<Option<&'a Language>>>(&self, language: P);
fn set_language(&self, language: Option<&Language>);
fn connect_session_cleared<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
......@@ -65,47 +63,47 @@ pub trait CheckerExt {
fn connect_property_language_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<Checker> + IsA<glib::object::Object>> CheckerExt for O {
impl<O: IsA<Checker>> CheckerExt for O {
fn add_word_to_personal(&self, word: &str) {
let word_length = word.len() as isize;
unsafe {
ffi::gspell_checker_add_word_to_personal(self.to_glib_none().0, word.to_glib_none().0, word_length);
gspell_sys::gspell_checker_add_word_to_personal(self.as_ref().to_glib_none().0, word.to_glib_none().0, word_length);
}
}
fn add_word_to_session(&self, word: &str) {
let word_length = word.len() as isize;
unsafe {
ffi::gspell_checker_add_word_to_session(self.to_glib_none().0, word.to_glib_none().0, word_length);
gspell_sys::gspell_checker_add_word_to_session(self.as_ref().to_glib_none().0, word.to_glib_none().0, word_length);
}
}
//fn check_word(&self, word: &str, error: /*Ignored*/Option<Error>) -> bool {
// unsafe { TODO: call ffi::gspell_checker_check_word() }
// unsafe { TODO: call gspell_sys:gspell_checker_check_word() }
//}
fn clear_session(&self) {
unsafe {
ffi::gspell_checker_clear_session(self.to_glib_none().0);
gspell_sys::gspell_checker_clear_session(self.as_ref().to_glib_none().0);
}
}
fn get_enchant_dict(&self) {
unsafe {
ffi::gspell_checker_get_enchant_dict(self.to_glib_none().0);
gspell_sys::gspell_checker_get_enchant_dict(self.as_ref().to_glib_none().0);
}
}
fn get_language(&self) -> Option<Language> {
unsafe {
from_glib_none(ffi::gspell_checker_get_language(self.to_glib_none().0))
from_glib_none(gspell_sys::gspell_checker_get_language(self.as_ref().to_glib_none().0))
}
}
fn get_suggestions(&self, word: &str) -> Vec<String> {
fn get_suggestions(&self, word: &str) -> Vec<GString> {
let word_length = word.len() as isize;
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gspell_checker_get_suggestions(self.to_glib_none().0, word.to_glib_none().0, word_length))
FromGlibPtrContainer::from_glib_full(gspell_sys::gspell_checker_get_suggestions(self.as_ref().to_glib_none().0, word.to_glib_none().0, word_length))
}
}
......@@ -113,71 +111,75 @@ impl<O: IsA<Checker> + IsA<glib::object::Object>> CheckerExt for O {
let word_length = word.len() as isize;
let replacement_length = replacement.len() as isize;
unsafe {
ffi::gspell_checker_set_correction(self.to_glib_none().0, word.to_glib_none().0, word_length, replacement.to_glib_none().0, replacement_length);
gspell_sys::gspell_checker_set_correction(self.as_ref().to_glib_none().0, word.to_glib_none().0, word_length, replacement.to_glib_none().0, replacement_length);
}
}
fn set_language<'a, P: Into<Option<&'a Language>>>(&self, language: P) {
let language = language.into();
let language = language.to_glib_none();
fn set_language(&self, language: Option<&Language>) {
unsafe {
ffi::gspell_checker_set_language(self.to_glib_none().0, language.0);
gspell_sys::gspell_checker_set_language(self.as_ref().to_glib_none().0, language.to_glib_none().0);
}
}
fn connect_session_cleared<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "session-cleared",
transmute(session_cleared_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"session-cleared\0".as_ptr() as *const _,
Some(transmute(session_cleared_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_word_added_to_personal<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &str) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "word-added-to-personal",
transmute(word_added_to_personal_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"word-added-to-personal\0".as_ptr() as *const _,
Some(transmute(word_added_to_personal_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_word_added_to_session<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &str) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "word-added-to-session",
transmute(word_added_to_session_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"word-added-to-session\0".as_ptr() as *const _,
Some(transmute(word_added_to_session_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_language_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::language",
transmute(notify_language_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::language\0".as_ptr() as *const _,
Some(transmute(notify_language_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
}
unsafe extern "C" fn session_cleared_trampoline<P>(this: *mut ffi::GspellChecker, f: glib_ffi::gpointer)
unsafe extern "C" fn session_cleared_trampoline<P, F: Fn(&P) + 'static>(this: *mut gspell_sys::GspellChecker, f: glib_sys::gpointer)
where P: IsA<Checker> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Checker::from_glib_borrow(this).downcast_unchecked())
let f: &F = &*(f as *const F);
f(&Checker::from_glib_borrow(this).unsafe_cast())
}
unsafe extern "C" fn word_added_to_personal_trampoline<P>(this: *mut ffi::GspellChecker, word: *mut libc::c_char, f: glib_ffi::gpointer)
unsafe extern "C" fn word_added_to_personal_trampoline<P, F: Fn(&P, &str) + 'static>(this: *mut gspell_sys::GspellChecker, word: *mut libc::c_char, f: glib_sys::gpointer)
where P: IsA<Checker> {
let f: &&(Fn(&P, &str) + 'static) = transmute(f);
f(&Checker::from_glib_borrow(this).downcast_unchecked(), &String::from_glib_none(word))
let f: &F = &*(f as *const F);
f(&Checker::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(word))
}
unsafe extern "C" fn word_added_to_session_trampoline<P>(this: *mut ffi::GspellChecker, word: *mut libc::c_char, f: glib_ffi::gpointer)
unsafe extern "C" fn word_added_to_session_trampoline<P, F: Fn(&P, &str) + 'static>(this: *mut gspell_sys::GspellChecker, word: *mut libc::c_char, f: glib_sys::gpointer)
where P: IsA<Checker> {
let f: &&(Fn(&P, &str) + 'static) = transmute(f);
f(&Checker::from_glib_borrow(this).downcast_unchecked(), &String::from_glib_none(word))
let f: &F = &*(f as *const F);
f(&Checker::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(word))
}
unsafe extern "C" fn notify_language_trampoline<P>(this: *mut ffi::GspellChecker, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
unsafe extern "C" fn notify_language_trampoline<P, F: Fn(&P) + 'static>(this: *mut gspell_sys::GspellChecker, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<Checker> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Checker::from_glib_borrow(this).downcast_unchecked())
let f: &F = &*(f as *const F);
f(&Checker::from_glib_borrow(this).unsafe_cast())
}
impl fmt::Display for Checker {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Checker")
}
}
......@@ -3,30 +3,18 @@
// DO NOT EDIT
use Navigator;
use ffi;
use glib;
use glib::object::Downcast;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gspell_sys;
use gtk;
use gtk_ffi;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
use std::fmt;
glib_wrapper! {
pub struct CheckerDialog(Object<ffi::GspellCheckerDialog, ffi::GspellCheckerDialogClass>): [
gtk::Window => gtk_ffi::GtkWindow,
gtk::Widget => gtk_ffi::GtkWidget,
];
pub struct CheckerDialog(Object<gspell_sys::GspellCheckerDialog, gspell_sys::GspellCheckerDialogClass, CheckerDialogClass>) @extends gtk::Window, gtk::Widget;
match fn {
get_type => || ffi::gspell_checker_dialog_get_type(),
get_type => || gspell_sys::gspell_checker_dialog_get_type(),
}
}
......@@ -34,35 +22,27 @@ impl CheckerDialog {
pub fn new<P: IsA<gtk::Window>, Q: IsA<Navigator>>(parent: &P, navigator: &Q) -> CheckerDialog {
skip_assert_initialized!();
unsafe {
gtk::Widget::from_glib_none(ffi::gspell_checker_dialog_new(parent.to_glib_none().0, navigator.to_glib_none().0)).downcast_unchecked()
gtk::Widget::from_glib_none(gspell_sys::gspell_checker_dialog_new(parent.as_ref().to_glib_none().0, navigator.as_ref().to_glib_none().0)).unsafe_cast()
}
}
}
pub trait CheckerDialogExt {
fn get_spell_navigator(&self) -> Option<Navigator>;
pub const NONE_CHECKER_DIALOG: Option<&CheckerDialog> = None;
fn connect_property_spell_navigator_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
pub trait CheckerDialogExt: 'static {
fn get_spell_navigator(&self) -> Option<Navigator>;
}
impl<O: IsA<CheckerDialog> + IsA<glib::object::Object>> CheckerDialogExt for O {
impl<O: IsA<CheckerDialog>> CheckerDialogExt for O {
fn get_spell_navigator(&self) -> Option<Navigator> {
unsafe {
from_glib_none(ffi::gspell_checker_dialog_get_spell_navigator(self.to_glib_none().0))
}
}
fn connect_property_spell_navigator_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::spell-navigator",
transmute(notify_spell_navigator_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
from_glib_none(gspell_sys::gspell_checker_dialog_get_spell_navigator(self.as_ref().to_glib_none().0))
}
}
}
unsafe extern "C" fn notify_spell_navigator_trampoline<P>(this: *mut ffi::GspellCheckerDialog, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<CheckerDialog> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&CheckerDialog::from_glib_borrow(this).downcast_unchecked())
impl fmt::Display for CheckerDialog {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "CheckerDialog")
}
}
......@@ -2,26 +2,23 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use ffi;
use glib;
use glib::object::Downcast;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::signal::connect_raw;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use glib_sys;
use gspell_sys;
use gtk;
use std::boxed::Box as Box_;
use std::mem;
use std::fmt;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct Entry(Object<ffi::GspellEntry, ffi::GspellEntryClass>);
pub struct Entry(Object<gspell_sys::GspellEntry, gspell_sys::GspellEntryClass, EntryClass>);
match fn {
get_type => || ffi::gspell_entry_get_type(),
get_type => || gspell_sys::gspell_entry_get_type(),
}
}
......@@ -29,12 +26,14 @@ impl Entry {
pub fn get_from_gtk_entry<P: IsA<gtk::Entry>>(gtk_entry: &P) -> Option<Entry> {
assert_initialized_main_thread!();
unsafe {
from_glib_none(ffi::gspell_entry_get_from_gtk_entry(gtk_entry.to_glib_none().0))
from_glib_none(gspell_sys::gspell_entry_get_from_gtk_entry(gtk_entry.as_ref().to_glib_none().0))
}
}
}
pub trait EntryExt {
pub const NONE_ENTRY: Option<&Entry> = None;
pub trait EntryExt: 'static {
fn basic_setup(&self);
fn get_entry(&self) -> Option<gtk::Entry>;
......@@ -43,61 +42,51 @@ pub trait EntryExt {
fn set_inline_spell_checking(&self, enable: bool);
fn connect_property_entry_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_inline_spell_checking_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<Entry> + IsA<glib::object::Object>> EntryExt for O {
impl<O: IsA<Entry>> EntryExt for O {
fn basic_setup(&self) {
unsafe {
ffi::gspell_entry_basic_setup(self.to_glib_none().0);
gspell_sys::gspell_entry_basic_setup(self.as_ref().to_glib_none().0);
}
}
fn get_entry(&self) -> Option<gtk::Entry> {
unsafe {
from_glib_none(ffi::gspell_entry_get_entry(self.to_glib_none().0))
from_glib_none(gspell_sys::gspell_entry_get_entry(self.as_ref().to_glib_none().0))
}
}
fn get_inline_spell_checking(&self) -> bool {
unsafe {
from_glib(ffi::gspell_entry_get_inline_spell_checking(self.to_glib_none().0))
from_glib(gspell_sys::gspell_entry_get_inline_spell_checking(self.as_ref().to_glib_none().0))
}
}
fn set_inline_spell_checking(&self, enable: bool) {
unsafe {
ffi::gspell_entry_set_inline_spell_checking(self.to_glib_none().0, enable.to_glib());
}
}
fn connect_property_entry_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::entry",
transmute(notify_entry_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
gspell_sys::gspell_entry_set_inline_spell_checking(self.as_ref().to_glib_none().0, enable.to_glib());
}
}
fn connect_property_inline_spell_checking_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(