<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="gio-Desktop-file-based-GAppInfo">
<refmeta>
<refentrytitle role="top_of_page" id="gio-Desktop-file-based-GAppInfo.top_of_page">Desktop file based GAppInfo</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GIO Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Desktop file based GAppInfo</refname>
<refpurpose>Application information from desktop files</refpurpose>
</refnamediv>

<refsynopsisdiv id="gio-Desktop-file-based-GAppInfo.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>
<anchor id="GDesktopAppInfo"/><anchor id="GDesktopAppInfoLookup"/>
<synopsis>

#include &lt;gio/gdesktopappinfo.h&gt;

                    <link linkend="GDesktopAppInfo-struct">GDesktopAppInfo</link>;
<link linkend="GDesktopAppInfo">GDesktopAppInfo</link> *   <link linkend="g-desktop-app-info-new-from-filename">g_desktop_app_info_new_from_filename</link>
                                                        (const <link linkend="char">char</link> *filename);
<link linkend="GDesktopAppInfo">GDesktopAppInfo</link> *   <link linkend="g-desktop-app-info-new-from-keyfile">g_desktop_app_info_new_from_keyfile</link> (<link linkend="GKeyFile">GKeyFile</link> *key_file);
<link linkend="GDesktopAppInfo">GDesktopAppInfo</link> *   <link linkend="g-desktop-app-info-new">g_desktop_app_info_new</link>              (const <link linkend="char">char</link> *desktop_id);
<link linkend="gboolean">gboolean</link>            <link linkend="g-desktop-app-info-get-is-hidden">g_desktop_app_info_get_is_hidden</link>    (<link linkend="GDesktopAppInfo">GDesktopAppInfo</link> *info);
<link linkend="void">void</link>                <link linkend="g-desktop-app-info-set-desktop-env">g_desktop_app_info_set_desktop_env</link>  (const <link linkend="char">char</link> *desktop_env);
                    <link linkend="GDesktopAppInfoLookup-struct">GDesktopAppInfoLookup</link>;
#define             <link linkend="G-DESKTOP-APP-INFO-LOOKUP-EXTENSION-POINT-NAME--CAPS">G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME</link>
<link linkend="GAppInfo">GAppInfo</link> *          <link linkend="g-desktop-app-info-lookup-get-default-for-uri-scheme">g_desktop_app_info_lookup_get_default_for_uri_scheme</link>
                                                        (<link linkend="GDesktopAppInfoLookup">GDesktopAppInfoLookup</link> *lookup,
                                                         const <link linkend="char">char</link> *uri_scheme);
</synopsis>
</refsynopsisdiv>

<refsect1 id="gio-Desktop-file-based-GAppInfo.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<synopsis>
  <link linkend="GObject">GObject</link>
   +----GDesktopAppInfo
</synopsis>
<synopsis>
  <link linkend="GInterface">GInterface</link>
   +----GDesktopAppInfoLookup
</synopsis>
</refsect1>

<refsect1 id="gio-Desktop-file-based-GAppInfo.prerequisites" role="prerequisites">
<title role="prerequisites.title">Prerequisites</title>
<para>
GDesktopAppInfoLookup requires
 <link linkend="GObject">GObject</link>.</para>
</refsect1>


<refsect1 id="gio-Desktop-file-based-GAppInfo.implemented-interfaces" role="impl_interfaces">
<title role="impl_interfaces.title">Implemented Interfaces</title>
<para>
GDesktopAppInfo implements
 <link linkend="GAppInfo">GAppInfo</link>.</para>
</refsect1>





<refsect1 id="gio-Desktop-file-based-GAppInfo.description" role="desc">
<title role="desc.title">Description</title>
<para>
<link linkend="GDesktopAppInfo"><type>GDesktopAppInfo</type></link> is an implementation of <link linkend="GAppInfo"><type>GAppInfo</type></link> based on
desktop files.
</para>
<para>
Note that <filename>&lt;gio/gdesktopappinfo.h&gt;</filename> belongs to 
the UNIX-specific GIO interfaces, thus you have to use the 
<filename>gio-unix-2.0.pc</filename> pkg-config file when using it.</para>
<para>
</para>
</refsect1>

