[nautilus-python/wip/jtojnar/nautilus-4: 16/17] Implement NautilusPropertiesModelProvider support




commit 652341e6eb7fcd46757b515c3b224194e3039d46
Author: Jan Tojnar <jtojnar gmail com>
Date:   Wed Aug 10 22:34:35 2022 +0200

    Implement NautilusPropertiesModelProvider support
    
    This replaces NautilusPropertyPageProvider from Nautilus-3.0.

 docs/reference/nautilus-python-class-reference.xml |   2 +
 docs/reference/nautilus-python-overview.xml        |   2 +-
 docs/reference/nautilus-python-properties-item.xml | 163 ++++++++++++++++++
 .../nautilus-python-properties-model-provider.xml  |  84 +++++++++
 .../reference/nautilus-python-properties-model.xml | 187 +++++++++++++++++++++
 .../nautilus-python-provider-reference.xml         |   1 +
 examples/md5sum-properties-model.py                |  39 +++++
 examples/meson.build                               |   1 +
 src/nautilus-python-object.c                       |  47 ++++++
 src/nautilus-python.c                              |   9 +-
 src/nautilus-python.h                              |   9 +
 11 files changed, 542 insertions(+), 2 deletions(-)
---
diff --git a/docs/reference/nautilus-python-class-reference.xml 
b/docs/reference/nautilus-python-class-reference.xml
index bc4a751..62fcf8e 100644
--- a/docs/reference/nautilus-python-class-reference.xml
+++ b/docs/reference/nautilus-python-class-reference.xml
@@ -9,5 +9,7 @@
     <xi:include href="nautilus-python-file-info.xml"/>
     <xi:include href="nautilus-python-menu.xml"/>
     <xi:include href="nautilus-python-menu-item.xml"/>
+    <xi:include href="nautilus-python-properties-model.xml"/>
+    <xi:include href="nautilus-python-properties-item.xml"/>
 </chapter>
 
diff --git a/docs/reference/nautilus-python-overview.xml b/docs/reference/nautilus-python-overview.xml
index ccdc291..cac3c12 100644
--- a/docs/reference/nautilus-python-overview.xml
+++ b/docs/reference/nautilus-python-overview.xml
@@ -10,7 +10,7 @@
     One simply imports the Nautilus module from the gobject introspection repository and creates a class 
which is derived from a gobject.GObject and 
     one of the Nautilus module's classes. When an extension derives a class, it becomes a "provider", 
     telling Nautilus to ask it for information. There are several types of providers 
-    available for extensions to use: there is MenuProvider, 
+    available for extensions to use: there is MenuProvider, PropertiesModelProvider,
     ColumnProvider, and InfoProvider, all of which will be explained 
     in more detail below. Your class can be derived from multiple providers.</para>
     
