pub trait AppInfoExt: IsA<AppInfo> + 'static {
Show 23 methods
// Provided methods
fn add_supports_type(&self, content_type: &str) -> Result<(), Error> { ... }
fn can_delete(&self) -> bool { ... }
fn can_remove_supports_type(&self) -> bool { ... }
fn delete(&self) -> bool { ... }
fn dup(&self) -> AppInfo { ... }
fn equal(&self, appinfo2: &impl IsA<AppInfo>) -> bool { ... }
fn commandline(&self) -> Option<PathBuf> { ... }
fn description(&self) -> Option<GString> { ... }
fn display_name(&self) -> GString { ... }
fn executable(&self) -> PathBuf { ... }
fn icon(&self) -> Option<Icon> { ... }
fn id(&self) -> Option<GString> { ... }
fn name(&self) -> GString { ... }
fn supported_types(&self) -> Vec<GString> { ... }
fn launch(
&self,
files: &[File],
context: Option<&impl IsA<AppLaunchContext>>,
) -> Result<(), Error> { ... }
fn launch_uris(
&self,
uris: &[&str],
context: Option<&impl IsA<AppLaunchContext>>,
) -> Result<(), Error> { ... }
fn remove_supports_type(&self, content_type: &str) -> Result<(), Error> { ... }
fn set_as_default_for_extension(
&self,
extension: impl AsRef<Path>,
) -> Result<(), Error> { ... }
fn set_as_default_for_type(&self, content_type: &str) -> Result<(), Error> { ... }
fn set_as_last_used_for_type(&self, content_type: &str) -> Result<(), Error> { ... }
fn should_show(&self) -> bool { ... }
fn supports_files(&self) -> bool { ... }
fn supports_uris(&self) -> bool { ... }
}
Expand description
Provided Methods§
Sourcefn can_delete(&self) -> bool
fn can_delete(&self) -> bool
Sourcefn can_remove_supports_type(&self) -> bool
fn can_remove_supports_type(&self) -> bool
Checks if a supported content type can be removed from an application.
§Returns
TRUE
if it is possible to remove supported content types from a
given @self, FALSE
if not.
Sourcefn delete(&self) -> bool
fn delete(&self) -> bool
Tries to delete a AppInfo
.
On some platforms, there may be a difference between user-defined
AppInfo
s which can be deleted, and system-wide ones which cannot.
See can_delete()
.
§Returns
TRUE
if @self has been deleted
fn equal(&self, appinfo2: &impl IsA<AppInfo>) -> bool
Sourcefn commandline(&self) -> Option<PathBuf>
fn commandline(&self) -> Option<PathBuf>
Gets the commandline with which the application will be started.
§Returns
a string containing the @self’s
commandline, or NULL
if this information is not available
Sourcefn description(&self) -> Option<GString>
fn description(&self) -> Option<GString>
Gets a human-readable description of an installed application.
§Returns
a string containing a description of the
application @self, or NULL
if none.
Sourcefn display_name(&self) -> GString
fn display_name(&self) -> GString
Gets the display name of the application. The display name is often more descriptive to the user than the name itself.
§Returns
the display name of the application for @self, or the name if no display name is available.
Sourcefn executable(&self) -> PathBuf
fn executable(&self) -> PathBuf
Gets the executable’s name for the installed application.
This is intended to be used for debugging or labelling what program is going
to be run. To launch the executable, use launch()
and related
functions, rather than spawning the return value from this function.
§Returns
a string containing the @self’s application binaries name
Sourcefn id(&self) -> Option<GString>
fn id(&self) -> Option<GString>
Gets the ID of an application. An id is a string that identifies the application. The exact format of the id is platform dependent. For instance, on Unix this is the desktop file id from the xdg menu specification.
Note that the returned ID may be NULL
, depending on how the @self has
been constructed.
§Returns
a string containing the application’s ID.
Sourcefn supported_types(&self) -> Vec<GString>
fn supported_types(&self) -> Vec<GString>
Retrieves the list of content types that @app_info claims to support.
If this information is not provided by the environment, this function
will return NULL
.
This function does not take in consideration associations added with
add_supports_type()
, but only those exported directly by
the application.
§Returns
a list of content types.
Sourcefn launch(
&self,
files: &[File],
context: Option<&impl IsA<AppLaunchContext>>,
) -> Result<(), Error>
fn launch( &self, files: &[File], context: Option<&impl IsA<AppLaunchContext>>, ) -> Result<(), Error>
Launches the application. Passes @files to the launched application as arguments, using the optional @context to get information about the details of the launcher (like what screen it is on). On error, @error will be set accordingly.
To launch the application without arguments pass a NULL
@files list.
Note that even if the launch is successful the application launched can fail to start if it runs into problems during startup. There is no way to detect this.
Some URIs can be changed when passed through a GFile (for instance
unsupported URIs with strange formats like mailto:), so if you have
a textual URI you want to pass in as argument, consider using
launch_uris()
instead.
The launched application inherits the environment of the launching
process, but it can be modified with AppLaunchContextExt::setenv()
and AppLaunchContextExt::unsetenv()
.
On UNIX, this function sets the GIO_LAUNCHED_DESKTOP_FILE
environment variable with the path of the launched desktop file and
GIO_LAUNCHED_DESKTOP_FILE_PID
to the process id of the launched
process. This can be used to ignore GIO_LAUNCHED_DESKTOP_FILE
,
should it be inherited by further processes. The DISPLAY
,
XDG_ACTIVATION_TOKEN
and DESKTOP_STARTUP_ID
environment
variables are also set, based on information provided in @context.
§files
a list of File
objects
§context
the launch context
§Returns
TRUE
on successful launch, FALSE
otherwise.
Sourcefn launch_uris(
&self,
uris: &[&str],
context: Option<&impl IsA<AppLaunchContext>>,
) -> Result<(), Error>
fn launch_uris( &self, uris: &[&str], context: Option<&impl IsA<AppLaunchContext>>, ) -> Result<(), Error>
Launches the application. This passes the @uris to the launched application as arguments, using the optional @context to get information about the details of the launcher (like what screen it is on). On error, @error will be set accordingly. If the application only supports one URI per invocation as part of their command-line, multiple instances of the application will be spawned.
To launch the application without arguments pass a NULL
@uris list.
Note that even if the launch is successful the application launched can fail to start if it runs into problems during startup. There is no way to detect this.
§uris
a list of URIs to launch.
§context
the launch context
§Returns
TRUE
on successful launch, FALSE
otherwise.
Sourcefn set_as_last_used_for_type(&self, content_type: &str) -> Result<(), Error>
fn set_as_last_used_for_type(&self, content_type: &str) -> Result<(), Error>
Sets the application as the last used application for a given type. This
will make the application appear as first in the list returned by
AppInfo::recommended_for_type()
, regardless of the default
application for that content type.
§content_type
the content type.
§Returns
TRUE
on success, FALSE
on error.
Sourcefn should_show(&self) -> bool
fn should_show(&self) -> bool
Checks if the application info should be shown in menus that list available applications.
§Returns
TRUE
if the @self should be shown, FALSE
otherwise.
Sourcefn supports_files(&self) -> bool
fn supports_files(&self) -> bool
Sourcefn supports_uris(&self) -> bool
fn supports_uris(&self) -> bool
Checks if the application supports reading files and directories from URIs.
§Returns
TRUE
if the @self supports URIs.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.