<refentry id="GnomeDbDataStore">
<refmeta>
<refentrytitle>GnomeDbDataStore</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>LIBGNOMEDB-4.0 Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>GnomeDbDataStore</refname><refpurpose>Implements the <link linkend="GtkTreeModel"><type>GtkTreeModel</type></link> interface</refpurpose>
</refnamediv>

<refsynopsisdiv><title>Synopsis</title>

<synopsis>



struct      <link linkend="GnomeDbDataStore-struct">GnomeDbDataStore</link>;
struct      <link linkend="GnomeDbDataStoreClass">GnomeDbDataStoreClass</link>;
struct      <link linkend="GnomeDbDataStorePriv">GnomeDbDataStorePriv</link>;
<link linkend="GtkTreeModel">GtkTreeModel</link>* <link linkend="gnome-db-data-store-new">gnome_db_data_store_new</link>       (<link linkend="GdaDataModel">GdaDataModel</link> *model);
<link linkend="gboolean">gboolean</link>    <link linkend="gnome-db-data-store-set-value">gnome_db_data_store_set_value</link>   (<link linkend="GnomeDbDataStore">GnomeDbDataStore</link> *store,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *iter,
                                             <link linkend="gint">gint</link> col,
                                             const <link linkend="GValue">GValue</link> *value);
<link linkend="void">void</link>        <link linkend="gnome-db-data-store-delete">gnome_db_data_store_delete</link>      (<link linkend="GnomeDbDataStore">GnomeDbDataStore</link> *store,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *iter);
<link linkend="void">void</link>        <link linkend="gnome-db-data-store-undelete">gnome_db_data_store_undelete</link>    (<link linkend="GnomeDbDataStore">GnomeDbDataStore</link> *store,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *iter);
<link linkend="gboolean">gboolean</link>    <link linkend="gnome-db-data-store-append">gnome_db_data_store_append</link>      (<link linkend="GnomeDbDataStore">GnomeDbDataStore</link> *store,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *iter);
<link linkend="GdaDataProxy">GdaDataProxy</link>* <link linkend="gnome-db-data-store-get-proxy">gnome_db_data_store_get_proxy</link> (<link linkend="GnomeDbDataStore">GnomeDbDataStore</link> *store);
<link linkend="gint">gint</link>        <link linkend="gnome-db-data-store-get-row-from-iter">gnome_db_data_store_get_row_from_iter</link>
                                            (<link linkend="GnomeDbDataStore">GnomeDbDataStore</link> *store,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *iter);
<link linkend="gboolean">gboolean</link>    <link linkend="gnome-db-data-store-get-iter-from-values">gnome_db_data_store_get_iter_from_values</link>
                                            (<link linkend="GnomeDbDataStore">GnomeDbDataStore</link> *store,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *iter,
                                             <link linkend="GSList">GSList</link> *values,
                                             <link linkend="gint">gint</link> *cols_index);

</synopsis>
</refsynopsisdiv>

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

  <link linkend="GObject">GObject</link>
   +----GnomeDbDataStore
</synopsis>

</refsect1>



<refsect1>
<title>Implemented Interfaces</title>
<para>
GnomeDbDataStore implements
 <link linkend="GtkTreeModel">GtkTreeModel</link>.</para>

</refsect1>


<refsect1>
<title>Properties</title>
<synopsis>

  &quot;<link linkend="GnomeDbDataStore--model">model</link>&quot;                <link linkend="gpointer">gpointer</link>             : Read / Write / Construct Only
  &quot;<link linkend="GnomeDbDataStore--prepend-null-entry">prepend-null-entry</link>&quot;   <link linkend="gboolean">gboolean</link>             : Read / Write
  &quot;<link linkend="GnomeDbDataStore--proxy">proxy</link>&quot;                <link linkend="gpointer">gpointer</link>             : Read
</synopsis>
</refsect1>



