<refentry id="ThunarxFileInfo">
<refmeta>
<refentrytitle>ThunarxFileInfo</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>THUNARX Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>ThunarxFileInfo</refname><refpurpose>Abstraction of a file handled within the file manager</refpurpose>
</refnamediv>
<refsect1>
<title>Stability Level</title>
Stable, unless otherwise indicated
</refsect1>

<refsynopsisdiv><title>Synopsis</title>

<synopsis>

#include &lt;thunarx/thunarx.h&gt;


            <link linkend="ThunarxFileInfoIface">ThunarxFileInfoIface</link>;
            <link linkend="ThunarxFileInfo-struct">ThunarxFileInfo</link>;
<link linkend="gchar">gchar</link>*      <link linkend="thunarx-file-info-get-name">thunarx_file_info_get_name</link>      (<link linkend="ThunarxFileInfo">ThunarxFileInfo</link> *file_info);
<link linkend="gchar">gchar</link>*      <link linkend="thunarx-file-info-get-uri">thunarx_file_info_get_uri</link>       (<link linkend="ThunarxFileInfo">ThunarxFileInfo</link> *file_info);
<link linkend="gchar">gchar</link>*      <link linkend="thunarx-file-info-get-parent-uri">thunarx_file_info_get_parent_uri</link>
                                            (<link linkend="ThunarxFileInfo">ThunarxFileInfo</link> *file_info);
<link linkend="gchar">gchar</link>*      <link linkend="thunarx-file-info-get-uri-scheme">thunarx_file_info_get_uri_scheme</link>
                                            (<link linkend="ThunarxFileInfo">ThunarxFileInfo</link> *file_info);
<link linkend="gchar">gchar</link>*      <link linkend="thunarx-file-info-get-mime-type">thunarx_file_info_get_mime_type</link> (<link linkend="ThunarxFileInfo">ThunarxFileInfo</link> *file_info);
<link linkend="gboolean">gboolean</link>    <link linkend="thunarx-file-info-has-mime-type">thunarx_file_info_has_mime_type</link> (<link linkend="ThunarxFileInfo">ThunarxFileInfo</link> *file_info,
                                             const <link linkend="gchar">gchar</link> *mime_type);
<link linkend="gboolean">gboolean</link>    <link linkend="thunarx-file-info-is-directory">thunarx_file_info_is_directory</link>  (<link linkend="ThunarxFileInfo">ThunarxFileInfo</link> *file_info);
<link linkend="GList">GList</link>*      <link linkend="thunarx-file-info-list-copy">thunarx_file_info_list_copy</link>     (<link linkend="GList">GList</link> *file_infos);
<link linkend="void">void</link>        <link linkend="thunarx-file-info-list-free">thunarx_file_info_list_free</link>     (<link linkend="GList">GList</link> *file_infos);


</synopsis>
</refsynopsisdiv>

<refsect1>
<title>Object Hierarchy</title>
<synopsis>

  <link linkend="GInterface">GInterface</link>
   +----ThunarxFileInfo
</synopsis>

</refsect1>

<refsect1>
<title>Prerequisites</title>
<para>
ThunarxFileInfo requires
 <link linkend="GObject">GObject</link>.</para>

</refsect1>







<refsect1>
<title>Description</title>
<para>
  The <interface>ThunarxFileInfo</interface> interface provides extensions with
  a way to access information about a file handled within the file manager.
</para>
</refsect1>

<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="ThunarxFileInfoIface"/>ThunarxFileInfoIface</title>
<indexterm><primary>ThunarxFileInfoIface</primary></indexterm><programlisting>typedef struct {
  gchar     *(*get_name)        (ThunarxFileInfo *file_info);

  gchar     *(*get_uri)         (ThunarxFileInfo *file_info);
  gchar     *(*get_parent_uri)  (ThunarxFileInfo *file_info);
  gchar     *(*get_uri_scheme)  (ThunarxFileInfo *file_info);

  gchar     *(*get_mime_type)   (ThunarxFileInfo *file_info);
  gboolean   (*has_mime_type)   (ThunarxFileInfo *file_info,
                                 const gchar     *mime_type);

  gboolean   (*is_directory)    (ThunarxFileInfo *file_info);
} ThunarxFileInfoIface;
</programlisting>
<para>
  Interface with virtual methods implemented by the file manager and accessible
  from the extensions.