diff --git a/docs/reference/nautilus-python-properties-item.xml 
b/docs/reference/nautilus-python-properties-item.xml
new file mode 100644
index 0000000..e01c0cb
--- /dev/null
+++ b/docs/reference/nautilus-python-properties-item.xml
@@ -0,0 +1,163 @@
+<?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-nautilus-python-properties-item">
+  <refmeta>
+    <refentrytitle>Nautilus.PropertiesItem</refentrytitle>
+  </refmeta>
+  <refnamediv>
+    <refname>Nautilus.PropertiesItem</refname>
+    <refpurpose>Nautilus.PropertiesItem Reference</refpurpose>
+  </refnamediv>
+
+<!-- ******************************* -->
+<!-- BEGIN OF NAUTILUS-PYTHON SYNOPSIS -->
+<!-- ******************************* -->
+
+  <refsect1>
+    <title>Synopsis</title>
+
+    <classsynopsis language="python">
+        <ooclass><classname>Nautilus.PropertiesItem</classname></ooclass>
+        <ooclass><classname><link linkend="class-gobject">gobject.GObject</link></classname></ooclass>
+
+        <constructorsynopsis language="python">
+            <methodname><link 
linkend="constructor-nautilus-properties-item">Nautilus.PropertiesItem</link></methodname>
+            <methodparam><parameter role="keyword">name</parameter></methodparam>
+            <methodparam><parameter role="keyword">value</parameter></methodparam>
+        </constructorsynopsis>
+
+        <methodsynopsis language="python">
+            <methodname><link 
linkend="method-nautilus-python-properties-item--get_name">get_name</link></methodname>
+        </methodsynopsis>
+
+        <methodsynopsis language="python">
+            <methodname><link 
linkend="method-nautilus-python-properties-item--get_value">get_value</link></methodname>
+        </methodsynopsis>
+    </classsynopsis>
+  </refsect1>
+
+<!-- ********************************* -->
+<!-- BEGIN OF ANCESTRY -->
+<!-- ********************************* -->
+
+<refsect1>
+    <title>Ancestry</title>
+
+<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
+    +-- <link linkend="class-nautilus-python-properties-item">Nautilus.PropertiesItem</link>
+</synopsis>
+</refsect1>
+
+
+<!-- ********************************** -->
+<!-- BEGIN OF DESCRIPTION -->
+<!-- ********************************** -->
+
+  <refsect1 id="description-properties-item">
+    <title>Description</title>
+
+      <para>
+        <link 
linkend="class-nautilus-python-properties-item"><classname>Nautilus.PropertiesItem</classname></link> is an 
object that describes a name &amp; value pair in file properties. Extensions can provide 
<classname>Nautilus.PropertiesItem</classname> objects grouped in <link 
linkend="class-nautilus-python-properties-model"><classname>Nautilus.PropertiesModel</classname></link>.
+      </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>"name"</entry>
+              <entry>The user-visible name for the properties item</entry>
+              <entry>Read-Write-ConstructOnly</entry>
+            </row>
+
+            <row valign="top">
+              <entry>"value"</entry>
+              <entry>The user-visible value for the properties item</entry>
+              <entry>Read-Write-ConstructOnly</entry>
+            </row>
+
+          </tbody>
+        </tgroup>
+      </informaltable>
+    </blockquote>
+</refsect1>
+
+
+<!-- ************************************ -->
+<!-- BEGIN OF CONSTRUCTOR -->
+<!-- ************************************ -->
+
+<refsect1 id="constructor-nautilus-properties-item">
+  <title>Constructor</title>
+
+  <programlisting><constructorsynopsis language="python">
+        <methodname>Nautilus.PropertiesItem</methodname>
+        <methodparam><parameter role="keyword">name</parameter></methodparam>
+        <methodparam><parameter role="keyword">value</parameter></methodparam>
+  </constructorsynopsis></programlisting>
+
+  <variablelist>
+    <varlistentry>
+           <term><parameter role="keyword">name</parameter>&nbsp;:</term>
+           <listitem><simpara>the user-visible name for the properties item</simpara></listitem>
+    </varlistentry>
+    <varlistentry>
+           <term><parameter role="keyword">value</parameter>&nbsp;:</term>
+           <listitem><simpara>the user-visible value for the properties item</simpara></listitem>
+    </varlistentry>
+  </variablelist>
+
+  <para>
+    Creates a new <link 
linkend="class-nautilus-python-properties-item"><classname>Nautilus.PropertiesItem</classname></link> object.
+  </para>
+</refsect1>
+
+
+
+<!-- ******************************** -->
+<!-- BEGIN OF METHODS -->
+<!-- ******************************** -->
+
+<refsect1>
+    <title>Public Methods</title>
+
+  <refsect2 id="method-nautilus-python-properties-item--get_name">
+    <title>Nautilus.Menu.get_name</title>
+    <programlisting><methodsynopsis language="python">
+    <methodname>get_name</methodname>
+    </methodsynopsis></programlisting>
+    <para>
+      Returns the name of this <link 
linkend="class-nautilus-python-properties-item"><classname>Nautilus.PropertiesItem</classname></link>.
+    </para>
+  </refsect2>
+
+  <refsect2 id="method-nautilus-python-properties-item--get_value">
+    <title>Nautilus.Menu.get_value</title>
+    <programlisting><methodsynopsis language="python">
+    <methodname>get_value</methodname>
+    </methodsynopsis></programlisting>
+    <para>
+      Returns the value of this <link 
linkend="class-nautilus-python-properties-item"><classname>Nautilus.PropertiesItem</classname></link>.
+    </para>
+  </refsect2>
+</refsect1>
+
+
+
+</refentry>
+
diff --git a/docs/reference/nautilus-python-properties-model-provider.xml 
b/docs/reference/nautilus-python-properties-model-provider.xml
new file mode 100644
index 0000000..2fa72e2
--- /dev/null
+++ b/docs/reference/nautilus-python-properties-model-provider.xml
@@ -0,0 +1,84 @@
+<?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-nautilus-python-properties-model-provider" xmlns:xi="http://www.w3.org/2001/XInclude";>
+  <refmeta>
+    <refentrytitle>Nautilus.PropertiesModelProvider</refentrytitle>
+  </refmeta>
+  <refnamediv>
+    <refname>Nautilus.PropertiesModelProvider</refname>
+    <refpurpose>Nautilus.PropertiesModelProvider Reference</refpurpose>
+  </refnamediv>
+
+<!-- ******************************* -->
+<!-- BEGIN OF SYNOPSIS -->
+<!-- ******************************* -->
+
+  <refsect1>
+    <title>Synopsis</title>
+
+    <classsynopsis language="python">
+      <ooclass><classname>Nautilus.PropertiesModelProvider</classname></ooclass>
+
+      <methodsynopsis language="python">
+        <methodname><link 
linkend="method-nautilus-properties-model-provider--get-models">get_models</link></methodname>
+        <methodparam><parameter role="keyword">files</parameter></methodparam>
+      </methodsynopsis>
+    </classsynopsis>
+  </refsect1>
+
+<!-- ********************************** -->
+<!-- BEGIN OF DESCRIPTION -->
+<!-- ********************************** -->
+
+  <refsect1 id="description-properties-model-provider">
+    <title>Description</title>
+
+      <para>
+      If subclassed, Nautilus will request a list of custom properties models that should
+      appear when a user opens the Properties dialog for a file or folder.
+      </para>
+
+<example>
+    <title>Nautilus.PropertiesModelProvider Example</title>
+    <programlisting><xi:include href="../../examples/md5sum-properties-model.py" parse="text" 
/></programlisting>
+</example>
+
+  </refsect1>
+
+<!-- ****************************** -->
+<!-- BEGIN OF METHODS -->
+<!-- ****************************** -->
+
+  <refsect1>
+        <title>Passive Methods</title>
+
+        <refsect2 id="method-nautilus-properties-model-provider--get-models">
+          <title>Nautilus.PropertiesModelProvider.get_models</title>
+
+          <programlisting><methodsynopsis language="python">
+            <methodname>get_models</methodname>
+            <methodparam><parameter role="keyword">files</parameter></methodparam>
+          </methodsynopsis></programlisting>
+
+          <variablelist>
+            <varlistentry>
+                   <term><parameter role="keyword">files</parameter>&nbsp;:</term>
+                   <listitem><simpara>a list of <link 
linkend="class-nautilus-python-file-info"><classname>Nautilus.FileInfo</classname></link> 
objects.</simpara></listitem>
+            </varlistentry>
+            <varlistentry>
+              <term><emphasis>Returns</emphasis>&nbsp;:</term>
+              <listitem><simpara>a list of <link 
linkend="class-nautilus-python-properties-model"><classname>Nautilus.PropertiesModel</classname></link> 
objects</simpara></listitem>
+            </varlistentry>
+          </variablelist>
+
+          <para>
+                This function is called by Nautilus when it wants properties model items from the extension.
+                It is called in the main thread before a properties model is shown, so it should return 
quickly.
+          </para>
+        </refsect2>
+    </refsect1>
+
+</refentry>
+
diff --git a/docs/reference/nautilus-python-properties-model.xml 
b/docs/reference/nautilus-python-properties-model.xml
new file mode 100644
index 0000000..c7aee70
--- /dev/null
+++ b/docs/reference/nautilus-python-properties-model.xml
@@ -0,0 +1,187 @@
+<?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-nautilus-python-properties-model">
+  <refmeta>
+    <refentrytitle>Nautilus.PropertiesModel</refentrytitle>
+  </refmeta>
+  <refnamediv>
+    <refname>Nautilus.PropertiesModel</refname>
+    <refpurpose>Nautilus.PropertiesModel Reference</refpurpose>
+  </refnamediv>
+
+<!-- ******************************* -->
+<!-- BEGIN OF NAUTILUS-PYTHON SYNOPSIS -->
+<!-- ******************************* -->
+
+  <refsect1>
+    <title>Synopsis</title>
+
+    <classsynopsis language="python">
+        <ooclass><classname>Nautilus.PropertiesModel</classname></ooclass>
+        <ooclass><classname><link linkend="class-gobject">gobject.GObject</link></classname></ooclass>
+
+        <constructorsynopsis language="python">
+            <methodname><link 
linkend="constructor-nautilus-properties-model">Nautilus.PropertiesModel</link></methodname>
+            <methodparam><parameter role="keyword">title</parameter></methodparam>
+            <methodparam><parameter role="keyword">model</parameter></methodparam>
+        </constructorsynopsis>
+
+        <methodsynopsis language="python">
+            <methodname><link linkend="method-nautilus-python-menu--set_title">set_title</link></methodname>
+            <methodparam><parameter role="keyword">title</parameter></methodparam>
+        </methodsynopsis>
+
+        <methodsynopsis language="python">
+            <methodname><link linkend="method-nautilus-python-menu--get_title">get_title</link></methodname>
+        </methodsynopsis>
+
+        <methodsynopsis language="python">
+            <methodname><link linkend="method-nautilus-python-menu--get_model">get_model</link></methodname>
+        </methodsynopsis>
+    </classsynopsis>
+  </refsect1>
+
+<!-- ********************************* -->
+<!-- BEGIN OF ANCESTRY -->
+<!-- ********************************* -->
+
+<refsect1>
+    <title>Ancestry</title>
+
+<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
+    +-- <link linkend="class-nautilus-python-properties-model">Nautilus.PropertiesModel</link>
+</synopsis>
+</refsect1>
+
+
+<!-- ********************************** -->
+<!-- BEGIN OF DESCRIPTION -->
+<!-- ********************************** -->
+
+  <refsect1 id="description-properties-model">
+    <title>Description</title>
+
+      <para>
+        A <link 
linkend="class-nautilus-python-properties-model"><classname>Nautilus.PropertiesModel</classname></link> 
object an model that describes a set of file properties. Extensions can provide <link 
linkend="class-nautilus-python-properties-model"><classname>Nautilus.PropertiesModel</classname></link> 
objects by registering it in <link 
linkend="class-nautilus-python-properties-model-provider"><classname>Nautilus.PropertiesModelProvider</classname></link>.
+      </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>"title"</entry>
+              <entry>The user-visible name for the set of properties in this model.</entry>
+              <entry>Read-Write</entry>
+            </row>
+
+            <row valign="top">
+              <entry>"model"</entry>
+              <entry>The <classname>GListModel</classname> containing <link 
linkend="class-nautilus-python-properties-item"><classname>Nautilus.PropertyItem</classname></link> objects.  
Default value: <literal>[]</literal></entry>
+              <entry>Read-Write-ConstructOnly</entry>
+            </row>
+
+          </tbody>
+        </tgroup>
+      </informaltable>
+    </blockquote>
+</refsect1>
+
+
+<!-- ************************************ -->
+<!-- BEGIN OF CONSTRUCTOR -->
+<!-- ************************************ -->
+
+<refsect1 id="constructor-nautilus-properties-model">
+  <title>Constructor</title>
+
+  <programlisting><constructorsynopsis language="python">
+        <methodname>Nautilus.PropertiesModel</methodname>
+        <methodparam><parameter role="keyword">title</parameter></methodparam>
+        <methodparam><parameter role="keyword">model</parameter></methodparam>
+  </constructorsynopsis></programlisting>
+
+  <variablelist>
+    <varlistentry>
+           <term><parameter role="keyword">title</parameter>&nbsp;:</term>
+           <listitem><simpara>the user-visible name for the set of properties in this 
model</simpara></listitem>
+    </varlistentry>
+    <varlistentry>
+           <term><parameter role="keyword">model</parameter>&nbsp;:</term>
+           <listitem><simpara>The <classname>GListModel</classname> containing <link 
linkend="class-nautilus-python-properties-item"><classname>Nautilus.PropertyItem</classname></link> 
objects.</simpara></listitem>
+    </varlistentry>
+  </variablelist>
+
+  <para>
+    Creates a new <link 
linkend="class-nautilus-python-properties-model"><classname>Nautilus.PropertiesModel</classname></link> 
object.
+  </para>
+</refsect1>
+
+
+
+<!-- ******************************** -->
+<!-- BEGIN OF METHODS -->
+<!-- ******************************** -->
+
+<refsect1>
+    <title>Public Methods</title>
+
+  <refsect2 id="method-nautilus-python-menu--set_title">
+    <title>Nautilus.Menu.set_title</title>
+    <programlisting><methodsynopsis language="python">
+    <methodname>set_title</methodname>
+      <methodparam><parameter role="keyword">title</parameter></methodparam>
+    </methodsynopsis></programlisting>
+    <variablelist>
+      <varlistentry>
+        <term><parameter role="keyword">title</parameter>&nbsp;:</term>
+        <listitem><simpara>a new name of this <link 
linkend="class-nautilus-python-properties-model"><classname>Nautilus.PropertiesModel</classname></link></simpara></listitem>
+      </varlistentry>
+    </variablelist>
+
+    <para>
+      Sets a new name of this <link 
linkend="class-nautilus-python-properties-model"><classname>Nautilus.PropertiesModel</classname></link>.
+    </para>
+  </refsect2>
+
+  <refsect2 id="method-nautilus-python-menu--get_title">
+    <title>Nautilus.Menu.get_title</title>
+    <programlisting><methodsynopsis language="python">
+    <methodname>get_title</methodname>
+    </methodsynopsis></programlisting>
+    <para>
+      Returns the title of this <link 
linkend="class-nautilus-python-properties-model"><classname>Nautilus.PropertiesModel</classname></link>.
+    </para>
+  </refsect2>
+
+  <refsect2 id="method-nautilus-python-menu--get_model">
+    <title>Nautilus.Menu.get_model</title>
+    <programlisting><methodsynopsis language="python">
+    <methodname>get_model</methodname>
+    </methodsynopsis></programlisting>
+    <para>
+      Returns a <classname>GListModel</classname> containing <link 
linkend="class-nautilus-python-properties-item"><classname>Nautilus.PropertyItem</classname></link> objects.
+    </para>
+  </refsect2>
+</refsect1>
+
+
+
+</refentry>
+
diff --git a/docs/reference/nautilus-python-provider-reference.xml 
b/docs/reference/nautilus-python-provider-reference.xml
index 3c0d335..4a87e3a 100644
--- a/docs/reference/nautilus-python-provider-reference.xml
+++ b/docs/reference/nautilus-python-provider-reference.xml
@@ -8,5 +8,6 @@
     <xi:include href="nautilus-python-column-provider.xml"/>
     <xi:include href="nautilus-python-info-provider.xml"/>
     <xi:include href="nautilus-python-menu-provider.xml"/>
