Call the correct gadget method on gc_shutdonw

If this was a popup-on-desktop instance call the popup_destroyed()
method instead of the instance_destroyed() one
This commit is contained in:
Davide Andreoli 2014-08-31 10:45:13 +02:00
parent 192fa721fd
commit 518dd74474
1 changed files with 19 additions and 7 deletions

View File

@ -609,16 +609,28 @@ static void
_edgar_gc_shutdown(E_Gadcon_Client *gcc)
{
Edgar_Py_Gadget *gadget = gcc->data;
PyObject *pyobj, *ret;
DBG("EDGAR: Gadcon Shutdown. NAME: %s, ID: %d", gcc->name, gcc->id);
// call the instance_destroyed() method of the gadget.
PyObject *py_obj = object_from_instance(gcc->o_base);
PyObject *ret = PyObject_CallMethod(gadget->instance, "instance_destroyed",
"(S)", py_obj);
PY_ON_ERROR_RETURN(!ret, , "Cannot call instance_destroyed()");
Py_DECREF(py_obj);
Py_DECREF(ret);
pyobj = object_from_instance(gcc->o_base);
if (gcc->gadcon->location->site == E_GADCON_SITE_DESKTOP &&
gadget->opt_pop_on_desk)
{
// call the popup_destroyed() method of the gadget.
ret = PyObject_CallMethod(gadget->instance, "popup_destroyed",
"(S)", pyobj);
PY_ON_ERROR_RETURN(!ret, , "Cannot call popup_destroyed()");
}
else
{
// call the instance_destroyed() method of the gadget.
ret = PyObject_CallMethod(gadget->instance, "instance_destroyed",
"(S)", pyobj);
PY_ON_ERROR_RETURN(!ret, , "Cannot call instance_destroyed()");
}
Py_XDECREF(ret);
Py_XDECREF(pyobj);
// destroy the object
evas_object_del(gcc->o_base);