Skip to main content

tracker/auto/
notifier.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, SparqlConnection};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    #[doc(alias = "TrackerNotifier")]
11    pub struct Notifier(Object<ffi::TrackerNotifier, ffi::TrackerNotifierClass>);
12
13    match fn {
14        type_ => || ffi::tracker_notifier_get_type(),
15    }
16}
17
18impl Notifier {
19    // rustdoc-stripper-ignore-next
20    /// Creates a new builder-pattern struct instance to construct [`Notifier`] objects.
21    ///
22    /// This method returns an instance of [`NotifierBuilder`](crate::builders::NotifierBuilder) which can be used to create [`Notifier`] objects.
23    pub fn builder() -> NotifierBuilder {
24        NotifierBuilder::new()
25    }
26
27    #[doc(alias = "tracker_notifier_signal_subscribe")]
28    pub fn signal_subscribe(
29        &self,
30        connection: &gio::DBusConnection,
31        service: Option<&str>,
32        object_path: Option<&str>,
33        graph: Option<&str>,
34    ) -> u32 {
35        unsafe {
36            ffi::tracker_notifier_signal_subscribe(
37                self.to_glib_none().0,
38                connection.to_glib_none().0,
39                service.to_glib_none().0,
40                object_path.to_glib_none().0,
41                graph.to_glib_none().0,
42            )
43        }
44    }
45
46    #[doc(alias = "tracker_notifier_signal_unsubscribe")]
47    pub fn signal_unsubscribe(&self, handler_id: u32) {
48        unsafe {
49            ffi::tracker_notifier_signal_unsubscribe(self.to_glib_none().0, handler_id);
50        }
51    }
52
53    pub fn connection(&self) -> Option<SparqlConnection> {
54        ObjectExt::property(self, "connection")
55    }
56
57    //#[doc(alias = "events")]
58    //pub fn connect_events<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
59    //    Empty ctype events: *.PtrArray TypeId { ns_id: 1, id: 14 }
60    //}
61}
62
63// rustdoc-stripper-ignore-next
64/// A [builder-pattern] type to construct [`Notifier`] objects.
65///
66/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
67#[must_use = "The builder must be built to be used"]
68pub struct NotifierBuilder {
69    builder: glib::object::ObjectBuilder<'static, Notifier>,
70}
71
72impl NotifierBuilder {
73    fn new() -> Self {
74        Self {
75            builder: glib::object::Object::builder(),
76        }
77    }
78
79    pub fn connection(self, connection: &SparqlConnection) -> Self {
80        Self {
81            builder: self.builder.property("connection", connection.clone()),
82        }
83    }
84
85    // rustdoc-stripper-ignore-next
86    /// Build the [`Notifier`].
87    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
88    pub fn build(self) -> Notifier {
89        assert_initialized_main_thread!();
90        self.builder.build()
91    }
92}