Klasse DesktopAppInfo

Alle implementierten Schnittstellen:
PointerInterface

public class DesktopAppInfo extends PropertyHolder
`GDesktopAppInfo` is an implementation of [iface@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.

https://docs.gtk.org/gio/class.DesktopAppInfo.html

  • Konstruktordetails

    • DesktopAppInfo

      public DesktopAppInfo(PointerContainer pointer)
    • DesktopAppInfo

      public DesktopAppInfo(@Nonnull Str desktop_id)
      Creates a new [class@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](http://standards.freedesktop.org/menu-spec/latest/)
      (i.e. a desktop ID of `kde-foo.desktop` will match
      `/usr/share/applications/kde/foo.desktop`).
      Parameter:
      desktop_id - the desktop file ID
    • DesktopAppInfo

      public DesktopAppInfo(String desktop_id)
      Creates a new [class@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](http://standards.freedesktop.org/menu-spec/latest/)
      (i.e. a desktop ID of `kde-foo.desktop` will match
      `/usr/share/applications/kde/foo.desktop`).
      Parameter:
      desktop_id - the desktop file ID
  • Methodendetails

    • getClassHandler

      public static ClassHandler getClassHandler()
    • newFromFilenameDesktopAppInfo

      public static DesktopAppInfo newFromFilenameDesktopAppInfo(@Nonnull Str filename)
      Creates a new [class@Gio.DesktopAppInfo].
      Parameter:
      filename - the path of a desktop file, in the GLib filename encoding
      Gibt zurück:
      a new [class@Gio.DesktopAppInfo] or `NULL` on error.
    • newFromFilenameDesktopAppInfo

      public static DesktopAppInfo newFromFilenameDesktopAppInfo(String filename)
      Creates a new [class@Gio.DesktopAppInfo].
      Parameter:
      filename - the path of a desktop file, in the GLib filename encoding
      Gibt zurück:
      a new [class@Gio.DesktopAppInfo] or `NULL` on error.
    • newFromKeyfileDesktopAppInfo

      public static DesktopAppInfo newFromKeyfileDesktopAppInfo(@Nonnull KeyFile key_file)
      Creates a new [class@Gio.DesktopAppInfo].
      Parameter:
      key_file - an opened [type@GLib.KeyFile]
      Gibt zurück:
      a new [class@Gio.DesktopAppInfo] or `NULL` on error.
    • getActionName

      public Str getActionName(@Nonnull Str action_name)
      Gets the user-visible display name of the
      [‘additional application actions’](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s11.html)
      specified by @action_name.

      This corresponds to the `Name` key within the keyfile group for the
      action.
      Parameter:
      action_name - the name of the action as from [method@Gio.DesktopAppInfo.list_actions]
      Gibt zurück:
      the locale-specific action name
    • getActionName

      public Str getActionName(String action_name)
      Gets the user-visible display name of the
      [‘additional application actions’](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s11.html)
      specified by @action_name.

      This corresponds to the `Name` key within the keyfile group for the
      action.
      Parameter:
      action_name - the name of the action as from [method@Gio.DesktopAppInfo.list_actions]
      Gibt zurück:
      the locale-specific action name
    • getBoolean

      public boolean getBoolean(@Nonnull Str key)
      Looks up a boolean value in the keyfile backing @info.

      The @key is looked up in the `Desktop Entry` group.
      Parameter:
      key - the key to look up
      Gibt zurück:
      the boolean value, or `FALSE` if the key is not found
    • getBoolean

      public boolean getBoolean(String key)
      Looks up a boolean value in the keyfile backing @info.

      The @key is looked up in the `Desktop Entry` group.
      Parameter:
      key - the key to look up
      Gibt zurück:
      the boolean value, or `FALSE` if the key is not found
    • getCategories

      public Str getCategories()
      Gets the categories from the desktop file.
      Gibt zurück:
      The unparsed [`Categories` key](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-categories) from the desktop file; i.e. no attempt is made to split it by `;` or validate it.
    • getFilename

      public Str getFilename()
      When @info was created from a known filename, return it. In some
      situations such as a [class@Gio.DesktopAppInfo] returned from
      [ctor@Gio.DesktopAppInfo.new_from_keyfile], this function will return `NULL`.
      Gibt zurück:
      The full path to the file for @info, or `NULL` if not known.
    • getGenericName

      public Str getGenericName()
      Gets the generic name from the desktop file.
      Gibt zurück:
      The value of the [`GenericName` key](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-genericname)
    • getIsHidden

      public boolean getIsHidden()
      A desktop file is hidden if the
      [`Hidden` key](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-hidden)
      in it is set to `True`.
      Gibt zurück:
      `TRUE` if hidden, `FALSE` otherwise.
    • getKeywords

      public Strs getKeywords()
      Gets the keywords from the desktop file.
      Gibt zurück:
      The value of the [`Keywords` key](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-keywords)
    • getLocaleString

      public Str getLocaleString(@Nonnull Str key)
      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.
      Parameter:
      key - the key to look up
      Gibt zurück:
      a newly allocated string, or `NULL` if the key is not found
    • getLocaleString

      public Str getLocaleString(String key)
      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.
      Parameter:
      key - the key to look up
      Gibt zurück:
      a newly allocated string, or `NULL` if the key is not found
    • getNodisplay

      public boolean getNodisplay()
      Gets the value of the
      [`NoDisplay` key](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-nodisplay)
      which helps determine if the application info should be shown in menus. See
      `G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY` and [method@Gio.AppInfo.should_show].
      Gibt zurück:
      The value of the `NoDisplay` key
    • getShowIn

      public boolean getShowIn(@Nullable Str desktop_env)
      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`](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-onlyshowin)
      and [`NotShowIn`](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-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 [method@Gio.AppInfo.should_show] for @info will include this check
      (with `NULL` for @desktop_env) as well as additional checks.
      Parameter:
      desktop_env - a string specifying a desktop name
      Gibt zurück:
      `TRUE` if the @info should be shown in @desktop_env according to the `OnlyShowIn` and `NotShowIn` keys, `FALSE` otherwise.
    • getShowIn

      public boolean getShowIn(String desktop_env)
      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`](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-onlyshowin)
      and [`NotShowIn`](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-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 [method@Gio.AppInfo.should_show] for @info will include this check
      (with `NULL` for @desktop_env) as well as additional checks.
      Parameter:
      desktop_env - a string specifying a desktop name
      Gibt zurück:
      `TRUE` if the @info should be shown in @desktop_env according to the `OnlyShowIn` and `NotShowIn` keys, `FALSE` otherwise.
    • getStartupWmClass

      public Str getStartupWmClass()
      Retrieves the `StartupWMClass` field from @info. This represents the
      `WM_CLASS` property of the main window of the application, if launched
      through @info.
      Gibt zurück:
      the startup WM class, or `NULL` if none is set in the desktop file.
    • getString

      public Str getString(@Nonnull Str key)
      Looks up a string value in the keyfile backing @info.

      The @key is looked up in the `Desktop Entry` group.
      Parameter:
      key - the key to look up
      Gibt zurück:
      a newly allocated string, or `NULL` if the key is not found
    • getString

      public Str getString(String key)
      Looks up a string value in the keyfile backing @info.

      The @key is looked up in the `Desktop Entry` group.
      Parameter:
      key - the key to look up
      Gibt zurück:
      a newly allocated string, or `NULL` if the key is not found
    • hasKey

      public boolean hasKey(@Nonnull Str key)
      Returns whether @key exists in the `Desktop Entry` group
      of the keyfile backing @info.
      Parameter:
      key - the key to look up
      Gibt zurück:
      `TRUE` if the @key exists
    • hasKey

      public boolean hasKey(String key)
      Returns whether @key exists in the `Desktop Entry` group
      of the keyfile backing @info.
      Parameter:
      key - the key to look up
      Gibt zurück:
      `TRUE` if the @key exists
    • launchAction

      public void launchAction(@Nonnull Str action_name, @Nullable AppLaunchContext launch_context)
      Activates the named application action.

      You may only call this function on action names that were
      returned from [method@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](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s11.html).

      As with [method@Gio.AppInfo.launch] there is no way to detect failures that
      occur while using this function.
      Parameter:
      action_name - the name of the action as from [method@Gio.DesktopAppInfo.list_actions]
      launch_context - a [class@Gio.AppLaunchContext]
    • launchAction

      public void launchAction(String action_name, @Nullable AppLaunchContext launch_context)
      Activates the named application action.

      You may only call this function on action names that were
      returned from [method@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](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s11.html).

      As with [method@Gio.AppInfo.launch] there is no way to detect failures that
      occur while using this function.
      Parameter:
      action_name - the name of the action as from [method@Gio.DesktopAppInfo.list_actions]
      launch_context - a [class@Gio.AppLaunchContext]
    • getImplementations

      public static List getImplementations(@Nonnull Str _interface)
      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.
      Parameter:
      _interface - the name of the interface
      Gibt zurück:
      a list of [class@Gio.DesktopAppInfo] objects.
    • setDesktopEnv

      @Deprecated public static void setDesktopEnv(@Nonnull Str desktop_env)
      Veraltet.
      Sets the name of the desktop that the application is running in.

      This is used by [method@Gio.AppInfo.should_show] and
      [method@Gio.DesktopAppInfo.get_show_in] to evaluate the
      [`OnlyShowIn`](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-onlyshowin)
      and [`NotShowIn`](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html#key-notshowin)
      keys.

      Should be called only once; subsequent calls are ignored.
      Parameter:
      desktop_env - a string specifying what desktop this is
    • asAppInfo

      public AppInfo asAppInfo()
      Implements interface AppInfo. Call this to get access to interface functions.
      Gibt zurück:
      AppInfo
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()