gstreamer_pbutils/auto/
install_plugins_context.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::ffi;
7use glib::translate::*;
8
9glib::wrapper! {
10    /// Opaque context structure for the plugin installation. Use the provided
11    /// API to set details on it.
12    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
13    pub struct InstallPluginsContext(Boxed<ffi::GstInstallPluginsContext>);
14
15    match fn {
16        copy => |ptr| ffi::gst_install_plugins_context_copy(mut_override(ptr)),
17        free => |ptr| ffi::gst_install_plugins_context_free(ptr),
18        type_ => || ffi::gst_install_plugins_context_get_type(),
19    }
20}
21
22impl InstallPluginsContext {
23    /// Creates a new [`InstallPluginsContext`][crate::InstallPluginsContext].
24    ///
25    /// # Returns
26    ///
27    /// a new [`InstallPluginsContext`][crate::InstallPluginsContext]. Free with
28    /// `gst_install_plugins_context_free()` when no longer needed
29    #[doc(alias = "gst_install_plugins_context_new")]
30    pub fn new() -> InstallPluginsContext {
31        assert_initialized_main_thread!();
32        unsafe { from_glib_full(ffi::gst_install_plugins_context_new()) }
33    }
34
35    /// This function is used to tell the external installer process whether it
36    /// should ask for confirmation or not before searching for missing plugins.
37    ///
38    /// If set, this option will be passed to the installer via a
39    /// --interaction=[show-confirm-search|hide-confirm-search] command line option.
40    /// ## `confirm_search`
41    /// whether to ask for confirmation before searching for plugins
42    #[doc(alias = "gst_install_plugins_context_set_confirm_search")]
43    pub fn set_confirm_search(&mut self, confirm_search: bool) {
44        unsafe {
45            ffi::gst_install_plugins_context_set_confirm_search(
46                self.to_glib_none_mut().0,
47                confirm_search.into_glib(),
48            );
49        }
50    }
51
52    /// This function is used to pass the calling application's desktop file ID to
53    /// the external installer process.
54    ///
55    /// A desktop file ID is the basename of the desktop file, including the
56    /// .desktop extension.
57    ///
58    /// If set, the desktop file ID will be passed to the installer via a
59    /// --desktop-id= command line option.
60    /// ## `desktop_id`
61    /// the desktop file ID of the calling application
62    #[doc(alias = "gst_install_plugins_context_set_desktop_id")]
63    pub fn set_desktop_id(&mut self, desktop_id: &str) {
64        unsafe {
65            ffi::gst_install_plugins_context_set_desktop_id(
66                self.to_glib_none_mut().0,
67                desktop_id.to_glib_none().0,
68            );
69        }
70    }
71
72    /// Sets the startup notification ID for the launched process.
73    ///
74    /// This is typically used to to pass the current X11 event timestamp to the
75    /// external installer process.
76    ///
77    /// Startup notification IDs are defined in the
78    /// [FreeDesktop.Org Startup Notifications standard](http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt).
79    ///
80    /// If set, the ID will be passed to the installer via a
81    /// --startup-notification-id= command line option.
82    ///
83    /// GTK+/GNOME applications should be able to create a startup notification ID
84    /// like this:
85    ///
86    /// ```text
87    ///   timestamp = gtk_get_current_event_time ();
88    ///   startup_id = g_strdup_printf ("_TIME%u", timestamp);
89    /// ...
90    /// ```
91    /// ## `startup_id`
92    /// the startup notification ID
93    #[doc(alias = "gst_install_plugins_context_set_startup_notification_id")]
94    pub fn set_startup_notification_id(&mut self, startup_id: &str) {
95        unsafe {
96            ffi::gst_install_plugins_context_set_startup_notification_id(
97                self.to_glib_none_mut().0,
98                startup_id.to_glib_none().0,
99            );
100        }
101    }
102
103    /// This function is for X11-based applications (such as most Gtk/Qt
104    /// applications on linux/unix) only. You can use it to tell the external
105    /// installer the XID of your main application window. That way the installer
106    /// can make its own window transient to your application window during the
107    /// installation.
108    ///
109    /// If set, the XID will be passed to the installer via a --transient-for=XID
110    /// command line option.
111    ///
112    /// Gtk+/Gnome application should be able to obtain the XID of the top-level
113    /// window like this:
114    ///
115    /// ```text
116    /// ##include <gtk/gtk.h>
117    /// ##ifdef GDK_WINDOWING_X11
118    /// ##include <gdk/gdkx.h>
119    /// ##endif
120    /// ...
121    /// ##ifdef GDK_WINDOWING_X11
122    ///   xid = GDK_WINDOW_XWINDOW (GTK_WIDGET (application_window)->window);
123    /// ##endif
124    /// ...
125    /// ```
126    /// ## `xid`
127    /// the XWindow ID (XID) of the top-level application
128    #[doc(alias = "gst_install_plugins_context_set_xid")]
129    pub fn set_xid(&mut self, xid: u32) {
130        unsafe {
131            ffi::gst_install_plugins_context_set_xid(self.to_glib_none_mut().0, xid);
132        }
133    }
134}
135
136impl Default for InstallPluginsContext {
137    fn default() -> Self {
138        Self::new()
139    }
140}
141
142unsafe impl Send for InstallPluginsContext {}
143unsafe impl Sync for InstallPluginsContext {}