<refsect1 id="gio-Desktop-file-based-GAppInfo.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="GDesktopAppInfo-struct" role="struct">
<title>GDesktopAppInfo</title>
<indexterm zone="GDesktopAppInfo-struct"><primary sortas="DesktopAppInfo">GDesktopAppInfo</primary></indexterm><programlisting>typedef struct _GDesktopAppInfo GDesktopAppInfo;</programlisting>
<para>
Information about an installed application from a desktop file.</para>
<para>
</para></refsect2>
<refsect2 id="g-desktop-app-info-new-from-filename" role="function">
<title>g_desktop_app_info_new_from_filename ()</title>
<indexterm zone="g-desktop-app-info-new-from-filename"><primary sortas="desktop_app_info_new_from_filename">g_desktop_app_info_new_from_filename</primary></indexterm><programlisting><link linkend="GDesktopAppInfo">GDesktopAppInfo</link> *   g_desktop_app_info_new_from_filename
                                                        (const <link linkend="char">char</link> *filename);</programlisting>
<para>
Creates a new <link linkend="GDesktopAppInfo"><type>GDesktopAppInfo</type></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>filename</parameter>&#160;:</term>
<listitem><simpara> the path of a desktop file, in the GLib filename encoding
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a new <link linkend="GDesktopAppInfo"><type>GDesktopAppInfo</type></link> or <link linkend="NULL--CAPS"><literal>NULL</literal></link> on error.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-desktop-app-info-new-from-keyfile" role="function" condition="since:2.18">
<title>g_desktop_app_info_new_from_keyfile ()</title>
<indexterm zone="g-desktop-app-info-new-from-keyfile" role="2.18"><primary sortas="desktop_app_info_new_from_keyfile">g_desktop_app_info_new_from_keyfile</primary></indexterm><programlisting><link linkend="GDesktopAppInfo">GDesktopAppInfo</link> *   g_desktop_app_info_new_from_keyfile (<link linkend="GKeyFile">GKeyFile</link> *key_file);</programlisting>
<para>
Creates a new <link linkend="GDesktopAppInfo"><type>GDesktopAppInfo</type></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>key_file</parameter>&#160;:</term>
<listitem><simpara> an opened <link linkend="GKeyFile"><type>GKeyFile</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a new <link linkend="GDesktopAppInfo"><type>GDesktopAppInfo</type></link> or <link linkend="NULL--CAPS"><literal>NULL</literal></link> on error.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.18</para></refsect2>
<refsect2 id="g-desktop-app-info-new" role="function">
<title>g_desktop_app_info_new ()</title>
<indexterm zone="g-desktop-app-info-new"><primary sortas="desktop_app_info_new">g_desktop_app_info_new</primary></indexterm><programlisting><link linkend="GDesktopAppInfo">GDesktopAppInfo</link> *   g_desktop_app_info_new              (const <link linkend="char">char</link> *desktop_id);</programlisting>
<para>
Creates a new <link linkend="GDesktopAppInfo"><type>GDesktopAppInfo</type></link> based on a desktop file id. 
</para>
<para>
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 <ulink url="http://standards.freedesktop.org/menu-spec/latest/">Menu Spec</ulink> 
(i.e. a desktop id of kde-foo.desktop will match
<filename>/usr/share/applications/kde/foo.desktop</filename>).</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>desktop_id</parameter>&#160;:</term>
<listitem><simpara> the desktop file id
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a new <link linkend="GDesktopAppInfo"><type>GDesktopAppInfo</type></link>, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if no desktop file with that id
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-desktop-app-info-get-is-hidden" role="function">
<title>g_desktop_app_info_get_is_hidden ()</title>
<indexterm zone="g-desktop-app-info-get-is-hidden"><primary sortas="desktop_app_info_get_is_hidden">g_desktop_app_info_get_is_hidden</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_desktop_app_info_get_is_hidden    (<link linkend="GDesktopAppInfo">GDesktopAppInfo</link> *info);</programlisting>
<para>
A desktop file is hidden if the Hidden key in it is
set to True.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>info</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GDesktopAppInfo"><type>GDesktopAppInfo</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if hidden, <link linkend="FALSE--CAPS"><literal>FALSE</literal></link> otherwise. 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-desktop-app-info-set-desktop-env" role="function">
<title>g_desktop_app_info_set_desktop_env ()</title>
<indexterm zone="g-desktop-app-info-set-desktop-env"><primary sortas="desktop_app_info_set_desktop_env">g_desktop_app_info_set_desktop_env</primary></indexterm><programlisting><link linkend="void">void</link>                g_desktop_app_info_set_desktop_env  (const <link linkend="char">char</link> *desktop_env);</programlisting>
<para>
Sets the name of the desktop that the application is running in.
This is used by <link linkend="g-app-info-should-show"><function>g_app_info_should_show()</function></link> to evaluate the
<literal>OnlyShowIn</literal> and <literal>NotShowIn</literal>
desktop entry fields.
</para>
<para>
The <ulink url="http://standards.freedesktop.org/menu-spec/latest/">Desktop 
Menu specification</ulink> recognizes the following:
<simplelist>
  <member>GNOME</member>
  <member>KDE</member>
  <member>ROX</member>
  <member>XFCE</member>
  <member>Old</member> 
