1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::ffi;
use glib::translate::*;

glib::wrapper! {
    ///
    ///
    /// This is an Abstract Base Class, you cannot instantiate it.
    ///
    /// ## Properties
    ///
    ///
    /// #### `code`
    ///  Readable | Writeable | Construct Only
    #[doc(alias = "SpellingLanguage")]
    pub struct Language(Object<ffi::SpellingLanguage, ffi::SpellingLanguageClass>);

    match fn {
        type_ => || ffi::spelling_language_get_type(),
    }
}

impl Language {
    #[doc(alias = "spelling_language_add_word")]
    pub fn add_word(&self, word: &str) {
        unsafe {
            ffi::spelling_language_add_word(self.to_glib_none().0, word.to_glib_none().0);
        }
    }

    #[doc(alias = "spelling_language_contains_word")]
    pub fn contains_word(&self, word: &str) -> bool {
        let word_len = word.len() as _;
        unsafe {
            from_glib(ffi::spelling_language_contains_word(
                self.to_glib_none().0,
                word.to_glib_none().0,
                word_len,
            ))
        }
    }

    #[doc(alias = "spelling_language_get_code")]
    #[doc(alias = "get_code")]
    pub fn code(&self) -> glib::GString {
        unsafe { from_glib_none(ffi::spelling_language_get_code(self.to_glib_none().0)) }
    }

    #[doc(alias = "spelling_language_get_extra_word_chars")]
    #[doc(alias = "get_extra_word_chars")]
    pub fn extra_word_chars(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::spelling_language_get_extra_word_chars(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "spelling_language_ignore_word")]
    pub fn ignore_word(&self, word: &str) {
        unsafe {
            ffi::spelling_language_ignore_word(self.to_glib_none().0, word.to_glib_none().0);
        }
    }

    /// Retrieves a list of possible corrections for @word.
    /// ## `word`
    /// a word to be checked
    /// ## `word_len`
    /// the length of @word, or -1 if @word is zero-terminated
    ///
    /// # Returns
    ///
    ///
    ///   A list of possible corrections, or [`None`].
    #[doc(alias = "spelling_language_list_corrections")]
    pub fn list_corrections(&self, word: &str) -> Vec<glib::GString> {
        let word_len = word.len() as _;
        unsafe {
            FromGlibPtrContainer::from_glib_full(ffi::spelling_language_list_corrections(
                self.to_glib_none().0,
                word.to_glib_none().0,
                word_len,
            ))
        }
    }
}