+    <xi:include href="nautilus-python-properties-model-provider.xml"/>
 </chapter>
 
diff --git a/examples/md5sum-properties-model.py b/examples/md5sum-properties-model.py
new file mode 100644
index 0000000..7180780
--- /dev/null
+++ b/examples/md5sum-properties-model.py
@@ -0,0 +1,39 @@
+import hashlib
+
+from urllib.parse import unquote
+from gi.repository import Nautilus, Gio, GObject
+from typing import List
+
+
+class MD5SumPropertiesModel(GObject.GObject, Nautilus.PropertiesModelProvider):
+    def get_models(
+        self,
+        files: List[Nautilus.FileInfo],
+    ) -> List[Nautilus.PropertiesModel]:
+        if len(files) != 1:
+            return []
+
+        file = files[0]
+        if file.get_uri_scheme() != "file":
+            return []
+
+        if file.is_directory():
+            return []
+
+        filename = unquote(file.get_uri()[7:]).encode("utf-8")
+
+        section_model = Gio.ListStore.new(item_type=Nautilus.PropertiesItem)
+
+        section_model.append(
+            Nautilus.PropertiesItem(
+                name="MD5 sum of the filename",
+                value=hashlib.md5(filename).hexdigest(),
+            )
+        )
+
+        return [
+            Nautilus.PropertiesModel(
+                title="MD5Sum",
+                model=section_model,
+            ),
+        ]
diff --git a/examples/meson.build b/examples/meson.build
index b79d303..186c22b 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -7,6 +7,7 @@ install_data(
   'background-image.py',
   'block-size-column.py',
   'open-terminal.py',
+  'md5sum-properties-model.py',
   'submenu.py',
   'TestExtension.py',
   'update-file-info-async.py',
diff --git a/src/nautilus-python-object.c b/src/nautilus-python-object.c
index 74a4ac0..5966bd1 100644
--- a/src/nautilus-python-object.c
+++ b/src/nautilus-python-object.c
@@ -126,6 +126,41 @@ nautilus_python_boxed_new (PyTypeObject *type, gpointer boxed, gboolean free_on_
     return (PyObject *) self;
 }
 
+#define METHOD_NAME "get_models"
+static GList *
+nautilus_python_object_get_models (NautilusPropertiesModelProvider *provider,
+                                   GList                           *files) {
+    NautilusPythonObject *object = (NautilusPythonObject*)provider;
+    PyObject *py_files, *py_ret = NULL;
+    GList *ret = NULL;
+    PyGILState_STATE state = pyg_gil_state_ensure();
+
+    debug_enter();
+
+    CHECK_OBJECT(object);
+    CHECK_METHOD_NAME(object->instance);
+
+    CONVERT_LIST(py_files, files);
+
+    py_ret = PyObject_CallMethod(object->instance, METHOD_PREFIX METHOD_NAME,
+                                 "(N)", py_files);
+    HANDLE_RETVAL(py_ret);
+
+    HANDLE_LIST(py_ret, NautilusPropertiesModel, "Nautilus.PropertiesModel");
+
+beach:
+    free_pygobject_data_list(files);
+    Py_XDECREF(py_ret);
+    pyg_gil_state_release(state);
+    return ret;
+}
+#undef METHOD_NAME
+
+static void
+nautilus_python_object_properties_model_provider_interface_init (NautilusPropertiesModelProviderInterface 
*interface) {
+    interface->get_models = nautilus_python_object_get_models;
+}
+
 #define METHOD_NAME "get_file_items"
 static GList *
 nautilus_python_object_get_file_items (NautilusMenuProvider *provider,
@@ -368,6 +403,12 @@ nautilus_python_object_get_type (GTypeModule *module,
     g_autofree gchar *type_name = NULL;
     GType gtype;
 
+    static const GInterfaceInfo properties_model_provider_interface_info = {
+        (GInterfaceInitFunc) nautilus_python_object_properties_model_provider_interface_init,
+        NULL,
+        NULL
+    };
+
     static const GInterfaceInfo menu_provider_interface_info = {
         (GInterfaceInitFunc) nautilus_python_object_menu_provider_interface_init,
         NULL,
@@ -407,6 +448,12 @@ nautilus_python_object_get_type (GTypeModule *module,
                                          type_name,
                                          info, 0);
 
+    if (PyObject_IsSubclass(type, (PyObject*)&PyNautilusPropertiesModelProvider_Type)) {
+        g_type_module_add_interface (module, gtype,
+                                     NAUTILUS_TYPE_PROPERTIES_MODEL_PROVIDER,
+                                     &properties_model_provider_interface_info);
+    }
+
     if (PyObject_IsSubclass(type, (PyObject*)&PyNautilusMenuProvider_Type)) {
         g_type_module_add_interface (module, gtype, 
                                      NAUTILUS_TYPE_MENU_PROVIDER,
diff --git a/src/nautilus-python.c b/src/nautilus-python.c
index bc71bcd..44d4e84 100644
--- a/src/nautilus-python.c
+++ b/src/nautilus-python.c
@@ -46,6 +46,9 @@ PyTypeObject *_PyNautilusInfoProvider_Type;
 PyTypeObject *_PyNautilusMenu_Type;
 PyTypeObject *_PyNautilusMenuItem_Type;
 PyTypeObject *_PyNautilusMenuProvider_Type;
+PyTypeObject *_PyNautilusPropertiesItem_Type;
+PyTypeObject *_PyNautilusPropertiesModel_Type;
+PyTypeObject *_PyNautilusPropertiesModelProvider_Type;
 PyTypeObject *_PyNautilusOperationHandle_Type;
 
 static inline gboolean 
@@ -91,7 +94,8 @@ nautilus_python_load_file(GTypeModule *type_module,
 
         if (PyObject_IsSubclass(value, (PyObject*)&PyNautilusColumnProvider_Type) ||
                                PyObject_IsSubclass(value, (PyObject*)&PyNautilusInfoProvider_Type) ||
-                               PyObject_IsSubclass(value, (PyObject*)&PyNautilusMenuProvider_Type)) {
+                               PyObject_IsSubclass(value, (PyObject*)&PyNautilusMenuProvider_Type) ||
+                               PyObject_IsSubclass(value, 
(PyObject*)&PyNautilusPropertiesModelProvider_Type)) {
             gtype = nautilus_python_object_get_type(type_module, value);
             g_array_append_val(all_types, gtype);
         }
@@ -207,6 +211,9 @@ nautilus_python_init_python (void) {
     IMPORT(Menu, "Menu");
     IMPORT(MenuItem, "MenuItem");
     IMPORT(MenuProvider, "MenuProvider");
+    IMPORT(PropertiesItem, "PropertiesItem");
+    IMPORT(PropertiesModel, "PropertiesModel");
+    IMPORT(PropertiesModelProvider, "PropertiesModelProvider");
     IMPORT(OperationHandle, "OperationHandle");
 
 #undef IMPORT
diff --git a/src/nautilus-python.h b/src/nautilus-python.h
index 90f8e17..8261878 100644
--- a/src/nautilus-python.h
+++ b/src/nautilus-python.h
@@ -55,6 +55,15 @@ extern PyTypeObject *_PyNautilusMenuItem_Type;
 extern PyTypeObject *_PyNautilusMenuProvider_Type;
 #define PyNautilusMenuProvider_Type (*_PyNautilusMenuProvider_Type)
 
+extern PyTypeObject *_PyNautilusPropertiesItem_Type;
+#define PyNautilusPropertiesItem_Type (*_PyNautilusPropertiesItem_Type)
+
+extern PyTypeObject *_PyNautilusPropertiesModel_Type;
+#define PyNautilusPropertiesModel_Type (*_PyNautilusPropertiesModel_Type)
+
+extern PyTypeObject *_PyNautilusPropertiesModelProvider_Type;
+#define PyNautilusPropertiesModelProvider_Type (*_PyNautilusPropertiesModelProvider_Type)
+
 extern PyTypeObject *_PyNautilusOperationHandle_Type;
 #define PyNautilusOperationHandle_Type (*_PyNautilusOperationHandle_Type)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]