<refsect1>
<title>Description</title>
<para>
This object implements the <link linkend="GtkTreeModel"><type>GtkTreeModel</type></link> interface, to make it easy to display a <link linkend="GdaDataModel"><type>GdaDataModel</type></link>
in a <link linkend="GtkTreeView"><type>GtkTreeView</type></link> widget. Internally a <link linkend="GdaDataProxy"><type>GdaDataProxy</type></link> is used so it is possible to adjust the range of
displayed data using that object.
</para>
<para>
Specifically, for a <link linkend="GdaDataModel"><type>GdaDataModel</type></link> object containing <varname>nb_cols</varname> columns,the <link linkend="GnomeDbDataStore"><type>GnomeDbDataStore</type></link> object 
provides the following columns, for a given row:
<itemizedlist>
    <listitem>
      <para>negative column number DATA_STORE_COL_MODEL_N_COLUMNS: always contains <varname>nb_cols</varname></para>
    </listitem>
    <listitem>
      <para>negative column number DATA_STORE_COL_MODEL_POINTER: always contains a pointer to the <link linkend="GdaDataModel"><type>GdaDataModel</type></link></para>
    </listitem>
    <listitem>
      <para>negative column number DATA_STORE_COL_MODEL_ROW: contains the <link linkend="GdaDataModel"><type>GdaDataModel</type></link>'s row number (-1 if the row
      has been added and is not yet present in the data model)</para>
    </listitem>
    <listitem>
      <para>negative column number DATA_STORE_COL_MODIFIED: contains TRUE if the row has been modified in the proxy</para>
    </listitem>
    <listitem>
      <para>negative column number DATA_STORE_COL_TO_DELETE: contains TRUE if the row has been marked to be
      removed in the proxy</para>
    </listitem>
    <listitem>
      <para>column such as 0 &lt;= <varname>column</varname> &lt; <varname>nb_cols</varname>: contains the current value
      in the proxy</para>
    </listitem>
    <listitem>
      <para>column such as <varname>nb_cols</varname> &lt;= <varname>column</varname> &lt; 2*<varname>nb_cols</varname>:
	contains the value in the <link linkend="GdaDataModel"><type>GdaDataModel</type></link> at column <varname>column</varname>-<varname>nb_cols</varname> (which
	may be different than the one in the proxy)</para>
    </listitem>
</itemizedlist>
</para>
</refsect1>

<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="GnomeDbDataStore-struct"/>struct GnomeDbDataStore</title>
<indexterm><primary>GnomeDbDataStore</primary></indexterm><programlisting>struct GnomeDbDataStore;</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="GnomeDbDataStoreClass"/>struct GnomeDbDataStoreClass</title>
<indexterm><primary>GnomeDbDataStoreClass</primary></indexterm><programlisting>struct GnomeDbDataStoreClass {

	GObjectClass           parent_class;
};
</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="GnomeDbDataStorePriv"/>struct GnomeDbDataStorePriv</title>
<indexterm><primary>GnomeDbDataStorePriv</primary></indexterm><programlisting>struct GnomeDbDataStorePriv;</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="gnome-db-data-store-new"/>gnome_db_data_store_new ()</title>
<indexterm><primary>gnome_db_data_store_new</primary></indexterm><programlisting><link linkend="GtkTreeModel">GtkTreeModel</link>* gnome_db_data_store_new       (<link linkend="GdaDataModel">GdaDataModel</link> *model);</programlisting>
<para>
Creates a <link linkend="GtkTreeModel"><type>GtkTreeModel</type></link> interface with a <link linkend="GdaDataModel"><type>GdaDataModel</type></link></para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>model</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GdaDataModel"><type>GdaDataModel</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the new object
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gnome-db-data-store-set-value"/>gnome_db_data_store_set_value ()</title>
<indexterm><primary>gnome_db_data_store_set_value</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>    gnome_db_data_store_set_value   (<link linkend="GnomeDbDataStore">GnomeDbDataStore</link> *store,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *iter,
                                             <link linkend="gint">gint</link> col,
                                             const <link linkend="GValue">GValue</link> *value);</programlisting>