</para><variablelist role="struct">
<varlistentry>
<term><structfield>get_name</structfield>&nbsp;()</term>
<listitem><simpara>See <link linkend="thunarx-file-info-get-name"><function>thunarx_file_info_get_name()</function></link>.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><structfield>get_uri</structfield>&nbsp;()</term>
<listitem><simpara>See <link linkend="thunarx-file-info-get-uri"><function>thunarx_file_info_get_uri()</function></link>.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><structfield>get_parent_uri</structfield>&nbsp;()</term>
<listitem><simpara>See <link linkend="thunarx-file-info-get-parent-uri"><function>thunarx_file_info_get_parent_uri()</function></link>.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><structfield>get_uri_scheme</structfield>&nbsp;()</term>
<listitem><simpara>See <link linkend="thunarx-file-info-get-uri-scheme"><function>thunarx_file_info_get_uri_scheme()</function></link>.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><structfield>get_mime_type</structfield>&nbsp;()</term>
<listitem><simpara>See <link linkend="thunarx-file-info-get-mime-type"><function>thunarx_file_info_get_mime_type()</function></link>.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><structfield>has_mime_type</structfield>&nbsp;()</term>
<listitem><simpara>See <link linkend="thunarx-file-info-has-mime-type"><function>thunarx_file_info_has_mime_type()</function></link>.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><structfield>is_directory</structfield>&nbsp;()</term>
<listitem><simpara>See <link linkend="thunarx-file-info-is-directory"><function>thunarx_file_info_is_directory()</function></link>.

</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="ThunarxFileInfo-struct"/>ThunarxFileInfo</title>
<indexterm><primary>ThunarxFileInfo</primary></indexterm><programlisting>typedef struct _ThunarxFileInfo ThunarxFileInfo;</programlisting>
<para>
	File info type, which is mapped to the real file info implementation
	within the file manager.
</para></refsect2>
<refsect2>
<title><anchor id="thunarx-file-info-get-name"/>thunarx_file_info_get_name ()</title>
<indexterm><primary>thunarx_file_info_get_name</primary></indexterm><programlisting><link linkend="gchar">gchar</link>*      thunarx_file_info_get_name      (<link linkend="ThunarxFileInfo">ThunarxFileInfo</link> *file_info);</programlisting>
<para>
Returns the real name of the file represented
by <parameter>file_info</parameter> in the local file system encoding.
You can use <link linkend="g-filename-display-name"><function>g_filename_display_name()</function></link> or similar
functions to generate an UTF-8 version of the
name, which is suitable for use in the user
interface.
</para>
<para>
The caller is responsible to free the returned
string using <link linkend="g-free"><function>g_free()</function></link> when no longer needed.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>file_info</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="ThunarxFileInfo"><type>ThunarxFileInfo</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the real name of the file represented
              by <parameter>file_info</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="thunarx-file-info-get-uri"/>thunarx_file_info_get_uri ()</title>
<indexterm><primary>thunarx_file_info_get_uri</primary></indexterm><programlisting><link linkend="gchar">gchar</link>*      thunarx_file_info_get_uri       (<link linkend="ThunarxFileInfo">ThunarxFileInfo</link> *file_info);</programlisting>
<para>
Returns the escaped, fully qualified URI
of the file object represented by <parameter>file_info</parameter>.
You may use <link linkend="g-filename-from-uri"><function>g_filename_from_uri()</function></link> and similar
functions to work with the returned URI.
</para>
<para>
The caller is responsible to free the returned
string using <link linkend="g-free"><function>g_free()</function></link> when no longer needed.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>file_info</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="ThunarxFileInfo"><type>ThunarxFileInfo</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the fully qualified URI of <parameter>file_info</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="thunarx-file-info-get-parent-uri"/>thunarx_file_info_get_parent_uri ()</title>
<indexterm><primary>thunarx_file_info_get_parent_uri</primary></indexterm><programlisting><link linkend="gchar">gchar</link>*      thunarx_file_info_get_parent_uri
                                            (<link linkend="ThunarxFileInfo">ThunarxFileInfo</link> *file_info);</programlisting>
<para>
Returns the URI to the parent file of
<parameter>file_info</parameter> or <literal>NULL</literal> if <parameter>file_info</parameter> has
no parent. Note that the parent URI
may be of a different type than the
URI of <parameter>file_info</parameter>. For example, the
parent of "file:///" is "computer:///".
</para>
<para>
The caller is responsible to free the
returned string using <link linkend="g-free"><function>g_free()</function></link> when no
longer needed.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>file_info</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="ThunarxFileInfo"><type>ThunarxFileInfo</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the parent URI for <parameter>file_info</parameter>
              or <literal>NULL</literal>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="thunarx-file-info-get-uri-scheme"/>thunarx_file_info_get_uri_scheme ()</title>
<indexterm><primary>thunarx_file_info_get_uri_scheme</primary></indexterm><programlisting><link linkend="gchar">gchar</link>*      thunarx_file_info_get_uri_scheme
                                            (<link linkend="ThunarxFileInfo">ThunarxFileInfo</link> *file_info);</programlisting>
