[rhythmbox] python: sort of fix RBSource impl_add_uri method
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] python: sort of fix RBSource impl_add_uri method
- Date: Sat, 25 Sep 2010 00:48:46 +0000 (UTC)
commit ffd7608f3eae17f0aacbd9223eefd27963a96aa5
Author: Jonathan Matthew <jonathan d14n org>
Date: Sat Sep 25 10:46:54 2010 +1000
python: sort of fix RBSource impl_add_uri method
For now, we just call the callback immediately after calling the python
method. We should be passing the callback to the python method instead,
but at this stage it doesn't look like that's worth the effort. This should
at least get the ubuntu one music store plugin working again.
bindings/python/rb.override | 99 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 99 insertions(+), 0 deletions(-)
---
diff --git a/bindings/python/rb.override b/bindings/python/rb.override
index 6ad9821..699de3c 100644
--- a/bindings/python/rb.override
+++ b/bindings/python/rb.override
@@ -1714,3 +1714,102 @@ _wrap_RBSource__proxy_do_impl_search(RBSource *self, RBSourceSearch*search, cons
Py_DECREF(py_self);
pyg_gil_state_release(__py_state);
}
+%%
+override RBSource__proxy_do_impl_add_uri
+static gboolean
+_wrap_RBSource__proxy_do_impl_add_uri(RBSource *self, const char*uri, const char*title, const char*genre, RBSourceAddCallback callback, gpointer data, GDestroyNotify destroy_data)
+{
+ PyGILState_STATE __py_state;
+ PyObject *py_self;
+ PyObject *py_uri = NULL;
+ PyObject *py_title;
+ PyObject *py_genre;
+ gboolean retval;
+ PyObject *py_main_retval;
+ PyObject *py_retval;
+ PyObject *py_args;
+ PyObject *py_method;
+
+ __py_state = pyg_gil_state_ensure();
+ py_self = pygobject_new((GObject *) self);
+ if (!py_self) {
+ if (PyErr_Occurred())
+ PyErr_Print();
+ pyg_gil_state_release(__py_state);
+ return FALSE;
+ }
+ if (uri)
+ py_uri = PyString_FromString(uri);
+ if (!py_uri) {
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_DECREF(py_self);
+ pyg_gil_state_release(__py_state);
+ return FALSE;
+ }
+ if (title)
+ py_title = PyString_FromString(title);
+ else {
+ Py_INCREF(Py_None);
+ py_title = Py_None;
+ }
+ if (genre)
+ py_genre = PyString_FromString(genre);
+ else {
+ Py_INCREF(Py_None);
+ py_genre = Py_None;
+ }
+
+ py_args = PyTuple_New(3);
+ PyTuple_SET_ITEM(py_args, 0, py_uri);
+ PyTuple_SET_ITEM(py_args, 1, py_title);
+ PyTuple_SET_ITEM(py_args, 2, py_genre);
+
+ py_method = PyObject_GetAttrString(py_self, "do_impl_add_uri");
+ if (!py_method) {
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_DECREF(py_args);
+ Py_DECREF(py_self);
+ pyg_gil_state_release(__py_state);
+ return FALSE;
+ }
+ py_retval = PyObject_CallObject(py_method, py_args);
+ if (!py_retval) {
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(py_retval);
+ Py_DECREF(py_method);
+ Py_DECREF(py_args);
+ Py_DECREF(py_self);
+ pyg_gil_state_release(__py_state);
+ return FALSE;
+ }
+ py_retval = Py_BuildValue("(N)", py_retval);
+ if (!PyArg_ParseTuple(py_retval, "O", &py_main_retval)) {
+ if (PyErr_Occurred())
+ PyErr_Print();
+ Py_XDECREF(py_retval);
+ Py_DECREF(py_method);
+ Py_DECREF(py_args);
+ Py_DECREF(py_self);
+ pyg_gil_state_release(__py_state);
+ return FALSE;
+ }
+ if (callback) {
+ callback (self, uri, data);
+ if (destroy_data) {
+ destroy_data (data);
+ }
+ }
+
+ retval = PyObject_IsTrue(py_main_retval)? TRUE : FALSE;
+
+ Py_XDECREF(py_retval);
+ Py_DECREF(py_method);
+ Py_DECREF(py_args);
+ Py_DECREF(py_self);
+ pyg_gil_state_release(__py_state);
+
+ return retval;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]