class Gio::DesktopAppInfo
- Gio::DesktopAppInfo
- GObject::Object
- Reference
- Object
Overview
GDesktopAppInfo
is an implementation of Gio::AppInfo
based on
desktop files.
Note that <gio/gdesktopappinfo.h>
belongs to the UNIX-specific
GIO interfaces, thus you have to use the gio-unix-2.0.pc
pkg-config
file or the GioUnix-2.0
GIR namespace when using it.
Included Modules
Defined in:
lib/gi-crystal/src/auto/gio-2.0/desktop_app_info.crConstructors
-
.new(desktop_id : String) : self | Nil
Creates a new
Gio::DesktopAppInfo
based on a desktop file ID. -
.new
Initialize a new
DesktopAppInfo
. - .new(*, filename : String | Nil = nil)
Class Method Summary
-
.desktop_env=(desktop_env : String) : Nil
Sets the name of the desktop that the application is running in.
DEPRECATED
-
.g_type : UInt64
Returns the type id (GType) registered in GLib type system.
-
.implementations(interface : String) : GLib::List
Gets all applications that implement interface.
-
.new_from_filename(filename : String) : self | Nil
Creates a new
Gio::DesktopAppInfo
. -
.new_from_keyfile(key_file : GLib::KeyFile) : self | Nil
Creates a new
Gio::DesktopAppInfo
. -
.search(search_string : String) : Enumerable(Enumerable(String))
Searches desktop files for ones that match search_string.
Instance Method Summary
-
#==(other : self)
Returns
true
if this reference is the same as other. -
#action_name(action_name : String) : String
Gets the user-visible display name of the ‘additional application actions’ specified by action_name.
-
#boolean(key : String) : Bool
Looks up a boolean value in the keyfile backing info.
-
#categories : String | Nil
Gets the categories from the desktop file.
-
#filename : Path | Nil
When info was created from a known filename, return it.
- #filename=(value : String) : String
-
#filename=(value : Nil) : Nil
Set
#filename
property to nil. -
#filename? : String | Nil
Same as
#filename
, but can return nil. -
#generic_name : String | Nil
Gets the generic name from the desktop file.
-
#has_key(key : String) : Bool
Returns whether key exists in the
Desktop Entry
group of the keyfile backing info. -
#hash(hasher)
See
Object#hash(hasher)
-
#is_hidden : Bool
A desktop file is hidden if the
Hidden
key in it is set toTrue
. -
#keywords : Enumerable(String)
Gets the keywords from the desktop file.
-
#launch_action(action_name : String, launch_context : Gio::AppLaunchContext | Nil) : Nil
Activates the named application action.
-
#launch_uris_as_manager(uris : GLib::List, launch_context : Gio::AppLaunchContext | Nil, spawn_flags : GLib::SpawnFlags, user_setup : GLib::SpawnChildSetupFunc | Nil, user_setup_data : Pointer(Void) | Nil, pid_callback : Gio::DesktopAppLaunchCallback | Nil, pid_callback_data : Pointer(Void) | Nil) : Bool
This function performs the equivalent of
Gio::AppInfo#launch_uris
, but is intended primarily for operating system components that launch applications. -
#launch_uris_as_manager_with_fds(uris : GLib::List, launch_context : Gio::AppLaunchContext | Nil, spawn_flags : GLib::SpawnFlags, user_setup : GLib::SpawnChildSetupFunc | Nil, user_setup_data : Pointer(Void) | Nil, pid_callback : Gio::DesktopAppLaunchCallback | Nil, pid_callback_data : Pointer(Void) | Nil, stdin_fd : Int32, stdout_fd : Int32, stderr_fd : Int32) : Bool
Equivalent to
Gio::DesktopAppInfo#launch_uris_as_manager
but allows you to pass in file descriptors for the stdin, stdout and stderr streams of the launched process. -
#list_actions : Enumerable(String)
Returns the list of ‘additional application actions’ supported on the desktop file, as per the desktop file specification.
-
#locale_string(key : String) : String | Nil
Looks up a localized string value in the keyfile backing info translated to the current locale.
-
#nodisplay : Bool
Gets the value of the
NoDisplay
key which helps determine if the application info should be shown in menus. -
#show_in(desktop_env : String | Nil) : 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
andNotShowIn
keys. -
#startup_wm_class : String | Nil
Retrieves the
StartupWMClass
field from info. -
#string(key : String) : String | Nil
Looks up a string value in the keyfile backing info.
-
#string_list(key : String) : Enumerable(String)
Looks up a string list value in the keyfile backing info.
Instance methods inherited from module Gio::AppInfo
add_supports_type(content_type : String) : Bool
add_supports_type,
as_default_for_extension=(extension : String) : Bool
as_default_for_extension=,
as_default_for_type=(content_type : String) : Bool
as_default_for_type=,
as_last_used_for_type=(content_type : String) : Bool
as_last_used_for_type=,
can_delete : Bool
can_delete,
can_remove_supports_type : Bool
can_remove_supports_type,
commandline : Path | Nil
commandline,
create_from_commandline(commandline : String, application_name : String | Nil, flags : Gio::AppInfoCreateFlags) : Gio::AppInfo
create_from_commandline,
default_for_type_finish(result : Gio::AsyncResult) : Gio::AppInfo
default_for_type_finish,
default_for_uri_scheme_finish(result : Gio::AsyncResult) : Gio::AppInfo
default_for_uri_scheme_finish,
delete : Bool
delete,
description : String | Nil
description,
display_name : String
display_name,
dup : Gio::AppInfo
dup,
equal(appinfo2 : Gio::AppInfo) : Bool
equal,
executable : Path
executable,
icon : Gio::Icon | Nil
icon,
id : String | Nil
id,
launch(files : GLib::List | Nil, context : Gio::AppLaunchContext | Nil) : Bool
launch,
launch_default_for_uri(uri : String, context : Gio::AppLaunchContext | Nil) : Bool
launch_default_for_uri,
launch_default_for_uri_finish(result : Gio::AsyncResult) : Bool
launch_default_for_uri_finish,
launch_uris(uris : GLib::List | Nil, context : Gio::AppLaunchContext | Nil) : Bool
launch_uris,
launch_uris_async(uris : GLib::List | Nil, context : Gio::AppLaunchContext | Nil, cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil
launch_uris_async,
launch_uris_finish(result : Gio::AsyncResult) : Bool
launch_uris_finish,
name : String
name,
remove_supports_type(content_type : String) : Bool
remove_supports_type,
should_show : Bool
should_show,
supported_types : Enumerable(String)
supported_types,
supports_files : Bool
supports_files,
supports_uris : Bool
supports_uris,
to_unsafe
to_unsafe
Constructor methods inherited from module Gio::AppInfo
cast(obj : GObject::Object) : self
cast
Class methods inherited from module Gio::AppInfo
all : GLib::List
all,
all_for_type(content_type : String) : GLib::List
all_for_type,
cast?(obj : GObject::Object) : self | Nil
cast?,
default_for_type(content_type : String, must_support_uris : Bool) : Gio::AppInfo | Nil
default_for_type,
default_for_type_async(content_type : String, must_support_uris : Bool, cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil
default_for_type_async,
default_for_uri_scheme(uri_scheme : String) : Gio::AppInfo | Nil
default_for_uri_scheme,
default_for_uri_scheme_async(uri_scheme : String, cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil
default_for_uri_scheme_async,
fallback_for_type(content_type : String) : GLib::List
fallback_for_type,
g_type : UInt64
g_type,
launch_default_for_uri_async(uri : String, context : Gio::AppLaunchContext | Nil, cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil
launch_default_for_uri_async,
recommended_for_type(content_type : String) : GLib::List
recommended_for_type,
reset_type_associations(content_type : String) : Nil
reset_type_associations
Instance methods inherited from class GObject::Object
==(other : self)
==,
bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding
bind_property,
bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding
bind_property_full,
data(key : String) : Pointer(Void) | Nil
data,
finalize
finalize,
freeze_notify : Nil
freeze_notify,
getv(names : Enumerable(String), values : Enumerable(_)) : Nil
getv,
hash(hasher)
hash,
notify(property_name : String) : Nil
notify,
notify_by_pspec(pspec : GObject::ParamSpec) : Nil
notify_by_pspec,
notify_signal
notify_signal,
property(property_name : String, value : _) : Nil
property,
qdata(quark : UInt32) : Pointer(Void) | Nil
qdata,
ref_count : UInt32
ref_count,
run_dispose : Nil
run_dispose,
set_data(key : String, data : Pointer(Void) | Nil) : Nil
set_data,
set_property(property_name : String, value : _) : Nil
set_property,
steal_data(key : String) : Pointer(Void) | Nil
steal_data,
steal_qdata(quark : UInt32) : Pointer(Void) | Nil
steal_qdata,
thaw_notify : Nil
thaw_notify,
to_unsafe : Pointer(Void)
to_unsafe,
watch_closure(closure : GObject::Closure) : Nil
watch_closure
Constructor methods inherited from class GObject::Object
cast(obj : GObject::Object) : self
cast,
new(pointer : Pointer(Void), transfer : GICrystal::Transfer)new new, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv
Class methods inherited from class GObject::Object
cast?(obj : GObject::Object) : self | Nil
cast?,
compat_control(what : UInt64, data : Pointer(Void) | Nil) : UInt64
compat_control,
g_type : UInt64
g_type,
interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec
interface_find_property,
interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec)
interface_list_properties
Macros inherited from class GObject::Object
previous_vfunc(*args)
previous_vfunc,
previous_vfunc!(*args)
previous_vfunc!,
signal(signature)
signal
Constructor Detail
Creates a new Gio::DesktopAppInfo
based on a desktop file ID.
A desktop file ID is the basename of the desktop file, including the
.desktop
extension. GIO is looking for a desktop file with this name
in the applications
subdirectories of the XDG
data directories (i.e. the directories specified in the XDG_DATA_HOME
and XDG_DATA_DIRS
environment variables). GIO also supports the
prefix-to-subdirectory mapping that is described in the
Menu Spec
(i.e. a desktop ID of kde-foo.desktop
will match
/usr/share/applications/kde/foo.desktop
).
Class Method Detail
Sets the name of the desktop that the application is running in.
This is used by Gio::AppInfo#should_show
and
Gio::DesktopAppInfo#show_in
to evaluate the
OnlyShowIn
and NotShowIn
keys.
Should be called only once; subsequent calls are ignored.
DEPRECATED
Gets all applications that implement interface.
An application implements an interface if that interface is listed in
the Implements
line of the desktop file of the application.
Creates a new Gio::DesktopAppInfo
.
Searches desktop files for ones that match search_string.
The return value is an array of strvs. Each strv contains a list of applications that matched search_string with an equal score. The outer list is sorted by score so that the first strv contains the best-matching applications, and so on. The algorithm for determining matches is undefined and may change at any time.
None of the search results are subjected to the normal validation
checks performed by Gio::DesktopAppInfo.new
(for example, checking that
the executable referenced by a result exists), and so it is possible for
Gio::DesktopAppInfo.new
to return NULL
when passed an app ID returned
by this function. It is expected that calling code will do this when
subsequently creating a Gio::DesktopAppInfo
for each result.
Instance Method Detail
Returns true
if this reference is the same as other. Invokes same?
.
Gets the user-visible display name of the ‘additional application actions’ specified by action_name.
This corresponds to the Name
key within the keyfile group for the
action.
Looks up a boolean value in the keyfile backing info.
The key is looked up in the Desktop Entry
group.
When info was created from a known filename, return it. In some
situations such as a Gio::DesktopAppInfo
returned from
Gio::DesktopAppInfo#new_from_keyfile
, this function will return NULL
.
Returns whether key exists in the Desktop Entry
group
of the keyfile backing info.
Activates the named application action.
You may only call this function on action names that were
returned from Gio::DesktopAppInfo#list_actions
.
Note that if the main entry of the desktop file indicates that the
application supports startup notification, and launch_context is
non-NULL
, 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 Gio::AppInfo#launch
there is no way to detect failures that
occur while using this function.
This function performs the equivalent of Gio::AppInfo#launch_uris
,
but is intended primarily for operating system components that
launch applications. Ordinary applications should use
Gio::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 GLib::spawn_async
.
Additionally, pid_callback (with pid_callback_data) will be called to
inform about the PID of the created process. See
GLib::spawn_async_with_pipes
for information on certain parameter
conditions that can enable an optimized posix_spawn()
code path to be used.
If application launching occurs via some other mechanism (for example, D-Bus activation) then spawn_flags, user_setup, user_setup_data, pid_callback and pid_callback_data are ignored.
Equivalent to Gio::DesktopAppInfo#launch_uris_as_manager
but allows
you to pass in file descriptors for the stdin, stdout and stderr streams
of the launched process.
If application launching occurs via some non-spawn mechanism (e.g. D-Bus activation) then stdin_fd, stdout_fd and stderr_fd are ignored.
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.
Looks up a localized string value in the keyfile backing info translated to the current locale.
The key is looked up in the Desktop Entry
group.
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 Gio::AppInfo#should_show
.
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 NULL
, 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 Gio::AppInfo#should_show
for info will include this check
(with NULL
for desktop_env) as well as additional checks.
Retrieves the StartupWMClass
field from info. This represents the
WM_CLASS
property of the main window of the application, if launched
through info.
Looks up a string value in the keyfile backing info.
The key is looked up in the Desktop Entry
group.