<para>
Stores a value in the <parameter>store</parameter> data model.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>store</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GnomeDbDataStore"><type>GnomeDbDataStore</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>iter</parameter>&nbsp;:</term>
<listitem><simpara> the considered row
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>col</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>value</parameter>&nbsp;:</term>
<listitem><simpara> the value to store (gets copied)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> TRUE on succes
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gnome-db-data-store-delete"/>gnome_db_data_store_delete ()</title>
<indexterm><primary>gnome_db_data_store_delete</primary></indexterm><programlisting><link linkend="void">void</link>        gnome_db_data_store_delete      (<link linkend="GnomeDbDataStore">GnomeDbDataStore</link> *store,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *iter);</programlisting>
<para>
Marks the row pointed by <parameter>iter</parameter> to be deleted</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>store</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GnomeDbDataStore"><type>GnomeDbDataStore</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>iter</parameter>&nbsp;:</term>
<listitem><simpara> the considered row
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gnome-db-data-store-undelete"/>gnome_db_data_store_undelete ()</title>
<indexterm><primary>gnome_db_data_store_undelete</primary></indexterm><programlisting><link linkend="void">void</link>        gnome_db_data_store_undelete    (<link linkend="GnomeDbDataStore">GnomeDbDataStore</link> *store,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *iter);</programlisting>
<para>
Remove the "to be deleted" mark the row pointed by <parameter>iter</parameter>, if it existed.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>store</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GnomeDbDataStore"><type>GnomeDbDataStore</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>iter</parameter>&nbsp;:</term>
<listitem><simpara> the considered row
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gnome-db-data-store-append"/>gnome_db_data_store_append ()</title>
<indexterm><primary>gnome_db_data_store_append</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>    gnome_db_data_store_append      (<link linkend="GnomeDbDataStore">GnomeDbDataStore</link> *store,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *iter);</programlisting>
<para>
Appends a new row.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>store</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GnomeDbDataStore"><type>GnomeDbDataStore</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>iter</parameter>&nbsp;:</term>
<listitem><simpara> an unset <link linkend="GtkTreeIter"><type>GtkTreeIter</type></link> to set to the appended row
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> TRUE if no error occurred
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gnome-db-data-store-get-proxy"/>gnome_db_data_store_get_proxy ()</title>
<indexterm><primary>gnome_db_data_store_get_proxy</primary></indexterm><programlisting><link linkend="GdaDataProxy">GdaDataProxy</link>* gnome_db_data_store_get_proxy (<link linkend="GnomeDbDataStore">GnomeDbDataStore</link> *store);</programlisting>
<para>
</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>store</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GnomeDbDataStore"><type>GnomeDbDataStore</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the internal <link linkend="GdaDataProxy"><type>GdaDataProxy</type></link> being used by <parameter>store</parameter>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gnome-db-data-store-get-row-from-iter"/>gnome_db_data_store_get_row_from_iter ()</title>
<indexterm><primary>gnome_db_data_store_get_row_from_iter</primary></indexterm><programlisting><link linkend="gint">gint</link>        gnome_db_data_store_get_row_from_iter
                                            (<link linkend="GnomeDbDataStore">GnomeDbDataStore</link> *store,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *iter);</programlisting>
<para>
Get the number of the row represented by <parameter>iter</parameter></para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>store</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GnomeDbDataStore"><type>GnomeDbDataStore</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>iter</parameter>&nbsp;:</term>
<listitem><simpara> a valid <link linkend="GtkTreeIter"><type>GtkTreeIter</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the row number, or -1 if an error occurred
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gnome-db-data-store-get-iter-from-values"/>gnome_db_data_store_get_iter_from_values ()</title>
<indexterm><primary>gnome_db_data_store_get_iter_from_values</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>    gnome_db_data_store_get_iter_from_values
                                            (<link linkend="GnomeDbDataStore">GnomeDbDataStore</link> *store,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *iter,
                                             <link linkend="GSList">GSList</link> *values,
                                             <link linkend="gint">gint</link> *cols_index);</programlisting>
<para>
Sets <parameter>iter</parameter> to the first row where all the values in <parameter>values</parameter> at the columns identified at
<parameter>cols_index</parameter> match. If the row can't be identified, then the contents of <parameter>iter</parameter> is not modified.
</para>
<para>
NOTE: the <parameter>cols_index</parameter> array MUST contain a column index for each value in <parameter>values</parameter></para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>store</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GnomeDbDataStore"><type>GnomeDbDataStore</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>iter</parameter>&nbsp;:</term>
<listitem><simpara> an unset <link linkend="GtkTreeIter"><type>GtkTreeIter</type></link> to set to the requested row
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>values</parameter>&nbsp;:</term>
<listitem><simpara> a list of <link linkend="GValue"><type>GValue</type></link> values
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>cols_index</parameter>&nbsp;:</term>
<listitem><simpara> an array of <link linkend="gint"><type>gint</type></link> containing the column number to match each value of <parameter>values</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> TRUE if the row has been identified <parameter>iter</parameter> was set
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>
<refsect1>
<title>Properties</title>
<variablelist>
<varlistentry><term><anchor id="GnomeDbDataStore--model"/>&quot;<literal>model</literal>&quot; (<link linkend="gpointer">gpointer</link> : Read / Write / Construct Only)</term>
<listitem>
<para></para>
</listitem></varlistentry>
<varlistentry><term><anchor id="GnomeDbDataStore--prepend-null-entry"/>&quot;<literal>prepend-null-entry</literal>&quot; (<link linkend="gboolean">gboolean</link> : Read / Write)</term>
<listitem>
<para></para>
</listitem></varlistentry>
<varlistentry><term><anchor id="GnomeDbDataStore--proxy"/>&quot;<literal>proxy</literal>&quot; (<link linkend="gpointer">gpointer</link> : Read)</term>
<listitem>
<para></para>
</listitem></varlistentry>

</variablelist>
</refsect1>




</refentry>
