[nautilus-python] Implemented the NautilusMenu.get_items method, updated documentation
- From: Adam Plumb <adamplumb src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus-python] Implemented the NautilusMenu.get_items method, updated documentation
- Date: Thu, 14 Jan 2010 20:11:23 +0000 (UTC)
commit 36713065c1e06f5773cac8d089778311b929d5b3
Author: Adam Plumb <adamplumb gmail com>
Date: Thu Jan 14 15:11:16 2010 -0500
Implemented the NautilusMenu.get_items method, updated documentation
examples/documentation.py | 19 ++++++++++++++++++
src/nautilus.override | 47 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+), 0 deletions(-)
---
diff --git a/examples/documentation.py b/examples/documentation.py
index 17598f6..c930df7 100644
--- a/examples/documentation.py
+++ b/examples/documentation.py
@@ -57,6 +57,19 @@ class InfoProvider:
and use together with the other extensions
"""
+class Menu:
+ def append(self, menu_item):
+ """
+ @type menu_item nautilus.MenuItem
+ """
+ pass
+
+ def get_items(self):
+ """
+ @rtype list of nautilus.MenuItem
+ """
+ pass
+
class MenuItem:
"""
Properties:
@@ -76,6 +89,12 @@ class MenuItem:
def activate(self):
pass
+
+ def set_submenu(self, menu):
+ """
+ @type menu nautilus.Menu
+ """
+ pass
class Column:
"""
diff --git a/src/nautilus.override b/src/nautilus.override
index ddfd138..a45c917 100644
--- a/src/nautilus.override
+++ b/src/nautilus.override
@@ -29,6 +29,32 @@ headers
#include <libnautilus-extension/nautilus-location-widget-provider.h>
#include <libnautilus-extension/nautilus-menu-provider.h>
#include <libnautilus-extension/nautilus-property-page-provider.h>
+#include <libnautilus-extension/nautilus-menu.h>
+
+static PyObject *
+_glist_to_pyobject (GList *list)
+{
+ GList *l;
+ PyObject *item, *py_ret;
+
+ py_ret = PyList_New (0);
+
+ for (l = list; l != NULL; l = l->next)
+ {
+ item = pygobject_new ((GObject *)l->data);
+
+ if (item == NULL)
+ {
+ Py_DECREF (py_ret);
+ return NULL;
+ }
+
+ PyList_Append (py_ret, item);
+ Py_DECREF (item);
+ }
+
+ return py_ret;
+}
%%
modulename nautilus
@@ -40,3 +66,24 @@ import gtk.Window as PyGtkWindow_Type
ignore-glob
*_get_type
%%
+define NautilusMenu.get_items
+static PyObject *
+_wrap_nautilus_menu_get_items(PyGObject *self)
+{
+ GList *ret;
+
+ if(self == NULL)
+ {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+
+ ret = nautilus_menu_get_items(NAUTILUS_MENU(self->obj));
+ if (ret) {
+ PyObject *py_ret = _glist_to_pyobject(ret);
+ return py_ret;
+ }
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]