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 92 93 94 95 96 97 98 99 100 101 102 103
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from webkit-gir-files
// DO NOT EDIT
use crate::ffi;
use glib::translate::*;
glib::wrapper! {
/// An opaque struct to provide position updates to a #WebKitGeolocationManager.
///
/// WebKitGeolocationPosition is an opaque struct used to provide position updates to a
/// #WebKitGeolocationManager using webkit_geolocation_manager_update_position().
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct GeolocationPosition(Boxed<ffi::WebKitGeolocationPosition>);
match fn {
copy => |ptr| ffi::webkit_geolocation_position_copy(mut_override(ptr)),
free => |ptr| ffi::webkit_geolocation_position_free(ptr),
type_ => || ffi::webkit_geolocation_position_get_type(),
}
}
impl GeolocationPosition {
/// Create a new #WebKitGeolocationPosition.
/// ## `latitude`
/// a valid latitude in degrees
/// ## `longitude`
/// a valid longitude in degrees
/// ## `accuracy`
/// accuracy of location in meters
///
/// # Returns
///
/// a newly created #WebKitGeolocationPosition
#[doc(alias = "webkit_geolocation_position_new")]
pub fn new(latitude: f64, longitude: f64, accuracy: f64) -> GeolocationPosition {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::webkit_geolocation_position_new(
latitude, longitude, accuracy,
))
}
}
/// Set the @self altitude.
/// ## `altitude`
/// altitude in meters
#[doc(alias = "webkit_geolocation_position_set_altitude")]
pub fn set_altitude(&mut self, altitude: f64) {
unsafe {
ffi::webkit_geolocation_position_set_altitude(self.to_glib_none_mut().0, altitude);
}
}
/// Set the accuracy of @self altitude.
/// ## `altitude_accuracy`
/// accuracy of position altitude in meters
#[doc(alias = "webkit_geolocation_position_set_altitude_accuracy")]
pub fn set_altitude_accuracy(&mut self, altitude_accuracy: f64) {
unsafe {
ffi::webkit_geolocation_position_set_altitude_accuracy(
self.to_glib_none_mut().0,
altitude_accuracy,
);
}
}
/// Set the @self heading.
///
/// Set the @self heading, as a positive angle between the direction of movement and the North
/// direction, in clockwise direction.
/// ## `heading`
/// heading in degrees
#[doc(alias = "webkit_geolocation_position_set_heading")]
pub fn set_heading(&mut self, heading: f64) {
unsafe {
ffi::webkit_geolocation_position_set_heading(self.to_glib_none_mut().0, heading);
}
}
/// Set the @self speed.
/// ## `speed`
/// speed in meters per second
#[doc(alias = "webkit_geolocation_position_set_speed")]
pub fn set_speed(&mut self, speed: f64) {
unsafe {
ffi::webkit_geolocation_position_set_speed(self.to_glib_none_mut().0, speed);
}
}
/// Set the @self timestamp.
///
/// By default it's the time when the @self was created.
/// ## `timestamp`
/// timestamp in seconds since the epoch, or 0 to use current time
#[doc(alias = "webkit_geolocation_position_set_timestamp")]
pub fn set_timestamp(&mut self, timestamp: u64) {
unsafe {
ffi::webkit_geolocation_position_set_timestamp(self.to_glib_none_mut().0, timestamp);
}
}
}