davemds pushed a commit to branch master.

http://git.enlightenment.org/enlightenment/modules/edgar.git/commit/?id=518dd7447463f7e3ee04f7718d5ec332d5894c36

commit 518dd7447463f7e3ee04f7718d5ec332d5894c36
Author: davemds <[email protected]>
Date:   Sun Aug 31 10:45:13 2014 +0200

    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
---
 src/e_mod_edgar.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/src/e_mod_edgar.c b/src/e_mod_edgar.c
index 6f016f8..4ab6ae4 100644
--- a/src/e_mod_edgar.c
+++ b/src/e_mod_edgar.c
@@ -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);

-- 


Reply via email to