</simplelist>
</para>
<para>
Should be called only once; subsequent calls are ignored.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>desktop_env</parameter>&#160;:</term>
<listitem><simpara> a string specifying what desktop this is
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="GDesktopAppInfoLookup-struct" role="struct">
<title>GDesktopAppInfoLookup</title>
<indexterm zone="GDesktopAppInfoLookup-struct"><primary sortas="DesktopAppInfoLookup">GDesktopAppInfoLookup</primary></indexterm><programlisting>typedef struct _GDesktopAppInfoLookup GDesktopAppInfoLookup;</programlisting>
<para>
Interface that is used by backends to associate default
handlers with URI schemes.</para>
<para>
</para></refsect2>
<refsect2 id="G-DESKTOP-APP-INFO-LOOKUP-EXTENSION-POINT-NAME--CAPS" role="macro">
<title>G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME</title>
<indexterm zone="G-DESKTOP-APP-INFO-LOOKUP-EXTENSION-POINT-NAME--CAPS"><primary sortas="DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME">G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME</primary></indexterm><programlisting>#define G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME "gio-desktop-app-info-lookup"
</programlisting>
<para>
Extension point for default handler to URI association. See
<link linkend="extending-gio">Extending GIO</link>.</para>
<para>
</para></refsect2>
<refsect2 id="g-desktop-app-info-lookup-get-default-for-uri-scheme" role="function">
<title>g_desktop_app_info_lookup_get_default_for_uri_scheme ()</title>
<indexterm zone="g-desktop-app-info-lookup-get-default-for-uri-scheme"><primary sortas="desktop_app_info_lookup_get_default_for_uri_scheme">g_desktop_app_info_lookup_get_default_for_uri_scheme</primary></indexterm><programlisting><link linkend="GAppInfo">GAppInfo</link> *          g_desktop_app_info_lookup_get_default_for_uri_scheme
                                                        (<link linkend="GDesktopAppInfoLookup">GDesktopAppInfoLookup</link> *lookup,
                                                         const <link linkend="char">char</link> *uri_scheme);</programlisting>
<para>
Gets the default application for launching applications 
using this URI scheme for a particular GDesktopAppInfoLookup
implementation.
</para>
<para>
The GDesktopAppInfoLookup interface and this function is used
to implement <link linkend="g-app-info-get-default-for-uri-scheme"><function>g_app_info_get_default_for_uri_scheme()</function></link> backends
in a GIO module. There is no reason for applications to use it
directly. Applications should use <link linkend="g-app-info-get-default-for-uri-scheme"><function>g_app_info_get_default_for_uri_scheme()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>lookup</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GDesktopAppInfoLookup"><type>GDesktopAppInfoLookup</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>uri_scheme</parameter>&#160;:</term>
<listitem><simpara> a string containing a URI scheme.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="GAppInfo"><type>GAppInfo</type></link> for given <parameter>uri_scheme</parameter> or <link linkend="NULL--CAPS"><literal>NULL</literal></link> on error.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
