sourceview5/auto/
buffer.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6use crate::{ffi, BracketMatchType, ChangeCaseType, Language, Mark, SortFlags, StyleScheme};
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    #[doc(alias = "GtkSourceBuffer")]
16    pub struct Buffer(Object<ffi::GtkSourceBuffer, ffi::GtkSourceBufferClass>) @extends gtk::TextBuffer;
17
18    match fn {
19        type_ => || ffi::gtk_source_buffer_get_type(),
20    }
21}
22
23impl Buffer {
24    pub const NONE: Option<&'static Buffer> = None;
25
26    #[doc(alias = "gtk_source_buffer_new")]
27    pub fn new(table: Option<&gtk::TextTagTable>) -> Buffer {
28        assert_initialized_main_thread!();
29        unsafe { from_glib_full(ffi::gtk_source_buffer_new(table.to_glib_none().0)) }
30    }
31
32    #[doc(alias = "gtk_source_buffer_new_with_language")]
33    #[doc(alias = "new_with_language")]
34    pub fn with_language(language: &Language) -> Buffer {
35        skip_assert_initialized!();
36        unsafe {
37            from_glib_full(ffi::gtk_source_buffer_new_with_language(
38                language.to_glib_none().0,
39            ))
40        }
41    }
42
43    // rustdoc-stripper-ignore-next
44    /// Creates a new builder-pattern struct instance to construct [`Buffer`] objects.
45    ///
46    /// This method returns an instance of [`BufferBuilder`](crate::builders::BufferBuilder) which can be used to create [`Buffer`] objects.
47    pub fn builder() -> BufferBuilder {
48        BufferBuilder::new()
49    }
50}
51
52impl Default for Buffer {
53    fn default() -> Self {
54        glib::object::Object::new::<Self>()
55    }
56}
57
58// rustdoc-stripper-ignore-next
59/// A [builder-pattern] type to construct [`Buffer`] objects.
60///
61/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
62#[must_use = "The builder must be built to be used"]
63pub struct BufferBuilder {
64    builder: glib::object::ObjectBuilder<'static, Buffer>,
65}
66
67impl BufferBuilder {
68    fn new() -> Self {
69        Self {
70            builder: glib::object::Object::builder(),
71        }
72    }
73
74    pub fn highlight_matching_brackets(self, highlight_matching_brackets: bool) -> Self {
75        Self {
76            builder: self
77                .builder
78                .property("highlight-matching-brackets", highlight_matching_brackets),
79        }
80    }
81
82    pub fn highlight_syntax(self, highlight_syntax: bool) -> Self {
83        Self {
84            builder: self.builder.property("highlight-syntax", highlight_syntax),
85        }
86    }
87
88    pub fn implicit_trailing_newline(self, implicit_trailing_newline: bool) -> Self {
89        Self {
90            builder: self
91                .builder
92                .property("implicit-trailing-newline", implicit_trailing_newline),
93        }
94    }
95
96    pub fn language(self, language: &Language) -> Self {
97        Self {
98            builder: self.builder.property("language", language.clone()),
99        }
100    }
101
102    pub fn style_scheme(self, style_scheme: &StyleScheme) -> Self {
103        Self {
104            builder: self.builder.property("style-scheme", style_scheme.clone()),
105        }
106    }
107
108    pub fn enable_undo(self, enable_undo: bool) -> Self {
109        Self {
110            builder: self.builder.property("enable-undo", enable_undo),
111        }
112    }
113
114    pub fn tag_table(self, tag_table: &gtk::TextTagTable) -> Self {
115        Self {
116            builder: self.builder.property("tag-table", tag_table.clone()),
117        }
118    }
119
120    pub fn text(self, text: impl Into<glib::GString>) -> Self {
121        Self {
122            builder: self.builder.property("text", text.into()),
123        }
124    }
125
126    // rustdoc-stripper-ignore-next
127    /// Build the [`Buffer`].
128    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
129    pub fn build(self) -> Buffer {
130        self.builder.build()
131    }
132}
133
134mod sealed {
135    pub trait Sealed {}
136    impl<T: super::IsA<super::Buffer>> Sealed for T {}
137}
138
139pub trait BufferExt: IsA<Buffer> + sealed::Sealed + 'static {
140    //#[doc(alias = "gtk_source_buffer_backward_iter_to_source_mark")]
141    //fn backward_iter_to_source_mark(&self, iter: /*Unimplemented*/gtk::TextIter, category: Option<&str>) -> bool {
142    //    unsafe { TODO: call ffi:gtk_source_buffer_backward_iter_to_source_mark() }
143    //}
144
145    #[doc(alias = "gtk_source_buffer_change_case")]
146    fn change_case(
147        &self,
148        case_type: ChangeCaseType,
149        start: &mut gtk::TextIter,
150        end: &mut gtk::TextIter,
151    ) {
152        unsafe {
153            ffi::gtk_source_buffer_change_case(
154                self.as_ref().to_glib_none().0,
155                case_type.into_glib(),
156                start.to_glib_none_mut().0,
157                end.to_glib_none_mut().0,
158            );
159        }
160    }
161
162    #[doc(alias = "gtk_source_buffer_create_source_mark")]
163    fn create_source_mark(
164        &self,
165        name: Option<&str>,
166        category: &str,
167        where_: &gtk::TextIter,
168    ) -> Mark {
169        unsafe {
170            from_glib_none(ffi::gtk_source_buffer_create_source_mark(
171                self.as_ref().to_glib_none().0,
172                name.to_glib_none().0,
173                category.to_glib_none().0,
174                where_.to_glib_none().0,
175            ))
176        }
177    }
178
179    //#[doc(alias = "gtk_source_buffer_create_source_tag")]
180    //fn create_source_tag(&self, tag_name: Option<&str>, first_property_name: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> gtk::TextTag {
181    //    unsafe { TODO: call ffi:gtk_source_buffer_create_source_tag() }
182    //}
183
184    #[doc(alias = "gtk_source_buffer_ensure_highlight")]
185    fn ensure_highlight(&self, start: &gtk::TextIter, end: &gtk::TextIter) {
186        unsafe {
187            ffi::gtk_source_buffer_ensure_highlight(
188                self.as_ref().to_glib_none().0,
189                start.to_glib_none().0,
190                end.to_glib_none().0,
191            );
192        }
193    }
194
195    //#[doc(alias = "gtk_source_buffer_forward_iter_to_source_mark")]
196    //fn forward_iter_to_source_mark(&self, iter: /*Unimplemented*/gtk::TextIter, category: Option<&str>) -> bool {
197    //    unsafe { TODO: call ffi:gtk_source_buffer_forward_iter_to_source_mark() }
198    //}
199
200    #[doc(alias = "gtk_source_buffer_get_context_classes_at_iter")]
201    #[doc(alias = "get_context_classes_at_iter")]
202    fn context_classes_at_iter(&self, iter: &gtk::TextIter) -> Vec<glib::GString> {
203        unsafe {
204            FromGlibPtrContainer::from_glib_full(
205                ffi::gtk_source_buffer_get_context_classes_at_iter(
206                    self.as_ref().to_glib_none().0,
207                    iter.to_glib_none().0,
208                ),
209            )
210        }
211    }
212
213    #[doc(alias = "gtk_source_buffer_get_highlight_matching_brackets")]
214    #[doc(alias = "get_highlight_matching_brackets")]
215    #[doc(alias = "highlight-matching-brackets")]
216    fn is_highlight_matching_brackets(&self) -> bool {
217        unsafe {
218            from_glib(ffi::gtk_source_buffer_get_highlight_matching_brackets(
219                self.as_ref().to_glib_none().0,
220            ))
221        }
222    }
223
224    #[doc(alias = "gtk_source_buffer_get_highlight_syntax")]
225    #[doc(alias = "get_highlight_syntax")]
226    #[doc(alias = "highlight-syntax")]
227    fn is_highlight_syntax(&self) -> bool {
228        unsafe {
229            from_glib(ffi::gtk_source_buffer_get_highlight_syntax(
230                self.as_ref().to_glib_none().0,
231            ))
232        }
233    }
234
235    #[doc(alias = "gtk_source_buffer_get_implicit_trailing_newline")]
236    #[doc(alias = "get_implicit_trailing_newline")]
237    #[doc(alias = "implicit-trailing-newline")]
238    fn is_implicit_trailing_newline(&self) -> bool {
239        unsafe {
240            from_glib(ffi::gtk_source_buffer_get_implicit_trailing_newline(
241                self.as_ref().to_glib_none().0,
242            ))
243        }
244    }
245
246    #[doc(alias = "gtk_source_buffer_get_language")]
247    #[doc(alias = "get_language")]
248    fn language(&self) -> Option<Language> {
249        unsafe {
250            from_glib_none(ffi::gtk_source_buffer_get_language(
251                self.as_ref().to_glib_none().0,
252            ))
253        }
254    }
255
256    #[doc(alias = "gtk_source_buffer_get_loading")]
257    #[doc(alias = "get_loading")]
258    #[doc(alias = "loading")]
259    fn is_loading(&self) -> bool {
260        unsafe {
261            from_glib(ffi::gtk_source_buffer_get_loading(
262                self.as_ref().to_glib_none().0,
263            ))
264        }
265    }
266
267    #[doc(alias = "gtk_source_buffer_get_source_marks_at_iter")]
268    #[doc(alias = "get_source_marks_at_iter")]
269    fn source_marks_at_iter(&self, iter: &mut gtk::TextIter, category: Option<&str>) -> Vec<Mark> {
270        unsafe {
271            FromGlibPtrContainer::from_glib_container(
272                ffi::gtk_source_buffer_get_source_marks_at_iter(
273                    self.as_ref().to_glib_none().0,
274                    iter.to_glib_none_mut().0,
275                    category.to_glib_none().0,
276                ),
277            )
278        }
279    }
280
281    #[doc(alias = "gtk_source_buffer_get_source_marks_at_line")]
282    #[doc(alias = "get_source_marks_at_line")]
283    fn source_marks_at_line(&self, line: i32, category: Option<&str>) -> Vec<Mark> {
284        unsafe {
285            FromGlibPtrContainer::from_glib_container(
286                ffi::gtk_source_buffer_get_source_marks_at_line(
287                    self.as_ref().to_glib_none().0,
288                    line,
289                    category.to_glib_none().0,
290                ),
291            )
292        }
293    }
294
295    #[doc(alias = "gtk_source_buffer_get_style_scheme")]
296    #[doc(alias = "get_style_scheme")]
297    #[doc(alias = "style-scheme")]
298    fn style_scheme(&self) -> Option<StyleScheme> {
299        unsafe {
300            from_glib_none(ffi::gtk_source_buffer_get_style_scheme(
301                self.as_ref().to_glib_none().0,
302            ))
303        }
304    }
305
306    //#[doc(alias = "gtk_source_buffer_iter_backward_to_context_class_toggle")]
307    //fn iter_backward_to_context_class_toggle(&self, iter: /*Unimplemented*/gtk::TextIter, context_class: &str) -> bool {
308    //    unsafe { TODO: call ffi:gtk_source_buffer_iter_backward_to_context_class_toggle() }
309    //}
310
311    //#[doc(alias = "gtk_source_buffer_iter_forward_to_context_class_toggle")]
312    //fn iter_forward_to_context_class_toggle(&self, iter: /*Unimplemented*/gtk::TextIter, context_class: &str) -> bool {
313    //    unsafe { TODO: call ffi:gtk_source_buffer_iter_forward_to_context_class_toggle() }
314    //}
315
316    #[doc(alias = "gtk_source_buffer_iter_has_context_class")]
317    fn iter_has_context_class(&self, iter: &gtk::TextIter, context_class: &str) -> bool {
318        unsafe {
319            from_glib(ffi::gtk_source_buffer_iter_has_context_class(
320                self.as_ref().to_glib_none().0,
321                iter.to_glib_none().0,
322                context_class.to_glib_none().0,
323            ))
324        }
325    }
326
327    #[doc(alias = "gtk_source_buffer_join_lines")]
328    fn join_lines(&self, start: &mut gtk::TextIter, end: &mut gtk::TextIter) {
329        unsafe {
330            ffi::gtk_source_buffer_join_lines(
331                self.as_ref().to_glib_none().0,
332                start.to_glib_none_mut().0,
333                end.to_glib_none_mut().0,
334            );
335        }
336    }
337
338    #[doc(alias = "gtk_source_buffer_remove_source_marks")]
339    fn remove_source_marks(
340        &self,
341        start: &gtk::TextIter,
342        end: &gtk::TextIter,
343        category: Option<&str>,
344    ) {
345        unsafe {
346            ffi::gtk_source_buffer_remove_source_marks(
347                self.as_ref().to_glib_none().0,
348                start.to_glib_none().0,
349                end.to_glib_none().0,
350                category.to_glib_none().0,
351            );
352        }
353    }
354
355    #[doc(alias = "gtk_source_buffer_set_highlight_matching_brackets")]
356    #[doc(alias = "highlight-matching-brackets")]
357    fn set_highlight_matching_brackets(&self, highlight: bool) {
358        unsafe {
359            ffi::gtk_source_buffer_set_highlight_matching_brackets(
360                self.as_ref().to_glib_none().0,
361                highlight.into_glib(),
362            );
363        }
364    }
365
366    #[doc(alias = "gtk_source_buffer_set_highlight_syntax")]
367    #[doc(alias = "highlight-syntax")]
368    fn set_highlight_syntax(&self, highlight: bool) {
369        unsafe {
370            ffi::gtk_source_buffer_set_highlight_syntax(
371                self.as_ref().to_glib_none().0,
372                highlight.into_glib(),
373            );
374        }
375    }
376
377    #[doc(alias = "gtk_source_buffer_set_implicit_trailing_newline")]
378    #[doc(alias = "implicit-trailing-newline")]
379    fn set_implicit_trailing_newline(&self, implicit_trailing_newline: bool) {
380        unsafe {
381            ffi::gtk_source_buffer_set_implicit_trailing_newline(
382                self.as_ref().to_glib_none().0,
383                implicit_trailing_newline.into_glib(),
384            );
385        }
386    }
387
388    #[doc(alias = "gtk_source_buffer_set_language")]
389    #[doc(alias = "language")]
390    fn set_language(&self, language: Option<&Language>) {
391        unsafe {
392            ffi::gtk_source_buffer_set_language(
393                self.as_ref().to_glib_none().0,
394                language.to_glib_none().0,
395            );
396        }
397    }
398
399    #[doc(alias = "gtk_source_buffer_set_style_scheme")]
400    #[doc(alias = "style-scheme")]
401    fn set_style_scheme(&self, scheme: Option<&StyleScheme>) {
402        unsafe {
403            ffi::gtk_source_buffer_set_style_scheme(
404                self.as_ref().to_glib_none().0,
405                scheme.to_glib_none().0,
406            );
407        }
408    }
409
410    #[doc(alias = "gtk_source_buffer_sort_lines")]
411    fn sort_lines(
412        &self,
413        start: &mut gtk::TextIter,
414        end: &mut gtk::TextIter,
415        flags: SortFlags,
416        column: i32,
417    ) {
418        unsafe {
419            ffi::gtk_source_buffer_sort_lines(
420                self.as_ref().to_glib_none().0,
421                start.to_glib_none_mut().0,
422                end.to_glib_none_mut().0,
423                flags.into_glib(),
424                column,
425            );
426        }
427    }
428
429    #[doc(alias = "bracket-matched")]
430    fn connect_bracket_matched<F: Fn(&Self, Option<&gtk::TextIter>, BracketMatchType) + 'static>(
431        &self,
432        f: F,
433    ) -> SignalHandlerId {
434        unsafe extern "C" fn bracket_matched_trampoline<
435            P: IsA<Buffer>,
436            F: Fn(&P, Option<&gtk::TextIter>, BracketMatchType) + 'static,
437        >(
438            this: *mut ffi::GtkSourceBuffer,
439            iter: *mut gtk::ffi::GtkTextIter,
440            state: ffi::GtkSourceBracketMatchType,
441            f: glib::ffi::gpointer,
442        ) {
443            let f: &F = &*(f as *const F);
444            f(
445                Buffer::from_glib_borrow(this).unsafe_cast_ref(),
446                Option::<gtk::TextIter>::from_glib_borrow(iter)
447                    .as_ref()
448                    .as_ref(),
449                from_glib(state),
450            )
451        }
452        unsafe {
453            let f: Box_<F> = Box_::new(f);
454            connect_raw(
455                self.as_ptr() as *mut _,
456                b"bracket-matched\0".as_ptr() as *const _,
457                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
458                    bracket_matched_trampoline::<Self, F> as *const (),
459                )),
460                Box_::into_raw(f),
461            )
462        }
463    }
464
465    #[doc(alias = "cursor-moved")]
466    fn connect_cursor_moved<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
467        unsafe extern "C" fn cursor_moved_trampoline<P: IsA<Buffer>, F: Fn(&P) + 'static>(
468            this: *mut ffi::GtkSourceBuffer,
469            f: glib::ffi::gpointer,
470        ) {
471            let f: &F = &*(f as *const F);
472            f(Buffer::from_glib_borrow(this).unsafe_cast_ref())
473        }
474        unsafe {
475            let f: Box_<F> = Box_::new(f);
476            connect_raw(
477                self.as_ptr() as *mut _,
478                b"cursor-moved\0".as_ptr() as *const _,
479                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
480                    cursor_moved_trampoline::<Self, F> as *const (),
481                )),
482                Box_::into_raw(f),
483            )
484        }
485    }
486
487    #[doc(alias = "highlight-updated")]
488    fn connect_highlight_updated<F: Fn(&Self, &gtk::TextIter, &gtk::TextIter) + 'static>(
489        &self,
490        f: F,
491    ) -> SignalHandlerId {
492        unsafe extern "C" fn highlight_updated_trampoline<
493            P: IsA<Buffer>,
494            F: Fn(&P, &gtk::TextIter, &gtk::TextIter) + 'static,
495        >(
496            this: *mut ffi::GtkSourceBuffer,
497            start: *mut gtk::ffi::GtkTextIter,
498            end: *mut gtk::ffi::GtkTextIter,
499            f: glib::ffi::gpointer,
500        ) {
501            let f: &F = &*(f as *const F);
502            f(
503                Buffer::from_glib_borrow(this).unsafe_cast_ref(),
504                &from_glib_borrow(start),
505                &from_glib_borrow(end),
506            )
507        }
508        unsafe {
509            let f: Box_<F> = Box_::new(f);
510            connect_raw(
511                self.as_ptr() as *mut _,
512                b"highlight-updated\0".as_ptr() as *const _,
513                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
514                    highlight_updated_trampoline::<Self, F> as *const (),
515                )),
516                Box_::into_raw(f),
517            )
518        }
519    }
520
521    #[doc(alias = "source-mark-updated")]
522    fn connect_source_mark_updated<F: Fn(&Self, &gtk::TextMark) + 'static>(
523        &self,
524        f: F,
525    ) -> SignalHandlerId {
526        unsafe extern "C" fn source_mark_updated_trampoline<
527            P: IsA<Buffer>,
528            F: Fn(&P, &gtk::TextMark) + 'static,
529        >(
530            this: *mut ffi::GtkSourceBuffer,
531            mark: *mut gtk::ffi::GtkTextMark,
532            f: glib::ffi::gpointer,
533        ) {
534            let f: &F = &*(f as *const F);
535            f(
536                Buffer::from_glib_borrow(this).unsafe_cast_ref(),
537                &from_glib_borrow(mark),
538            )
539        }
540        unsafe {
541            let f: Box_<F> = Box_::new(f);
542            connect_raw(
543                self.as_ptr() as *mut _,
544                b"source-mark-updated\0".as_ptr() as *const _,
545                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
546                    source_mark_updated_trampoline::<Self, F> as *const (),
547                )),
548                Box_::into_raw(f),
549            )
550        }
551    }
552
553    #[doc(alias = "highlight-matching-brackets")]
554    fn connect_highlight_matching_brackets_notify<F: Fn(&Self) + 'static>(
555        &self,
556        f: F,
557    ) -> SignalHandlerId {
558        unsafe extern "C" fn notify_highlight_matching_brackets_trampoline<
559            P: IsA<Buffer>,
560            F: Fn(&P) + 'static,
561        >(
562            this: *mut ffi::GtkSourceBuffer,
563            _param_spec: glib::ffi::gpointer,
564            f: glib::ffi::gpointer,
565        ) {
566            let f: &F = &*(f as *const F);
567            f(Buffer::from_glib_borrow(this).unsafe_cast_ref())
568        }
569        unsafe {
570            let f: Box_<F> = Box_::new(f);
571            connect_raw(
572                self.as_ptr() as *mut _,
573                b"notify::highlight-matching-brackets\0".as_ptr() as *const _,
574                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
575                    notify_highlight_matching_brackets_trampoline::<Self, F> as *const (),
576                )),
577                Box_::into_raw(f),
578            )
579        }
580    }
581
582    #[doc(alias = "highlight-syntax")]
583    fn connect_highlight_syntax_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
584        unsafe extern "C" fn notify_highlight_syntax_trampoline<
585            P: IsA<Buffer>,
586            F: Fn(&P) + 'static,
587        >(
588            this: *mut ffi::GtkSourceBuffer,
589            _param_spec: glib::ffi::gpointer,
590            f: glib::ffi::gpointer,
591        ) {
592            let f: &F = &*(f as *const F);
593            f(Buffer::from_glib_borrow(this).unsafe_cast_ref())
594        }
595        unsafe {
596            let f: Box_<F> = Box_::new(f);
597            connect_raw(
598                self.as_ptr() as *mut _,
599                b"notify::highlight-syntax\0".as_ptr() as *const _,
600                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
601                    notify_highlight_syntax_trampoline::<Self, F> as *const (),
602                )),
603                Box_::into_raw(f),
604            )
605        }
606    }
607
608    #[doc(alias = "implicit-trailing-newline")]
609    fn connect_implicit_trailing_newline_notify<F: Fn(&Self) + 'static>(
610        &self,
611        f: F,
612    ) -> SignalHandlerId {
613        unsafe extern "C" fn notify_implicit_trailing_newline_trampoline<
614            P: IsA<Buffer>,
615            F: Fn(&P) + 'static,
616        >(
617            this: *mut ffi::GtkSourceBuffer,
618            _param_spec: glib::ffi::gpointer,
619            f: glib::ffi::gpointer,
620        ) {
621            let f: &F = &*(f as *const F);
622            f(Buffer::from_glib_borrow(this).unsafe_cast_ref())
623        }
624        unsafe {
625            let f: Box_<F> = Box_::new(f);
626            connect_raw(
627                self.as_ptr() as *mut _,
628                b"notify::implicit-trailing-newline\0".as_ptr() as *const _,
629                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
630                    notify_implicit_trailing_newline_trampoline::<Self, F> as *const (),
631                )),
632                Box_::into_raw(f),
633            )
634        }
635    }
636
637    #[doc(alias = "language")]
638    fn connect_language_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
639        unsafe extern "C" fn notify_language_trampoline<P: IsA<Buffer>, F: Fn(&P) + 'static>(
640            this: *mut ffi::GtkSourceBuffer,
641            _param_spec: glib::ffi::gpointer,
642            f: glib::ffi::gpointer,
643        ) {
644            let f: &F = &*(f as *const F);
645            f(Buffer::from_glib_borrow(this).unsafe_cast_ref())
646        }
647        unsafe {
648            let f: Box_<F> = Box_::new(f);
649            connect_raw(
650                self.as_ptr() as *mut _,
651                b"notify::language\0".as_ptr() as *const _,
652                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
653                    notify_language_trampoline::<Self, F> as *const (),
654                )),
655                Box_::into_raw(f),
656            )
657        }
658    }
659
660    #[cfg(feature = "v5_10")]
661    #[cfg_attr(docsrs, doc(cfg(feature = "v5_10")))]
662    #[doc(alias = "loading")]
663    fn connect_loading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
664        unsafe extern "C" fn notify_loading_trampoline<P: IsA<Buffer>, F: Fn(&P) + 'static>(
665            this: *mut ffi::GtkSourceBuffer,
666            _param_spec: glib::ffi::gpointer,
667            f: glib::ffi::gpointer,
668        ) {
669            let f: &F = &*(f as *const F);
670            f(Buffer::from_glib_borrow(this).unsafe_cast_ref())
671        }
672        unsafe {
673            let f: Box_<F> = Box_::new(f);
674            connect_raw(
675                self.as_ptr() as *mut _,
676                b"notify::loading\0".as_ptr() as *const _,
677                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
678                    notify_loading_trampoline::<Self, F> as *const (),
679                )),
680                Box_::into_raw(f),
681            )
682        }
683    }
684
685    #[doc(alias = "style-scheme")]
686    fn connect_style_scheme_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
687        unsafe extern "C" fn notify_style_scheme_trampoline<P: IsA<Buffer>, F: Fn(&P) + 'static>(
688            this: *mut ffi::GtkSourceBuffer,
689            _param_spec: glib::ffi::gpointer,
690            f: glib::ffi::gpointer,
691        ) {
692            let f: &F = &*(f as *const F);
693            f(Buffer::from_glib_borrow(this).unsafe_cast_ref())
694        }
695        unsafe {
696            let f: Box_<F> = Box_::new(f);
697            connect_raw(
698                self.as_ptr() as *mut _,
699                b"notify::style-scheme\0".as_ptr() as *const _,
700                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
701                    notify_style_scheme_trampoline::<Self, F> as *const (),
702                )),
703                Box_::into_raw(f),
704            )
705        }
706    }
707}
708
709impl<O: IsA<Buffer>> BufferExt for O {}