[−][src]Trait gio::AppInfoExt
Required methods
fn add_supports_type(&self, content_type: &str) -> Result<(), Error>
Adds a content type to the application information to indicate the application is capable of opening files with the given content type.
content_type
a string.
Returns
true on success, false on error.
fn can_delete(&self) -> bool
Obtains the information whether the AppInfo can be deleted.
See AppInfo::delete.
Returns
true if self can be deleted
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.
fn delete(&self) -> bool
Tries to delete a AppInfo.
On some platforms, there may be a difference between user-defined
GAppInfos which can be deleted, and system-wide ones which cannot.
See AppInfo::can_delete.
Returns
true if self has been deleted
fn dup(&self) -> Option<AppInfo>
fn equal<P: IsA<AppInfo>>(&self, appinfo2: &P) -> bool
Checks if two GAppInfos are equal.
Note that the check <emphasis>may not</emphasis> compare each individual
field, and only does an identity check. In case detecting changes in the
contents is needed, program code must additionally compare relevant fields.
appinfo2
the second AppInfo.
Returns
true if self is equal to appinfo2. false otherwise.
fn get_commandline(&self) -> Option<PathBuf>
Gets the commandline with which the application will be started.
Returns
a string containing the self's commandline,
or None if this information is not available
fn get_description(&self) -> Option<GString>
Gets a human-readable description of an installed application.
Returns
a string containing a description of the
application self, or None if none.
fn get_display_name(&self) -> Option<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.
fn get_executable(&self) -> Option<PathBuf>
Gets the executable's name for the installed application.
Returns
a string containing the self's application
binaries name
fn get_icon(&self) -> Option<Icon>
Gets the icon for the application.
Returns
the default Icon for self or None
if there is no default icon.
fn get_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 None, depending on how
the self has been constructed.
Returns
a string containing the application's ID.
fn get_name(&self) -> Option<GString>
fn get_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 None.
This function does not take in consideration associations added with
AppInfo::add_supports_type, but only those exported directly by
the application.
Returns
a list of content types.
fn launch<P: IsA<AppLaunchContext>>(
&self,
files: &[File],
context: Option<&P>
) -> Result<(), Error>
&self,
files: &[File],
context: Option<&P>
) -> 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 None 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
AppInfo::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 and
DESKTOP_STARTUP_ID environment variables are also set, based
on information provided in context.
files
a glib::List of File objects
context
a AppLaunchContext or None
Returns
true on successful launch, false otherwise.
fn launch_uris<P: IsA<AppLaunchContext>>(
&self,
uris: &[&str],
context: Option<&P>
) -> Result<(), Error>
&self,
uris: &[&str],
context: Option<&P>
) -> 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.
To launch the application without arguments pass a None 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 glib::List containing URIs to launch.
context
a AppLaunchContext or None
Returns
true on successful launch, false otherwise.
fn remove_supports_type(&self, content_type: &str) -> Result<(), Error>
Removes a supported type from an application, if possible.
content_type
a string.
Returns
true on success, false on error.
fn set_as_default_for_extension<P: AsRef<Path>>(
&self,
extension: P
) -> Result<(), Error>
&self,
extension: P
) -> Result<(), Error>
Sets the application as the default handler for the given file extension.
extension
a string containing the file extension (without the dot).
Returns
true on success, false on error.
fn set_as_default_for_type(&self, content_type: &str) -> Result<(), Error>
Sets the application as the default handler for a given type.
content_type
the content type.
Returns
true on success, false on 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::get_recommended_for_type, regardless of the default
application for that content type.
content_type
the content type.
Returns
true on success, false on error.
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.
fn supports_files(&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.
Implementors
impl<O: IsA<AppInfo>> AppInfoExt for O[src]
fn add_supports_type(&self, content_type: &str) -> Result<(), Error>[src]
fn can_delete(&self) -> bool[src]
fn can_remove_supports_type(&self) -> bool[src]
fn delete(&self) -> bool[src]
fn dup(&self) -> Option<AppInfo>[src]
fn equal<P: IsA<AppInfo>>(&self, appinfo2: &P) -> bool[src]
fn get_commandline(&self) -> Option<PathBuf>[src]
fn get_description(&self) -> Option<GString>[src]
fn get_display_name(&self) -> Option<GString>[src]
fn get_executable(&self) -> Option<PathBuf>[src]
fn get_icon(&self) -> Option<Icon>[src]
fn get_id(&self) -> Option<GString>[src]
fn get_name(&self) -> Option<GString>[src]
fn get_supported_types(&self) -> Vec<GString>[src]
fn launch<P: IsA<AppLaunchContext>>(
&self,
files: &[File],
context: Option<&P>
) -> Result<(), Error>[src]
&self,
files: &[File],
context: Option<&P>
) -> Result<(), Error>
fn launch_uris<P: IsA<AppLaunchContext>>(
&self,
uris: &[&str],
context: Option<&P>
) -> Result<(), Error>[src]
&self,
uris: &[&str],
context: Option<&P>
) -> Result<(), Error>
fn remove_supports_type(&self, content_type: &str) -> Result<(), Error>[src]
fn set_as_default_for_extension<P: AsRef<Path>>(
&self,
extension: P
) -> Result<(), Error>[src]
&self,
extension: P
) -> Result<(), Error>