<refentry id="libtracker-client-Connecting">
<refmeta>
<refentrytitle role="top_of_page" id="libtracker-client-Connecting.top_of_page">Connecting</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>LIBTRACKER-CLIENT Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Connecting</refname>
<refpurpose>A client library for querying and inserting
data in Tracker.</refpurpose>
</refnamediv>

<refsynopsisdiv id="libtracker-client-Connecting.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

#include &lt;libtracker-client/tracker.h&gt;

                    <link linkend="TrackerClient">TrackerClient</link>;
<link linkend="TrackerClient">TrackerClient</link> *     <link linkend="tracker-connect">tracker_connect</link>                     (<link linkend="gboolean">gboolean</link> enable_warnings,
                                                         <link linkend="gint">gint</link> timeout);
<link linkend="void">void</link>                <link linkend="tracker-disconnect">tracker_disconnect</link>                  (<link linkend="TrackerClient">TrackerClient</link> *client);
</synopsis>
</refsynopsisdiv>









<refsect1 id="libtracker-client-Connecting.description" role="desc">
<title role="desc.title">Description</title>
<para>
This API is for applications which want to integrate with Tracker
either by storing their data or by querying it. They are also not
limited to their application's data. Other data mined by other
applications is also available in some cases.</para>
<para>
</para>
</refsect1>

<refsect1 id="libtracker-client-Connecting.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="TrackerClient" role="struct">
<title>TrackerClient</title>
<indexterm zone="TrackerClient"><primary sortas="TrackerClient">TrackerClient</primary></indexterm><programlisting>typedef struct {
	DBusGProxy *proxy_statistics;
	DBusGProxy *proxy_resources;

        GHashTable *pending_calls;
        guint last_call;
} TrackerClient;
</programlisting>
<para>
This structure is used by <link linkend="tracker-connect"><function>tracker_connect()</function></link> and <link linkend="tracker-disconnect"><function>tracker_disconnect()</function></link>.</para>
<para>
</para><variablelist role="struct">
<varlistentry>
<term><link linkend="DBusGProxy">DBusGProxy</link>&#160;*<structfield>proxy_statistics</structfield>;</term>
<listitem><simpara> a <link linkend="DBusGProxy"><type>DBusGProxy</type></link> for the connection to Tracker's
statistics D-Bus service.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="DBusGProxy">DBusGProxy</link>&#160;*<structfield>proxy_resources</structfield>;</term>
<listitem><simpara> a <link linkend="DBusGProxy"><type>DBusGProxy</type></link> for the connection to Tracker's
resources D-Bus service.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="GHashTable">GHashTable</link>&#160;*<structfield>pending_calls</structfield>;</term>
<listitem><simpara> a <link linkend="GHashTable"><type>GHashTable</type></link> with the D-Bus calls currently
pending (used for the <link linkend="tracker-cancel-call"><function>tracker_cancel_call()</function></link> API).
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint">guint</link>&#160;<structfield>last_call</structfield>;</term>
<listitem><simpara> a <link linkend="guint"><type>guint</type></link> representing the last API call with this
<link linkend="TrackerClient"><type>TrackerClient</type></link>.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="tracker-connect" role="function">
<title>tracker_connect ()</title>
<indexterm zone="tracker-connect"><primary sortas="tracker_connect">tracker_connect</primary></indexterm><programlisting><link linkend="TrackerClient">TrackerClient</link> *     tracker_connect                     (<link linkend="gboolean">gboolean</link> enable_warnings,
                                                         <link linkend="gint">gint</link> timeout);</programlisting>
<para>
Creates a connection over D-Bus to the Tracker store for doing data
querying and inserting.
</para>
<para>
The <parameter>timeout</parameter> is only used if it is &gt; 0. If it is, then it is used
with <link linkend="dbus-g-proxy-set-default-timeout"><function>dbus_g_proxy_set_default_timeout()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>enable_warnings</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="gboolean"><type>gboolean</type></link> to determine if warnings are issued in
cases where they are found.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>timeout</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="gint"><type>gint</type></link> used for D-Bus call timeouts.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the <link linkend="TrackerClient"><type>TrackerClient</type></link> which should be used with
<link linkend="tracker-disconnect"><function>tracker_disconnect()</function></link> when finished with. 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="tracker-disconnect" role="function">
<title>tracker_disconnect ()</title>
<indexterm zone="tracker-disconnect"><primary sortas="tracker_disconnect">tracker_disconnect</primary></indexterm><programlisting><link linkend="void">void</link>                tracker_disconnect                  (<link linkend="TrackerClient">TrackerClient</link> *client);</programlisting>
<para>
This will disconnect the D-Bus connections to Tracker services and
free the allocated <link linkend="TrackerClient"><type>TrackerClient</type></link> by <link linkend="tracker-connect"><function>tracker_connect()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>client</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="TrackerClient"><type>TrackerClient</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
