diff options
-rw-r--r-- | docs/reference/caja-python-column-provider.xml | 32 | ||||
-rw-r--r-- | docs/reference/caja-python-column.xml | 16 | ||||
-rw-r--r-- | docs/reference/caja-python-file-info.xml | 54 | ||||
-rw-r--r-- | docs/reference/caja-python-info-provider.xml | 66 | ||||
-rw-r--r-- | docs/reference/caja-python-location-widget-provider.xml | 17 | ||||
-rw-r--r-- | docs/reference/caja-python-menu-item.xml | 32 | ||||
-rw-r--r-- | docs/reference/caja-python-menu-provider.xml | 225 | ||||
-rw-r--r-- | docs/reference/caja-python-menu.xml | 26 | ||||
-rw-r--r-- | docs/reference/caja-python-operation-result.xml | 16 | ||||
-rw-r--r-- | docs/reference/caja-python-overview-example.xml | 64 | ||||
-rw-r--r-- | docs/reference/caja-python-overview-methods.xml | 4 | ||||
-rw-r--r-- | docs/reference/caja-python-overview.xml | 27 | ||||
-rw-r--r-- | docs/reference/caja-python-property-page-provider.xml | 45 | ||||
-rw-r--r-- | docs/reference/caja-python-property-page.xml | 16 |
14 files changed, 277 insertions, 363 deletions
diff --git a/docs/reference/caja-python-column-provider.xml b/docs/reference/caja-python-column-provider.xml index e9acb19..ba4956e 100644 --- a/docs/reference/caja-python-column-provider.xml +++ b/docs/reference/caja-python-column-provider.xml @@ -4,8 +4,8 @@ <refentry id="class-caja-python-column-provider"> <refnamediv> - <refname>caja.ColumnProvider</refname> - <refpurpose>caja.ColumnProvider Reference</refpurpose> + <refname>Caja.ColumnProvider</refname> + <refpurpose>Caja.ColumnProvider Reference</refpurpose> </refnamediv> <!-- ******************************* --> @@ -16,7 +16,7 @@ <title>Synopsis</title> <classsynopsis language="python"> - <ooclass><classname>caja.ColumnProvider</classname></ooclass> + <ooclass><classname>Caja.ColumnProvider</classname></ooclass> <methodsynopsis language="python"> <methodname><link linkend="method-caja-column-provider--get-columns">get_columns</link></methodname> @@ -33,32 +33,32 @@ <title>Description</title> <para> - If subclassed, Caja will request a list of <link linkend="class-caja-python-column"><classname>caja.Column</classname></link> + 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> + <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> + <title>Caja.ColumnProvider Example</title> <programlisting> import os import urllib -import caja +from gi.repository import Caja, GObject -class ColumnExtension(caja.ColumnProvider, caja.InfoProvider): +class ColumnExtension(GObject.GObject, 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"), + return Caja.Column(name="CajaPython::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': @@ -80,7 +80,7 @@ class ColumnExtension(caja.ColumnProvider, caja.InfoProvider): <title>Passive Methods</title> <refsect2 id="method-caja-column-provider--get-columns"> - <title>caja.ColumnProvider.get_columns</title> + <title>Caja.ColumnProvider.get_columns</title> <programlisting><methodsynopsis language="python"> <methodname>get_columns</methodname> @@ -90,13 +90,13 @@ class ColumnExtension(caja.ColumnProvider, caja.InfoProvider): <variablelist> <varlistentry> <term><emphasis>Returns</emphasis> :</term> - <listitem><simpara>a list of <literal>caja.Column</literal></simpara></listitem> + <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>. + <link linkend="class-caja-python-column"><classname>Caja.Column</classname></link>. </para> </refsect2> </refsect1> diff --git a/docs/reference/caja-python-column.xml b/docs/reference/caja-python-column.xml index 0d79032..8d4b9b7 100644 --- a/docs/reference/caja-python-column.xml +++ b/docs/reference/caja-python-column.xml @@ -4,8 +4,8 @@ <refentry id="class-caja-python-column"> <refnamediv> - <refname>caja.Column</refname> - <refpurpose>caja.Column Reference</refpurpose> + <refname>Caja.Column</refname> + <refpurpose>Caja.Column Reference</refpurpose> </refnamediv> <!-- ******************************* --> @@ -16,11 +16,11 @@ <title>Synopsis</title> <classsynopsis language="python"> - <ooclass><classname>caja.Column</classname></ooclass> + <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> + <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> @@ -37,7 +37,7 @@ <title>Ancestry</title> <synopsis>+-- <link linkend="class-gobject">gobject.GObject</link> - +-- <link linkend="class-caja-python-column">caja.Column</link> + +-- <link linkend="class-caja-python-column">Caja.Column</link> </synopsis> </refsect1> @@ -50,7 +50,7 @@ <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. + 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> @@ -122,7 +122,7 @@ <title>Constructor</title> <programlisting><constructorsynopsis language="python"> - <methodname>caja.Column</methodname> + <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> @@ -149,7 +149,7 @@ </variablelist> <para> - Creates a new <link linkend="class-caja-python-column"><classname>caja.Column</classname></link> object. + Creates a new <link linkend="class-caja-python-column"><classname>Caja.Column</classname></link> object. </para> </refsect1> diff --git a/docs/reference/caja-python-file-info.xml b/docs/reference/caja-python-file-info.xml index a581c84..fb156ee 100644 --- a/docs/reference/caja-python-file-info.xml +++ b/docs/reference/caja-python-file-info.xml @@ -4,8 +4,8 @@ <refentry id="class-caja-python-file-info"> <refnamediv> - <refname>caja.FileInfo</refname> - <refpurpose>caja.FileInfo Reference</refpurpose> + <refname>Caja.FileInfo</refname> + <refpurpose>Caja.FileInfo Reference</refpurpose> </refnamediv> <!-- ******************************* --> @@ -16,7 +16,7 @@ <title>Synopsis</title> <classsynopsis language="python"> - <ooclass><classname>caja.FileInfo</classname></ooclass> + <ooclass><classname>Caja.FileInfo</classname></ooclass> <ooclass><classname><link linkend="class-ginterface">gobject.GInterface</link></classname></ooclass> <methodsynopsis language="python"> @@ -126,7 +126,7 @@ <title>Ancestry</title> <synopsis>+-- <link linkend="class-ginterface">gobject.GInterface</link> - +-- <link linkend="class-caja-python-file-info">caja.FileInfo</link> + +-- <link linkend="class-caja-python-file-info">Caja.FileInfo</link> </synopsis> </refsect1> @@ -139,8 +139,8 @@ <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>. + <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> @@ -154,7 +154,7 @@ <title>Public Methods</title> <refsect2 id="method-caja-python-file-info--is-gone"> - <title>caja.FileInfo.is_gone</title> + <title>Caja.FileInfo.is_gone</title> <programlisting><methodsynopsis language="python"> <methodname>is_gone</methodname> </methodsynopsis></programlisting> @@ -167,7 +167,7 @@ </refsect2> <refsect2 id="method-caja-python-file-info--get-file-type"> - <title>caja.FileInfo.get_file_type</title> + <title>Caja.FileInfo.get_file_type</title> <programlisting><methodsynopsis language="python"> <methodname>get_file_type</methodname> </methodsynopsis></programlisting> @@ -180,7 +180,7 @@ </refsect2> <refsect2 id="method-caja-python-file-info--get-location"> - <title>caja.FileInfo.get_location</title> + <title>Caja.FileInfo.get_location</title> <programlisting><methodsynopsis language="python"> <methodname>get_location</methodname> </methodsynopsis></programlisting> @@ -193,7 +193,7 @@ </refsect2> <refsect2 id="method-caja-python-file-info--get-name"> - <title>caja.FileInfo.get_name</title> + <title>Caja.FileInfo.get_name</title> <programlisting><methodsynopsis language="python"> <methodname>get_name</methodname> </methodsynopsis></programlisting> @@ -206,7 +206,7 @@ </refsect2> <refsect2 id="method-caja-python-file-info--get-uri"> - <title>caja.FileInfo.get_uri</title> + <title>Caja.FileInfo.get_uri</title> <programlisting><methodsynopsis language="python"> <methodname>get_uri</methodname> </methodsynopsis></programlisting> @@ -219,7 +219,7 @@ </refsect2> <refsect2 id="method-caja-python-file-info--get-activation-uri"> - <title>caja.FileInfo.get_activation_uri</title> + <title>Caja.FileInfo.get_activation_uri</title> <programlisting><methodsynopsis language="python"> <methodname>get_activation_uri</methodname> </methodsynopsis></programlisting> @@ -232,20 +232,20 @@ </refsect2> <refsect2 id="method-caja-python-file-info--get-parent-info"> - <title>caja.FileInfo.get_parent_info</title> + <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> + <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> + <title>Caja.FileInfo.get_parent_location</title> <programlisting><methodsynopsis language="python"> <methodname>get_parent_location</methodname> </methodsynopsis></programlisting> @@ -258,7 +258,7 @@ </refsect2> <refsect2 id="method-caja-python-file-info--get-parent-uri"> - <title>caja.FileInfo.get_parent_uri</title> + <title>Caja.FileInfo.get_parent_uri</title> <programlisting><methodsynopsis language="python"> <methodname>get_parent_uri</methodname> </methodsynopsis></programlisting> @@ -271,7 +271,7 @@ </refsect2> <refsect2 id="method-caja-python-file-info--get-mount"> - <title>caja.FileInfo.get_mount</title> + <title>Caja.FileInfo.get_mount</title> <programlisting><methodsynopsis language="python"> <methodname>get_mount</methodname> </methodsynopsis></programlisting> @@ -284,7 +284,7 @@ </refsect2> <refsect2 id="method-caja-python-file-info--get-uri-scheme"> - <title>caja.FileInfo.get_uri_scheme</title> + <title>Caja.FileInfo.get_uri_scheme</title> <programlisting><methodsynopsis language="python"> <methodname>get_uri_scheme</methodname> </methodsynopsis></programlisting> @@ -297,7 +297,7 @@ </refsect2> <refsect2 id="method-caja-python-file-info--get-mime-type"> - <title>caja.FileInfo.get_mime_type</title> + <title>Caja.FileInfo.get_mime_type</title> <programlisting><methodsynopsis language="python"> <methodname>get_mime_type</methodname> </methodsynopsis></programlisting> @@ -310,7 +310,7 @@ </refsect2> <refsect2 id="method-caja-python-file-info--is-mime-type"> - <title>caja.FileInfo.is_mime_type</title> + <title>Caja.FileInfo.is_mime_type</title> <programlisting><methodsynopsis language="python"> <methodname>is_mime_type</methodname> <methodparam><parameter role="keyword">mimetype</parameter></methodparam> @@ -328,7 +328,7 @@ </refsect2> <refsect2 id="method-caja-python-file-info--is-directory"> - <title>caja.FileInfo.is_directory</title> + <title>Caja.FileInfo.is_directory</title> <programlisting><methodsynopsis language="python"> <methodname>is_directory</methodname> </methodsynopsis></programlisting> @@ -341,7 +341,7 @@ </refsect2> <refsect2 id="method-caja-python-file-info--can-write"> - <title>caja.FileInfo.can_write</title> + <title>Caja.FileInfo.can_write</title> <programlisting><methodsynopsis language="python"> <methodname>can_write</methodname> </methodsynopsis></programlisting> @@ -354,7 +354,7 @@ </refsect2> <refsect2 id="method-caja-python-file-info--add-emblem"> - <title>caja.FileInfo.add_emblem</title> + <title>Caja.FileInfo.add_emblem</title> <programlisting><methodsynopsis language="python"> <methodname>add_emblem</methodname> <methodparam><parameter role="keyword">emblem_name</parameter></methodparam> @@ -368,7 +368,7 @@ </refsect2> <refsect2 id="method-caja-python-file-info--get-string-attribute"> - <title>caja.FileInfo.get_string_attribute</title> + <title>Caja.FileInfo.get_string_attribute</title> <programlisting><methodsynopsis language="python"> <methodname>get_string_attribute</methodname> <methodparam><parameter role="keyword">attribute_name</parameter></methodparam> @@ -386,7 +386,7 @@ </refsect2> <refsect2 id="method-caja-python-file-info--add-string-attribute"> - <title>caja.FileInfo.add_string_attribute</title> + <title>Caja.FileInfo.add_string_attribute</title> <programlisting><methodsynopsis language="python"> <methodname>add_string_attribute</methodname> <methodparam><parameter role="keyword">attribute_name</parameter></methodparam> @@ -405,12 +405,12 @@ </refsect2> <refsect2 id="method-caja-python-file-info--invalidate-extension-info"> - <title>caja.FileInfo.invalidate_extension_info</title> + <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> + from its <link linkend="class-caja-python-info-provider"><classname>Caja.InfoProvider</classname></link> providers.</para> </refsect2> </refsect1> diff --git a/docs/reference/caja-python-info-provider.xml b/docs/reference/caja-python-info-provider.xml index 556bb59..424fdb0 100644 --- a/docs/reference/caja-python-info-provider.xml +++ b/docs/reference/caja-python-info-provider.xml @@ -4,8 +4,8 @@ <refentry id="class-caja-python-info-provider"> <refnamediv> - <refname>caja.InfoProvider</refname> - <refpurpose>caja.InfoProvider Reference</refpurpose> + <refname>Caja.InfoProvider</refname> + <refpurpose>Caja.InfoProvider Reference</refpurpose> </refnamediv> <!-- ******************************* --> @@ -16,7 +16,7 @@ <title>Synopsis</title> <classsynopsis language="python"> - <ooclass><classname>caja.InfoProvider</classname></ooclass> + <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> @@ -38,11 +38,11 @@ </methodsynopsis> <methodsynopsis language="python"> - <methodname><link linkend="method-caja-python-info-provider--update-complete-invoke">update_complete_invoke</link></methodname> + <methodname><link linkend="method-caja-python-info-provider--update-complete-invoke">Caja.info_provider_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> + <methodparam><parameter role="keyword">result</parameter><initializer>Caja.OperationResult.COMPLETE</initializer></methodparam> </methodsynopsis> </classsynopsis> </refsect1> @@ -61,18 +61,20 @@ </para> <example> - <title>caja.InfoProvider Example</title> + <title>Caja.InfoProvider Example</title> <programlisting> -import os.path -import caja +from gi.repository import Caja, GObject -class SimpleInfoProviderExample(caja.InfoProvider): +class ColumnExtension(GObject.GObject, 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") + def update_file_info_full(self, provider, handle, closure, file): + gobject.timeout_add_seconds(3, self.update_cb, provider, handle, closure) + return Caja.OperationResult.IN_PROGRESS + + def update_cb(self, provider, handle, closure): + Caja.info_provider_update_complete_invoke(closure, provider, handle, Caja.OperationResult.FAILED) </programlisting> </example> @@ -86,7 +88,7 @@ class SimpleInfoProviderExample(caja.InfoProvider): <title>Passive Methods</title> <refsect2 id="method-caja-python-info-provider--update-file-info"> - <title>caja.InfoProvider.update_file_info</title> + <title>Caja.InfoProvider.update_file_info</title> <programlisting><methodsynopsis language="python"> <methodname>update_file_info</methodname> @@ -96,7 +98,7 @@ class SimpleInfoProviderExample(caja.InfoProvider): <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> + <listitem><simpara>a <link linkend="class-caja-python-file-info"><classname>Caja.FileInfo</classname></link> object</simpara></listitem> </varlistentry> </variablelist> @@ -108,7 +110,7 @@ class SimpleInfoProviderExample(caja.InfoProvider): <refsect2 id="method-caja-python-info-provider--update-file-info-full"> - <title>caja.InfoProvider.update_file_info_full</title> + <title>Caja.InfoProvider.update_file_info_full</title> <programlisting><methodsynopsis language="python"> <methodname>update_file_info_full</methodname> @@ -121,7 +123,7 @@ class SimpleInfoProviderExample(caja.InfoProvider): <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> + <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> @@ -129,21 +131,21 @@ class SimpleInfoProviderExample(caja.InfoProvider): </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> + <listitem><simpara>a C Closure that must be passed to <link linkend="method-caja-python-info-provider--update-complete-invoke">Caja.info_provider_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> + <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> + <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> + 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 @@ -151,8 +153,8 @@ class SimpleInfoProviderExample(caja.InfoProvider): </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, + <link linkend="enum-caja-python-operation-result"><classname>Caja.OperationResult</classname></link> enum. + Then, when the operation has completed, call the Caja.info_provider_update_complete_invoke method, passing the provider, handle and closure variables as parameters. </para> <para> @@ -167,7 +169,7 @@ class SimpleInfoProviderExample(caja.InfoProvider): <refsect2 id="method-caja-python-info-provider--cancel-update"> - <title>caja.InfoProvider.cancel_update</title> + <title>Caja.InfoProvider.cancel_update</title> <programlisting><methodsynopsis language="python"> <methodname>cancel_update</methodname> @@ -178,7 +180,7 @@ class SimpleInfoProviderExample(caja.InfoProvider): <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> + <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> @@ -202,20 +204,20 @@ class SimpleInfoProviderExample(caja.InfoProvider): <title>Active Methods</title> <refsect2 id="method-caja-python-info-provider--update-complete-invoke"> - <title>caja.InfoProvider.update_complete_invoke</title> + <title>Caja.info_provider_update_complete_invoke</title> <programlisting><methodsynopsis language="python"> - <methodname>update_complete_invoke</methodname> + <methodname>info_provider_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> + <methodparam><parameter role="keyword">result</parameter><initializer>Caja.OperationResult.COMPLETE</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> + <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> @@ -223,18 +225,18 @@ class SimpleInfoProviderExample(caja.InfoProvider): </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> + <listitem><simpara>a C Closure that must be passed to <link linkend="method-caja-python-info-provider--update-complete-invoke">Caja.info_provider_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> + <listitem><simpara>an optional parameter. If left out, <link linkend="enum-caja-python-operation-result--OPERATION_COMPLETE"><classname>Caja.OperationResult.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. + returns the <link linkend="enum-caja-python-operation-result--OPERATION_IN_PROGRESS"><classname>Caja.OperationResult.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> diff --git a/docs/reference/caja-python-location-widget-provider.xml b/docs/reference/caja-python-location-widget-provider.xml index ff39657..3fd4927 100644 --- a/docs/reference/caja-python-location-widget-provider.xml +++ b/docs/reference/caja-python-location-widget-provider.xml @@ -4,8 +4,8 @@ <refentry id="class-caja-python-location-widget-provider"> <refnamediv> - <refname>caja.LocationWidgetProvider</refname> - <refpurpose>caja.LocationWidgetProvider Reference</refpurpose> + <refname>Caja.LocationWidgetProvider</refname> + <refpurpose>Caja.LocationWidgetProvider Reference</refpurpose> </refnamediv> <!-- ******************************* --> @@ -16,7 +16,7 @@ <title>Synopsis</title> <classsynopsis language="python"> - <ooclass><classname>caja.LocationWidgetProvider</classname></ooclass> + <ooclass><classname>Caja.LocationWidgetProvider</classname></ooclass> <methodsynopsis language="python"> <methodname><link linkend="method-caja-location-widget-provider--get-widget">get_widget</link></methodname> @@ -38,17 +38,16 @@ </para> <example> - <title>caja.LocationWidgetProvider Example</title> + <title>Caja.LocationWidgetProvider Example</title> <programlisting> -import caja -import gtk +from gi.repository import Caja, GObject, Gtk -class LocationProviderExample(caja.LocationWidgetProvider): +class ColumnExtension(GObject.GObject, Caja.LocationWidgetProvider): def __init__(self): pass def get_widget(self, uri, window): - entry = gtk.Entry() + entry = Gtk.Entry() entry.set_text(uri) entry.show() return entry @@ -65,7 +64,7 @@ class LocationProviderExample(caja.LocationWidgetProvider): <title>Passive Methods</title> <refsect2 id="method-caja-location-widget-provider--get-widget"> - <title>caja.LocationWidgetProvider.get_widget</title> + <title>Caja.LocationWidgetProvider.get_widget</title> <programlisting><methodsynopsis language="python"> <methodname>get_widget</methodname> diff --git a/docs/reference/caja-python-menu-item.xml b/docs/reference/caja-python-menu-item.xml index 798afa7..ea391f1 100644 --- a/docs/reference/caja-python-menu-item.xml +++ b/docs/reference/caja-python-menu-item.xml @@ -4,8 +4,8 @@ <refentry id="class-caja-python-menu-item"> <refnamediv> - <refname>caja.MenuItem</refname> - <refpurpose>caja.MenuItem Reference</refpurpose> + <refname>Caja.MenuItem</refname> + <refpurpose>Caja.MenuItem Reference</refpurpose> </refnamediv> <!-- ******************************* --> @@ -16,11 +16,11 @@ <title>Synopsis</title> <classsynopsis language="python"> - <ooclass><classname>caja.MenuItem</classname></ooclass> + <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> + <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> @@ -47,7 +47,7 @@ <title>Ancestry</title> <synopsis>+-- <link linkend="class-gobject">gobject.GObject</link> - +-- <link linkend="class-caja-python-menu-item">caja.MenuItem</link> + +-- <link linkend="class-caja-python-menu-item">Caja.MenuItem</link> </synopsis> </refsect1> @@ -60,7 +60,7 @@ <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. + <link linkend="class-caja-python-menu-item"><classname>Caja.MenuItem</classname></link> objects are appended to lists to create menus and submenus. </para> </refsect1> @@ -95,7 +95,7 @@ <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>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> @@ -161,7 +161,7 @@ <title>Constructor</title> <programlisting><constructorsynopsis language="python"> - <methodname>caja.MenuItem</methodname> + <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> @@ -188,7 +188,7 @@ </variablelist> <para> - Creates a new <link linkend="class-caja-python-menu-item"><classname>caja.MenuItem</classname></link> object. + Creates a new <link linkend="class-caja-python-menu-item"><classname>Caja.MenuItem</classname></link> object. </para> </refsect1> @@ -201,18 +201,18 @@ <title>Public Methods</title> <refsect2 id="method-caja-python-menu-item--activate"> - <title>caja.MenuItem.activate</title> + <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>. + 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> + <title>Caja.MenuItem.set_submenu</title> <programlisting><methodsynopsis language="python"> <methodname>set_submenu</methodname> <methodparam><parameter role="keyword">menu</parameter></methodparam> @@ -220,11 +220,11 @@ <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> + <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>. + 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> @@ -238,7 +238,7 @@ <title>Signal Details</title> <refsect2 id="signal-caja-python-menu-item--activate"> - <title>The "activate" caja.MenuItem Signal</title> + <title>The "activate" Caja.MenuItem Signal</title> <programlisting><methodsynopsis language="python"> <methodname>callback</methodname> @@ -250,7 +250,7 @@ <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> + <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> diff --git a/docs/reference/caja-python-menu-provider.xml b/docs/reference/caja-python-menu-provider.xml index 0050bec..4e750a0 100644 --- a/docs/reference/caja-python-menu-provider.xml +++ b/docs/reference/caja-python-menu-provider.xml @@ -4,8 +4,8 @@ <refentry id="class-caja-python-menu-provider"> <refnamediv> - <refname>caja.MenuProvider</refname> - <refpurpose>caja.MenuProvider Reference</refpurpose> + <refname>Caja.MenuProvider</refname> + <refpurpose>Caja.MenuProvider Reference</refpurpose> </refnamediv> <!-- ******************************* --> @@ -16,7 +16,7 @@ <title>Synopsis</title> <classsynopsis language="python"> - <ooclass><classname>caja.MenuProvider</classname></ooclass> + <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> @@ -45,20 +45,7 @@ </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> + <methodname><link linkend="method-caja-python-menu-provider--emit-items-updated-signal">Caja.menu_provider_emit_items_updated_signal</link></methodname> <methodparam><parameter role="keyword">provider</parameter></methodparam> </methodsynopsis> </classsynopsis> @@ -72,61 +59,56 @@ <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, + 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. + the following methods to be defined (or their *_full variants): get_file_items or + get_background_items.</para> + + <para>The get_toolbar_items methods were removed in caja-python 1.0 because they were removed from Caja 3. Technically, you should still be + able to call those methods with caja-python 1.0 if you are running Caja 2.x with annotations. </para> <example> - <title>caja.MenuProvider Example</title> + <title>Caja.MenuProvider Example</title> <programlisting> -import os -import urllib - -import gtk -import caja -import mateconf - -TERMINAL_KEY = '/desktop/mate/applications/terminal/exec' +from gi.repository import Caja, GObject -class OpenTerminalExtension(caja.MenuProvider): +class ColumnExtension(GObject.GObject, 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) + pass - 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, + top_menuitem = Caja.MenuItem(name='ExampleMenuProvider::Foo', + label='Foo', + tip='', + icon='') + + submenu = Caja.Menu() + top_menuitem.set_submenu(submenu) + + sub_menuitem = Caja.MenuItem(name='ExampleMenuProvider::Bar', + label='Bar', + tip='', + icon='') + submenu.append_item(sub_menuitem) + + return top_menuitem, 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, + submenu = Caja.Menu() + submenu.append_item(Caja.MenuItem(name='ExampleMenuProvider::Bar2', + label='Bar2', + tip='', + icon='')) + + menuitem = Caja.MenuItem(name='ExampleMenuProvider::Foo2', + label='Foo2', + tip='', + icon='') + menuitem.set_submenu(submenu) + + return menuitem, + </programlisting> </example> @@ -159,7 +141,7 @@ class OpenTerminalExtension(caja.MenuProvider): <title>Passive Methods</title> <refsect2 id="method-caja-python-menu-provider--get-file-items"> - <title>caja.MenuProvider.get_file_items</title> + <title>Caja.MenuProvider.get_file_items</title> <programlisting><methodsynopsis language="python"> <methodname>get_file_items</methodname> @@ -174,22 +156,22 @@ class OpenTerminalExtension(caja.MenuProvider): </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> + <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> + <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. + <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> + <title>Caja.MenuProvider.get_file_items_full</title> <programlisting><methodsynopsis language="python"> <methodname>get_file_items_full</methodname> @@ -201,7 +183,7 @@ class OpenTerminalExtension(caja.MenuProvider): <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> + <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> @@ -209,21 +191,21 @@ class OpenTerminalExtension(caja.MenuProvider): </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> + <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> + <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>. + <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 + <link linkend="method-caja-menu-provider--emit_items_updated_signal">Caja.menu_provider_emit_items_updated_signal</link>, which must be passed the current provider instance. </para> <note> @@ -233,7 +215,7 @@ class OpenTerminalExtension(caja.MenuProvider): <refsect2 id="method-caja-python-menu-provider--get-background-items"> - <title>caja.MenuProvider.get_background_items</title> + <title>Caja.MenuProvider.get_background_items</title> <programlisting><methodsynopsis language="python"> <methodname>get_background_items</methodname> @@ -248,22 +230,22 @@ class OpenTerminalExtension(caja.MenuProvider): </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> + <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> + <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>. + <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> + <title>Caja.MenuProvider.get_background_items_full</title> <programlisting><methodsynopsis language="python"> <methodname>get_background_items_full</methodname> @@ -275,7 +257,7 @@ class OpenTerminalExtension(caja.MenuProvider): <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> + <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> @@ -283,21 +265,21 @@ class OpenTerminalExtension(caja.MenuProvider): </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> + <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> + <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>. + <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 + <link linkend="method-caja-menu-provider--emit_items_updated_signal">Caja.menu_provider_emit_items_updated_signal</link>, which must be passed the current provider instance. </para> <note> @@ -305,96 +287,23 @@ class OpenTerminalExtension(caja.MenuProvider): </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> + <title>Caja.menu_provider_emit_items_updated_signal</title> <programlisting><methodsynopsis language="python"> - <methodname>emit_items_updated_signal</methodname> + <methodname>menu_provider_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> + <listitem><simpara>the current <link linkend="class-caja-python-menu-provider"><classname>Caja.MenuProvider</classname></link> instance</simpara></listitem> </varlistentry> </variablelist> @@ -417,7 +326,7 @@ class OpenTerminalExtension(caja.MenuProvider): <title>Signal Details</title> <refsect2 id="signal-caja-python-menu-provider--items-updated"> - <title>The "items-updated" caja.MenuProvider Signal</title> + <title>The "items-updated" Caja.MenuProvider Signal</title> <para> Emits the "<link linkend="signal-caja-python-menu-provider--items-updated">items-updated</link>" signal. diff --git a/docs/reference/caja-python-menu.xml b/docs/reference/caja-python-menu.xml index 678585b..95fa94f 100644 --- a/docs/reference/caja-python-menu.xml +++ b/docs/reference/caja-python-menu.xml @@ -4,8 +4,8 @@ <refentry id="class-caja-python-menu"> <refnamediv> - <refname>caja.Menu</refname> - <refpurpose>caja.Menu Reference</refpurpose> + <refname>Caja.Menu</refname> + <refpurpose>Caja.Menu Reference</refpurpose> </refnamediv> <!-- ******************************* --> @@ -16,11 +16,11 @@ <title>Synopsis</title> <classsynopsis language="python"> - <ooclass><classname>caja.Menu</classname></ooclass> + <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> + <methodname><link linkend="constructor-caja-menu">Caja.Menu</link></methodname> </constructorsynopsis> <methodsynopsis language="python"> @@ -43,7 +43,7 @@ <title>Ancestry</title> <synopsis>+-- <link linkend="class-gobject">gobject.GObject</link> - +-- <link linkend="class-caja-python-menu">caja.Menu</link> + +-- <link linkend="class-caja-python-menu">Caja.Menu</link> </synopsis> </refsect1> @@ -56,7 +56,7 @@ <title>Description</title> <para> - A caja.Menu object allows an extension to create sub-menus. + A Caja.Menu object allows an extension to create sub-menus. </para> </refsect1> @@ -71,11 +71,11 @@ <title>Constructor</title> <programlisting><constructorsynopsis language="python"> - <methodname>caja.Menu</methodname> + <methodname>Caja.Menu</methodname> </constructorsynopsis></programlisting> <para> - Creates a new <link linkend="class-caja-python-menu"><classname>caja.Menu</classname></link> object. + Creates a new <link linkend="class-caja-python-menu"><classname>Caja.Menu</classname></link> object. </para> </refsect1> @@ -89,7 +89,7 @@ <title>Public Methods</title> <refsect2 id="method-caja-python-menu--append_item"> - <title>caja.Menu.append_item</title> + <title>Caja.Menu.append_item</title> <programlisting><methodsynopsis language="python"> <methodname>append_item</methodname> <methodparam><parameter role="keyword">item</parameter></methodparam> @@ -97,22 +97,22 @@ <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> + <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>. + 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> + <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>. + 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> diff --git a/docs/reference/caja-python-operation-result.xml b/docs/reference/caja-python-operation-result.xml index 3720f2f..ee13b01 100644 --- a/docs/reference/caja-python-operation-result.xml +++ b/docs/reference/caja-python-operation-result.xml @@ -4,8 +4,8 @@ <refentry id="enum-caja-python-operation-result"> <refnamediv> - <refname>caja.OperationResult</refname> - <refpurpose>caja.OperationResult Reference</refpurpose> + <refname>Caja.OperationResult</refname> + <refpurpose>Caja.OperationResult Reference</refpurpose> </refnamediv> @@ -18,8 +18,8 @@ <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 + 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> @@ -27,20 +27,20 @@ <variablelist> <varlistentry> - <term><literal>caja.OPERATION_COMPLETE</literal></term> + <term><literal>Caja.OperationResult.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> + <term><literal>Caja.OperationResult.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 + <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">Caja.info_provider_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> + <term><literal>Caja.OperationResult.FAILED</literal></term> <listitem> <simpara>The operation has failed.</simpara> </listitem> diff --git a/docs/reference/caja-python-overview-example.xml b/docs/reference/caja-python-overview-example.xml index b429365..ea1175d 100644 --- a/docs/reference/caja-python-overview-example.xml +++ b/docs/reference/caja-python-overview-example.xml @@ -11,49 +11,43 @@ <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> +from gi.repository import Caja, GObject + +class ColumnExtension(GObject.GObject, 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( + name="SimpleMenuExtension::Show_File_Name", + label="Showing %s" % file.get_name(), + tip="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>Save this file as TestExtension.py in the ~/.local/share/caja-python/extensions folder. + You may need to create this folder. To run, simply restart Caja.</para> - <para>Once Caja starts, right-click on a file and you should see a new menu item, + <para>Once Caja restarts, 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 + get loaded by Caja, a python extension must import the Caja module from gi.repository, + create a class derived from a caja *Provider and a gobject.GObject, and 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> + 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 index 973aecd..2a86a92 100644 --- a/docs/reference/caja-python-overview-methods.xml +++ b/docs/reference/caja-python-overview-methods.xml @@ -10,8 +10,8 @@ <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 + Caja. You can see this with the <link linkend="method-caja--menu-provider-emit-items-updated-signal">Caja.menu_provider_emit_items_updated_signal</link> + and <link linkend="method-caja--info-provider-update-complete-invoke">Caja.info_provider_update_complete_invoke</link> methods, which the extension actively calls, passing the provider instance as a parameter. </para> diff --git a/docs/reference/caja-python-overview.xml b/docs/reference/caja-python-overview.xml index e92dedf..8c778dd 100644 --- a/docs/reference/caja-python-overview.xml +++ b/docs/reference/caja-python-overview.xml @@ -6,9 +6,9 @@ <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", + <para>Writing a Caja-Python extension is a fairly straight-forward process. + One simply imports the Caja module from the gobject introspection repository and creates a class which is derived from a gobject.GObject and + one 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 @@ -16,20 +16,25 @@ <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> + <para>1. A script is written and installed to the standard caja-python extension install path</para> + <para>2. Caja is (re)started and loads the caja-python C extension, which in turn loads all python extensions it can find</para> + <para>3. Any python script in the standard caja-python extension install path that imports the Caja module from the gobject introspection repository 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 +<para>As of caja-python 0.7.0 (and continued in 1.0+), caja-python looks in ~/.local/share/caja-python/extensions for local extensions and $PREFIX/share/caja-python/extensions for global extensions.</para> </note> + + <note> +<title>A note about compatibility issues for caja-python 1.0</title> + <para>1. We no longer support the "import caja" command that previous versions used. This is because + caja-python now directly uses Caja's annotations, which must be imported by the "from gi.repository import Caja" command.</para> + <para>2. The extension class must now derive itself from a gobject.GObject in addition to the standard Caja classes.</para> + <para>3. For now, some Caja class constructors require passing named arguments instead of a standard argument list. This requirement may go away at some point.</para> + </note> <xi:include href="caja-python-overview-example.xml"/> <xi:include href="caja-python-overview-methods.xml"/> diff --git a/docs/reference/caja-python-property-page-provider.xml b/docs/reference/caja-python-property-page-provider.xml index 1ecb50f..8cb3662 100644 --- a/docs/reference/caja-python-property-page-provider.xml +++ b/docs/reference/caja-python-property-page-provider.xml @@ -4,8 +4,8 @@ <refentry id="class-caja-python-property-page-provider"> <refnamediv> - <refname>caja.PropertyPageProvider</refname> - <refpurpose>caja.PropertyPageProvider Reference</refpurpose> + <refname>Caja.PropertyPageProvider</refname> + <refpurpose>Caja.PropertyPageProvider Reference</refpurpose> </refnamediv> <!-- ******************************* --> @@ -16,7 +16,7 @@ <title>Synopsis</title> <classsynopsis language="python"> - <ooclass><classname>caja.PropertyPageProvider</classname></ooclass> + <ooclass><classname>Caja.PropertyPageProvider</classname></ooclass> <methodsynopsis language="python"> <methodname><link linkend="method-caja-property-page-provider--get-pages">get_pages</link></methodname> @@ -38,15 +38,14 @@ </para> <example> - <title>caja.PropertyPageProvider Example</title> + <title>Caja.PropertyPageProvider Example</title> <programlisting> import hashlib import urllib -import gtk -import caja +from gi.repository import Caja, GObject, Gtk -class MD5SumPropertyPage(caja.PropertyPageProvider): +class ColumnExtension(GObject.GObject, Caja.PropertyPageProvider): def __init__(self): pass @@ -63,25 +62,31 @@ class MD5SumPropertyPage(caja.PropertyPageProvider): filename = urllib.unquote(file.get_uri()[7:]) - self.property_label = gtk.Label('MD5Sum') + self.property_label = Gtk.Label('MD5Sum') self.property_label.show() - self.hbox = gtk.HBox(0, False) + self.hbox = Gtk.HBox(homogeneous=False, spacing=0) self.hbox.show() - label = gtk.Label('MD5Sum:') + label = Gtk.Label('MD5Sum:') label.show() - self.hbox.pack_start(label) + self.hbox.pack_start(label, False, False, 0) - self.value_label = gtk.Label() - self.hbox.pack_start(self.value_label) + self.value_label = Gtk.Label() + self.hbox.pack_start(self.value_label, False, False, 0) - md5sum = hashlib.md5(filename).hexdigest() - self.value_label.set_text(md5sum) + md5sum = hashlib.md5() + with open(filename,'rb') as f: + for chunk in iter(lambda: f.read(8192), ''): + md5sum.update(chunk) + f.close() + + self.value_label.set_text(md5sum.hexdigest()) self.value_label.show() - return caja.PropertyPage("CajaPython::md5_sum", - self.property_label, self.hbox), + return Caja.PropertyPage(name="CajaPython::md5_sum", + label=self.property_label, + page=self.hbox), </programlisting> </example> @@ -95,7 +100,7 @@ class MD5SumPropertyPage(caja.PropertyPageProvider): <title>Passive Methods</title> <refsect2 id="method-caja-property-page-provider--get-pages"> - <title>caja.PropertyPageProvider.get_pages</title> + <title>Caja.PropertyPageProvider.get_pages</title> <programlisting><methodsynopsis language="python"> <methodname>get_pages</methodname> @@ -105,11 +110,11 @@ class MD5SumPropertyPage(caja.PropertyPageProvider): <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> + <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> + <listitem><simpara>a list of <link linkend="class-caja-python-property-page"><classname>Caja.PropertyPage</classname></link> objects</simpara></listitem> </varlistentry> </variablelist> diff --git a/docs/reference/caja-python-property-page.xml b/docs/reference/caja-python-property-page.xml index c1131ff..706dafa 100644 --- a/docs/reference/caja-python-property-page.xml +++ b/docs/reference/caja-python-property-page.xml @@ -4,8 +4,8 @@ <refentry id="class-caja-python-property-page"> <refnamediv> - <refname>caja.PropertyPage</refname> - <refpurpose>caja.PropertyPage Reference</refpurpose> + <refname>Caja.PropertyPage</refname> + <refpurpose>Caja.PropertyPage Reference</refpurpose> </refnamediv> <!-- ******************************* --> @@ -16,11 +16,11 @@ <title>Synopsis</title> <classsynopsis language="python"> - <ooclass><classname>caja.PropertyPage</classname></ooclass> + <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> + <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> @@ -36,7 +36,7 @@ <title>Ancestry</title> <synopsis>+-- <link linkend="class-gobject">gobject.GObject</link> - +-- <link linkend="class-caja-python-property-page">caja.PropertyPage</link> + +-- <link linkend="class-caja-python-property-page">Caja.PropertyPage</link> </synopsis> </refsect1> @@ -49,7 +49,7 @@ <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. + 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> @@ -103,7 +103,7 @@ <title>Constructor</title> <programlisting><constructorsynopsis language="python"> - <methodname>caja.PropertyPage</methodname> + <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> @@ -125,7 +125,7 @@ </variablelist> <para> - Creates a new <link linkend="class-caja-python-property-page"><classname>caja.PropertyPage</classname></link> object. + Creates a new <link linkend="class-caja-python-property-page"><classname>Caja.PropertyPage</classname></link> object. </para> </refsect1> |