[nautilus-python] Allow the python extension to provide an option result parameter to the update_complete_invoke metho
- From: Adam Plumb <adamplumb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-python] Allow the python extension to provide an option result parameter to the update_complete_invoke metho
- Date: Fri, 30 Apr 2010 19:20:21 +0000 (UTC)
commit 534d645335a4adbf0913ffc3761f6128ac4b1a1d
Author: Adam Plumb <adamplumb gmail com>
Date: Fri Apr 30 15:20:15 2010 -0400
Allow the python extension to provide an option result parameter to the update_complete_invoke method. Also, added an example plugin
examples/update-file-info-async.py | 15 +++++++++++++++
src/nautilus.override | 15 +++++++++------
2 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/examples/update-file-info-async.py b/examples/update-file-info-async.py
new file mode 100644
index 0000000..1d14d4f
--- /dev/null
+++ b/examples/update-file-info-async.py
@@ -0,0 +1,15 @@
+import nautilus
+import gobject
+
+class UpdateFileInfoAsync(nautilus.InfoProvider):
+ def __init__(self):
+ pass
+
+ def update_file_info_full(self, provider, handle, closure, file):
+ print "update_file_info_full"
+ gobject.timeout_add_seconds(3, self.update_cb, provider, handle, closure)
+ return nautilus.OPERATION_IN_PROGRESS
+
+ def update_cb(self, provider, handle, closure):
+ print "update_cb"
+ self.update_complete_invoke(provider, handle, closure, result=nautilus.OPERATION_FAILED)
diff --git a/src/nautilus.override b/src/nautilus.override
index 137f0d0..98abaef 100644
--- a/src/nautilus.override
+++ b/src/nautilus.override
@@ -88,25 +88,28 @@ _wrap_nautilus_menu_get_items(PyGObject *self)
return Py_None;
}
%%
-define NautilusInfoProvider.update_complete_invoke args
+define NautilusInfoProvider.update_complete_invoke kwargs
static PyObject *
-_wrap_nautilus_info_provider_update_complete_invoke(PyGObject *self, PyObject *args)
+_wrap_nautilus_info_provider_update_complete_invoke(PyGObject *self, PyObject *args, PyObject *kwargs)
{
- PyObject *py_closure, *py_handle;
+ static char *kwlist[] = { "provider", "handle", "closure", "result", NULL };
+ PyObject *py_closure, *py_handle, *py_result;
PyGObject *py_provider;
GClosure *closure;
NautilusOperationHandle *handle;
NautilusOperationResult result = NAUTILUS_OPERATION_COMPLETE;
- if (!PyArg_ParseTuple(args, "O!OO:NautilusInfoProvider.update_complete_invoke",
- &PyNautilusMenuProvider_Type, &py_provider,
- &py_handle, &py_closure))
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!OO|O:NautilusInfoProvider.update_complete_invoke", kwlist,
+ &PyNautilusInfoProvider_Type, &py_provider,
+ &py_handle, &py_closure, &py_result))
{
return NULL;
}
closure = pyg_boxed_get(py_closure, GClosure);
handle = pyg_pointer_get(py_handle, NautilusOperationHandle);
+ if (py_result != NULL)
+ result = (NautilusOperationResult)py_result;
nautilus_info_provider_update_complete_invoke(closure,
NAUTILUS_INFO_PROVIDER(py_provider->obj), handle, result);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]