diff options
author | Stefano Karapetsas <[email protected]> | 2012-01-13 23:18:04 +0100 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2012-01-13 23:18:04 +0100 |
commit | ca0a8f4d6cc24707bc07c3013bff321e2f0c24fd (patch) | |
tree | 4c4d47f249603be3cb816b1456a9dc71c0b48999 /docs/reference | |
download | python-caja-ca0a8f4d6cc24707bc07c3013bff321e2f0c24fd.tar.bz2 python-caja-ca0a8f4d6cc24707bc07c3013bff321e2f0c24fd.tar.xz |
initial import from Mate-Extra repo
Diffstat (limited to 'docs/reference')
19 files changed, 2365 insertions, 0 deletions
diff --git a/docs/reference/caja-python-class-reference.xml b/docs/reference/caja-python-class-reference.xml new file mode 100644 index 0000000..5386ee9 --- /dev/null +++ b/docs/reference/caja-python-class-reference.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> +<chapter id="caja-python-class-reference" + xmlns:xi="http://www.w3.org/2001/XInclude"> + + <title>Available Classes</title> + <xi:include href="caja-python-column.xml"/> + <xi:include href="caja-python-file-info.xml"/> + <xi:include href="caja-python-menu.xml"/> + <xi:include href="caja-python-menu-item.xml"/> + <xi:include href="caja-python-property-page.xml"/> +</chapter> + diff --git a/docs/reference/caja-python-column-provider.xml b/docs/reference/caja-python-column-provider.xml new file mode 100644 index 0000000..e9acb19 --- /dev/null +++ b/docs/reference/caja-python-column-provider.xml @@ -0,0 +1,105 @@ +<?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-caja-python-column-provider"> + <refnamediv> + <refname>caja.ColumnProvider</refname> + <refpurpose>caja.ColumnProvider Reference</refpurpose> + </refnamediv> + +<!-- ******************************* --> +<!-- BEGIN OF SYNOPSIS --> +<!-- ******************************* --> + + <refsect1> + <title>Synopsis</title> + + <classsynopsis language="python"> + <ooclass><classname>caja.ColumnProvider</classname></ooclass> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-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, Caja will request a list of <link linkend="class-caja-python-column"><classname>caja.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-caja-python-column-provider"><classname>caja.ColumnProvider</classname></link> + will almost always want to sub-class <link linkend="class-info-provider"><classname>caja.InfoProvider</classname></link> + as well, since that is how an extension provides information for each item in a directory listing. + </note> + </para> + +<example> + <title>caja.ColumnProvider Example</title> + <programlisting> +import os +import urllib + +import caja + +class ColumnExtension(caja.ColumnProvider, caja.InfoProvider): + def __init__(self): + pass + + def get_columns(self): + return caja.Column("CajaPython::block_size_column", + "block_size", + "Block size", + "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-caja-column-provider--get-columns"> + <title>caja.ColumnProvider.get_columns</title> + + <programlisting><methodsynopsis language="python"> + <methodname>get_columns</methodname> + <methodparam></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>a list of <literal>caja.Column</literal></simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>get_columns</methodname>() method returns a list of + <link linkend="class-caja-python-column"><classname>caja.Column</classname></link>. + </para> + </refsect2> + </refsect1> + +</refentry> + diff --git a/docs/reference/caja-python-column.xml b/docs/reference/caja-python-column.xml new file mode 100644 index 0000000..0d79032 --- /dev/null +++ b/docs/reference/caja-python-column.xml @@ -0,0 +1,159 @@ +<?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-caja-python-column"> + <refnamediv> + <refname>caja.Column</refname> + <refpurpose>caja.Column Reference</refpurpose> + </refnamediv> + +<!-- ******************************* --> +<!-- BEGIN OF CAJA-PYTHON SYNOPSIS --> +<!-- ******************************* --> + + <refsect1> + <title>Synopsis</title> + + <classsynopsis language="python"> + <ooclass><classname>caja.Column</classname></ooclass> + <ooclass><classname><link linkend="class-gobject">gobject.GObject</link></classname></ooclass> + + <constructorsynopsis language="python"> + <methodname><link linkend="constructor-caja-column">caja.Column</link></methodname> + <methodparam><parameter role="keyword">name</parameter></methodparam> + <methodparam><parameter role="keyword">attribute</parameter></methodparam> + <methodparam><parameter role="keyword">label</parameter></methodparam> + <methodparam><parameter role="keyword">description</parameter></methodparam> + </constructorsynopsis> + </classsynopsis> + </refsect1> + +<!-- ********************************* --> +<!-- BEGIN OF ANCESTRY --> +<!-- ********************************* --> + +<refsect1> + <title>Ancestry</title> + +<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link> + +-- <link linkend="class-caja-python-column">caja.Column</link> +</synopsis> +</refsect1> + + +<!-- ********************************** --> +<!-- BEGIN OF DESCRIPTION --> +<!-- ********************************** --> + + <refsect1 id="description-column"> + <title>Description</title> + + <para> + A list of <link linkend="class-caja-python-column"><classname>caja.Column</classname></link> objects is returned by <link linkend="class-caja-python-column-provider"><classname>caja.ColumnProvider</classname></link> extensions. + </para> + + </refsect1> + + +<!-- *********************************** --> +<!-- BEGIN OF PROPERTIES --> +<!-- *********************************** --> + +<refsect1> + <title>Properties</title> + + <blockquote role="properties"> + <informaltable pgwide="1" frame="none"> + <tgroup cols="3"> + <colspec column="1" colwidth="1in"/> + <colspec column="2" colwidth="1in"/> + <colspec column="3" colwidth="4in"/> + <tbody> + + <row valign="top"> + <entry>"attribute"</entry> + <entry>The attribute name to display. Default value: None</entry> + <entry>Read-Write</entry> + </row> + + <row valign="top"> + <entry>"attribute-q"</entry> + <entry>The attribute name to display, in quark form. Default value: 0</entry> + <entry>Read</entry> + </row> + + <row valign="top"> + <entry>"description"</entry> + <entry>The user-visible description of the column. Default value: None</entry> + <entry>Read-Write</entry> + </row> + + <row valign="top"> + <entry>"label"</entry> + <entry>The label to display in the column. Default value: None</entry> + <entry>Read-Write</entry> + </row> + + <row valign="top"> + <entry>"name"</entry> + <entry>The name of the column. Default value: None</entry> + <entry>Read-Write-ConstructOnly</entry> + </row> + + <row valign="top"> + <entry>"xalign"</entry> + <entry>The x-alignment of the column. Allowed values: [0,1]. Default value: 0</entry> + <entry>Read-Write</entry> + </row> + + </tbody> + </tgroup> + </informaltable> + </blockquote> +</refsect1> + + +<!-- ************************************ --> +<!-- BEGIN OF CONSTRUCTOR --> +<!-- ************************************ --> + +<refsect1 id="constructor-caja-column"> + <title>Constructor</title> + + <programlisting><constructorsynopsis language="python"> + <methodname>caja.Column</methodname> + <methodparam><parameter role="keyword">name</parameter></methodparam> + <methodparam><parameter role="keyword">attribute</parameter></methodparam> + <methodparam><parameter role="keyword">label</parameter></methodparam> + <methodparam><parameter role="keyword">description</parameter></methodparam> + </constructorsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">name</parameter> :</term> + <listitem><simpara>identifier of the column</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">attribute</parameter> :</term> + <listitem><simpara>the file attribute to be displayed in the column</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">label</parameter> :</term> + <listitem><simpara>the user-visible label for the column</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">description</parameter> :</term> + <listitem><simpara>a user-visible description of the column</simpara></listitem> + </varlistentry> + </variablelist> + + <para> + Creates a new <link linkend="class-caja-python-column"><classname>caja.Column</classname></link> object. + </para> +</refsect1> + + + +</refentry> + diff --git a/docs/reference/caja-python-enum-reference.xml b/docs/reference/caja-python-enum-reference.xml new file mode 100644 index 0000000..ec8216b --- /dev/null +++ b/docs/reference/caja-python-enum-reference.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> +<chapter id="caja-python-enum-reference" + xmlns:xi="http://www.w3.org/2001/XInclude"> + + <title>Available Enums</title> + <xi:include href="caja-python-operation-result.xml"/> +</chapter> + diff --git a/docs/reference/caja-python-file-info.xml b/docs/reference/caja-python-file-info.xml new file mode 100644 index 0000000..a581c84 --- /dev/null +++ b/docs/reference/caja-python-file-info.xml @@ -0,0 +1,420 @@ +<?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-caja-python-file-info"> + <refnamediv> + <refname>caja.FileInfo</refname> + <refpurpose>caja.FileInfo Reference</refpurpose> + </refnamediv> + +<!-- ******************************* --> +<!-- BEGIN OF CAJA-PYTHON SYNOPSIS --> +<!-- ******************************* --> + + <refsect1> + <title>Synopsis</title> + + <classsynopsis language="python"> + <ooclass><classname>caja.FileInfo</classname></ooclass> + <ooclass><classname><link linkend="class-ginterface">gobject.GInterface</link></classname></ooclass> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--is-gone">is_gone</link></methodname> + <methodparam></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--get-file-type">get_file_type</link></methodname> + <methodparam></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--get-location">get_location</link></methodname> + <methodparam></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--get-name">get_name</link></methodname> + <methodparam></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--get-uri">get_uri</link></methodname> + <methodparam></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--get-activation-uri">get_activation_uri</link></methodname> + <methodparam></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--get-parent-info">get_parent_info</link></methodname> + <methodparam></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--get-parent-location">get_parent_location</link></methodname> + <methodparam></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--get-parent-uri">get_parent_uri</link></methodname> + <methodparam></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--get-mount">get_mount</link></methodname> + <methodparam></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--get-uri-scheme">get_uri_scheme</link></methodname> + <methodparam></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--get-mime-type">get_mime_type</link></methodname> + <methodparam></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--is-mime-type">is_mime_type</link></methodname> + <methodparam><parameter role="keyword">mime_type</parameter></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--is-directory">is_directory</link></methodname> + <methodparam></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--can-write">can_write</link></methodname> + <methodparam></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--add-emblem">add_emblem</link></methodname> + <methodparam><parameter role="keyword">emblem_name</parameter></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--get-string-attribute">get_string_attribute</link></methodname> + <methodparam><parameter role="keyword">attribute_name</parameter></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--add-string-attribute">add_string_attribute</link></methodname> + <methodparam><parameter role="keyword">attribute_name</parameter></methodparam> + <methodparam><parameter role="keyword">value</parameter></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-file-info--invalidate-extension-info">invalidate_extension_info</link></methodname> + <methodparam></methodparam> + </methodsynopsis> + + </classsynopsis> + </refsect1> + +<!-- ********************************* --> +<!-- BEGIN OF ANCESTRY --> +<!-- ********************************* --> + +<refsect1> + <title>Ancestry</title> + +<synopsis>+-- <link linkend="class-ginterface">gobject.GInterface</link> + +-- <link linkend="class-caja-python-file-info">caja.FileInfo</link> +</synopsis> +</refsect1> + + +<!-- ********************************** --> +<!-- BEGIN OF DESCRIPTION --> +<!-- ********************************** --> + + <refsect1 id="description-file-info"> + <title>Description</title> + + <para> + <link linkend="class-caja-python-file-info"><classname>caja.FileInfo</classname></link> objects are passed + to extensions by the <link linkend="class-caja-python-info-provider"><classname>caja.InfoProvider</classname></link>. + </para> + + </refsect1> + + +<!-- ******************************** --> +<!-- BEGIN OF METHODS --> +<!-- ******************************** --> + +<refsect1> + <title>Public Methods</title> + + <refsect2 id="method-caja-python-file-info--is-gone"> + <title>caja.FileInfo.is_gone</title> + <programlisting><methodsynopsis language="python"> + <methodname>is_gone</methodname> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>whether the file still exists</simpara></listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="method-caja-python-file-info--get-file-type"> + <title>caja.FileInfo.get_file_type</title> + <programlisting><methodsynopsis language="python"> + <methodname>get_file_type</methodname> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>the <classname>gio.FileType</classname> associated with the file</simpara></listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="method-caja-python-file-info--get-location"> + <title>caja.FileInfo.get_location</title> + <programlisting><methodsynopsis language="python"> + <methodname>get_location</methodname> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>the <classname>gio.File</classname> associated with the file</simpara></listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="method-caja-python-file-info--get-name"> + <title>caja.FileInfo.get_name</title> + <programlisting><methodsynopsis language="python"> + <methodname>get_name</methodname> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>the basename of the file</simpara></listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="method-caja-python-file-info--get-uri"> + <title>caja.FileInfo.get_uri</title> + <programlisting><methodsynopsis language="python"> + <methodname>get_uri</methodname> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>the uri of the file</simpara></listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="method-caja-python-file-info--get-activation-uri"> + <title>caja.FileInfo.get_activation_uri</title> + <programlisting><methodsynopsis language="python"> + <methodname>get_activation_uri</methodname> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>the activation uri of the file</simpara></listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="method-caja-python-file-info--get-parent-info"> + <title>caja.FileInfo.get_parent_info</title> + <programlisting><methodsynopsis language="python"> + <methodname>get_parent_info</methodname> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>the <link linkend="class-caja-python-file-info"><classname>caja.FileInfo</classname></link> object associated with the file's parent</simpara></listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="method-caja-python-file-info--get-parent-location"> + <title>caja.FileInfo.get_parent_location</title> + <programlisting><methodsynopsis language="python"> + <methodname>get_parent_location</methodname> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>the <classname>gio.File</classname> associated with the file's parent location</simpara></listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="method-caja-python-file-info--get-parent-uri"> + <title>caja.FileInfo.get_parent_uri</title> + <programlisting><methodsynopsis language="python"> + <methodname>get_parent_uri</methodname> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>the uri of the file's parent</simpara></listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="method-caja-python-file-info--get-mount"> + <title>caja.FileInfo.get_mount</title> + <programlisting><methodsynopsis language="python"> + <methodname>get_mount</methodname> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>the <classname>gio.GMount</classname> associated with the file, if it exists</simpara></listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="method-caja-python-file-info--get-uri-scheme"> + <title>caja.FileInfo.get_uri_scheme</title> + <programlisting><methodsynopsis language="python"> + <methodname>get_uri_scheme</methodname> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>the uri scheme of the file</simpara></listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="method-caja-python-file-info--get-mime-type"> + <title>caja.FileInfo.get_mime_type</title> + <programlisting><methodsynopsis language="python"> + <methodname>get_mime_type</methodname> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>the mimetype of the file</simpara></listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="method-caja-python-file-info--is-mime-type"> + <title>caja.FileInfo.is_mime_type</title> + <programlisting><methodsynopsis language="python"> + <methodname>is_mime_type</methodname> + <methodparam><parameter role="keyword">mimetype</parameter></methodparam> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><parameter role="keyword">mimetype</parameter> :</term> + <listitem><simpara>a mimetype string (i.e. "text/plain")</simpara></listitem> + </varlistentry> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>whether the file's mimetype string matches the provided mimetype string</simpara></listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="method-caja-python-file-info--is-directory"> + <title>caja.FileInfo.is_directory</title> + <programlisting><methodsynopsis language="python"> + <methodname>is_directory</methodname> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>whether the item is a directory</simpara></listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="method-caja-python-file-info--can-write"> + <title>caja.FileInfo.can_write</title> + <programlisting><methodsynopsis language="python"> + <methodname>can_write</methodname> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>whether the file is writeable</simpara></listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="method-caja-python-file-info--add-emblem"> + <title>caja.FileInfo.add_emblem</title> + <programlisting><methodsynopsis language="python"> + <methodname>add_emblem</methodname> + <methodparam><parameter role="keyword">emblem_name</parameter></methodparam> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><parameter role="keyword">emblem_name</parameter> :</term> + <listitem><simpara>the name of an emblem to add</simpara></listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="method-caja-python-file-info--get-string-attribute"> + <title>caja.FileInfo.get_string_attribute</title> + <programlisting><methodsynopsis language="python"> + <methodname>get_string_attribute</methodname> + <methodparam><parameter role="keyword">attribute_name</parameter></methodparam> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><parameter role="keyword">attribute_name</parameter> :</term> + <listitem><simpara>a string attribute name</simpara></listitem> + </varlistentry> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>the value associated with the file attribute</simpara></listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="method-caja-python-file-info--add-string-attribute"> + <title>caja.FileInfo.add_string_attribute</title> + <programlisting><methodsynopsis language="python"> + <methodname>add_string_attribute</methodname> + <methodparam><parameter role="keyword">attribute_name</parameter></methodparam> + <methodparam><parameter role="keyword">value</parameter></methodparam> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><parameter role="keyword">attribute_name</parameter> :</term> + <listitem><simpara>a string attribute name</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">value</parameter> :</term> + <listitem><simpara>an attribute value</simpara></listitem> + </varlistentry> + </variablelist> + </refsect2> + + <refsect2 id="method-caja-python-file-info--invalidate-extension-info"> + <title>caja.FileInfo.invalidate_extension_info</title> + <programlisting><methodsynopsis language="python"> + <methodname>invalidate_extension_info</methodname> + </methodsynopsis></programlisting> + <para>Invalidates the information Caja has about this file, which causes it to request new information + from its <link linkend="class-caja-python-info-provider"><classname>caja.InfoProvider</classname></link> providers.</para> + </refsect2> + +</refsect1> + + +</refentry> + diff --git a/docs/reference/caja-python-info-provider.xml b/docs/reference/caja-python-info-provider.xml new file mode 100644 index 0000000..556bb59 --- /dev/null +++ b/docs/reference/caja-python-info-provider.xml @@ -0,0 +1,247 @@ +<?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-caja-python-info-provider"> + <refnamediv> + <refname>caja.InfoProvider</refname> + <refpurpose>caja.InfoProvider Reference</refpurpose> + </refnamediv> + +<!-- ******************************* --> +<!-- BEGIN OF SYNOPSIS --> +<!-- ******************************* --> + + <refsect1> + <title>Synopsis</title> + + <classsynopsis language="python"> + <ooclass><classname>caja.InfoProvider</classname></ooclass> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-info-provider--update-file-info">update_file_info</link></methodname> + <methodparam><parameter role="keyword">file</parameter></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-info-provider--update-file-info-full">update_file_info_full</link></methodname> + <methodparam><parameter role="keyword">provider</parameter></methodparam> + <methodparam><parameter role="keyword">handle</parameter></methodparam> + <methodparam><parameter role="keyword">closure</parameter></methodparam> + <methodparam><parameter role="keyword">file</parameter></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-info-provider--cancel-update">cancel_update</link></methodname> + <methodparam><parameter role="keyword">provider</parameter></methodparam> + <methodparam><parameter role="keyword">handle</parameter></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-info-provider--update-complete-invoke">update_complete_invoke</link></methodname> + <methodparam><parameter role="keyword">provider</parameter></methodparam> + <methodparam><parameter role="keyword">handle</parameter></methodparam> + <methodparam><parameter role="keyword">closure</parameter></methodparam> + <methodparam><parameter role="keyword">result</parameter><initializer>caja.OPERATION_COMPLETE</initializer></methodparam> + </methodsynopsis> + </classsynopsis> + </refsect1> + +<!-- ********************************** --> +<!-- BEGIN OF DESCRIPTION --> +<!-- ********************************** --> + + <refsect1 id="description-info-provider"> + <title>Description</title> + + <para> + If subclassed, Caja will call update_file_info(_full) to notify extensions of which + files are being viewed by the user. This gives extensions an opportunity to invoke actions on the files, + or to add emblems or attributes. + </para> + +<example> + <title>caja.InfoProvider Example</title> + <programlisting> +import os.path +import caja + +class SimpleInfoProviderExample(caja.InfoProvider): + def __init__(self): + pass + + def update_file_info(self, file): + if os.path.splitext(file.get_name())[1] == ".mp3": + file.add_emblem("multimedia") + </programlisting> +</example> + + </refsect1> + +<!-- ****************************** --> +<!-- BEGIN OF METHODS --> +<!-- ****************************** --> + + <refsect1> + <title>Passive Methods</title> + + <refsect2 id="method-caja-python-info-provider--update-file-info"> + <title>caja.InfoProvider.update_file_info</title> + + <programlisting><methodsynopsis language="python"> + <methodname>update_file_info</methodname> + <methodparam><parameter role="keyword">file</parameter></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">file</parameter> :</term> + <listitem><simpara>a <link linkend="class-caja-python-file-info"><classname>caja.FileInfo</classname></link> object</simpara></listitem> + </varlistentry> + </variablelist> + + <para> + This method is called by Caja for each file or folder that exists under the + current directory listing. There is no return value. + </para> + </refsect2> + + + <refsect2 id="method-caja-python-info-provider--update-file-info-full"> + <title>caja.InfoProvider.update_file_info_full</title> + + <programlisting><methodsynopsis language="python"> + <methodname>update_file_info_full</methodname> + <methodparam><parameter role="keyword">provider</parameter></methodparam> + <methodparam><parameter role="keyword">handle</parameter></methodparam> + <methodparam><parameter role="keyword">closure</parameter></methodparam> + <methodparam><parameter role="keyword">file</parameter></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">provider</parameter> :</term> + <listitem><simpara>the current <link linkend="class-caja-python-info-provider"><classname>caja.InfoProvider</classname></link> instance</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">handle</parameter> :</term> + <listitem><simpara>a <classname>gobject.gpointer</classname> generated solely to track this call</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">closure</parameter> :</term> + <listitem><simpara>a C Closure that must be passed to <link linkend="method-caja-python-info-provider--update-complete-invoke">update_complete_invoke</link> if that method is called</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">file</parameter> :</term> + <listitem><simpara>a <link linkend="class-caja-python-file-info"><classname>caja.FileInfo</classname></link> object</simpara></listitem> + </varlistentry> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>None or a <link linkend="enum-caja-python-operation-result"><classname>caja.OperationResult</classname></link> enum</simpara></listitem> + </varlistentry> + </variablelist> + + <para> + This method is called by Caja for each file or folder that exists under the + current directory listing. Originally, <link linkend="class-caja-python-info-provider"><classname>caja.InfoProvider</classname></link> + only provided the update_file_info + method, which blocked Caja when the method required a lot of computation time. This method was + created to allow an extension to tell Caja that it will be spending time on an operation and that + Caja should not block itself during that time. + </para> + <para> + In order to notify Caja of your extension's intentions, you must return a + <link linkend="enum-caja-python-operation-result"><classname>caja.OperationResult</classname></link> enum. + Then, when the operation has completed, call the self.update_complete_invoke method, passing the provider, + handle and closure variables as parameters. + </para> + <para> + This method was created for backwards compatibility reasons. If your + extension used the <link linkend="method-caja-python-info-provider--update-file-info"><function>update_file_info</function></link> method and you want non-blocking + usage, you should switch to this method. + </para> + <note> + This method was introduced in caja-python 0.7.0. + </note> + </refsect2> + + + <refsect2 id="method-caja-python-info-provider--cancel-update"> + <title>caja.InfoProvider.cancel_update</title> + + <programlisting><methodsynopsis language="python"> + <methodname>cancel_update</methodname> + <methodparam><parameter role="keyword">provider</parameter></methodparam> + <methodparam><parameter role="keyword">handle</parameter></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">provider</parameter> :</term> + <listitem><simpara>the current <link linkend="class-caja-python-info-provider"><classname>caja.InfoProvider</classname></link> instance</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">handle</parameter> :</term> + <listitem><simpara>a <classname>gobject.gpointer</classname> generated by a specific update_file_info_full call</simpara></listitem> + </varlistentry> + </variablelist> + + <para> + This method is called by Caja when an update_file_info_full call is in progress + but is no longer required. This may happen because the user is moving directories or a file + has been deleted, etc. You may use the handle parameter here to match the + handle parameter passed in <link linkend="method-caja-python-info-provider--update-file-info-full"><function>update_file_info_full</function></link>. + </para> + <note> + This method was introduced in caja-python 0.7.0. + </note> + </refsect2> + </refsect1> + + <refsect1> + <title>Active Methods</title> + + <refsect2 id="method-caja-python-info-provider--update-complete-invoke"> + <title>caja.InfoProvider.update_complete_invoke</title> + + <programlisting><methodsynopsis language="python"> + <methodname>update_complete_invoke</methodname> + <methodparam><parameter role="keyword">provider</parameter></methodparam> + <methodparam><parameter role="keyword">handle</parameter></methodparam> + <methodparam><parameter role="keyword">closure</parameter></methodparam> + <methodparam><parameter role="keyword">result</parameter><initializer>caja.OPERATION_COMEPLETE</initializer></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">provider</parameter> :</term> + <listitem><simpara>the current <link linkend="class-caja-python-info-provider"><classname>caja.InfoProvider</classname></link> instance</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">handle</parameter> :</term> + <listitem><simpara>a <classname>gobject.gpointer</classname> generated by a specific update_file_info_full call</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">closure</parameter> :</term> + <listitem><simpara>a C Closure that must be passed to <link linkend="method-caja-python-info-provider--update-complete-invoke">update_complete_invoke</link> if that method is called</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">result</parameter> :</term> + <listitem><simpara>an optional parameter. If left out, <link linkend="enum-caja-python-operation-result--OPERATION_COMPLETE"><classname>caja.OPERATION_COMPLETE</classname></link> is assumed. + Otherwise, you may pass any any of the <link linkend="enum-caja-python-operation-result"><classname>caja.OperationResult</classname></link> enums.</simpara></listitem> + </varlistentry> + </variablelist> + + <para> + An extension must call this method for each update_file_info_full method that + returns the <link linkend="enum-caja-python-operation-result--OPERATION_IN_PROGRESS"><classname>caja.OPERATION_IN_PROGRESS</classname></link> enum. + The method must be called with the provider, handle, and closure parameters which were passed to the earlier <link linkend="method-caja-python-info-provider--update-file-info-full"><function>update_file_info_full</function></link> method. + </para> + <note> + This method was introduced in caja-python 0.7.0. + </note> + </refsect2> + </refsect1> + +</refentry> + diff --git a/docs/reference/caja-python-location-widget-provider.xml b/docs/reference/caja-python-location-widget-provider.xml new file mode 100644 index 0000000..ff39657 --- /dev/null +++ b/docs/reference/caja-python-location-widget-provider.xml @@ -0,0 +1,99 @@ +<?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-caja-python-location-widget-provider"> + <refnamediv> + <refname>caja.LocationWidgetProvider</refname> + <refpurpose>caja.LocationWidgetProvider Reference</refpurpose> + </refnamediv> + +<!-- ******************************* --> +<!-- BEGIN OF SYNOPSIS --> +<!-- ******************************* --> + + <refsect1> + <title>Synopsis</title> + + <classsynopsis language="python"> + <ooclass><classname>caja.LocationWidgetProvider</classname></ooclass> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-location-widget-provider--get-widget">get_widget</link></methodname> + <methodparam><parameter role="keyword">uri</parameter></methodparam> + <methodparam><parameter role="keyword">window</parameter></methodparam> + </methodsynopsis> + </classsynopsis> + </refsect1> + +<!-- ********************************** --> +<!-- BEGIN OF DESCRIPTION --> +<!-- ********************************** --> + + <refsect1 id="description-location-widget-provider"> + <title>Description</title> + + <para> + If subclassed, Caja will request a widget to be displayed at the top of the directory listing. + </para> + +<example> + <title>caja.LocationWidgetProvider Example</title> + <programlisting> +import caja +import gtk + +class LocationProviderExample(caja.LocationWidgetProvider): + def __init__(self): + pass + + def get_widget(self, uri, window): + entry = gtk.Entry() + entry.set_text(uri) + entry.show() + return entry + </programlisting> +</example> + + </refsect1> + +<!-- ****************************** --> +<!-- BEGIN OF METHODS --> +<!-- ****************************** --> + + <refsect1> + <title>Passive Methods</title> + + <refsect2 id="method-caja-location-widget-provider--get-widget"> + <title>caja.LocationWidgetProvider.get_widget</title> + + <programlisting><methodsynopsis language="python"> + <methodname>get_widget</methodname> + <methodparam><parameter role="keyword">uri</parameter></methodparam> + <methodparam><parameter role="keyword">window</parameter></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">uri</parameter> :</term> + <listitem><simpara>the current folder uri</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">window</parameter> :</term> + <listitem><simpara>the current <link linkend="class-gtkwindow"><classname>gtk.Window</classname></link> instance</simpara></listitem> + </varlistentry> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>a <link linkend="class-gtk-widget"><classname>gtk.Widget</classname></link> object</simpara></listitem> + </varlistentry> + </variablelist> + + <para> + This function is called by Caja when it wants a location widget from the extension. + It is called in the main thread before a directory listing is shown, so it should return quickly. + </para> + </refsect2> + </refsect1> + +</refentry> + diff --git a/docs/reference/caja-python-menu-item.xml b/docs/reference/caja-python-menu-item.xml new file mode 100644 index 0000000..798afa7 --- /dev/null +++ b/docs/reference/caja-python-menu-item.xml @@ -0,0 +1,275 @@ +<?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-caja-python-menu-item"> + <refnamediv> + <refname>caja.MenuItem</refname> + <refpurpose>caja.MenuItem Reference</refpurpose> + </refnamediv> + +<!-- ******************************* --> +<!-- BEGIN OF CAJA-PYTHON SYNOPSIS --> +<!-- ******************************* --> + + <refsect1> + <title>Synopsis</title> + + <classsynopsis language="python"> + <ooclass><classname>caja.MenuItem</classname></ooclass> + <ooclass><classname><link linkend="class-gobject">gobject.GObject</link></classname></ooclass> + + <constructorsynopsis language="python"> + <methodname><link linkend="constructor-caja-menu-item">caja.MenuItem</link></methodname> + <methodparam><parameter role="keyword">name</parameter></methodparam> + <methodparam><parameter role="keyword">label</parameter></methodparam> + <methodparam><parameter role="keyword">tooltip</parameter></methodparam> + <methodparam><parameter role="keyword">icon</parameter></methodparam> + </constructorsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-menu-item--activate">activate</link></methodname> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-menu-item--set_submenu">set_submenu</link></methodname> + <methodparam><parameter role="keyword">menu</parameter></methodparam> + </methodsynopsis> + + </classsynopsis> + </refsect1> + +<!-- ********************************* --> +<!-- BEGIN OF ANCESTRY --> +<!-- ********************************* --> + +<refsect1> + <title>Ancestry</title> + +<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link> + +-- <link linkend="class-caja-python-menu-item">caja.MenuItem</link> +</synopsis> +</refsect1> + + +<!-- ********************************** --> +<!-- BEGIN OF DESCRIPTION --> +<!-- ********************************** --> + + <refsect1 id="description-menu-item"> + <title>Description</title> + + <para> + <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname></link> objects are appended to lists to create menus and submenus. + </para> + + </refsect1> + + +<!-- *********************************** --> +<!-- BEGIN OF PROPERTIES --> +<!-- *********************************** --> + +<refsect1> + <title>Properties</title> + + <blockquote role="properties"> + <informaltable pgwide="1" frame="none"> + <tgroup cols="3"> + <colspec column="1" colwidth="1in"/> + <colspec column="2" colwidth="1in"/> + <colspec column="3" colwidth="4in"/> + <tbody> + + <row valign="top"> + <entry>"<link linkend="property-caja-python-menu-item--icon">icon</link>"</entry> + <entry>Name of the icon to display in the menu item. Default value: None</entry> + <entry>Read-Write</entry> + </row> + + <row valign="top"> + <entry>"<link linkend="property-caja-python-menu-item--label">label</link>"</entry> + <entry>The label to display to the user. Default value: None</entry> + <entry>Read-Write</entry> + </row> + + <row valign="top"> + <entry>"<link linkend="property-caja-python-menu-item--menu">menu</link>"</entry> + <entry>The <link linkend="class-caja-python-menu">caja.Menu</link> menu object belonging to this item. May be None.</entry> + <entry>Read-Write</entry> + </row> + + <row valign="top"> + <entry>"<link linkend="property-caja-python-menu-item--name">name</link>"</entry> + <entry>The name of the item. Default value: None</entry> + <entry>Read-Write-ConstructOnly</entry> + </row> + + <row valign="top"> + <entry>"<link linkend="property-caja-python-menu-item--priority">priority</link>"</entry> + <entry>Whether or not to show priority text in toolbars. Default value: True</entry> + <entry>Read-Write</entry> + </row> + + <row valign="top"> + <entry>"<link linkend="property-caja-python-menu-item--sensitive">sensitive</link>"</entry> + <entry>Whether or not the menu item is sensitive. Default value: True</entry> + <entry>Read-Write</entry> + </row> + + <row valign="top"> + <entry>"<link linkend="property-caja-python-menu-item--tip">tip</link>"</entry> + <entry>The tooltip for the menu item. Default value: None</entry> + <entry>Read-Write</entry> + </row> + + </tbody> + </tgroup> + </informaltable> + </blockquote> +</refsect1> + + +<!-- ****************************************** --> +<!-- BEGIN OF SIGNAL PROTOTYPES --> +<!-- ****************************************** --> + +<refsect1> + <title>Signals</title> + <variablelist> + <varlistentry> + <term><link linkend="signal-caja-python-menu-item--activate">"activate"</link></term> + <listitem> + <methodsynopsis language="python"><methodname>callback</methodname> + <methodparam><parameter>item</parameter></methodparam> + <methodparam><parameter>user_param1</parameter></methodparam> + <methodparam><parameter>...</parameter></methodparam> + </methodsynopsis> + </listitem> + </varlistentry> + </variablelist> +</refsect1> + + + + +<!-- ************************************ --> +<!-- BEGIN OF CONSTRUCTOR --> +<!-- ************************************ --> + +<refsect1 id="constructor-caja-menu-item"> + <title>Constructor</title> + + <programlisting><constructorsynopsis language="python"> + <methodname>caja.MenuItem</methodname> + <methodparam><parameter role="keyword">name</parameter></methodparam> + <methodparam><parameter role="keyword">label</parameter></methodparam> + <methodparam><parameter role="keyword">tooltip</parameter></methodparam> + <methodparam><parameter role="keyword">icon</parameter></methodparam> + </constructorsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">name</parameter> :</term> + <listitem><simpara>identifier of the item</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">label</parameter> :</term> + <listitem><simpara>the user-visible label for the item</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">tooltip</parameter> :</term> + <listitem><simpara>the user-visible tooltip for the item</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">icon</parameter> :</term> + <listitem><simpara>Name of the icon to display in the item</simpara></listitem> + </varlistentry> + </variablelist> + + <para> + Creates a new <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname></link> object. + </para> +</refsect1> + + +<!-- ******************************** --> +<!-- BEGIN OF METHODS --> +<!-- ******************************** --> + +<refsect1> + <title>Public Methods</title> + + <refsect2 id="method-caja-python-menu-item--activate"> + <title>caja.MenuItem.activate</title> + <programlisting><methodsynopsis language="python"> + <methodname>activate</methodname> + </methodsynopsis></programlisting> + + <para> + Generates the "<link linkend="signal-caja-python-menu-item--activate">activate</link>" signal for this <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname></link>. + </para> + </refsect2> + + <refsect2 id="method-caja-python-menu-item--set_submenu"> + <title>caja.MenuItem.set_submenu</title> + <programlisting><methodsynopsis language="python"> + <methodname>set_submenu</methodname> + <methodparam><parameter role="keyword">menu</parameter></methodparam> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><parameter role="keyword">menu</parameter> :</term> + <listitem><simpara>a <link linkend="class-caja-python-menu"><classname>caja.Menu</classname></link></simpara></listitem> + </varlistentry> + </variablelist> + <para> + Attaches a <link linkend="class-caja-python-menu"><classname>caja.Menu</classname></link> as the submenu for this <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname></link>. + </para> + </refsect2> +</refsect1> + + +<!-- ******************************** --> +<!-- BEGIN OF SIGNAL DETAILS --> +<!-- ******************************** --> + +<refsect1> + <title>Signal Details</title> + + <refsect2 id="signal-caja-python-menu-item--activate"> + <title>The "activate" caja.MenuItem Signal</title> + + <programlisting><methodsynopsis language="python"> + <methodname>callback</methodname> + <methodparam><parameter>item</parameter></methodparam> + <methodparam><parameter>user_param1</parameter></methodparam> + <methodparam><parameter>...</parameter></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter>item</parameter> :</term> + <listitem><simpara>the <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname></link> being activated</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter>user_param1</parameter> :</term> + <listitem><simpara>User-defined parameter the user attaches to the signal connector</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter>...</parameter> :</term> + <listitem><simpara>Additional parameter(s) the user attaches to the signal connector</simpara></listitem> + </varlistentry> + </variablelist> + + <para> + Emits the "<link linkend="signal-caja-python-menu-item--activate">activate</link>" signal. + </para> + + </refsect2> +</refsect1> + + + +</refentry> + diff --git a/docs/reference/caja-python-menu-provider.xml b/docs/reference/caja-python-menu-provider.xml new file mode 100644 index 0000000..0050bec --- /dev/null +++ b/docs/reference/caja-python-menu-provider.xml @@ -0,0 +1,431 @@ +<?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-caja-python-menu-provider"> + <refnamediv> + <refname>caja.MenuProvider</refname> + <refpurpose>caja.MenuProvider Reference</refpurpose> + </refnamediv> + +<!-- ******************************* --> +<!-- BEGIN OF SYNOPSIS --> +<!-- ******************************* --> + + <refsect1> + <title>Synopsis</title> + + <classsynopsis language="python"> + <ooclass><classname>caja.MenuProvider</classname></ooclass> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-menu-provider--get-file-items">get_file_items</link></methodname> + <methodparam><parameter role="keyword">window</parameter></methodparam> + <methodparam><parameter role="keyword">files</parameter></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-menu-provider--get-file-items-full">get_file_items_full</link></methodname> + <methodparam><parameter role="keyword">provider</parameter></methodparam> + <methodparam><parameter role="keyword">window</parameter></methodparam> + <methodparam><parameter role="keyword">files</parameter></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-menu-provider--get-background-items">get_background_items</link></methodname> + <methodparam><parameter role="keyword">window</parameter></methodparam> + <methodparam><parameter role="keyword">folder</parameter></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-menu-provider--get-background-items-full">get_background_items_full</link></methodname> + <methodparam><parameter role="keyword">provider</parameter></methodparam> + <methodparam><parameter role="keyword">window</parameter></methodparam> + <methodparam><parameter role="keyword">folder</parameter></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-menu-provider--get-toolbar-items">get_toolbar_items</link></methodname> + <methodparam><parameter role="keyword">window</parameter></methodparam> + <methodparam><parameter role="keyword">folder</parameter></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-menu-provider--get-toolbar-items-full">get_toolbar_items_full</link></methodname> + <methodparam><parameter role="keyword">provider</parameter></methodparam> + <methodparam><parameter role="keyword">window</parameter></methodparam> + <methodparam><parameter role="keyword">folder</parameter></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-menu-provider--emit-items-updated-signal">emit_items_updated_signal</link></methodname> + <methodparam><parameter role="keyword">provider</parameter></methodparam> + </methodsynopsis> + </classsynopsis> + </refsect1> + +<!-- ********************************** --> +<!-- BEGIN OF DESCRIPTION --> +<!-- ********************************** --> + + <refsect1 id="description-menu-provider"> + <title>Description</title> + + <para> + If subclassed, Caja will request a list of <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname></link> objects, + which are then attached to various menus. Caja expects at least one of + the following methods to be defined (or their *_full variants): get_file_items, + get_background_items, or get_toolbar_items. + </para> + +<example> + <title>caja.MenuProvider Example</title> + <programlisting> +import os +import urllib + +import gtk +import caja +import mateconf + +TERMINAL_KEY = '/desktop/mate/applications/terminal/exec' + +class OpenTerminalExtension(caja.MenuProvider): + def __init__(self): + self.client = mateconf.client_get_default() + + def _open_terminal(self, file): + filename = urllib.unquote(file.get_uri()[7:]) + terminal = self.client.get_string(TERMINAL_KEY) + + os.chdir(filename) + os.system('%s &' % terminal) + + def menu_activate_cb(self, menu, file): + self._open_terminal(file) + + def menu_background_activate_cb(self, menu, file): + self._open_terminal(file) + + def get_file_items(self, window, files): + if len(files) != 1: + return + + file = files[0] + if not file.is_directory() or file.get_uri_scheme() != 'file': + return + + item = caja.MenuItem('CajaPython::openterminal_file_item', + 'Open Terminal' , + 'Open Terminal In %s' % file.get_name()) + item.connect('activate', self.menu_activate_cb, file) + return item, + + def get_background_items(self, window, file): + item = caja.MenuItem('CajaPython::openterminal_item', + 'Open Terminal Here', + 'Open Terminal In This Directory') + item.connect('activate', self.menu_background_activate_cb, file) + return item, + </programlisting> +</example> + + +<!-- ****************************************** --> +<!-- BEGIN OF SIGNAL PROTOTYPES --> +<!-- ****************************************** --> + +<refsect1> + <title>Signals</title> + <variablelist> + <varlistentry> + <term><link linkend="signal-caja-python-menu-provider--items-updated">"items-updated"</link></term> + <listitem> + <methodsynopsis language="python"><methodname>callback</methodname> + </methodsynopsis> + </listitem> + </varlistentry> + </variablelist> +</refsect1> + + + </refsect1> + +<!-- ****************************** --> +<!-- BEGIN OF METHODS --> +<!-- ****************************** --> + + <refsect1> + <title>Passive Methods</title> + + <refsect2 id="method-caja-python-menu-provider--get-file-items"> + <title>caja.MenuProvider.get_file_items</title> + + <programlisting><methodsynopsis language="python"> + <methodname>get_file_items</methodname> + <methodparam><parameter role="keyword">window</parameter></methodparam> + <methodparam><parameter role="keyword">files</parameter></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">window</parameter> :</term> + <listitem><simpara>the current <link linkend="class-gtkwindow"><classname>gtk.Window</classname></link> instance</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">menu</parameter> :</term> + <listitem><simpara>a list of <link linkend="class-caja-python-file-info"><classname>caja.FileInfo</classname></link> objects.</simpara></listitem> + </varlistentry> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>a list of <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname></link> objects</simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>get_file_items</methodname>() method returns a list of + <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname></link> objects. + </para> + </refsect2> + + <refsect2 id="method-caja-python-menu-provider--get-file-items-full"> + <title>caja.MenuProvider.get_file_items_full</title> + + <programlisting><methodsynopsis language="python"> + <methodname>get_file_items_full</methodname> + <methodparam><parameter role="keyword">provider</parameter></methodparam> + <methodparam><parameter role="keyword">window</parameter></methodparam> + <methodparam><parameter role="keyword">files</parameter></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">provider</parameter> :</term> + <listitem><simpara>the current <link linkend="class-caja-python-menu-provider"><classname>caja.MenuProvider</classname></link> instance</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">window</parameter> :</term> + <listitem><simpara>the current <link linkend="class-gtkwindow"><classname>gtk.Window</classname></link> instance</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">files</parameter> :</term> + <listitem><simpara>a list of <link linkend="class-caja-python-file-info"><classname>caja.FileInfo</classname></link> objects.</simpara></listitem> + </varlistentry> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>a list of <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname></link> objects</simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>get_file_items_full</methodname>() method returns a list of + <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname> objects</link>. + </para> + <para> + This method was created in order to allow extension writers to call the + <link linkend="method-caja-menu-provider--emit_items_updated_signal">caja.MenuProvider.emit_items_updated_signal</link>, which must + be passed the current provider instance. + </para> + <note> + This method was introduced in caja-python 0.7.0. + </note> + </refsect2> + + + <refsect2 id="method-caja-python-menu-provider--get-background-items"> + <title>caja.MenuProvider.get_background_items</title> + + <programlisting><methodsynopsis language="python"> + <methodname>get_background_items</methodname> + <methodparam><parameter role="keyword">window</parameter></methodparam> + <methodparam><parameter role="keyword">folder</parameter></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">window</parameter> :</term> + <listitem><simpara>the current <link linkend="class-gtkwindow"><classname>gtk.Window</classname></link> instance</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">folder</parameter> :</term> + <listitem><simpara>the current folder, as a <link linkend="class-caja-python-file-info"><classname>caja.FileInfo</classname></link> object.</simpara></listitem> + </varlistentry> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>a list of <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname></link> objects</simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>get_background_items</methodname>() method returns a list of + <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname> objects</link>. + </para> + </refsect2> + + <refsect2 id="method-caja-python-menu-provider--get-background-items-full"> + <title>caja.MenuProvider.get_background_items_full</title> + + <programlisting><methodsynopsis language="python"> + <methodname>get_background_items_full</methodname> + <methodparam><parameter role="keyword">provider</parameter></methodparam> + <methodparam><parameter role="keyword">window</parameter></methodparam> + <methodparam><parameter role="keyword">folder</parameter></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">provider</parameter> :</term> + <listitem><simpara>the current <link linkend="class-caja-python-menu-provider"><classname>caja.MenuProvider</classname></link> instance</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">window</parameter> :</term> + <listitem><simpara>the current <link linkend="class-gtkwindow"><classname>gtk.Window</classname></link> instance</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">folder</parameter> :</term> + <listitem><simpara>the current folder, as a <link linkend="class-caja-python-file-info"><classname>caja.FileInfo</classname></link> object.</simpara></listitem> + </varlistentry> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>a list of <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname></link> objects</simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>get_background_items_full</methodname>() method returns a list of + <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname> objects</link>. + </para> + <para> + This method was created in order to allow extension writers to call the + <link linkend="method-caja-menu-provider--emit_items_updated_signal">caja.MenuProvider.emit_items_updated_signal</link>, which must + be passed the current provider instance. + </para> + <note> + This method was introduced in caja-python 0.7.0. + </note> + </refsect2> + + + <refsect2 id="method-caja-python-menu-provider--get-toolbar-items"> + <title>caja.MenuProvider.get_toolbar_items</title> + + <programlisting><methodsynopsis language="python"> + <methodname>get_toolbar_items</methodname> + <methodparam><parameter role="keyword">window</parameter></methodparam> + <methodparam><parameter role="keyword">folder</parameter></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">window</parameter> :</term> + <listitem><simpara>the current <link linkend="class-gtkwindow"><classname>gtk.Window</classname></link> instance</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">folder</parameter> :</term> + <listitem><simpara>the current folder, as a <link linkend="class-caja-python-file-info"><classname>caja.FileInfo</classname></link> object.</simpara></listitem> + </varlistentry> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>a list of <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname></link> objects</simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>get_toolbar_items</methodname>() method returns a list of + <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname> objects</link>. + </para> + </refsect2> + + <refsect2 id="method-caja-python-menu-provider--get-toolbar-items-full"> + <title>caja.MenuProvider.get_toolbar_items_full</title> + + <programlisting><methodsynopsis language="python"> + <methodname>get_toolbar_items_full</methodname> + <methodparam><parameter role="keyword">provider</parameter></methodparam> + <methodparam><parameter role="keyword">window</parameter></methodparam> + <methodparam><parameter role="keyword">folder</parameter></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">provider</parameter> :</term> + <listitem><simpara>the current <link linkend="class-caja-python-menu-provider"><classname>caja.MenuProvider</classname></link> instance</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">window</parameter> :</term> + <listitem><simpara>the current <link linkend="class-gtkwindow"><classname>gtk.Window</classname></link> instance</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">folder</parameter> :</term> + <listitem><simpara>the current folder, as a <link linkend="class-caja-python-file-info"><classname>caja.FileInfo</classname></link> object.</simpara></listitem> + </varlistentry> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>a list of <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname></link> objects</simpara></listitem> + </varlistentry> + </variablelist> + + <para> + The <methodname>get_toolbar_items_full</methodname>() method returns a list of + <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname> objects</link>. + </para> + <para> + This method was created in order to allow extension writers to call the + <link linkend="method-caja-menu-provider--emit_items_updated_signal">caja.MenuProvider.emit_items_updated_signal</link>, which must + be passed the current provider instance. + </para> + <note> + This method was introduced in caja-python 0.7.0. + </note> + </refsect2> + </refsect1> + + <refsect1> + <title>Active Methods</title> + + <refsect2 id="method-caja-python-menu-provider--emit-items-updated-signal"> + <title>caja.MenuProvider.emit_items_updated_signal</title> + + <programlisting><methodsynopsis language="python"> + <methodname>emit_items_updated_signal</methodname> + <methodparam><parameter role="keyword">provider</parameter></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">provider</parameter> :</term> + <listitem><simpara>the current <link linkend="class-caja-python-menu-provider"><classname>caja.MenuProvider</classname></link> instance</simpara></listitem> + </varlistentry> + </variablelist> + + <para> + Emits the "<link linkend="signal-caja-python-menu-provider--items-updated">items-updated</link>" signal. + </para> + <note> + This method was introduced in caja-python 0.7.0. + </note> + </refsect2> + </refsect1> + + + +<!-- ******************************** --> +<!-- BEGIN OF SIGNAL DETAILS --> +<!-- ******************************** --> + +<refsect1> + <title>Signal Details</title> + + <refsect2 id="signal-caja-python-menu-provider--items-updated"> + <title>The "items-updated" caja.MenuProvider Signal</title> + + <para> + Emits the "<link linkend="signal-caja-python-menu-provider--items-updated">items-updated</link>" signal. + </para> + + </refsect2> +</refsect1> + + +</refentry> + diff --git a/docs/reference/caja-python-menu.xml b/docs/reference/caja-python-menu.xml new file mode 100644 index 0000000..678585b --- /dev/null +++ b/docs/reference/caja-python-menu.xml @@ -0,0 +1,123 @@ +<?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-caja-python-menu"> + <refnamediv> + <refname>caja.Menu</refname> + <refpurpose>caja.Menu Reference</refpurpose> + </refnamediv> + +<!-- ******************************* --> +<!-- BEGIN OF CAJA-PYTHON SYNOPSIS --> +<!-- ******************************* --> + + <refsect1> + <title>Synopsis</title> + + <classsynopsis language="python"> + <ooclass><classname>caja.Menu</classname></ooclass> + <ooclass><classname><link linkend="class-gobject">gobject.GObject</link></classname></ooclass> + + <constructorsynopsis language="python"> + <methodname><link linkend="constructor-caja-menu">caja.Menu</link></methodname> + </constructorsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-menu--append_item">append_item</link></methodname> + <methodparam><parameter role="keyword">item</parameter></methodparam> + </methodsynopsis> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-python-menu--get_items">get_items</link></methodname> + </methodsynopsis> + + </classsynopsis> + </refsect1> + +<!-- ********************************* --> +<!-- BEGIN OF ANCESTRY --> +<!-- ********************************* --> + +<refsect1> + <title>Ancestry</title> + +<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link> + +-- <link linkend="class-caja-python-menu">caja.Menu</link> +</synopsis> +</refsect1> + + +<!-- ********************************** --> +<!-- BEGIN OF DESCRIPTION --> +<!-- ********************************** --> + + <refsect1 id="description-menu"> + <title>Description</title> + + <para> + A caja.Menu object allows an extension to create sub-menus. + </para> + + </refsect1> + + + +<!-- ************************************ --> +<!-- BEGIN OF CONSTRUCTOR --> +<!-- ************************************ --> + +<refsect1 id="constructor-caja-menu"> + <title>Constructor</title> + + <programlisting><constructorsynopsis language="python"> + <methodname>caja.Menu</methodname> + </constructorsynopsis></programlisting> + + <para> + Creates a new <link linkend="class-caja-python-menu"><classname>caja.Menu</classname></link> object. + </para> +</refsect1> + + + +<!-- ******************************** --> +<!-- BEGIN OF METHODS --> +<!-- ******************************** --> + +<refsect1> + <title>Public Methods</title> + + <refsect2 id="method-caja-python-menu--append_item"> + <title>caja.Menu.append_item</title> + <programlisting><methodsynopsis language="python"> + <methodname>append_item</methodname> + <methodparam><parameter role="keyword">item</parameter></methodparam> + </methodsynopsis></programlisting> + <variablelist> + <varlistentry> + <term><parameter role="keyword">item</parameter> :</term> + <listitem><simpara>a <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname></link></simpara></listitem> + </varlistentry> + </variablelist> + + <para> + Append a <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname></link> to a <link linkend="class-caja-python-menu"><classname>caja.Menu</classname></link>. + </para> + </refsect2> + + <refsect2 id="method-caja-python-menu--get_items"> + <title>caja.Menu.get_items</title> + <programlisting><methodsynopsis language="python"> + <methodname>get_items</methodname> + </methodsynopsis></programlisting> + <para> + Returns a list of <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname></link> objects attached to the <link linkend="class-caja-python-menu"><classname>caja.Menu</classname></link>. + </para> + </refsect2> +</refsect1> + + + +</refentry> + diff --git a/docs/reference/caja-python-operation-result.xml b/docs/reference/caja-python-operation-result.xml new file mode 100644 index 0000000..3720f2f --- /dev/null +++ b/docs/reference/caja-python-operation-result.xml @@ -0,0 +1,56 @@ +<?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="enum-caja-python-operation-result"> + <refnamediv> + <refname>caja.OperationResult</refname> + <refpurpose>caja.OperationResult Reference</refpurpose> + </refnamediv> + + + +<!-- ********************************** --> +<!-- BEGIN OF DESCRIPTION --> +<!-- ********************************** --> + + <refsect1 id="description-operation-result"> + <title>Description</title> + + <para> + The <link linkend="enum-caja-python-operation-result"><classname>caja.OperationResult</classname></link> constants are + used by the <link linkend="class-caja-python-info-provider"><classname>caja.InfoProvider</classname></link> provider to + notify Caja what the extension intends to do when Caja calls the extension's <link linkend="method-caja-python-info-provider--update-file-info-full">update_file_info_full</link> + method. The possible values are as follows: + </para> + + + <variablelist> + <varlistentry> + <term><literal>caja.OPERATION_COMPLETE</literal></term> + <listitem> + <simpara>The operation is complete and Caja can move on to the next <link linkend="method-caja-python-info-provider--update-file-info-full">update_file_info_full</link> call.</simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><literal>caja.OPERATION_IN_PROGRESS</literal></term> + <listitem> + <simpara>The operation is in progress and running asynchronously and Caja should wait until the <link linkend="method-caja-python-info-provider--update-complete-invoke">update_complete_invoke</link> method + is called before moving on to the next <link linkend="method-caja-python-info-provider--update-file-info-full">update_file_info_full</link> call.</simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><literal>caja.OPERATION_FAILED</literal></term> + <listitem> + <simpara>The operation has failed.</simpara> + </listitem> + </varlistentry> + </variablelist> + </refsect1> + + + + + +</refentry> + diff --git a/docs/reference/caja-python-overview-example.xml b/docs/reference/caja-python-overview-example.xml new file mode 100644 index 0000000..b429365 --- /dev/null +++ b/docs/reference/caja-python-overview-example.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> +<chapter id="caja-python-overview-example" + xmlns:xi="http://www.w3.org/2001/XInclude"> + + <title>A Simple Extension</title> + + <para>Create an empty file with the following code:</para> + + <example> + <title>A Simple Extension</title> + <programlisting> +import caja + +class SimpleMenuExtension(caja.MenuProvider): +def __init__(self): + pass + +def menu_activate_cb(self, menu, file): + print "menu_activate_cb",file + +def get_file_items(self, window, files): + if len(files) != 1: + return + + file = files[0] + + item = caja.MenuItem( + "SimpleMenuExtension::Show_File_Name", + "Showing %s" % file.get_name(), + "Showing %s" % file.get_name() + ) + item.connect('activate', self.menu_activate_cb, file) + + return [item]</programlisting> + </example> + + <para>Save this file as TestExtension.py in the ~/.caja/python-extensions folder. + You may need to create this folder. To run, open the terminal and type:</para> + + <informalexample> + <programlisting> +$ caja -q +$ caja --no-desktop</programlisting> + </informalexample> + + <para>Once Caja starts, right-click on a file and you should see a new menu item, + "Showing #filename#". It is as simple as that!</para> + + <para>As mentioned above, in order to + get loaded by Caja, a python extension must import the caja module, + create a class derived from a caja *Provider, then create the methods that + will be called by Caja when it requests information from its providers. + In this case, when someone right-clicks on a file, Caja will ask all of its + MenuProviders for additional menu items to show the user. When folders or files are clicked, + the get_file_items method is called and a list of caja.MenuItems is expected.</para> + +</chapter> diff --git a/docs/reference/caja-python-overview-methods.xml b/docs/reference/caja-python-overview-methods.xml new file mode 100644 index 0000000..973aecd --- /dev/null +++ b/docs/reference/caja-python-overview-methods.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> + +<chapter id="caja-python-overview-methods" + xmlns:xi="http://www.w3.org/2001/XInclude"> + + <title>Explanation of Passive/Active Methods</title> + + <para>Because caja-python is an interface to a Caja' extension interface rather than a true library, it is + rather quirky in how it works. One example of this is that several providers have additional public methods + that an extension actively calls, rather than the extension defining and the method in their class that is called by + Caja. You can see this with the <link linkend="method-caja-python-menu-provider--emit-items-updated-signal">caja.MenuProvider.emit_items_updated_signal</link> + and <link linkend="method-caja-python-info-provider--update-complete-invoke">caja.InfoProvider.update_complete_invoke</link> methods, which + the extension actively calls, passing the provider instance as a parameter. + </para> + + <para>Due to this confusion, I have termed these actively-called methods <emphasis>Active Methods</emphasis> and the methods + called by Caja are termed <emphasis>Passive Methods</emphasis>.</para> +</chapter> diff --git a/docs/reference/caja-python-overview.xml b/docs/reference/caja-python-overview.xml new file mode 100644 index 0000000..e92dedf --- /dev/null +++ b/docs/reference/caja-python-overview.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> +<chapter id="caja-python-overview" + xmlns:xi="http://www.w3.org/2001/XInclude"> + + <title>Overview</title> + + <para>Writing a Caja-Python extension is a fairly straight-forward process. + One simply imports the caja module and creates a class which is derived from a number + of the caja module's classes. When an extension derives a class, it becomes a "provider", + telling Caja to ask it for information. There are several types of providers + available for extensions to use: there is MenuProvider, LocationWidgetProvider, + ColumnProvider, PropertyPageProvider, and InfoProvider, all of which will be explained + in more detail below. Your class can be derived from multiple providers.</para> + + <para>Here are the basic steps:</para> + + <para>1. A script is written and installed to the standard python extensions install path</para> + <para>2. Caja is (re)started and loads the Caja-Python C extension, which in turn loads all python extensions</para> + <para>3. Any python script in the standard python extensions install path that imports the caja module and derives + the main class from a caja module class will be loaded</para> + + <note> +<title>A note about the standard python extensions install path</title> + +<para>The install path for individual users is ~/.caja/python-extensions. </para> +<para>The system-wide install path is $PREFIX/lib/caja/extensions-2.0/python. However, some 64 bit distributions, +such as Fedora, put Caja-Python extensions in $PREFIX/lib64/caja/extensions-2.0/python. </para> +<para>As of caja-python 0.7.0, caja-python looks in ~/.local/share/caja-python/extensions +for local extensions and $PREFIX/share/caja-python/extensions for global extensions.</para> + </note> + + <xi:include href="caja-python-overview-example.xml"/> + <xi:include href="caja-python-overview-methods.xml"/> + +</chapter> + diff --git a/docs/reference/caja-python-property-page-provider.xml b/docs/reference/caja-python-property-page-provider.xml new file mode 100644 index 0000000..1ecb50f --- /dev/null +++ b/docs/reference/caja-python-property-page-provider.xml @@ -0,0 +1,124 @@ +<?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-caja-python-property-page-provider"> + <refnamediv> + <refname>caja.PropertyPageProvider</refname> + <refpurpose>caja.PropertyPageProvider Reference</refpurpose> + </refnamediv> + +<!-- ******************************* --> +<!-- BEGIN OF SYNOPSIS --> +<!-- ******************************* --> + + <refsect1> + <title>Synopsis</title> + + <classsynopsis language="python"> + <ooclass><classname>caja.PropertyPageProvider</classname></ooclass> + + <methodsynopsis language="python"> + <methodname><link linkend="method-caja-property-page-provider--get-pages">get_pages</link></methodname> + <methodparam><parameter role="keyword">files</parameter></methodparam> + </methodsynopsis> + </classsynopsis> + </refsect1> + +<!-- ********************************** --> +<!-- BEGIN OF DESCRIPTION --> +<!-- ********************************** --> + + <refsect1 id="description-property-page-provider"> + <title>Description</title> + + <para> + If subclassed, Caja will request a list of custom property pages that should + appear when a user opens the Properties dialog for a file or folder. + </para> + +<example> + <title>caja.PropertyPageProvider Example</title> + <programlisting> +import hashlib +import urllib + +import gtk +import caja + +class MD5SumPropertyPage(caja.PropertyPageProvider): + def __init__(self): + pass + + def get_property_pages(self, files): + if len(files) != 1: + return + + file = files[0] + if file.get_uri_scheme() != 'file': + return + + if file.is_directory(): + return + + filename = urllib.unquote(file.get_uri()[7:]) + + self.property_label = gtk.Label('MD5Sum') + self.property_label.show() + + self.hbox = gtk.HBox(0, False) + self.hbox.show() + + label = gtk.Label('MD5Sum:') + label.show() + self.hbox.pack_start(label) + + self.value_label = gtk.Label() + self.hbox.pack_start(self.value_label) + + md5sum = hashlib.md5(filename).hexdigest() + self.value_label.set_text(md5sum) + self.value_label.show() + + return caja.PropertyPage("CajaPython::md5_sum", + self.property_label, self.hbox), + </programlisting> +</example> + + </refsect1> + +<!-- ****************************** --> +<!-- BEGIN OF METHODS --> +<!-- ****************************** --> + + <refsect1> + <title>Passive Methods</title> + + <refsect2 id="method-caja-property-page-provider--get-pages"> + <title>caja.PropertyPageProvider.get_pages</title> + + <programlisting><methodsynopsis language="python"> + <methodname>get_pages</methodname> + <methodparam></methodparam> + </methodsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">files</parameter> :</term> + <listitem><simpara>a list of <link linkend="class-caja-python-file-info"><classname>caja.FileInfo</classname></link> objects.</simpara></listitem> + </varlistentry> + <varlistentry> + <term><emphasis>Returns</emphasis> :</term> + <listitem><simpara>a list of <link linkend="class-caja-python-property-page"><classname>caja.PropertyPage</classname></link> objects</simpara></listitem> + </varlistentry> + </variablelist> + + <para> + This function is called by Caja when it wants property page items from the extension. + It is called in the main thread before a property page is shown, so it should return quickly. + </para> + </refsect2> + </refsect1> + +</refentry> + diff --git a/docs/reference/caja-python-property-page.xml b/docs/reference/caja-python-property-page.xml new file mode 100644 index 0000000..c1131ff --- /dev/null +++ b/docs/reference/caja-python-property-page.xml @@ -0,0 +1,135 @@ +<?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-caja-python-property-page"> + <refnamediv> + <refname>caja.PropertyPage</refname> + <refpurpose>caja.PropertyPage Reference</refpurpose> + </refnamediv> + +<!-- ******************************* --> +<!-- BEGIN OF CAJA-PYTHON SYNOPSIS --> +<!-- ******************************* --> + + <refsect1> + <title>Synopsis</title> + + <classsynopsis language="python"> + <ooclass><classname>caja.PropertyPage</classname></ooclass> + <ooclass><classname><link linkend="class-gobject">gobject.GObject</link></classname></ooclass> + + <constructorsynopsis language="python"> + <methodname><link linkend="constructor-caja-property-page">caja.PropertyPage</link></methodname> + <methodparam><parameter role="keyword">name</parameter></methodparam> + <methodparam><parameter role="keyword">label</parameter></methodparam> + <methodparam><parameter role="keyword">page</parameter></methodparam> + </constructorsynopsis> + </classsynopsis> + </refsect1> + +<!-- ********************************* --> +<!-- BEGIN OF ANCESTRY --> +<!-- ********************************* --> + +<refsect1> + <title>Ancestry</title> + +<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link> + +-- <link linkend="class-caja-python-property-page">caja.PropertyPage</link> +</synopsis> +</refsect1> + + +<!-- ********************************** --> +<!-- BEGIN OF DESCRIPTION --> +<!-- ********************************** --> + + <refsect1 id="description-property-page"> + <title>Description</title> + + <para> + A <link linkend="class-caja-python-property-page"><classname>caja.PropertyPage</classname></link> object is returned by <link linkend="class-caja-python-property-page-provider"><classname>caja.PropertyPageProvider</classname></link> extensions. + </para> + + </refsect1> + + +<!-- *********************************** --> +<!-- BEGIN OF PROPERTIES --> +<!-- *********************************** --> + +<refsect1> + <title>Properties</title> + + <blockquote role="properties"> + <informaltable pgwide="1" frame="none"> + <tgroup cols="3"> + <colspec column="1" colwidth="1in"/> + <colspec column="2" colwidth="1in"/> + <colspec column="3" colwidth="4in"/> + <tbody> + + <row valign="top"> + <entry>"label"</entry> + <entry>The label widget displayed in the notebook tab.</entry> + <entry>Read-Write</entry> + </row> + + <row valign="top"> + <entry>"name"</entry> + <entry>The name of the page. Default value: None</entry> + <entry>Read-Write-ConstructOnly</entry> + </row> + + <row valign="top"> + <entry>"page"</entry> + <entry>The property page widget</entry> + <entry>Read-Write</entry> + </row> + + </tbody> + </tgroup> + </informaltable> + </blockquote> +</refsect1> + + +<!-- ************************************ --> +<!-- BEGIN OF CONSTRUCTOR --> +<!-- ************************************ --> + +<refsect1 id="constructor-caja-property-page"> + <title>Constructor</title> + + <programlisting><constructorsynopsis language="python"> + <methodname>caja.PropertyPage</methodname> + <methodparam><parameter role="keyword">name</parameter></methodparam> + <methodparam><parameter role="keyword">label</parameter></methodparam> + <methodparam><parameter role="keyword">page</parameter></methodparam> + </constructorsynopsis></programlisting> + + <variablelist> + <varlistentry> + <term><parameter role="keyword">name</parameter> :</term> + <listitem><simpara>identifier of the property page</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">label</parameter> :</term> + <listitem><simpara>the user-visible label for the property page</simpara></listitem> + </varlistentry> + <varlistentry> + <term><parameter role="keyword">page</parameter> :</term> + <listitem><simpara>the property page widget</simpara></listitem> + </varlistentry> + </variablelist> + + <para> + Creates a new <link linkend="class-caja-python-property-page"><classname>caja.PropertyPage</classname></link> object. + </para> +</refsect1> + + + +</refentry> + diff --git a/docs/reference/caja-python-provider-reference.xml b/docs/reference/caja-python-provider-reference.xml new file mode 100644 index 0000000..898c6c8 --- /dev/null +++ b/docs/reference/caja-python-provider-reference.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> +<chapter id="caja-python-provider-reference" + xmlns:xi="http://www.w3.org/2001/XInclude"> + + <title>Provider Interfaces</title> + <xi:include href="caja-python-column-provider.xml"/> + <xi:include href="caja-python-info-provider.xml"/> + <xi:include href="caja-python-location-widget-provider.xml"/> + <xi:include href="caja-python-menu-provider.xml"/> + <xi:include href="caja-python-property-page-provider.xml"/> +</chapter> + diff --git a/docs/reference/caja-python-ref.xml b/docs/reference/caja-python-ref.xml new file mode 100644 index 0000000..e54ad6c --- /dev/null +++ b/docs/reference/caja-python-ref.xml @@ -0,0 +1,35 @@ +<?xml version='1.0'?> +<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" +[ +<!ENTITY % entities SYSTEM "entities.docbook"> +%entities; +<!ENTITY builddate SYSTEM "builddate.xml"> +<!ENTITY version SYSTEM "version.xml"> +]> +<book id="caja-python-reference" xmlns:xi="http://www.w3.org/2001/XInclude"> + <bookinfo> + <pubdate>&builddate;</pubdate> + <title>caja-python Reference Manual</title> + <edition>Reference Manual for caja-python &version;</edition> + <releaseinfo>For caja-python version &version;</releaseinfo> + <authorgroup> + <author> + <firstname>Adam</firstname> + <surname>Plumb</surname> + </author> + </authorgroup> + <abstract> + <para>This reference describes the classes of the caja-python module.</para> + </abstract> + </bookinfo> + <toc> + </toc> + +<!-- the reference page chapters for the caja-python classes --> + + <xi:include href="caja-python-overview.xml"/> + <xi:include href="caja-python-class-reference.xml"/> + <xi:include href="caja-python-provider-reference.xml"/> + <xi:include href="caja-python-enum-reference.xml"/> +</book> + diff --git a/docs/reference/entities.docbook.in b/docs/reference/entities.docbook.in new file mode 100644 index 0000000..7b2eb41 --- /dev/null +++ b/docs/reference/entities.docbook.in @@ -0,0 +1 @@ +<!ENTITY version "@VERSION@"> |