gio_unix/auto/desktop_app_info.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// DO NOT EDIT
4
5use crate::ffi;
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// `GDesktopAppInfo` is an implementation of [`gio::AppInfo`][crate::gio::AppInfo] based on
10 /// desktop files.
11 ///
12 /// Note that `<gio/gdesktopappinfo.h>` belongs to the UNIX-specific
13 /// GIO interfaces, thus you have to use the `gio-unix-2.0.pc` pkg-config
14 /// file or the `GioUnix-2.0` GIR namespace when using it.
15 ///
16 /// ## Properties
17 ///
18 ///
19 /// #### `filename`
20 /// The origin filename of this [`DesktopAppInfo`][crate::DesktopAppInfo]
21 ///
22 /// Readable | Writable | Construct Only
23 ///
24 /// # Implements
25 ///
26 /// [`trait@gio::prelude::AppInfoExt`], [`DesktopAppInfoExtManual`][trait@crate::prelude::DesktopAppInfoExtManual]
27 #[doc(alias = "GDesktopAppInfo")]
28 pub struct DesktopAppInfo(Object<ffi::GDesktopAppInfo, ffi::GDesktopAppInfoClass>) @implements gio::AppInfo;
29
30 match fn {
31 type_ => || ffi::g_desktop_app_info_get_type(),
32 }
33}
34
35impl DesktopAppInfo {
36 /// Creates a new [`DesktopAppInfo`][crate::DesktopAppInfo] based on a desktop file ID.
37 ///
38 /// A desktop file ID is the basename of the desktop file, including the
39 /// `.desktop` extension. GIO is looking for a desktop file with this name
40 /// in the `applications` subdirectories of the XDG
41 /// data directories (i.e. the directories specified in the `XDG_DATA_HOME`
42 /// and `XDG_DATA_DIRS` environment variables). GIO also supports the
43 /// prefix-to-subdirectory mapping that is described in the
44 /// [Menu Spec](http://standards.freedesktop.org/menu-spec/latest/)
45 /// (i.e. a desktop ID of `kde-foo.desktop` will match
46 /// `/usr/share/applications/kde/foo.desktop`).
47 /// ## `desktop_id`
48 /// the desktop file ID
49 ///
50 /// # Returns
51 ///
52 /// a new [`DesktopAppInfo`][crate::DesktopAppInfo], or `NULL` if no
53 /// desktop file with that ID exists.
54 #[doc(alias = "g_desktop_app_info_new")]
55 pub fn new(desktop_id: &str) -> Option<DesktopAppInfo> {
56 unsafe { from_glib_full(ffi::g_desktop_app_info_new(desktop_id.to_glib_none().0)) }
57 }
58
59 /// Creates a new [`DesktopAppInfo`][crate::DesktopAppInfo].
60 /// ## `filename`
61 /// the path of a desktop file, in the GLib
62 /// filename encoding
63 ///
64 /// # Returns
65 ///
66 /// a new [`DesktopAppInfo`][crate::DesktopAppInfo] or `NULL` on error.
67 #[doc(alias = "g_desktop_app_info_new_from_filename")]
68 #[doc(alias = "new_from_filename")]
69 pub fn from_filename(filename: impl AsRef<std::path::Path>) -> Option<DesktopAppInfo> {
70 unsafe {
71 from_glib_full(ffi::g_desktop_app_info_new_from_filename(
72 filename.as_ref().to_glib_none().0,
73 ))
74 }
75 }
76
77 /// Creates a new [`DesktopAppInfo`][crate::DesktopAppInfo].
78 /// ## `key_file`
79 /// an opened [type@GLib.KeyFile]
80 ///
81 /// # Returns
82 ///
83 /// a new [`DesktopAppInfo`][crate::DesktopAppInfo] or `NULL` on error.
84 #[doc(alias = "g_desktop_app_info_new_from_keyfile")]
85 #[doc(alias = "new_from_keyfile")]
86 pub fn from_keyfile(key_file: &glib::KeyFile) -> Option<DesktopAppInfo> {
87 unsafe {
88 from_glib_full(ffi::g_desktop_app_info_new_from_keyfile(
89 key_file.to_glib_none().0,
90 ))
91 }
92 }
93
94 /// Gets the user-visible display name of the
95 /// [‘additional application actions’](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s11.html)
96 /// specified by @action_name.
97 ///
98 /// This corresponds to the `Name` key within the keyfile group for the
99 /// action.
100 /// ## `action_name`
101 /// the name of the action as from
102 /// [`list_actions()`][Self::list_actions()]
103 ///
104 /// # Returns
105 ///
106 /// the locale-specific action name
107 #[doc(alias = "g_desktop_app_info_get_action_name")]
108 #[doc(alias = "get_action_name")]
109 pub fn action_name(&self, action_name: &str) -> glib::GString {
110 unsafe {
111 from_glib_full(ffi::g_desktop_app_info_get_action_name(
112 self.to_glib_none().0,
113 action_name.to_glib_none().0,
114 ))
115 }
116 }
117
118 /// Looks up a boolean value in the keyfile backing @self.
119 ///
120 /// The @key is looked up in the `Desktop Entry` group.
121 /// ## `key`
122 /// the key to look up
123 ///
124 /// # Returns
125 ///
126 /// the boolean value, or `FALSE` if the key is not found
127 #[doc(alias = "g_desktop_app_info_get_boolean")]
128 #[doc(alias = "get_boolean")]
129 pub fn boolean(&self, key: &str) -> bool {
130 unsafe {
131 from_glib(ffi::g_desktop_app_info_get_boolean(
132 self.to_glib_none().0,
133 key.to_glib_none().0,
134 ))
135 }
136 }
137
138 /// Gets the categories from the desktop file.
139 ///
140 /// # Returns
141 ///
142 /// The unparsed
143 /// [`Categories` key](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-categories)
144 /// from the desktop file;
145 /// i.e. no attempt is made to split it by `;` or validate it.
146 #[doc(alias = "g_desktop_app_info_get_categories")]
147 #[doc(alias = "get_categories")]
148 pub fn categories(&self) -> Option<glib::GString> {
149 unsafe {
150 from_glib_none(ffi::g_desktop_app_info_get_categories(
151 self.to_glib_none().0,
152 ))
153 }
154 }
155
156 /// When @self was created from a known filename, return it.
157 ///
158 /// In some situations such as a [`DesktopAppInfo`][crate::DesktopAppInfo] returned
159 /// from [`from_keyfile()`][Self::from_keyfile()], this function
160 /// will return `NULL`.
161 ///
162 /// # Returns
163 ///
164 /// The full path to the file for @self,
165 /// or `NULL` if not known.
166 #[doc(alias = "g_desktop_app_info_get_filename")]
167 #[doc(alias = "get_filename")]
168 pub fn filename(&self) -> Option<std::path::PathBuf> {
169 unsafe { from_glib_none(ffi::g_desktop_app_info_get_filename(self.to_glib_none().0)) }
170 }
171
172 /// Gets the generic name from the desktop file.
173 ///
174 /// # Returns
175 ///
176 /// The value of the
177 /// [`GenericName` key](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-genericname)
178 #[doc(alias = "g_desktop_app_info_get_generic_name")]
179 #[doc(alias = "get_generic_name")]
180 pub fn generic_name(&self) -> Option<glib::GString> {
181 unsafe {
182 from_glib_none(ffi::g_desktop_app_info_get_generic_name(
183 self.to_glib_none().0,
184 ))
185 }
186 }
187
188 /// Gets the implemented intents from the desktop file.
189 ///
190 /// As per the specification, this is the list of intents that are
191 /// explicitly listed in the [`Implements` key](https://specifications.freedesktop.org/desktop-entry/latest/recognized-keys.html) of the `Desktop Entry` group.
192 ///
193 /// # Returns
194 ///
195 /// a
196 /// list of strings, always non-`NULL`
197 #[cfg(feature = "v2_92")]
198 #[cfg_attr(docsrs, doc(cfg(feature = "v2_92")))]
199 #[doc(alias = "g_desktop_app_info_get_intents")]
200 #[doc(alias = "get_intents")]
201 pub fn intents(&self) -> Vec<glib::GString> {
202 unsafe {
203 FromGlibPtrContainer::from_glib_none(ffi::g_desktop_app_info_get_intents(
204 self.to_glib_none().0,
205 ))
206 }
207 }
208
209 /// A desktop file is hidden if the
210 /// [`Hidden` key](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-hidden)
211 /// in it is set to `True`.
212 ///
213 /// # Returns
214 ///
215 /// `TRUE` if hidden, `FALSE` otherwise.
216 #[doc(alias = "g_desktop_app_info_get_is_hidden")]
217 #[doc(alias = "get_is_hidden")]
218 pub fn is_hidden(&self) -> bool {
219 unsafe { from_glib(ffi::g_desktop_app_info_get_is_hidden(self.to_glib_none().0)) }
220 }
221
222 /// Gets the keywords from the desktop file.
223 ///
224 /// # Returns
225 ///
226 /// The value of the
227 /// [`Keywords` key](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-keywords)
228 #[doc(alias = "g_desktop_app_info_get_keywords")]
229 #[doc(alias = "get_keywords")]
230 pub fn keywords(&self) -> Vec<glib::GString> {
231 unsafe {
232 FromGlibPtrContainer::from_glib_none(ffi::g_desktop_app_info_get_keywords(
233 self.to_glib_none().0,
234 ))
235 }
236 }
237
238 /// Looks up a localized string value in the keyfile backing @self
239 /// translated to the current locale.
240 ///
241 /// The @key is looked up in the `Desktop Entry` group.
242 /// ## `key`
243 /// the key to look up
244 ///
245 /// # Returns
246 ///
247 /// a newly allocated string, or `NULL` if the key is not
248 /// found
249 #[doc(alias = "g_desktop_app_info_get_locale_string")]
250 #[doc(alias = "get_locale_string")]
251 pub fn locale_string(&self, key: &str) -> Option<glib::GString> {
252 unsafe {
253 from_glib_full(ffi::g_desktop_app_info_get_locale_string(
254 self.to_glib_none().0,
255 key.to_glib_none().0,
256 ))
257 }
258 }
259
260 /// Gets the value of the
261 /// [`NoDisplay` key](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-nodisplay)
262 /// which helps determine if the application info should be shown in menus. See
263 /// `G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY` and [`AppInfoExtManual::should_show()`][crate::gio::prelude::AppInfoExtManual::should_show()].
264 ///
265 /// # Returns
266 ///
267 /// The value of the `NoDisplay` key
268 #[doc(alias = "g_desktop_app_info_get_nodisplay")]
269 #[doc(alias = "get_nodisplay")]
270 pub fn is_nodisplay(&self) -> bool {
271 unsafe { from_glib(ffi::g_desktop_app_info_get_nodisplay(self.to_glib_none().0)) }
272 }
273
274 /// Checks if the application info should be shown in menus that list available
275 /// applications for a specific name of the desktop, based on the
276 /// [`OnlyShowIn`](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-onlyshowin)
277 /// and [`NotShowIn`](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-notshowin)
278 /// keys.
279 ///
280 /// @desktop_env should typically be given as `NULL`, in which case the
281 /// `XDG_CURRENT_DESKTOP` environment variable is consulted. If you want
282 /// to override the default mechanism then you may specify @desktop_env,
283 /// but this is not recommended.
284 ///
285 /// Note that [`AppInfoExtManual::should_show()`][crate::gio::prelude::AppInfoExtManual::should_show()] for @self will include this check
286 /// (with `NULL` for @desktop_env) as well as additional checks.
287 /// ## `desktop_env`
288 /// a string specifying a desktop name
289 ///
290 /// # Returns
291 ///
292 /// `TRUE` if the @self should be shown in @desktop_env according to the
293 /// `OnlyShowIn` and `NotShowIn` keys, `FALSE` otherwise.
294 #[doc(alias = "g_desktop_app_info_get_show_in")]
295 #[doc(alias = "get_show_in")]
296 pub fn shows_in(&self, desktop_env: Option<&str>) -> bool {
297 unsafe {
298 from_glib(ffi::g_desktop_app_info_get_show_in(
299 self.to_glib_none().0,
300 desktop_env.to_glib_none().0,
301 ))
302 }
303 }
304
305 /// Retrieves the `StartupWMClass` field from @self. This represents the
306 /// `WM_CLASS` property of the main window of the application, if launched
307 /// through @self.
308 ///
309 /// # Returns
310 ///
311 /// the startup WM class, or `NULL` if none
312 /// is set in the desktop file.
313 #[doc(alias = "g_desktop_app_info_get_startup_wm_class")]
314 #[doc(alias = "get_startup_wm_class")]
315 pub fn startup_wm_class(&self) -> Option<glib::GString> {
316 unsafe {
317 from_glib_none(ffi::g_desktop_app_info_get_startup_wm_class(
318 self.to_glib_none().0,
319 ))
320 }
321 }
322
323 /// Looks up a string value in the keyfile backing @self.
324 ///
325 /// The @key is looked up in the `Desktop Entry` group.
326 /// ## `key`
327 /// the key to look up
328 ///
329 /// # Returns
330 ///
331 /// a newly allocated string, or `NULL` if the key is not
332 /// found
333 #[doc(alias = "g_desktop_app_info_get_string")]
334 #[doc(alias = "get_string")]
335 pub fn string(&self, key: &str) -> Option<glib::GString> {
336 unsafe {
337 from_glib_full(ffi::g_desktop_app_info_get_string(
338 self.to_glib_none().0,
339 key.to_glib_none().0,
340 ))
341 }
342 }
343
344 /// Looks up a string list value in the keyfile backing @self.
345 ///
346 /// The @key is looked up in the `Desktop Entry` group.
347 /// ## `key`
348 /// the key to look up
349 ///
350 /// # Returns
351 ///
352 ///
353 /// a `NULL`-terminated string array or `NULL` if the specified
354 /// key cannot be found. The array should be freed with `strfreev()`.
355 #[cfg(feature = "v2_60")]
356 #[cfg_attr(docsrs, doc(cfg(feature = "v2_60")))]
357 #[doc(alias = "g_desktop_app_info_get_string_list")]
358 #[doc(alias = "get_string_list")]
359 pub fn string_list(&self, key: &str) -> Vec<glib::GString> {
360 unsafe {
361 let mut length = std::mem::MaybeUninit::uninit();
362 let ret = FromGlibContainer::from_glib_full_num(
363 ffi::g_desktop_app_info_get_string_list(
364 self.to_glib_none().0,
365 key.to_glib_none().0,
366 length.as_mut_ptr(),
367 ),
368 length.assume_init() as _,
369 );
370 ret
371 }
372 }
373
374 /// Returns whether @intent is implemented by the application.
375 ///
376 /// As per specification, an intent implemented by the application is listed in
377 /// the [`Implements` key](https://specifications.freedesktop.org/desktop-entry/latest/recognized-keys.html) of the `Desktop Entry` group.
378 /// ## `intent`
379 /// the intent to look up
380 ///
381 /// # Returns
382 ///
383 /// true if the @intent is implemented by the application
384 #[cfg(feature = "v2_92")]
385 #[cfg_attr(docsrs, doc(cfg(feature = "v2_92")))]
386 #[doc(alias = "g_desktop_app_info_has_intent")]
387 pub fn has_intent(&self, intent: &str) -> bool {
388 unsafe {
389 from_glib(ffi::g_desktop_app_info_has_intent(
390 self.to_glib_none().0,
391 intent.to_glib_none().0,
392 ))
393 }
394 }
395
396 /// Returns whether @key exists in the `Desktop Entry` group
397 /// of the keyfile backing @self.
398 /// ## `key`
399 /// the key to look up
400 ///
401 /// # Returns
402 ///
403 /// `TRUE` if the @key exists
404 #[doc(alias = "g_desktop_app_info_has_key")]
405 pub fn has_key(&self, key: &str) -> bool {
406 unsafe {
407 from_glib(ffi::g_desktop_app_info_has_key(
408 self.to_glib_none().0,
409 key.to_glib_none().0,
410 ))
411 }
412 }
413
414 /// Activates the named application action.
415 ///
416 /// You may only call this function on action names that were
417 /// returned from [`list_actions()`][Self::list_actions()].
418 ///
419 /// Note that if the main entry of the desktop file indicates that the
420 /// application supports startup notification, and @launch_context is
421 /// non-`NULL`, then startup notification will be used when activating the
422 /// action (and as such, invocation of the action on the receiving side
423 /// must signal the end of startup notification when it is completed).
424 /// This is the expected behaviour of applications declaring additional
425 /// actions, as per the
426 /// [desktop file specification](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s11.html).
427 ///
428 /// As with [`AppInfoExtManual::launch()`][crate::gio::prelude::AppInfoExtManual::launch()] there is no way to detect failures that
429 /// occur while using this function.
430 /// ## `action_name`
431 /// the name of the action as from
432 /// [`list_actions()`][Self::list_actions()]
433 /// ## `launch_context`
434 /// a [`gio::AppLaunchContext`][crate::gio::AppLaunchContext]
435 #[doc(alias = "g_desktop_app_info_launch_action")]
436 pub fn launch_action(
437 &self,
438 action_name: &str,
439 launch_context: Option<&impl IsA<gio::AppLaunchContext>>,
440 ) {
441 unsafe {
442 ffi::g_desktop_app_info_launch_action(
443 self.to_glib_none().0,
444 action_name.to_glib_none().0,
445 launch_context.map(|p| p.as_ref()).to_glib_none().0,
446 );
447 }
448 }
449
450 //#[doc(alias = "g_desktop_app_info_launch_uris_as_manager")]
451 //pub fn launch_uris_as_manager(&self, uris: &[&str], launch_context: Option<&impl IsA<gio::AppLaunchContext>>, spawn_flags: glib::SpawnFlags, user_setup: Option<Box_<dyn FnOnce() + 'static>>, pid_callback: /*Unimplemented*/FnMut(&DesktopAppInfo, /*Ignored*/glib::Pid), pid_callback_data: /*Unimplemented*/Option<Basic: Pointer>) -> Result<(), glib::Error> {
452 // unsafe { TODO: call ffi:g_desktop_app_info_launch_uris_as_manager() }
453 //}
454
455 /// Returns the list of
456 /// [‘additional application actions’](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s11.html)
457 /// supported on the desktop file, as per the desktop file specification.
458 ///
459 /// As per the specification, this is the list of actions that are
460 /// explicitly listed in the `Actions` key of the `Desktop Entry` group.
461 ///
462 /// # Returns
463 ///
464 /// a
465 /// list of strings, always non-`NULL`
466 #[doc(alias = "g_desktop_app_info_list_actions")]
467 pub fn list_actions(&self) -> Vec<glib::GString> {
468 unsafe {
469 FromGlibPtrContainer::from_glib_none(ffi::g_desktop_app_info_list_actions(
470 self.to_glib_none().0,
471 ))
472 }
473 }
474
475 /// Sets the application as the default handler for an intent interface, or for
476 /// a scope of the intent interface.
477 ///
478 /// If @scope is provided, the default handler for that scope of the intent
479 /// interface will be set. Additionally, the application will be added to the
480 /// list of the default handlers for the intent interface.
481 ///
482 /// If @scope is not provided, the default handler for the intent interface will
483 /// be set to the application.
484 /// ## `interface`
485 /// the intent interface to set the app as default for
486 /// ## `scope`
487 /// an optional scope
488 ///
489 /// # Returns
490 ///
491 /// true on success; false otherwise
492 #[cfg(feature = "v2_92")]
493 #[cfg_attr(docsrs, doc(cfg(feature = "v2_92")))]
494 #[doc(alias = "g_desktop_app_info_set_as_default_for_intent")]
495 pub fn set_as_default_for_intent(
496 &self,
497 interface: &str,
498 scope: Option<&str>,
499 ) -> Result<(), glib::Error> {
500 unsafe {
501 let mut error = std::ptr::null_mut();
502 let is_ok = ffi::g_desktop_app_info_set_as_default_for_intent(
503 self.to_glib_none().0,
504 interface.to_glib_none().0,
505 scope.to_glib_none().0,
506 &mut error,
507 );
508 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
509 if error.is_null() {
510 Ok(())
511 } else {
512 Err(from_glib_full(error))
513 }
514 }
515 }
516
517 /// Gets the default [`gio::AppInfo`][crate::gio::AppInfo] that implements @interface and, if @scope
518 /// is not `NULL`, also supports @scope.
519 ///
520 /// An application implements an interface if that interface is listed in
521 /// the `Implements` line of the desktop file, as per the
522 /// [Desktop Entry Specification](https://specifications.freedesktop.org/desktop-entry/latest/interfaces.html).
523 ///
524 /// An application implements a scope of an interface, if the scope is listed in
525 /// the [`Supports` line](https://specifications.freedesktop.org/intent-apps/latest/#scopes)
526 /// of the section of the desktop file named after @interface. Scopes are specific
527 /// to each @interface and are defined in the specification which defines that intent
528 /// interface. A URI handler intent might have `https`, `http` and `ftp` as scopes,
529 /// for example.
530 ///
531 /// Application priority can be adjusted via
532 /// [`intentapps.list` files](https://specifications.freedesktop.org/intent-apps/latest/#file).
533 /// ## `interface`
534 /// the intent interface to find an app for
535 /// ## `scope`
536 /// an optional scope
537 ///
538 /// # Returns
539 ///
540 /// app info for the given @intent and @scope,
541 /// or `NULL` if not found.
542 #[cfg(feature = "v2_92")]
543 #[cfg_attr(docsrs, doc(cfg(feature = "v2_92")))]
544 #[doc(alias = "g_desktop_app_info_get_default_for_intent")]
545 #[doc(alias = "get_default_for_intent")]
546 pub fn default_for_intent(interface: &str, scope: Option<&str>) -> Option<gio::AppInfo> {
547 unsafe {
548 from_glib_full(ffi::g_desktop_app_info_get_default_for_intent(
549 interface.to_glib_none().0,
550 scope.to_glib_none().0,
551 ))
552 }
553 }
554
555 /// Gets all [`gio::AppInfo`][crate::gio::AppInfo]s that implement @interface and, if @scope is not
556 /// `NULL`, also supports @scope.
557 ///
558 /// Applications earlier in the list have higher priority.
559 ///
560 /// An application implements an interface if that interface is listed in
561 /// the `Implements` line of the desktop file, as per the
562 /// [Desktop Entry Specification](https://specifications.freedesktop.org/desktop-entry/latest/interfaces.html).
563 ///
564 /// An application implements a scope of an interface, if the scope is listed in
565 /// the [`Supports` line](https://specifications.freedesktop.org/intent-apps/latest/#scopes)
566 /// of the section of the desktop file named after @interface. Scopes are specific
567 /// to each @interface and are defined in the specification which defines that intent
568 /// interface. A URI handler intent might have `https`, `http` and `ftp` as scopes,
569 /// for example.
570 ///
571 /// Application priority can be adjusted via
572 /// [`intentapps.list` files](https://specifications.freedesktop.org/intent-apps/latest/#file).
573 ///
574 /// The list is guaranteed to be `NULL` terminated. The `NULL` terminator is not
575 /// counted in @out_n_results.
576 /// ## `interface`
577 /// the intent interface to find an app for
578 /// ## `scope`
579 /// an optional scope
580 ///
581 /// # Returns
582 ///
583 /// an array of
584 /// app infos for the given @intent and @scope, or `NULL` if none are found.
585 #[cfg(feature = "v2_92")]
586 #[cfg_attr(docsrs, doc(cfg(feature = "v2_92")))]
587 #[doc(alias = "g_desktop_app_info_get_for_intent")]
588 #[doc(alias = "get_for_intent")]
589 pub fn for_intent(interface: &str, scope: Option<&str>) -> Vec<gio::AppInfo> {
590 unsafe {
591 let mut out_n_results = std::mem::MaybeUninit::uninit();
592 let ret = FromGlibContainer::from_glib_full_num(
593 ffi::g_desktop_app_info_get_for_intent(
594 interface.to_glib_none().0,
595 scope.to_glib_none().0,
596 out_n_results.as_mut_ptr(),
597 ),
598 out_n_results.assume_init() as _,
599 );
600 ret
601 }
602 }
603
604 /// Gets all applications that implement @interface.
605 ///
606 /// An application implements an interface if that interface is listed in
607 /// the `Implements` line of the desktop file of the application.
608 /// ## `interface`
609 /// the name of the interface
610 ///
611 /// # Returns
612 ///
613 /// a list of
614 /// [`DesktopAppInfo`][crate::DesktopAppInfo] objects.
615 #[doc(alias = "g_desktop_app_info_get_implementations")]
616 #[doc(alias = "get_implementations")]
617 pub fn implementations(interface: &str) -> Vec<DesktopAppInfo> {
618 unsafe {
619 FromGlibPtrContainer::from_glib_full(ffi::g_desktop_app_info_get_implementations(
620 interface.to_glib_none().0,
621 ))
622 }
623 }
624}