tracker-rs 0.8.0

Rust bindings for tracker
Documentation
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT

use crate::{ffi, SparqlConnection};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    #[doc(alias = "TrackerNotifier")]
    pub struct Notifier(Object<ffi::TrackerNotifier, ffi::TrackerNotifierClass>);

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

impl Notifier {
    // rustdoc-stripper-ignore-next
    /// Creates a new builder-pattern struct instance to construct [`Notifier`] objects.
    ///
    /// This method returns an instance of [`NotifierBuilder`](crate::builders::NotifierBuilder) which can be used to create [`Notifier`] objects.
    pub fn builder() -> NotifierBuilder {
        NotifierBuilder::new()
    }

    #[doc(alias = "tracker_notifier_signal_subscribe")]
    pub fn signal_subscribe(
        &self,
        connection: &gio::DBusConnection,
        service: Option<&str>,
        object_path: Option<&str>,
        graph: Option<&str>,
    ) -> u32 {
        unsafe {
            ffi::tracker_notifier_signal_subscribe(
                self.to_glib_none().0,
                connection.to_glib_none().0,
                service.to_glib_none().0,
                object_path.to_glib_none().0,
                graph.to_glib_none().0,
            )
        }
    }

    #[doc(alias = "tracker_notifier_signal_unsubscribe")]
    pub fn signal_unsubscribe(&self, handler_id: u32) {
        unsafe {
            ffi::tracker_notifier_signal_unsubscribe(self.to_glib_none().0, handler_id);
        }
    }

    pub fn connection(&self) -> Option<SparqlConnection> {
        ObjectExt::property(self, "connection")
    }

    //#[doc(alias = "events")]
    //pub fn connect_events<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
    //    Empty ctype events: *.PtrArray TypeId { ns_id: 1, id: 14 }
    //}
}

// rustdoc-stripper-ignore-next
/// A [builder-pattern] type to construct [`Notifier`] objects.
///
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
#[must_use = "The builder must be built to be used"]
pub struct NotifierBuilder {
    builder: glib::object::ObjectBuilder<'static, Notifier>,
}

impl NotifierBuilder {
    fn new() -> Self {
        Self {
            builder: glib::object::Object::builder(),
        }
    }

    pub fn connection(self, connection: &SparqlConnection) -> Self {
        Self {
            builder: self.builder.property("connection", connection.clone()),
        }
    }

    // rustdoc-stripper-ignore-next
    /// Build the [`Notifier`].
    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
    pub fn build(self) -> Notifier {
        assert_initialized_main_thread!();
        self.builder.build()
    }
}