nm_rs/auto/simple_connection.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
6use crate::{Connection, ffi};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10 ///
11 ///
12 /// # Implements
13 ///
14 /// [`ConnectionExt`][trait@crate::prelude::ConnectionExt]
15 #[doc(alias = "NMSimpleConnection")]
16 pub struct SimpleConnection(Object<ffi::NMSimpleConnection, ffi::NMSimpleConnectionClass>) @implements Connection;
17
18 match fn {
19 type_ => || ffi::nm_simple_connection_get_type(),
20 }
21}
22
23impl SimpleConnection {
24 /// Creates a new #NMSimpleConnection object with no #NMSetting objects.
25 ///
26 /// # Returns
27 ///
28 /// the new empty #NMConnection object
29 #[doc(alias = "nm_simple_connection_new")]
30 pub fn new() -> Connection {
31 assert_initialized_main_thread!();
32 unsafe { from_glib_full(ffi::nm_simple_connection_new()) }
33 }
34
35 /// Clones an #NMConnection as an #NMSimpleConnection.
36 /// ## `connection`
37 /// the #NMConnection to clone
38 ///
39 /// # Returns
40 ///
41 /// a new #NMConnection containing the same settings
42 /// and properties as the source #NMConnection
43 #[doc(alias = "nm_simple_connection_new_clone")]
44 pub fn new_clone(connection: &impl IsA<Connection>) -> Connection {
45 skip_assert_initialized!();
46 unsafe {
47 from_glib_full(ffi::nm_simple_connection_new_clone(
48 connection.as_ref().to_glib_none().0,
49 ))
50 }
51 }
52
53 //#[doc(alias = "nm_simple_connection_new_from_dbus")]
54 //pub fn new_from_dbus(dict: /*Ignored*/&glib::Variant) -> Result<Connection, glib::Error> {
55 // unsafe { TODO: call ffi:nm_simple_connection_new_from_dbus() }
56 //}
57}
58
59impl Default for SimpleConnection {
60 fn default() -> Self {
61 Self::new()
62 .downcast()
63 .expect("Casting from SimpleConnection should not panic.")
64 }
65}