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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT

use crate::ffi;
use glib::translate::*;

glib::wrapper! {
    /// Opaque context structure for the plugin installation. Use the provided
    /// API to set details on it.
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct InstallPluginsContext(Boxed<ffi::GstInstallPluginsContext>);

    match fn {
        copy => |ptr| ffi::gst_install_plugins_context_copy(mut_override(ptr)),
        free => |ptr| ffi::gst_install_plugins_context_free(ptr),
        type_ => || ffi::gst_install_plugins_context_get_type(),
    }
}

impl InstallPluginsContext {
    /// Creates a new [`InstallPluginsContext`][crate::InstallPluginsContext].
    ///
    /// # Returns
    ///
    /// a new [`InstallPluginsContext`][crate::InstallPluginsContext]. Free with
    /// `gst_install_plugins_context_free()` when no longer needed
    #[doc(alias = "gst_install_plugins_context_new")]
    pub fn new() -> InstallPluginsContext {
        assert_initialized_main_thread!();
        unsafe { from_glib_full(ffi::gst_install_plugins_context_new()) }
    }

    /// This function is used to tell the external installer process whether it
    /// should ask for confirmation or not before searching for missing plugins.
    ///
    /// If set, this option will be passed to the installer via a
    /// --interaction=[show-confirm-search|hide-confirm-search] command line option.
    /// ## `confirm_search`
    /// whether to ask for confirmation before searching for plugins
    #[doc(alias = "gst_install_plugins_context_set_confirm_search")]
    pub fn set_confirm_search(&mut self, confirm_search: bool) {
        unsafe {
            ffi::gst_install_plugins_context_set_confirm_search(
                self.to_glib_none_mut().0,
                confirm_search.into_glib(),
            );
        }
    }

    /// This function is used to pass the calling application's desktop file ID to
    /// the external installer process.
    ///
    /// A desktop file ID is the basename of the desktop file, including the
    /// .desktop extension.
    ///
    /// If set, the desktop file ID will be passed to the installer via a
    /// --desktop-id= command line option.
    /// ## `desktop_id`
    /// the desktop file ID of the calling application
    #[doc(alias = "gst_install_plugins_context_set_desktop_id")]
    pub fn set_desktop_id(&mut self, desktop_id: &str) {
        unsafe {
            ffi::gst_install_plugins_context_set_desktop_id(
                self.to_glib_none_mut().0,
                desktop_id.to_glib_none().0,
            );
        }
    }

    /// Sets the startup notification ID for the launched process.
    ///
    /// This is typically used to to pass the current X11 event timestamp to the
    /// external installer process.
    ///
    /// Startup notification IDs are defined in the
    /// [FreeDesktop.Org Startup Notifications standard](http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt).
    ///
    /// If set, the ID will be passed to the installer via a
    /// --startup-notification-id= command line option.
    ///
    /// GTK+/GNOME applications should be able to create a startup notification ID
    /// like this:
    ///
    /// ```text
    ///   timestamp = gtk_get_current_event_time ();
    ///   startup_id = g_strdup_printf ("_TIME%u", timestamp);
    /// ...
    /// ```
    /// ## `startup_id`
    /// the startup notification ID
    #[doc(alias = "gst_install_plugins_context_set_startup_notification_id")]
    pub fn set_startup_notification_id(&mut self, startup_id: &str) {
        unsafe {
            ffi::gst_install_plugins_context_set_startup_notification_id(
                self.to_glib_none_mut().0,
                startup_id.to_glib_none().0,
            );
        }
    }

    /// This function is for X11-based applications (such as most Gtk/Qt
    /// applications on linux/unix) only. You can use it to tell the external
    /// installer the XID of your main application window. That way the installer
    /// can make its own window transient to your application window during the
    /// installation.
    ///
    /// If set, the XID will be passed to the installer via a --transient-for=XID
    /// command line option.
    ///
    /// Gtk+/Gnome application should be able to obtain the XID of the top-level
    /// window like this:
    ///
    /// ```text
    /// ##include <gtk/gtk.h>
    /// ##ifdef GDK_WINDOWING_X11
    /// ##include <gdk/gdkx.h>
    /// ##endif
    /// ...
    /// ##ifdef GDK_WINDOWING_X11
    ///   xid = GDK_WINDOW_XWINDOW (GTK_WIDGET (application_window)->window);
    /// ##endif
    /// ...
    /// ```
    /// ## `xid`
    /// the XWindow ID (XID) of the top-level application
    #[doc(alias = "gst_install_plugins_context_set_xid")]
    pub fn set_xid(&mut self, xid: u32) {
        unsafe {
            ffi::gst_install_plugins_context_set_xid(self.to_glib_none_mut().0, xid);
        }
    }
}

impl Default for InstallPluginsContext {
    fn default() -> Self {
        Self::new()
    }
}

unsafe impl Send for InstallPluginsContext {}
unsafe impl Sync for InstallPluginsContext {}