<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

<refentry id="class-nemo-python-column-provider">
  <refmeta>
    <refentrytitle>Nemo.ColumnProvider</refentrytitle>
  </refmeta>
  <refnamediv>
    <refname>Nemo.ColumnProvider</refname>
    <refpurpose>Nemo.ColumnProvider Reference</refpurpose>
  </refnamediv>

<!-- ******************************* -->
<!-- BEGIN OF SYNOPSIS -->
<!-- ******************************* -->

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>Nemo.ColumnProvider</classname></ooclass>

      <methodsynopsis language="python">
        <methodname><link linkend="method-nemo-column-provider--get-columns">get_columns</link></methodname>
          <methodparam></methodparam>
      </methodsynopsis>
    </classsynopsis>
  </refsect1>

<!-- ********************************** -->
<!-- BEGIN OF DESCRIPTION -->
<!-- ********************************** -->

  <refsect1 id="description-column-provider">
    <title>Description</title>

      <para>
        If subclassed, Nemo will request a list of <link linkend="class-nemo-python-column"><classname>Nemo.Column</classname></link> 
        objects, which are then displayed when the user is in <literal>List</literal> mode.
        
        <note>An extension sub-classing <link linkend="class-nemo-python-column-provider"><classname>Nemo.ColumnProvider</classname></link> 
        will almost always want to sub-class <link linkend="class-info-provider"><classname>Nemo.InfoProvider</classname></link> 
        as well, since that is how an extension provides information for each item in a directory listing.
        </note>
        </para>

<example>
    <title>Nemo.ColumnProvider Example</title>
    <programlisting>
import os
import urllib

from gi.repository import Nemo, GObject

class ColumnExtension(GObject.GObject, Nemo.ColumnProvider, Nemo.InfoProvider):
    def __init__(self):
        pass
    
    def get_columns(self):
        return Nemo.Column(name="NemoPython::block_size_column",
                               attribute="block_size",
                               label="Block size",
                               description="Get the block size"),

    def update_file_info(self, file):
        if file.get_uri_scheme() != 'file':
            return
        
        filename = urllib.unquote(file.get_uri()[7:])
        
        file.add_string_attribute('block_size', str(os.stat(filename).st_blksize))
    </programlisting>
</example>
        
  </refsect1>

<!-- ****************************** -->
<!-- BEGIN OF METHODS -->
<!-- ****************************** -->

  <refsect1>
        <title>Passive Methods</title>

        <refsect2 id="method-nemo-column-provider--get-columns">
          <title>Nemo.ColumnProvider.get_columns</title>

          <programlisting><methodsynopsis language="python">
            <methodname>get_columns</methodname>
              <methodparam></methodparam>
          </methodsynopsis></programlisting>

          <variablelist>
            <varlistentry>
              <term><emphasis>Returns</emphasis>&nbsp;:</term>
              <listitem><simpara>a list of <literal>Nemo.Column</literal></simpara></listitem>
            </varlistentry>
          </variablelist>

          <para>
            The <methodname>get_columns</methodname>() method returns a list of
            <link linkend="class-nemo-python-column"><classname>Nemo.Column</classname></link>.
          </para>
        </refsect2>
    </refsect1>

</refentry>

