Skip to main content

libshumate/auto/
map_source.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)
4// DO NOT EDIT
5
6use crate::{MapProjection, Tile, ffi};
7#[cfg(feature = "v1_7")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
9use glib::object::ObjectType as _;
10use glib::{
11    prelude::*,
12    signal::{SignalHandlerId, connect_raw},
13    translate::*,
14};
15use std::{boxed::Box as Box_, pin::Pin};
16
17glib::wrapper! {
18    /// The base class for all map sources. Map sources fill [`Tile`][crate::Tile] objects
19    /// with images from various sources: a web API, for example, or a test pattern
20    /// generated on demand.
21    ///
22    /// The most common map source is [`RasterRenderer`][crate::RasterRenderer], which fetches tiles
23    /// using a [`TileDownloader`][crate::TileDownloader].
24    ///
25    /// This is an Abstract Base Class, you cannot instantiate it.
26    ///
27    /// ## Properties
28    ///
29    ///
30    /// #### `id`
31    ///  The id of the map source
32    ///
33    /// Readable | Writable | Construct
34    ///
35    ///
36    /// #### `license`
37    ///  The usage license of the map source
38    ///
39    /// Readable | Writable | Construct
40    ///
41    ///
42    /// #### `license-uri`
43    ///  The usage license's uri for more information
44    ///
45    /// Readable | Writable | Construct
46    ///
47    ///
48    /// #### `max-zoom-level`
49    ///  The maximum zoom level
50    ///
51    /// Readable | Writable | Construct
52    ///
53    ///
54    /// #### `min-zoom-level`
55    ///  The minimum zoom level
56    ///
57    /// Readable | Writable | Construct
58    ///
59    ///
60    /// #### `name`
61    ///  The name of the map source
62    ///
63    /// Readable | Writable | Construct
64    ///
65    ///
66    /// #### `projection`
67    ///  The map projection of the map source
68    ///
69    /// Readable | Writable | Construct
70    ///
71    ///
72    /// #### `tile-size`
73    ///  The tile size of the map source
74    ///
75    /// Readable | Writable | Construct
76    ///
77    /// ## Signals
78    ///
79    ///
80    /// #### `modified`
81    ///  Emitted when the source is modified in such a way that tiles previously filled by it should be refreshed.
82    ///
83    /// It is the [`MapSource`][crate::MapSource] implementation's responsibility to emit this signal when appropriate, such as when a
84    /// data source or rendering parameter changes.
85    ///
86    ///
87    ///
88    /// # Implements
89    ///
90    /// [`MapSourceExt`][trait@crate::prelude::MapSourceExt], [`trait@glib::ObjectExt`]
91    #[doc(alias = "ShumateMapSource")]
92    pub struct MapSource(Object<ffi::ShumateMapSource, ffi::ShumateMapSourceClass>);
93
94    match fn {
95        type_ => || ffi::shumate_map_source_get_type(),
96    }
97}
98
99impl MapSource {
100    pub const NONE: Option<&'static MapSource> = None;
101}
102
103/// Trait containing all [`struct@MapSource`] methods.
104///
105/// # Implementors
106///
107/// [`MapSource`][struct@crate::MapSource], [`RasterRenderer`][struct@crate::RasterRenderer], [`VectorRenderer`][struct@crate::VectorRenderer]
108pub trait MapSourceExt: IsA<MapSource> + 'static {
109    /// Asynchronous version of shumate_map_source_fill_tile().
110    /// ## `tile`
111    /// a #ShumateTile
112    /// ## `cancellable`
113    /// a #GCancellable
114    /// ## `callback`
115    /// a #GAsyncReadyCallback to execute upon completion
116    #[doc(alias = "shumate_map_source_fill_tile_async")]
117    fn fill_tile_async<P: FnOnce(Result<(), glib::Error>) + 'static>(
118        &self,
119        tile: &Tile,
120        cancellable: Option<&impl IsA<gio::Cancellable>>,
121        callback: P,
122    ) {
123        let main_context = glib::MainContext::ref_thread_default();
124        let is_main_context_owner = main_context.is_owner();
125        let has_acquired_main_context = (!is_main_context_owner)
126            .then(|| main_context.acquire().ok())
127            .flatten();
128        assert!(
129            is_main_context_owner || has_acquired_main_context.is_some(),
130            "Async operations only allowed if the thread is owning the MainContext"
131        );
132
133        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
134            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
135        unsafe extern "C" fn fill_tile_async_trampoline<
136            P: FnOnce(Result<(), glib::Error>) + 'static,
137        >(
138            _source_object: *mut glib::gobject_ffi::GObject,
139            res: *mut gio::ffi::GAsyncResult,
140            user_data: glib::ffi::gpointer,
141        ) {
142            unsafe {
143                let mut error = std::ptr::null_mut();
144                ffi::shumate_map_source_fill_tile_finish(_source_object as *mut _, res, &mut error);
145                let result = if error.is_null() {
146                    Ok(())
147                } else {
148                    Err(from_glib_full(error))
149                };
150                let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
151                    Box_::from_raw(user_data as *mut _);
152                let callback: P = callback.into_inner();
153                callback(result);
154            }
155        }
156        let callback = fill_tile_async_trampoline::<P>;
157        unsafe {
158            ffi::shumate_map_source_fill_tile_async(
159                self.as_ref().to_glib_none().0,
160                tile.to_glib_none().0,
161                cancellable.map(|p| p.as_ref()).to_glib_none().0,
162                Some(callback),
163                Box_::into_raw(user_data) as *mut _,
164            );
165        }
166    }
167
168    fn fill_tile_future(
169        &self,
170        tile: &Tile,
171    ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
172        let tile = tile.clone();
173        Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
174            obj.fill_tile_async(&tile, Some(cancellable), move |res| {
175                send.resolve(res);
176            });
177        }))
178    }
179
180    /// Gets the number of tiles in a column at this zoom level for this map
181    /// source.
182    /// ## `zoom_level`
183    /// the zoom level
184    ///
185    /// # Returns
186    ///
187    /// the number of tiles in a column
188    #[doc(alias = "shumate_map_source_get_column_count")]
189    #[doc(alias = "get_column_count")]
190    fn column_count(&self, zoom_level: u32) -> u32 {
191        unsafe {
192            ffi::shumate_map_source_get_column_count(self.as_ref().to_glib_none().0, zoom_level)
193        }
194    }
195
196    /// Gets map source's id.
197    ///
198    /// # Returns
199    ///
200    /// the map source's id.
201    #[doc(alias = "shumate_map_source_get_id")]
202    #[doc(alias = "get_id")]
203    fn id(&self) -> Option<glib::GString> {
204        unsafe {
205            from_glib_none(ffi::shumate_map_source_get_id(
206                self.as_ref().to_glib_none().0,
207            ))
208        }
209    }
210
211    /// Gets the latitude corresponding to this y position in the map source's
212    /// projection.
213    /// ## `zoom_level`
214    /// the zoom level
215    /// ## `y`
216    /// a y position
217    ///
218    /// # Returns
219    ///
220    /// the latitude
221    #[doc(alias = "shumate_map_source_get_latitude")]
222    #[doc(alias = "get_latitude")]
223    fn latitude(&self, zoom_level: f64, y: f64) -> f64 {
224        unsafe {
225            ffi::shumate_map_source_get_latitude(self.as_ref().to_glib_none().0, zoom_level, y)
226        }
227    }
228
229    /// Gets map source's license.
230    ///
231    /// # Returns
232    ///
233    /// the map source's license.
234    #[doc(alias = "shumate_map_source_get_license")]
235    #[doc(alias = "get_license")]
236    fn license(&self) -> Option<glib::GString> {
237        unsafe {
238            from_glib_none(ffi::shumate_map_source_get_license(
239                self.as_ref().to_glib_none().0,
240            ))
241        }
242    }
243
244    /// Gets map source's license URI.
245    ///
246    /// # Returns
247    ///
248    /// the map source's license URI.
249    #[doc(alias = "shumate_map_source_get_license_uri")]
250    #[doc(alias = "get_license_uri")]
251    #[doc(alias = "license-uri")]
252    fn license_uri(&self) -> Option<glib::GString> {
253        unsafe {
254            from_glib_none(ffi::shumate_map_source_get_license_uri(
255                self.as_ref().to_glib_none().0,
256            ))
257        }
258    }
259
260    /// Gets the longitude corresponding to this x position in the map source's
261    /// projection.
262    /// ## `zoom_level`
263    /// the zoom level
264    /// ## `x`
265    /// a x position
266    ///
267    /// # Returns
268    ///
269    /// the longitude
270    #[doc(alias = "shumate_map_source_get_longitude")]
271    #[doc(alias = "get_longitude")]
272    fn longitude(&self, zoom_level: f64, x: f64) -> f64 {
273        unsafe {
274            ffi::shumate_map_source_get_longitude(self.as_ref().to_glib_none().0, zoom_level, x)
275        }
276    }
277
278    /// Gets map source's maximum zoom level.
279    ///
280    /// # Returns
281    ///
282    /// the maximum zoom level this map source supports
283    #[doc(alias = "shumate_map_source_get_max_zoom_level")]
284    #[doc(alias = "get_max_zoom_level")]
285    #[doc(alias = "max-zoom-level")]
286    fn max_zoom_level(&self) -> u32 {
287        unsafe { ffi::shumate_map_source_get_max_zoom_level(self.as_ref().to_glib_none().0) }
288    }
289
290    /// Gets meters per pixel at the position on the map using this map source's projection.
291    /// ## `zoom_level`
292    /// the zoom level
293    /// ## `latitude`
294    /// a latitude
295    /// ## `longitude`
296    /// a longitude
297    ///
298    /// # Returns
299    ///
300    /// the meters per pixel
301    #[doc(alias = "shumate_map_source_get_meters_per_pixel")]
302    #[doc(alias = "get_meters_per_pixel")]
303    fn meters_per_pixel(&self, zoom_level: f64, latitude: f64, longitude: f64) -> f64 {
304        unsafe {
305            ffi::shumate_map_source_get_meters_per_pixel(
306                self.as_ref().to_glib_none().0,
307                zoom_level,
308                latitude,
309                longitude,
310            )
311        }
312    }
313
314    /// Gets map source's minimum zoom level.
315    ///
316    /// # Returns
317    ///
318    /// the miminum zoom level this map source supports
319    #[doc(alias = "shumate_map_source_get_min_zoom_level")]
320    #[doc(alias = "get_min_zoom_level")]
321    #[doc(alias = "min-zoom-level")]
322    fn min_zoom_level(&self) -> u32 {
323        unsafe { ffi::shumate_map_source_get_min_zoom_level(self.as_ref().to_glib_none().0) }
324    }
325
326    /// Gets map source's name.
327    ///
328    /// # Returns
329    ///
330    /// the map source's name.
331    #[doc(alias = "shumate_map_source_get_name")]
332    #[doc(alias = "get_name")]
333    fn name(&self) -> Option<glib::GString> {
334        unsafe {
335            from_glib_none(ffi::shumate_map_source_get_name(
336                self.as_ref().to_glib_none().0,
337            ))
338        }
339    }
340
341    /// Gets map source's projection.
342    ///
343    /// # Returns
344    ///
345    /// the map source's projection.
346    #[doc(alias = "shumate_map_source_get_projection")]
347    #[doc(alias = "get_projection")]
348    fn projection(&self) -> MapProjection {
349        unsafe {
350            from_glib(ffi::shumate_map_source_get_projection(
351                self.as_ref().to_glib_none().0,
352            ))
353        }
354    }
355
356    /// Gets the number of tiles in a row at this zoom level for this map source.
357    /// ## `zoom_level`
358    /// the zoom level
359    ///
360    /// # Returns
361    ///
362    /// the number of tiles in a row
363    #[doc(alias = "shumate_map_source_get_row_count")]
364    #[doc(alias = "get_row_count")]
365    fn row_count(&self, zoom_level: u32) -> u32 {
366        unsafe { ffi::shumate_map_source_get_row_count(self.as_ref().to_glib_none().0, zoom_level) }
367    }
368
369    /// Gets map source's tile size.
370    ///
371    /// # Returns
372    ///
373    /// the tile's size (width and height) in pixels for this map source
374    #[doc(alias = "shumate_map_source_get_tile_size")]
375    #[doc(alias = "get_tile_size")]
376    #[doc(alias = "tile-size")]
377    fn tile_size(&self) -> u32 {
378        unsafe { ffi::shumate_map_source_get_tile_size(self.as_ref().to_glib_none().0) }
379    }
380
381    /// Gets the apparent size of the map tiles at the given fractional zoom level.
382    ///
383    /// As the map is zoomed in, a tile gets bigger and bigger until, at the next
384    /// integer zoom level, it "splits" into four tiles at the next zoom level.
385    /// Thus, the size increase follows an exponential curve, base 2.
386    /// ## `zoom_level`
387    /// a zoom level
388    ///
389    /// # Returns
390    ///
391    /// the tile's size (width and height) in pixels for this map source
392    /// at this zoom level
393    #[doc(alias = "shumate_map_source_get_tile_size_at_zoom")]
394    #[doc(alias = "get_tile_size_at_zoom")]
395    fn tile_size_at_zoom(&self, zoom_level: f64) -> f64 {
396        unsafe {
397            ffi::shumate_map_source_get_tile_size_at_zoom(
398                self.as_ref().to_glib_none().0,
399                zoom_level,
400            )
401        }
402    }
403
404    /// Gets the x position on the map using this map source's projection.
405    /// (0, 0) is located at the top left.
406    /// ## `zoom_level`
407    /// the zoom level
408    /// ## `longitude`
409    /// a longitude
410    ///
411    /// # Returns
412    ///
413    /// the x position
414    #[doc(alias = "shumate_map_source_get_x")]
415    #[doc(alias = "get_x")]
416    fn x(&self, zoom_level: f64, longitude: f64) -> f64 {
417        unsafe {
418            ffi::shumate_map_source_get_x(self.as_ref().to_glib_none().0, zoom_level, longitude)
419        }
420    }
421
422    /// Gets the y position on the map using this map source's projection.
423    /// (0, 0) is located at the top left.
424    /// ## `zoom_level`
425    /// the zoom level
426    /// ## `latitude`
427    /// a latitude
428    ///
429    /// # Returns
430    ///
431    /// the y position
432    #[doc(alias = "shumate_map_source_get_y")]
433    #[doc(alias = "get_y")]
434    fn y(&self, zoom_level: f64, latitude: f64) -> f64 {
435        unsafe {
436            ffi::shumate_map_source_get_y(self.as_ref().to_glib_none().0, zoom_level, latitude)
437        }
438    }
439
440    /// Sets the map source's id.
441    /// ## `id`
442    /// an id
443    #[doc(alias = "shumate_map_source_set_id")]
444    #[doc(alias = "id")]
445    fn set_id(&self, id: &str) {
446        unsafe {
447            ffi::shumate_map_source_set_id(self.as_ref().to_glib_none().0, id.to_glib_none().0);
448        }
449    }
450
451    /// Sets the map source's license.
452    /// ## `license`
453    /// the licence
454    #[doc(alias = "shumate_map_source_set_license")]
455    #[doc(alias = "license")]
456    fn set_license(&self, license: &str) {
457        unsafe {
458            ffi::shumate_map_source_set_license(
459                self.as_ref().to_glib_none().0,
460                license.to_glib_none().0,
461            );
462        }
463    }
464
465    /// Sets the map source's license URI.
466    /// ## `license_uri`
467    /// the licence URI
468    #[doc(alias = "shumate_map_source_set_license_uri")]
469    #[doc(alias = "license-uri")]
470    fn set_license_uri(&self, license_uri: &str) {
471        unsafe {
472            ffi::shumate_map_source_set_license_uri(
473                self.as_ref().to_glib_none().0,
474                license_uri.to_glib_none().0,
475            );
476        }
477    }
478
479    /// Sets the map source's maximum zoom level.
480    /// ## `zoom_level`
481    /// the maximum zoom level
482    #[doc(alias = "shumate_map_source_set_max_zoom_level")]
483    #[doc(alias = "max-zoom-level")]
484    fn set_max_zoom_level(&self, zoom_level: u32) {
485        unsafe {
486            ffi::shumate_map_source_set_max_zoom_level(self.as_ref().to_glib_none().0, zoom_level);
487        }
488    }
489
490    /// Sets the map source's minimal zoom level.
491    /// ## `zoom_level`
492    /// the minimal zoom level
493    #[doc(alias = "shumate_map_source_set_min_zoom_level")]
494    #[doc(alias = "min-zoom-level")]
495    fn set_min_zoom_level(&self, zoom_level: u32) {
496        unsafe {
497            ffi::shumate_map_source_set_min_zoom_level(self.as_ref().to_glib_none().0, zoom_level);
498        }
499    }
500
501    /// Sets the map source's name.
502    /// ## `name`
503    /// a name
504    #[doc(alias = "shumate_map_source_set_name")]
505    #[doc(alias = "name")]
506    fn set_name(&self, name: &str) {
507        unsafe {
508            ffi::shumate_map_source_set_name(self.as_ref().to_glib_none().0, name.to_glib_none().0);
509        }
510    }
511
512    /// Sets the map source's projection.
513    /// ## `projection`
514    /// a #ShumateMapProjection
515    #[doc(alias = "shumate_map_source_set_projection")]
516    #[doc(alias = "projection")]
517    fn set_projection(&self, projection: MapProjection) {
518        unsafe {
519            ffi::shumate_map_source_set_projection(
520                self.as_ref().to_glib_none().0,
521                projection.into_glib(),
522            );
523        }
524    }
525
526    /// Sets the map source's tile size.
527    /// ## `tile_size`
528    /// the tile size
529    #[doc(alias = "shumate_map_source_set_tile_size")]
530    #[doc(alias = "tile-size")]
531    fn set_tile_size(&self, tile_size: u32) {
532        unsafe {
533            ffi::shumate_map_source_set_tile_size(self.as_ref().to_glib_none().0, tile_size);
534        }
535    }
536
537    /// Emitted when the source is modified in such a way that tiles previously filled by it should be refreshed.
538    ///
539    /// It is the [`MapSource`][crate::MapSource] implementation's responsibility to emit this signal when appropriate, such as when a
540    /// data source or rendering parameter changes.
541    #[cfg(feature = "v1_7")]
542    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
543    #[doc(alias = "modified")]
544    fn connect_modified<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
545        unsafe extern "C" fn modified_trampoline<P: IsA<MapSource>, F: Fn(&P) + 'static>(
546            this: *mut ffi::ShumateMapSource,
547            f: glib::ffi::gpointer,
548        ) {
549            unsafe {
550                let f: &F = &*(f as *const F);
551                f(MapSource::from_glib_borrow(this).unsafe_cast_ref())
552            }
553        }
554        unsafe {
555            let f: Box_<F> = Box_::new(f);
556            connect_raw(
557                self.as_ptr() as *mut _,
558                c"modified".as_ptr(),
559                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
560                    modified_trampoline::<Self, F> as *const (),
561                )),
562                Box_::into_raw(f),
563            )
564        }
565    }
566
567    #[doc(alias = "id")]
568    fn connect_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
569        unsafe extern "C" fn notify_id_trampoline<P: IsA<MapSource>, F: Fn(&P) + 'static>(
570            this: *mut ffi::ShumateMapSource,
571            _param_spec: glib::ffi::gpointer,
572            f: glib::ffi::gpointer,
573        ) {
574            unsafe {
575                let f: &F = &*(f as *const F);
576                f(MapSource::from_glib_borrow(this).unsafe_cast_ref())
577            }
578        }
579        unsafe {
580            let f: Box_<F> = Box_::new(f);
581            connect_raw(
582                self.as_ptr() as *mut _,
583                c"notify::id".as_ptr(),
584                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
585                    notify_id_trampoline::<Self, F> as *const (),
586                )),
587                Box_::into_raw(f),
588            )
589        }
590    }
591
592    #[doc(alias = "license")]
593    fn connect_license_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
594        unsafe extern "C" fn notify_license_trampoline<P: IsA<MapSource>, F: Fn(&P) + 'static>(
595            this: *mut ffi::ShumateMapSource,
596            _param_spec: glib::ffi::gpointer,
597            f: glib::ffi::gpointer,
598        ) {
599            unsafe {
600                let f: &F = &*(f as *const F);
601                f(MapSource::from_glib_borrow(this).unsafe_cast_ref())
602            }
603        }
604        unsafe {
605            let f: Box_<F> = Box_::new(f);
606            connect_raw(
607                self.as_ptr() as *mut _,
608                c"notify::license".as_ptr(),
609                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
610                    notify_license_trampoline::<Self, F> as *const (),
611                )),
612                Box_::into_raw(f),
613            )
614        }
615    }
616
617    #[doc(alias = "license-uri")]
618    fn connect_license_uri_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
619        unsafe extern "C" fn notify_license_uri_trampoline<
620            P: IsA<MapSource>,
621            F: Fn(&P) + 'static,
622        >(
623            this: *mut ffi::ShumateMapSource,
624            _param_spec: glib::ffi::gpointer,
625            f: glib::ffi::gpointer,
626        ) {
627            unsafe {
628                let f: &F = &*(f as *const F);
629                f(MapSource::from_glib_borrow(this).unsafe_cast_ref())
630            }
631        }
632        unsafe {
633            let f: Box_<F> = Box_::new(f);
634            connect_raw(
635                self.as_ptr() as *mut _,
636                c"notify::license-uri".as_ptr(),
637                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
638                    notify_license_uri_trampoline::<Self, F> as *const (),
639                )),
640                Box_::into_raw(f),
641            )
642        }
643    }
644
645    #[doc(alias = "max-zoom-level")]
646    fn connect_max_zoom_level_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
647        unsafe extern "C" fn notify_max_zoom_level_trampoline<
648            P: IsA<MapSource>,
649            F: Fn(&P) + 'static,
650        >(
651            this: *mut ffi::ShumateMapSource,
652            _param_spec: glib::ffi::gpointer,
653            f: glib::ffi::gpointer,
654        ) {
655            unsafe {
656                let f: &F = &*(f as *const F);
657                f(MapSource::from_glib_borrow(this).unsafe_cast_ref())
658            }
659        }
660        unsafe {
661            let f: Box_<F> = Box_::new(f);
662            connect_raw(
663                self.as_ptr() as *mut _,
664                c"notify::max-zoom-level".as_ptr(),
665                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
666                    notify_max_zoom_level_trampoline::<Self, F> as *const (),
667                )),
668                Box_::into_raw(f),
669            )
670        }
671    }
672
673    #[doc(alias = "min-zoom-level")]
674    fn connect_min_zoom_level_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
675        unsafe extern "C" fn notify_min_zoom_level_trampoline<
676            P: IsA<MapSource>,
677            F: Fn(&P) + 'static,
678        >(
679            this: *mut ffi::ShumateMapSource,
680            _param_spec: glib::ffi::gpointer,
681            f: glib::ffi::gpointer,
682        ) {
683            unsafe {
684                let f: &F = &*(f as *const F);
685                f(MapSource::from_glib_borrow(this).unsafe_cast_ref())
686            }
687        }
688        unsafe {
689            let f: Box_<F> = Box_::new(f);
690            connect_raw(
691                self.as_ptr() as *mut _,
692                c"notify::min-zoom-level".as_ptr(),
693                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
694                    notify_min_zoom_level_trampoline::<Self, F> as *const (),
695                )),
696                Box_::into_raw(f),
697            )
698        }
699    }
700
701    #[doc(alias = "name")]
702    fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
703        unsafe extern "C" fn notify_name_trampoline<P: IsA<MapSource>, F: Fn(&P) + 'static>(
704            this: *mut ffi::ShumateMapSource,
705            _param_spec: glib::ffi::gpointer,
706            f: glib::ffi::gpointer,
707        ) {
708            unsafe {
709                let f: &F = &*(f as *const F);
710                f(MapSource::from_glib_borrow(this).unsafe_cast_ref())
711            }
712        }
713        unsafe {
714            let f: Box_<F> = Box_::new(f);
715            connect_raw(
716                self.as_ptr() as *mut _,
717                c"notify::name".as_ptr(),
718                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
719                    notify_name_trampoline::<Self, F> as *const (),
720                )),
721                Box_::into_raw(f),
722            )
723        }
724    }
725
726    #[doc(alias = "projection")]
727    fn connect_projection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
728        unsafe extern "C" fn notify_projection_trampoline<
729            P: IsA<MapSource>,
730            F: Fn(&P) + 'static,
731        >(
732            this: *mut ffi::ShumateMapSource,
733            _param_spec: glib::ffi::gpointer,
734            f: glib::ffi::gpointer,
735        ) {
736            unsafe {
737                let f: &F = &*(f as *const F);
738                f(MapSource::from_glib_borrow(this).unsafe_cast_ref())
739            }
740        }
741        unsafe {
742            let f: Box_<F> = Box_::new(f);
743            connect_raw(
744                self.as_ptr() as *mut _,
745                c"notify::projection".as_ptr(),
746                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
747                    notify_projection_trampoline::<Self, F> as *const (),
748                )),
749                Box_::into_raw(f),
750            )
751        }
752    }
753
754    #[doc(alias = "tile-size")]
755    fn connect_tile_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
756        unsafe extern "C" fn notify_tile_size_trampoline<P: IsA<MapSource>, F: Fn(&P) + 'static>(
757            this: *mut ffi::ShumateMapSource,
758            _param_spec: glib::ffi::gpointer,
759            f: glib::ffi::gpointer,
760        ) {
761            unsafe {
762                let f: &F = &*(f as *const F);
763                f(MapSource::from_glib_borrow(this).unsafe_cast_ref())
764            }
765        }
766        unsafe {
767            let f: Box_<F> = Box_::new(f);
768            connect_raw(
769                self.as_ptr() as *mut _,
770                c"notify::tile-size".as_ptr(),
771                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
772                    notify_tile_size_trampoline::<Self, F> as *const (),
773                )),
774                Box_::into_raw(f),
775            )
776        }
777    }
778}
779
780impl<O: IsA<MapSource>> MapSourceExt for O {}