Public Member Functions | Static Public Member Functions | Related Functions

# Gio::DesktopAppInfo Class Reference

DesktopAppInfo is an implementation of AppInfo based on desktop files. More...

`#include <giomm/desktopappinfo.h>`

Inheritance diagram for Gio::DesktopAppInfo:
[legend]

List of all members.

## Public Member Functions
virtual | ~DesktopAppInfo ()
GDesktopAppInfo* | gobj ()
| Provides access to the underlying C GObject.
const GDesktopAppInfo* | gobj () const
| Provides access to the underlying C GObject.
GDesktopAppInfo* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
std::string | get_filename () const
| When info was created from a known filename, return it.
bool | is_hidden () const
| A desktop file is hidden if the Hidden key in it is set to True.
## Static Public Member Functions
static Glib::RefPtr < DesktopAppInfo > | create (const std::string& desktop_id)
| Creates a new DesktopAppInfo based on a desktop file id.
static Glib::RefPtr < DesktopAppInfo > | create_from_keyfile (Glib::KeyFile& key_file)
| Creates a new DesktopAppInfo.
static Glib::RefPtr < DesktopAppInfo > | create_from_filename (const std::string& filename)
| Creates a new DesktopAppInfo.
static void | set_desktop_env (const std::string& desktop_env)
| Sets the name of the desktop that the application is running in.
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gio::DesktopAppInfo > | wrap (GDesktopAppInfo* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

DesktopAppInfo is an implementation of AppInfo based on desktop files.

Since glibmm 2.16:

## Constructor & Destructor Documentation

virtual Gio::DesktopAppInfo::~DesktopAppInfo | ( | ) | `[virtual]`

## Member Function Documentation

static Glib::RefPtr<DesktopAppInfo> Gio::DesktopAppInfo::create | ( | const std::string & | desktop_id ) | `[static]`

Creates a new 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 <filename>applications</filename> subdirectories of the XDG data directories (i.e. the directories specified in the <envar>XDG_DATA_HOME</envar> and <envar>XDG_DATA_DIRS</envar> environment variables). GIO also supports the prefix-to-subdirectory mapping that is described in the ).

Parameters:

  desktop_id | The desktop file id.

Returns:
  A new DesktopAppInfo, or `0` if no desktop file with that id.

static Glib::RefPtr<DesktopAppInfo> Gio::DesktopAppInfo::create_from_filename | ( | const std::string & | filename ) | `[static]`

Creates a new DesktopAppInfo.

Parameters:

  filename | The path of a desktop file, in the GLib filename encoding.

Returns:
  A new DesktopAppInfo or `0` on error.

static Glib::RefPtr<DesktopAppInfo> Gio::DesktopAppInfo::create_from_keyfile | ( | Glib::KeyFile& | key_file ) | `[static]`

Creates a new DesktopAppInfo.

Since glibmm 2.18:

Parameters:

  key_file | An opened KeyFile.

Returns:
  A new DesktopAppInfo or `0` on error.

std::string Gio::DesktopAppInfo::get_filename | ( | ) | const

When info was created from a known filename, return it.

In some situations such as the DesktopAppInfo returned from g_desktop_app_info_new_from_keyfile(), this function will return `0`.

Since glibmm 2.24:

Returns:
  The full path to the file for info, or `0` if not known.

const GDesktopAppInfo* Gio::DesktopAppInfo::gobj | ( | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gio::AppInfo.

GDesktopAppInfo* Gio::DesktopAppInfo::gobj | ( | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gio::AppInfo.

GDesktopAppInfo* Gio::DesktopAppInfo::gobj_copy | ( | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

bool Gio::DesktopAppInfo::is_hidden | ( | ) | const

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

Returns:
  `true` if hidden, `false` otherwise.

static void Gio::DesktopAppInfo::set_desktop_env | ( | const std::string & | desktop_env ) | `[static]`

Sets the name of the desktop that the application is running in.

This is used by g_app_info_should_show() to evaluate the `OnlyShowIn` and `NotShowIn` desktop entry fields.

The

Should be called only once; subsequent calls are ignored.

Parameters:

  desktop_env | A string specifying what desktop this is.

## Friends And Related Function Documentation

Glib::RefPtr< Gio::DesktopAppInfo > wrap | ( | GDesktopAppInfo * | object,
|  | bool | take_copy = `false`
| ) |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.