<para>
Returns the URI scheme of the file represented
by <parameter>file_info</parameter>. E.g. if <parameter>file_info</parameter> refers to the
file "file:///usr/home", the return value will
be "file".
</para>
<para>
The caller is responsible to free the returned
string using <link linkend="g-free"><function>g_free()</function></link> when no longer needed.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>file_info</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="ThunarxFileInfo"><type>ThunarxFileInfo</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the URI scheme for <parameter>file_info</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="thunarx-file-info-get-mime-type"/>thunarx_file_info_get_mime_type ()</title>
<indexterm><primary>thunarx_file_info_get_mime_type</primary></indexterm><programlisting><link linkend="gchar">gchar</link>*      thunarx_file_info_get_mime_type (<link linkend="ThunarxFileInfo">ThunarxFileInfo</link> *file_info);</programlisting>
<para>
Returns the MIME-type of the file represented by
<parameter>file_info</parameter> or <literal>NULL</literal> if no MIME-type is known for
<parameter>file_info</parameter>.
</para>
<para>
The caller is responsible to free the returned
string using <link linkend="g-free"><function>g_free()</function></link> when no longer needed.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>file_info</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="ThunarxFileInfo"><type>ThunarxFileInfo</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the MIME-type for <parameter>file_info</parameter> or
              <literal>NULL</literal>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="thunarx-file-info-has-mime-type"/>thunarx_file_info_has_mime_type ()</title>
<indexterm><primary>thunarx_file_info_has_mime_type</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>    thunarx_file_info_has_mime_type (<link linkend="ThunarxFileInfo">ThunarxFileInfo</link> *file_info,
                                             const <link linkend="gchar">gchar</link> *mime_type);</programlisting>
<para>
Checks whether <parameter>file_info</parameter> is of the given <parameter>mime_type</parameter>
or whether the MIME-type of <parameter>file_info</parameter> is a subclass
of <parameter>mime_type</parameter>.
</para>
<para>
This is the preferred way for most extensions to check
whether they support a given file or not, and you should
consider using this method rather than
<link linkend="thunarx-file-info-get-mime-type"><function>thunarx_file_info_get_mime_type()</function></link>. A simple example would
be a menu extension that performs a certain action on
text files. In this case you want to check whether a given
<link linkend="ThunarxFileInfo"><type>ThunarxFileInfo</type></link> refers to any kind of text file, not only
to "text/plain" (e.g. this also includes "text/xml" and
"application/x-desktop").
</para>
<para>
But you should be aware that this method may take some
time to test whether <parameter>mime_type</parameter> is valid for <parameter>file_info</parameter>,
so don't call it too often.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>file_info</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="ThunarxFileInfo"><type>ThunarxFileInfo</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>mime_type</parameter>&nbsp;:</term>
<listitem><simpara> a MIME-type (e.g. "text/plain").
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <literal>TRUE</literal> if <parameter>mime_type</parameter> is valid for <parameter>file_info</parameter>,
              else <literal>FALSE</literal>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="thunarx-file-info-is-directory"/>thunarx_file_info_is_directory ()</title>
<indexterm><primary>thunarx_file_info_is_directory</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>    thunarx_file_info_is_directory  (<link linkend="ThunarxFileInfo">ThunarxFileInfo</link> *file_info);</programlisting>
<para>
Checks whether <parameter>file_info</parameter> refers to a directory.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>file_info</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="ThunarxFileInfo"><type>ThunarxFileInfo</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <literal>TRUE</literal> if <parameter>file_info</parameter> is a directory.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="thunarx-file-info-list-copy"/>thunarx_file_info_list_copy ()</title>
<indexterm><primary>thunarx_file_info_list_copy</primary></indexterm><programlisting><link linkend="GList">GList</link>*      thunarx_file_info_list_copy     (<link linkend="GList">GList</link> *file_infos);</programlisting>
<para>
Does a deep copy of <parameter>file_infos</parameter> and returns the
new list.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>file_infos</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GList"><type>GList</type></link> of <link linkend="ThunarxFileInfo"><type>ThunarxFileInfo</type></link><!---->s.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a copy of <parameter>file_infos</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="thunarx-file-info-list-free"/>thunarx_file_info_list_free ()</title>
<indexterm><primary>thunarx_file_info_list_free</primary></indexterm><programlisting><link linkend="void">void</link>        thunarx_file_info_list_free     (<link linkend="GList">GList</link> *file_infos);</programlisting>
<para>
Frees the resources allocated for the <parameter>file_infos</parameter>
list and decreases the reference count on the
<link linkend="ThunarxFileInfo"><type>ThunarxFileInfo</type></link><!---->s contained within.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>file_infos</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GList"><type>GList</type></link> of <link linkend="ThunarxFileInfo"><type>ThunarxFileInfo</type></link><!---->s.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
