nm_rs/auto/secret_agent_old.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir
3// from gtk-girs (https://github.com/gtk-rs/gir-files)
4// DO NOT EDIT
5#![allow(deprecated)]
6
7use crate::{ffi,Connection,SecretAgentCapabilities};
8use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
9use std::{boxed::Box as Box_,pin::Pin};
10
11#[cfg(feature = "gio_v2_22")]
12#[cfg_attr(docsrs, doc(cfg(feature = "gio_v2_22")))]
13glib::wrapper! {
14 ///
15 ///
16 /// This is an Abstract Base Class, you cannot instantiate it.
17 ///
18 /// ## Properties
19 ///
20 ///
21 /// #### `auto-register`
22 /// If [`true`] (the default), the agent will always be registered when
23 /// NetworkManager is running; if NetworkManager exits and restarts, the
24 /// agent will re-register itself automatically.
25 ///
26 /// In particular, if this property is [`true`] at construct time, then the
27 /// agent will register itself with NetworkManager during
28 /// construction/initialization and initialization will only complete
29 /// after registration is completed (either successfully or unsuccessfully).
30 /// Since 1.24, a failure to register will no longer cause initialization
31 /// of #NMSecretAgentOld to fail.
32 ///
33 /// If the property is [`false`], the agent will not automatically register with
34 /// NetworkManager, and nm_secret_agent_old_enable() or
35 /// nm_secret_agent_old_register_async() must be called to register it.
36 ///
37 /// Calling nm_secret_agent_old_enable() has the same effect as setting this
38 /// property.
39 ///
40 /// Readable | Writeable | Construct
41 ///
42 ///
43 /// #### `capabilities`
44 /// A bitfield of `NMSecretAgentCapabilities`.
45 ///
46 /// Changing this property is possible at any time. In case the secret
47 /// agent is currently registered, this will cause a re-registration.
48 ///
49 /// Readable | Writeable | Construct
50 ///
51 ///
52 /// #### `dbus-connection`
53 /// The #GDBusConnection used by the instance. You may either set this
54 /// as construct-only property, or otherwise #NMSecretAgentOld will choose
55 /// a connection via g_bus_get() during initialization.
56 ///
57 /// Readable | Writeable | Construct Only
58 ///
59 ///
60 /// #### `identifier`
61 /// Identifies this agent; only one agent in each user session may use the
62 /// same identifier. Identifier formatting follows the same rules as
63 /// D-Bus bus names with the exception that the ':' character is not
64 /// allowed. The valid set of characters is "[A-Z][a-z][0-9]_-." and the
65 /// identifier is limited in length to 255 characters with a minimum
66 /// of 3 characters. An example valid identifier is 'org.gnome.nm-applet'
67 /// (without quotes).
68 ///
69 /// Readable | Writeable | Construct Only
70 ///
71 ///
72 /// #### `registered`
73 /// [`true`] if the agent is registered with NetworkManager, [`false`] if not.
74 ///
75 /// Readable
76 ///
77 /// # Implements
78 ///
79 /// [`SecretAgentOldExt`][trait@crate::prelude::SecretAgentOldExt], [`trait@gio::prelude::AsyncInitableExt`], [`trait@gio::prelude::InitableExt`]
80 #[doc(alias = "NMSecretAgentOld")]
81 pub struct SecretAgentOld(Object<ffi::NMSecretAgentOld, ffi::NMSecretAgentOldClass>) @implements gio::AsyncInitable, gio::Initable;
82
83 match fn {
84 type_ => || ffi::nm_secret_agent_old_get_type(),
85 }
86}
87
88#[cfg(not(any(feature = "gio_v2_22")))]
89#[cfg(feature = "gio_v2_22")]
90glib::wrapper! {
91 #[doc(alias = "NMSecretAgentOld")]
92 pub struct SecretAgentOld(Object<ffi::NMSecretAgentOld, ffi::NMSecretAgentOldClass>) @implements gio::Initable;
93
94 match fn {
95 type_ => || ffi::nm_secret_agent_old_get_type(),
96 }
97}
98
99#[cfg(not(any(feature = "gio_v2_22")))]
100glib::wrapper! {
101 #[doc(alias = "NMSecretAgentOld")]
102 pub struct SecretAgentOld(Object<ffi::NMSecretAgentOld, ffi::NMSecretAgentOldClass>);
103
104 match fn {
105 type_ => || ffi::nm_secret_agent_old_get_type(),
106 }
107}
108
109impl SecretAgentOld {
110 pub const NONE: Option<&'static SecretAgentOld> = None;
111
112}
113
114/// Trait containing all [`struct@SecretAgentOld`] methods.
115///
116/// # Implementors
117///
118/// [`SecretAgentOld`][struct@crate::SecretAgentOld]
119pub trait SecretAgentOldExt: IsA<SecretAgentOld> + 'static {
120 /// Asynchronously asks the agent to delete all saved secrets belonging to
121 /// @connection.
122 /// ## `connection`
123 /// a #NMConnection
124 /// ## `callback`
125 /// a callback, to be invoked when the operation is done
126 #[doc(alias = "nm_secret_agent_old_delete_secrets")]
127 fn delete_secrets<P: FnOnce(&SecretAgentOld, &Connection, Option<&glib::Error>) + 'static>(&self, connection: &impl IsA<Connection>, callback: P) {
128 let callback_data: Box_<P> = Box_::new(callback);
129 unsafe extern "C" fn callback_func<P: FnOnce(&SecretAgentOld, &Connection, Option<&glib::Error>) + 'static>(agent: *mut ffi::NMSecretAgentOld, connection: *mut ffi::NMConnection, error: *mut glib::ffi::GError, user_data: glib::ffi::gpointer) {
130 let agent = from_glib_borrow(agent);
131 let connection = from_glib_borrow(connection);
132 let error: Borrowed<Option<glib::Error>> = from_glib_borrow(error);
133 let callback = Box_::from_raw(user_data as *mut P);
134 (*callback)(&agent, &connection, error.as_ref().as_ref())
135 }
136 let callback = Some(callback_func::<P> as _);
137 let super_callback0: Box_<P> = callback_data;
138 unsafe {
139 ffi::nm_secret_agent_old_delete_secrets(self.as_ref().to_glib_none().0, connection.as_ref().to_glib_none().0, callback, Box_::into_raw(super_callback0) as *mut _);
140 }
141 }
142
143 #[cfg(feature = "v1_24")]
144 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
145 #[doc(alias = "nm_secret_agent_old_destroy")]
146 fn destroy(&self) {
147 unsafe {
148 ffi::nm_secret_agent_old_destroy(self.as_ref().to_glib_none().0);
149 }
150 }
151
152 /// This has the same effect as setting [`SECRET_AGENT_OLD_AUTO_REGISTER`][crate::SECRET_AGENT_OLD_AUTO_REGISTER]
153 /// property.
154 ///
155 /// Unlike most other functions, you may already call this function before
156 /// initialization completes.
157 /// ## `enable`
158 /// whether to enable or disable the listener.
159 #[cfg(feature = "v1_24")]
160 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
161 #[doc(alias = "nm_secret_agent_old_enable")]
162 fn enable(&self, enable: bool) {
163 unsafe {
164 ffi::nm_secret_agent_old_enable(self.as_ref().to_glib_none().0, enable.into_glib());
165 }
166 }
167
168 //#[cfg(feature = "v1_24")]
169 //#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
170 //#[doc(alias = "nm_secret_agent_old_get_context_busy_watcher")]
171 //#[doc(alias = "get_context_busy_watcher")]
172 //fn context_busy_watcher(&self) -> /*Ignored*/glib::Object {
173 // unsafe { TODO: call ffi:nm_secret_agent_old_get_context_busy_watcher() }
174 //}
175
176 //#[cfg(feature = "v1_24")]
177 //#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
178 //#[doc(alias = "nm_secret_agent_old_get_dbus_connection")]
179 //#[doc(alias = "get_dbus_connection")]
180 //#[doc(alias = "dbus-connection")]
181 //fn dbus_connection(&self) -> /*Ignored*/gio::DBusConnection {
182 // unsafe { TODO: call ffi:nm_secret_agent_old_get_dbus_connection() }
183 //}
184
185 ///
186 /// # Returns
187 ///
188 /// the current D-Bus name owner. While this property
189 /// is set while registering, it really only makes sense when
190 /// the nm_secret_agent_old_get_registered() indicates that
191 /// registration is successful.
192 #[cfg(feature = "v1_24")]
193 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
194 #[doc(alias = "nm_secret_agent_old_get_dbus_name_owner")]
195 #[doc(alias = "get_dbus_name_owner")]
196 fn dbus_name_owner(&self) -> glib::GString {
197 unsafe {
198 from_glib_none(ffi::nm_secret_agent_old_get_dbus_name_owner(self.as_ref().to_glib_none().0))
199 }
200 }
201
202 //#[cfg(feature = "v1_24")]
203 //#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
204 //#[doc(alias = "nm_secret_agent_old_get_main_context")]
205 //#[doc(alias = "get_main_context")]
206 //fn main_context(&self) -> /*Ignored*/glib::MainContext {
207 // unsafe { TODO: call ffi:nm_secret_agent_old_get_main_context() }
208 //}
209
210 /// Note that the secret agent transparently registers and re-registers
211 /// as the D-Bus name owner appears. Hence, this property is not really
212 /// useful. Also, to be graceful against races during registration, the
213 /// instance will already accept requests while being in the process of
214 /// registering.
215 /// If you need to avoid races and want to wait until @self is registered,
216 /// call nm_secret_agent_old_register_async(). If that function completes
217 /// with success, you know the instance is registered.
218 ///
219 /// # Returns
220 ///
221 /// a [`true`] if the agent is registered, [`false`] if it is not.
222 #[doc(alias = "nm_secret_agent_old_get_registered")]
223 #[doc(alias = "get_registered")]
224 #[doc(alias = "registered")]
225 fn is_registered(&self) -> bool {
226 unsafe {
227 from_glib(ffi::nm_secret_agent_old_get_registered(self.as_ref().to_glib_none().0))
228 }
229 }
230
231 //#[doc(alias = "nm_secret_agent_old_get_secrets")]
232 //#[doc(alias = "get_secrets")]
233 //fn secrets(&self, connection: &impl IsA<Connection>, setting_name: &str, hints: &[&str], flags: SecretAgentGetSecretsFlags, callback: /*Unimplemented*/FnOnce(&SecretAgentOld, &Connection, /*Ignored*/Option<glib::Variant>, Option<&glib::Error>), user_data: /*Unimplemented*/Option<Basic: Pointer>) {
234 // unsafe { TODO: call ffi:nm_secret_agent_old_get_secrets() }
235 //}
236
237 /// Registers the #NMSecretAgentOld with the NetworkManager secret manager,
238 /// indicating to NetworkManager that the agent is able to provide and save
239 /// secrets for connections on behalf of its user.
240 ///
241 /// # Deprecated since 1.24
242 ///
243 /// Use nm_secret_agent_old_enable() or nm_secret_agent_old_register_async().
244 /// ## `cancellable`
245 /// a #GCancellable, or [`None`]
246 ///
247 /// # Returns
248 ///
249 /// [`true`] if registration was successful, [`false`] on error.
250 ///
251 /// Since 1.24, this can no longer fail unless the @cancellable gets
252 /// cancelled. Contrary to nm_secret_agent_old_register_async(), this also
253 /// does not wait for the registration to succeed. You cannot synchronously
254 /// (without iterating the caller's GMainContext) wait for registration.
255 ///
256 /// Since 1.24, registration is idempotent. It has the same effect as setting
257 /// [`SECRET_AGENT_OLD_AUTO_REGISTER`][crate::SECRET_AGENT_OLD_AUTO_REGISTER] to [`true`] or nm_secret_agent_old_enable().
258 #[cfg_attr(feature = "v1_24", deprecated = "Since 1.24")]
259 #[allow(deprecated)]
260 #[doc(alias = "nm_secret_agent_old_register")]
261 fn register(&self, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
262 unsafe {
263 let mut error = std::ptr::null_mut();
264 let is_ok = ffi::nm_secret_agent_old_register(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
265 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
266 if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
267 }
268 }
269
270 /// Asynchronously registers the #NMSecretAgentOld with the NetworkManager secret
271 /// manager, indicating to NetworkManager that the agent is able to provide and
272 /// save secrets for connections on behalf of its user.
273 ///
274 /// Since 1.24, registration cannot fail and is idempotent. It has
275 /// the same effect as setting [`SECRET_AGENT_OLD_AUTO_REGISTER`][crate::SECRET_AGENT_OLD_AUTO_REGISTER] to [`true`]
276 /// or nm_secret_agent_old_enable().
277 ///
278 /// Since 1.24, the asynchronous result indicates whether the instance is successfully
279 /// registered. In any case, this call enables the agent and it will automatically
280 /// try to register and handle secret requests. A failure of this function only indicates
281 /// that currently the instance might not be ready (but since it will automatically
282 /// try to recover, it might be ready in a moment afterwards). Use this function if
283 /// you want to check and ensure that the agent is registered.
284 /// ## `cancellable`
285 /// a #GCancellable, or [`None`]
286 /// ## `callback`
287 /// callback to call when the agent is registered
288 #[doc(alias = "nm_secret_agent_old_register_async")]
289 fn register_async<P: FnOnce(Result<(), glib::Error>) + 'static>(&self, cancellable: Option<&impl IsA<gio::Cancellable>>, callback: P) {
290
291 let main_context = glib::MainContext::ref_thread_default();
292 let is_main_context_owner = main_context.is_owner();
293 let has_acquired_main_context = (!is_main_context_owner)
294 .then(|| main_context.acquire().ok())
295 .flatten();
296 assert!(
297 is_main_context_owner || has_acquired_main_context.is_some(),
298 "Async operations only allowed if the thread is owning the MainContext"
299 );
300
301 let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::new(glib::thread_guard::ThreadGuard::new(callback));
302 unsafe extern "C" fn register_async_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) {
303 let mut error = std::ptr::null_mut();
304 ffi::nm_secret_agent_old_register_finish(_source_object as *mut _, res, &mut error);
305 let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) };
306 let callback: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::from_raw(user_data as *mut _);
307 let callback: P = callback.into_inner();
308 callback(result);
309 }
310 let callback = register_async_trampoline::<P>;
311 unsafe {
312 ffi::nm_secret_agent_old_register_async(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _);
313 }
314 }
315
316
317 fn register_future(&self) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
318
319 Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
320 obj.register_async(
321 Some(cancellable),
322 move |res| {
323 send.resolve(res);
324 },
325 );
326 }))
327 }
328
329 /// Asynchronously ensures that all secrets inside @connection are stored to
330 /// disk.
331 /// ## `connection`
332 /// a #NMConnection
333 /// ## `callback`
334 /// a callback, to be invoked when the operation is done
335 #[doc(alias = "nm_secret_agent_old_save_secrets")]
336 fn save_secrets<P: FnOnce(&SecretAgentOld, &Connection, Option<&glib::Error>) + 'static>(&self, connection: &impl IsA<Connection>, callback: P) {
337 let callback_data: Box_<P> = Box_::new(callback);
338 unsafe extern "C" fn callback_func<P: FnOnce(&SecretAgentOld, &Connection, Option<&glib::Error>) + 'static>(agent: *mut ffi::NMSecretAgentOld, connection: *mut ffi::NMConnection, error: *mut glib::ffi::GError, user_data: glib::ffi::gpointer) {
339 let agent = from_glib_borrow(agent);
340 let connection = from_glib_borrow(connection);
341 let error: Borrowed<Option<glib::Error>> = from_glib_borrow(error);
342 let callback = Box_::from_raw(user_data as *mut P);
343 (*callback)(&agent, &connection, error.as_ref().as_ref())
344 }
345 let callback = Some(callback_func::<P> as _);
346 let super_callback0: Box_<P> = callback_data;
347 unsafe {
348 ffi::nm_secret_agent_old_save_secrets(self.as_ref().to_glib_none().0, connection.as_ref().to_glib_none().0, callback, Box_::into_raw(super_callback0) as *mut _);
349 }
350 }
351
352 /// Unregisters the #NMSecretAgentOld with the NetworkManager secret manager,
353 /// indicating to NetworkManager that the agent will no longer provide or
354 /// store secrets on behalf of this user.
355 ///
356 /// # Deprecated since 1.24
357 ///
358 /// Use nm_secret_agent_old_enable().
359 /// ## `cancellable`
360 /// a #GCancellable, or [`None`]
361 ///
362 /// # Returns
363 ///
364 /// [`true`] if unregistration was successful, [`false`] on error
365 ///
366 /// Since 1.24, registration cannot fail and is idempotent. It has
367 /// the same effect as setting [`SECRET_AGENT_OLD_AUTO_REGISTER`][crate::SECRET_AGENT_OLD_AUTO_REGISTER] to [`false`]
368 /// or nm_secret_agent_old_enable().
369 #[cfg_attr(feature = "v1_24", deprecated = "Since 1.24")]
370 #[allow(deprecated)]
371 #[doc(alias = "nm_secret_agent_old_unregister")]
372 fn unregister(&self, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
373 unsafe {
374 let mut error = std::ptr::null_mut();
375 let is_ok = ffi::nm_secret_agent_old_unregister(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
376 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
377 if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
378 }
379 }
380
381 /// Asynchronously unregisters the #NMSecretAgentOld with the NetworkManager secret
382 /// manager, indicating to NetworkManager that the agent will no longer provide
383 /// or store secrets on behalf of this user.
384 ///
385 /// Since 1.24, registration cannot fail and is idempotent. It has
386 /// the same effect as setting [`SECRET_AGENT_OLD_AUTO_REGISTER`][crate::SECRET_AGENT_OLD_AUTO_REGISTER] to [`false`]
387 /// or nm_secret_agent_old_enable().
388 ///
389 /// # Deprecated since 1.24
390 ///
391 /// Use nm_secret_agent_old_enable().
392 /// ## `cancellable`
393 /// a #GCancellable, or [`None`]
394 /// ## `callback`
395 /// callback to call when the agent is unregistered
396 #[cfg_attr(feature = "v1_24", deprecated = "Since 1.24")]
397 #[allow(deprecated)]
398 #[doc(alias = "nm_secret_agent_old_unregister_async")]
399 fn unregister_async<P: FnOnce(Result<(), glib::Error>) + 'static>(&self, cancellable: Option<&impl IsA<gio::Cancellable>>, callback: P) {
400
401 let main_context = glib::MainContext::ref_thread_default();
402 let is_main_context_owner = main_context.is_owner();
403 let has_acquired_main_context = (!is_main_context_owner)
404 .then(|| main_context.acquire().ok())
405 .flatten();
406 assert!(
407 is_main_context_owner || has_acquired_main_context.is_some(),
408 "Async operations only allowed if the thread is owning the MainContext"
409 );
410
411 let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::new(glib::thread_guard::ThreadGuard::new(callback));
412 unsafe extern "C" fn unregister_async_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) {
413 let mut error = std::ptr::null_mut();
414 ffi::nm_secret_agent_old_unregister_finish(_source_object as *mut _, res, &mut error);
415 let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) };
416 let callback: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::from_raw(user_data as *mut _);
417 let callback: P = callback.into_inner();
418 callback(result);
419 }
420 let callback = unregister_async_trampoline::<P>;
421 unsafe {
422 ffi::nm_secret_agent_old_unregister_async(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _);
423 }
424 }
425
426 #[cfg_attr(feature = "v1_24", deprecated = "Since 1.24")]
427
428 fn unregister_future(&self) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
429
430 Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
431 obj.unregister_async(
432 Some(cancellable),
433 move |res| {
434 send.resolve(res);
435 },
436 );
437 }))
438 }
439
440 /// If [`true`] (the default), the agent will always be registered when
441 /// NetworkManager is running; if NetworkManager exits and restarts, the
442 /// agent will re-register itself automatically.
443 ///
444 /// In particular, if this property is [`true`] at construct time, then the
445 /// agent will register itself with NetworkManager during
446 /// construction/initialization and initialization will only complete
447 /// after registration is completed (either successfully or unsuccessfully).
448 /// Since 1.24, a failure to register will no longer cause initialization
449 /// of #NMSecretAgentOld to fail.
450 ///
451 /// If the property is [`false`], the agent will not automatically register with
452 /// NetworkManager, and nm_secret_agent_old_enable() or
453 /// nm_secret_agent_old_register_async() must be called to register it.
454 ///
455 /// Calling nm_secret_agent_old_enable() has the same effect as setting this
456 /// property.
457 #[doc(alias = "auto-register")]
458 fn is_auto_register(&self) -> bool {
459 ObjectExt::property(self.as_ref(), "auto-register")
460 }
461
462 /// If [`true`] (the default), the agent will always be registered when
463 /// NetworkManager is running; if NetworkManager exits and restarts, the
464 /// agent will re-register itself automatically.
465 ///
466 /// In particular, if this property is [`true`] at construct time, then the
467 /// agent will register itself with NetworkManager during
468 /// construction/initialization and initialization will only complete
469 /// after registration is completed (either successfully or unsuccessfully).
470 /// Since 1.24, a failure to register will no longer cause initialization
471 /// of #NMSecretAgentOld to fail.
472 ///
473 /// If the property is [`false`], the agent will not automatically register with
474 /// NetworkManager, and nm_secret_agent_old_enable() or
475 /// nm_secret_agent_old_register_async() must be called to register it.
476 ///
477 /// Calling nm_secret_agent_old_enable() has the same effect as setting this
478 /// property.
479 #[doc(alias = "auto-register")]
480 fn set_auto_register(&self, auto_register: bool) {
481 ObjectExt::set_property(self.as_ref(),"auto-register", auto_register)
482 }
483
484 /// A bitfield of `NMSecretAgentCapabilities`.
485 ///
486 /// Changing this property is possible at any time. In case the secret
487 /// agent is currently registered, this will cause a re-registration.
488 fn capabilities(&self) -> SecretAgentCapabilities {
489 ObjectExt::property(self.as_ref(), "capabilities")
490 }
491
492 /// A bitfield of `NMSecretAgentCapabilities`.
493 ///
494 /// Changing this property is possible at any time. In case the secret
495 /// agent is currently registered, this will cause a re-registration.
496 fn set_capabilities(&self, capabilities: SecretAgentCapabilities) {
497 ObjectExt::set_property(self.as_ref(),"capabilities", capabilities)
498 }
499
500 /// Identifies this agent; only one agent in each user session may use the
501 /// same identifier. Identifier formatting follows the same rules as
502 /// D-Bus bus names with the exception that the ':' character is not
503 /// allowed. The valid set of characters is "[A-Z][a-z][0-9]_-." and the
504 /// identifier is limited in length to 255 characters with a minimum
505 /// of 3 characters. An example valid identifier is 'org.gnome.nm-applet'
506 /// (without quotes).
507 fn identifier(&self) -> Option<glib::GString> {
508 ObjectExt::property(self.as_ref(), "identifier")
509 }
510
511 #[doc(alias = "auto-register")]
512 fn connect_auto_register_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
513 unsafe extern "C" fn notify_auto_register_trampoline<P: IsA<SecretAgentOld>, F: Fn(&P) + 'static>(this: *mut ffi::NMSecretAgentOld, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
514 let f: &F = &*(f as *const F);
515 f(SecretAgentOld::from_glib_borrow(this).unsafe_cast_ref())
516 }
517 unsafe {
518 let f: Box_<F> = Box_::new(f);
519 connect_raw(self.as_ptr() as *mut _, c"notify::auto-register".as_ptr() as *const _,
520 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_auto_register_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
521 }
522 }
523
524 #[doc(alias = "capabilities")]
525 fn connect_capabilities_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
526 unsafe extern "C" fn notify_capabilities_trampoline<P: IsA<SecretAgentOld>, F: Fn(&P) + 'static>(this: *mut ffi::NMSecretAgentOld, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
527 let f: &F = &*(f as *const F);
528 f(SecretAgentOld::from_glib_borrow(this).unsafe_cast_ref())
529 }
530 unsafe {
531 let f: Box_<F> = Box_::new(f);
532 connect_raw(self.as_ptr() as *mut _, c"notify::capabilities".as_ptr() as *const _,
533 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_capabilities_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
534 }
535 }
536
537 #[doc(alias = "registered")]
538 fn connect_registered_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
539 unsafe extern "C" fn notify_registered_trampoline<P: IsA<SecretAgentOld>, F: Fn(&P) + 'static>(this: *mut ffi::NMSecretAgentOld, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
540 let f: &F = &*(f as *const F);
541 f(SecretAgentOld::from_glib_borrow(this).unsafe_cast_ref())
542 }
543 unsafe {
544 let f: Box_<F> = Box_::new(f);
545 connect_raw(self.as_ptr() as *mut _, c"notify::registered".as_ptr() as *const _,
546 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_registered_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
547 }
548 }
549}
550
551impl<O: IsA<SecretAgentOld>> SecretAgentOldExt for O {}