[][src]Trait gio::DesktopAppInfoExt

pub trait DesktopAppInfoExt: 'static {
    fn get_action_name(&self, action_name: &str) -> Option<GString>;
fn get_boolean(&self, key: &str) -> bool;
fn get_categories(&self) -> Option<GString>;
fn get_filename(&self) -> Option<PathBuf>;
fn get_generic_name(&self) -> Option<GString>;
fn get_is_hidden(&self) -> bool;
fn get_keywords(&self) -> Vec<GString>;
fn get_nodisplay(&self) -> bool;
fn get_show_in(&self, desktop_env: Option<&str>) -> bool;
fn get_startup_wm_class(&self) -> Option<GString>;
fn get_string(&self, key: &str) -> Option<GString>;
fn has_key(&self, key: &str) -> bool;
fn launch_action<P: IsA<AppLaunchContext>>(
        &self,
        action_name: &str,
        launch_context: Option<&P>
    );
fn launch_uris_as_manager<P: IsA<AppLaunchContext>>(
        &self,
        uris: &[&str],
        launch_context: Option<&P>,
        spawn_flags: SpawnFlags,
        user_setup: Option<Box_<dyn FnOnce() + 'static>>,
        pid_callback: Option<&mut dyn FnMut(&DesktopAppInfo, Pid)>
    ) -> Result<(), Error>;
fn list_actions(&self) -> Vec<GString>; }

Trait containing all DesktopAppInfo methods.

Implementors

DesktopAppInfo

Required methods

fn get_action_name(&self, action_name: &str) -> Option<GString>

Gets the user-visible display name of the "additional application action" specified by action_name.

This corresponds to the "Name" key within the keyfile group for the action.

action_name

the name of the action as from DesktopAppInfoExt::list_actions

Returns

the locale-specific action name

fn get_boolean(&self, key: &str) -> bool

Looks up a boolean value in the keyfile backing self.

The key is looked up in the "Desktop Entry" group.

key

the key to look up

Returns

the boolean value, or false if the key is not found

fn get_categories(&self) -> Option<GString>

Gets the categories from the desktop file.

Returns

The unparsed Categories key from the desktop file; i.e. no attempt is made to split it by ';' or validate it.

fn get_filename(&self) -> Option<PathBuf>

When self was created from a known filename, return it. In some situations such as the DesktopAppInfo returned from DesktopAppInfo::new_from_keyfile, this function will return None.

Returns

The full path to the file for self, or None if not known.

fn get_generic_name(&self) -> Option<GString>

Gets the generic name from the destkop file.

Returns

The value of the GenericName key

fn get_is_hidden(&self) -> bool

A desktop file is hidden if the Hidden key in it is set to True.

Returns

true if hidden, false otherwise.

fn get_keywords(&self) -> Vec<GString>

Gets the keywords from the desktop file.

Returns

The value of the Keywords key

fn get_nodisplay(&self) -> bool

Gets the value of the NoDisplay key, which helps determine if the application info should be shown in menus. See G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY and AppInfo::should_show.

Returns

The value of the NoDisplay key

fn get_show_in(&self, desktop_env: Option<&str>) -> bool

Checks if the application info should be shown in menus that list available applications for a specific name of the desktop, based on the OnlyShowIn and NotShowIn keys.

desktop_env should typically be given as None, in which case the XDG_CURRENT_DESKTOP environment variable is consulted. If you want to override the default mechanism then you may specify desktop_env, but this is not recommended.

Note that AppInfo::should_show for self will include this check (with None for desktop_env) as well as additional checks.

desktop_env

a string specifying a desktop name

Returns

true if the self should be shown in desktop_env according to the OnlyShowIn and NotShowIn keys, false otherwise.

fn get_startup_wm_class(&self) -> Option<GString>

Retrieves the StartupWMClass field from self. This represents the WM_CLASS property of the main window of the application, if launched through self.

Returns

the startup WM class, or None if none is set in the desktop file.

fn get_string(&self, key: &str) -> Option<GString>

Looks up a string value in the keyfile backing self.

The key is looked up in the "Desktop Entry" group.

key

the key to look up

Returns

a newly allocated string, or None if the key is not found

fn has_key(&self, key: &str) -> bool

Returns whether key exists in the "Desktop Entry" group of the keyfile backing self.

key

the key to look up

Returns

true if the key exists

fn launch_action<P: IsA<AppLaunchContext>>(
    &self,
    action_name: &str,
    launch_context: Option<&P>
)

Activates the named application action.

You may only call this function on action names that were returned from DesktopAppInfoExt::list_actions.

Note that if the main entry of the desktop file indicates that the application supports startup notification, and launch_context is non-None, then startup notification will be used when activating the action (and as such, invocation of the action on the receiving side must signal the end of startup notification when it is completed). This is the expected behaviour of applications declaring additional actions, as per the desktop file specification.

As with AppInfo::launch there is no way to detect failures that occur while using this function.

action_name

the name of the action as from DesktopAppInfoExt::list_actions

launch_context

a AppLaunchContext

fn launch_uris_as_manager<P: IsA<AppLaunchContext>>(
    &self,
    uris: &[&str],
    launch_context: Option<&P>,
    spawn_flags: SpawnFlags,
    user_setup: Option<Box_<dyn FnOnce() + 'static>>,
    pid_callback: Option<&mut dyn FnMut(&DesktopAppInfo, Pid)>
) -> Result<(), Error>

This function performs the equivalent of AppInfo::launch_uris, but is intended primarily for operating system components that launch applications. Ordinary applications should use AppInfo::launch_uris.

If the application is launched via GSpawn, then spawn_flags, user_setup and user_setup_data are used for the call to g_spawn_async. Additionally, pid_callback (with pid_callback_data) will be called to inform about the PID of the created process. See g_spawn_async_with_pipes for information on certain parameter conditions that can enable an optimized posix_spawn codepath to be used.

If application launching occurs via some other mechanism (eg: D-Bus activation) then spawn_flags, user_setup, user_setup_data, pid_callback and pid_callback_data are ignored.

uris

List of URIs

launch_context

a AppLaunchContext

spawn_flags

glib::SpawnFlags, used for each process

user_setup

a GSpawnChildSetupFunc, used once for each process.

user_setup_data

User data for user_setup

pid_callback

Callback for child processes

pid_callback_data

User data for callback

Returns

true on successful launch, false otherwise.

fn list_actions(&self) -> Vec<GString>

Returns the list of "additional application actions" supported on the desktop file, as per the desktop file specification.

As per the specification, this is the list of actions that are explicitly listed in the "Actions" key of the [Desktop Entry] group.

Returns

a list of strings, always non-None

Loading content...

Implementors

impl<O: IsA<DesktopAppInfo>> DesktopAppInfoExt for O[src]

Loading content...