1 // This file was generated by gir (https://github.com/gtk-rs/gir)
2 // from gir-files (https://github.com/gtk-rs/gir-files)
3 // DO NOT EDIT
4 
5 use glib::object::Cast;
6 use glib::object::IsA;
7 use glib::signal::connect_raw;
8 use glib::signal::SignalHandlerId;
9 use glib::translate::*;
10 use glib::GString;
11 use glib_sys;
12 use gtk_source_sys;
13 use std::boxed::Box as Box_;
14 use std::fmt;
15 use std::mem::transmute;
16 
17 glib_wrapper! {
18     pub struct Language(Object<gtk_source_sys::GtkSourceLanguage, gtk_source_sys::GtkSourceLanguageClass, LanguageClass>);
19 
20     match fn {
21         get_type => || gtk_source_sys::gtk_source_language_get_type(),
22     }
23 }
24 
25 pub const NONE_LANGUAGE: Option<&Language> = None;
26 
27 pub trait LanguageExt: 'static {
get_globs(&self) -> Vec<GString>28     fn get_globs(&self) -> Vec<GString>;
29 
get_hidden(&self) -> bool30     fn get_hidden(&self) -> bool;
31 
get_id(&self) -> Option<GString>32     fn get_id(&self) -> Option<GString>;
33 
get_metadata(&self, name: &str) -> Option<GString>34     fn get_metadata(&self, name: &str) -> Option<GString>;
35 
get_mime_types(&self) -> Vec<GString>36     fn get_mime_types(&self) -> Vec<GString>;
37 
get_name(&self) -> Option<GString>38     fn get_name(&self) -> Option<GString>;
39 
get_section(&self) -> Option<GString>40     fn get_section(&self) -> Option<GString>;
41 
get_style_fallback(&self, style_id: &str) -> Option<GString>42     fn get_style_fallback(&self, style_id: &str) -> Option<GString>;
43 
get_style_ids(&self) -> Vec<GString>44     fn get_style_ids(&self) -> Vec<GString>;
45 
get_style_name(&self, style_id: &str) -> Option<GString>46     fn get_style_name(&self, style_id: &str) -> Option<GString>;
47 
connect_property_hidden_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId48     fn connect_property_hidden_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
49 
connect_property_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId50     fn connect_property_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
51 
connect_property_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId52     fn connect_property_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
53 
connect_property_section_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId54     fn connect_property_section_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
55 }
56 
57 impl<O: IsA<Language>> LanguageExt for O {
get_globs(&self) -> Vec<GString>58     fn get_globs(&self) -> Vec<GString> {
59         unsafe {
60             FromGlibPtrContainer::from_glib_full(gtk_source_sys::gtk_source_language_get_globs(self.as_ref().to_glib_none().0))
61         }
62     }
63 
get_hidden(&self) -> bool64     fn get_hidden(&self) -> bool {
65         unsafe {
66             from_glib(gtk_source_sys::gtk_source_language_get_hidden(self.as_ref().to_glib_none().0))
67         }
68     }
69 
get_id(&self) -> Option<GString>70     fn get_id(&self) -> Option<GString> {
71         unsafe {
72             from_glib_none(gtk_source_sys::gtk_source_language_get_id(self.as_ref().to_glib_none().0))
73         }
74     }
75 
get_metadata(&self, name: &str) -> Option<GString>76     fn get_metadata(&self, name: &str) -> Option<GString> {
77         unsafe {
78             from_glib_none(gtk_source_sys::gtk_source_language_get_metadata(self.as_ref().to_glib_none().0, name.to_glib_none().0))
79         }
80     }
81 
get_mime_types(&self) -> Vec<GString>82     fn get_mime_types(&self) -> Vec<GString> {
83         unsafe {
84             FromGlibPtrContainer::from_glib_full(gtk_source_sys::gtk_source_language_get_mime_types(self.as_ref().to_glib_none().0))
85         }
86     }
87 
get_name(&self) -> Option<GString>88     fn get_name(&self) -> Option<GString> {
89         unsafe {
90             from_glib_none(gtk_source_sys::gtk_source_language_get_name(self.as_ref().to_glib_none().0))
91         }
92     }
93 
get_section(&self) -> Option<GString>94     fn get_section(&self) -> Option<GString> {
95         unsafe {
96             from_glib_none(gtk_source_sys::gtk_source_language_get_section(self.as_ref().to_glib_none().0))
97         }
98     }
99 
get_style_fallback(&self, style_id: &str) -> Option<GString>100     fn get_style_fallback(&self, style_id: &str) -> Option<GString> {
101         unsafe {
102             from_glib_none(gtk_source_sys::gtk_source_language_get_style_fallback(self.as_ref().to_glib_none().0, style_id.to_glib_none().0))
103         }
104     }
105 
get_style_ids(&self) -> Vec<GString>106     fn get_style_ids(&self) -> Vec<GString> {
107         unsafe {
108             FromGlibPtrContainer::from_glib_full(gtk_source_sys::gtk_source_language_get_style_ids(self.as_ref().to_glib_none().0))
109         }
110     }
111 
get_style_name(&self, style_id: &str) -> Option<GString>112     fn get_style_name(&self, style_id: &str) -> Option<GString> {
113         unsafe {
114             from_glib_none(gtk_source_sys::gtk_source_language_get_style_name(self.as_ref().to_glib_none().0, style_id.to_glib_none().0))
115         }
116     }
117 
connect_property_hidden_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId118     fn connect_property_hidden_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
119         unsafe extern "C" fn notify_hidden_trampoline<P, F: Fn(&P) + 'static>(this: *mut gtk_source_sys::GtkSourceLanguage, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
120             where P: IsA<Language>
121         {
122             let f: &F = &*(f as *const F);
123             f(&Language::from_glib_borrow(this).unsafe_cast())
124         }
125         unsafe {
126             let f: Box_<F> = Box_::new(f);
127             connect_raw(self.as_ptr() as *mut _, b"notify::hidden\0".as_ptr() as *const _,
128                 Some(transmute(notify_hidden_trampoline::<Self, F> as usize)), Box_::into_raw(f))
129         }
130     }
131 
connect_property_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId132     fn connect_property_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
133         unsafe extern "C" fn notify_id_trampoline<P, F: Fn(&P) + 'static>(this: *mut gtk_source_sys::GtkSourceLanguage, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
134             where P: IsA<Language>
135         {
136             let f: &F = &*(f as *const F);
137             f(&Language::from_glib_borrow(this).unsafe_cast())
138         }
139         unsafe {
140             let f: Box_<F> = Box_::new(f);
141             connect_raw(self.as_ptr() as *mut _, b"notify::id\0".as_ptr() as *const _,
142                 Some(transmute(notify_id_trampoline::<Self, F> as usize)), Box_::into_raw(f))
143         }
144     }
145 
connect_property_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId146     fn connect_property_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
147         unsafe extern "C" fn notify_name_trampoline<P, F: Fn(&P) + 'static>(this: *mut gtk_source_sys::GtkSourceLanguage, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
148             where P: IsA<Language>
149         {
150             let f: &F = &*(f as *const F);
151             f(&Language::from_glib_borrow(this).unsafe_cast())
152         }
153         unsafe {
154             let f: Box_<F> = Box_::new(f);
155             connect_raw(self.as_ptr() as *mut _, b"notify::name\0".as_ptr() as *const _,
156                 Some(transmute(notify_name_trampoline::<Self, F> as usize)), Box_::into_raw(f))
157         }
158     }
159 
connect_property_section_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId160     fn connect_property_section_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
161         unsafe extern "C" fn notify_section_trampoline<P, F: Fn(&P) + 'static>(this: *mut gtk_source_sys::GtkSourceLanguage, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
162             where P: IsA<Language>
163         {
164             let f: &F = &*(f as *const F);
165             f(&Language::from_glib_borrow(this).unsafe_cast())
166         }
167         unsafe {
168             let f: Box_<F> = Box_::new(f);
169             connect_raw(self.as_ptr() as *mut _, b"notify::section\0".as_ptr() as *const _,
170                 Some(transmute(notify_section_trampoline::<Self, F> as usize)), Box_::into_raw(f))
171         }
172     }
173 }
174 
175 impl fmt::Display for Language {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result176     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
177         write!(f, "Language")
178     }
179 }
180