davemds pushed a commit to branch master.

http://git.enlightenment.org/enlightenment/modules/edgar.git/commit/?id=250957a6c67e7d26a118eabbf93a82faa251b2a7

commit 250957a6c67e7d26a118eabbf93a82faa251b2a7
Author: Dave Andreoli <d...@gurumeditation.it>
Date:   Sun Jul 12 10:44:06 2020 +0200

    Remove bryce integration, making the module work again
---
 src/e_mod_edgar.c | 284 +-----------------------------------------------------
 1 file changed, 2 insertions(+), 282 deletions(-)

diff --git a/src/e_mod_edgar.c b/src/e_mod_edgar.c
index 43d9229..c4c50de 100644
--- a/src/e_mod_edgar.c
+++ b/src/e_mod_edgar.c
@@ -28,16 +28,10 @@
 #include "efl.eo_api.h"
 
 
-// undef this to disable bryce integration
-#define EDGAR_GADGETS_DOMAIN "Edgar"
-
-
-/* TODO:
-
- - correctly manage the new bryce orientations
+/*
+TODO
  - gadget configurations (and thus id management)
  - gadget actions (keybindings)
-
 */
 
 /* Local typedefs */
@@ -70,14 +64,6 @@ static const char *_edgar_gc_id_new(const 
E_Gadcon_Client_Class *client_class);
 static void _edgar_gc_id_del(const E_Gadcon_Client_Class *client_class, const 
char *id);
 static Evas_Object *_edgar_gc_icon(const E_Gadcon_Client_Class *client_class, 
Evas *evas);
 
-#ifdef EDGAR_GADGETS_DOMAIN
-/* Local Gadget/Bryce Prototypes */
-EINTERN Evas_Object *edgar_bryce_create_cb(Evas_Object *parent, const char 
*type, int *id, E_Gadget_Site_Orient orient);
-EINTERN char        *edgar_bryce_name_cb(const char *type);
-static Evas_Object  *edgar_bryce_popup_new(Edgar_Py_Gadget *gadget, 
Evas_Object *gadget_object);
-static void          edgar_bryce_popup_del(Edgar_Py_Gadget *gadget, 
Evas_Object *ctx_popup);
-#endif
-
 /* Python eapi module proto */
 PyMODINIT_FUNC PyInit_eapi(void);
 
@@ -342,14 +328,6 @@ edgar_gadget_load(const char *name, const char *path)
    e_gadcon_provider_register(cclass);
    eina_hash_add(edgar_gadgets, name, gadget);
 
-#ifdef EDGAR_GADGETS_DOMAIN
-   // add the gadget to the bryce gadgets system
-   e_gadget_external_type_add(EDGAR_GADGETS_DOMAIN, name,
-                              edgar_bryce_create_cb, NULL);
-   e_gadget_external_type_name_cb_set(EDGAR_GADGETS_DOMAIN, name,
-                                      edgar_bryce_name_cb);
-#endif
-
    return gadget;
 }
 
@@ -365,11 +343,6 @@ edgar_gadget_unload(Edgar_Py_Gadget *gadget)
    EINA_LIST_FOREACH_SAFE(gadget->pops_obj, l, l2, popup_content)
       E_FREE_FUNC(popup_content, evas_object_del);
 
-#ifdef EDGAR_GADGETS_DOMAIN
-   // remove the gadget from the bryce gadgets system
-   e_gadget_external_type_del(EDGAR_GADGETS_DOMAIN, gadget->name);
-#endif
-
    // Free the gadcon client class
    e_gadcon_provider_unregister(gadget->cclass);
    eina_stringshare_del(gadget->cclass->name);
@@ -669,259 +642,6 @@ edgar_mouse_down1_cb(void *data, Evas *e, Evas_Object 
*obj, void *event_info)
    }
 }
 
-
-#ifdef EDGAR_GADGETS_DOMAIN
-/*****************************************************************************/
-/*****  Gadget/Bryce Pupup   *************************************************/
-/*****************************************************************************/
-static void
-edgar_bryce_ctxpopup_dismissed_cb(void *data, Evas_Object *obj, void *info 
EINA_UNUSED)
-{
-   Edgar_Py_Gadget *gadget = data;
-   edgar_bryce_popup_del(gadget, obj);
-}
-
-static Evas_Object *
-edgar_bryce_popup_new(Edgar_Py_Gadget *gadget, Evas_Object *gadget_object)
-{
-   Evas_Object *ctxpopup, *content;
-
-   DBG("EDGAR: Bryce popup for gadget:%s", gadget->name);
-
-   // create an elm ctxpopup to hold the content generated by the gadget
-   ctxpopup = elm_ctxpopup_add(e_comp->elm);
-   elm_object_style_set(ctxpopup, "noblock");
-   evas_object_smart_callback_add(ctxpopup, "dismissed",
-                                  edgar_bryce_ctxpopup_dismissed_cb, gadget);
-
-   // request the popup content from the python gadget
-   content = edgar_request_popup_content(gadget, ctxpopup);
-   if (!content)
-   {
-      evas_object_del(ctxpopup);
-      return NULL;
-   }
-
-   // keep track of the popup
-   evas_object_data_set(gadget_object, "edgar-ctxpopup", ctxpopup);
-   evas_object_data_set(ctxpopup, "edgar-ctxpopup-owner", gadget_object);
-
-   // put the content in the ctxpopup and show everything
-   elm_object_content_set(ctxpopup, content);
-   e_gadget_util_ctxpopup_place(gadget_object, ctxpopup, NULL);
-   evas_object_show(ctxpopup);
-
-   return ctxpopup;
-}
-
-static void
-edgar_bryce_popup_del(Edgar_Py_Gadget *gadget, Evas_Object *ctxpopup)
-{
-   Evas_Object *popup_content = elm_object_content_get(ctxpopup);
-   Evas_Object *gadget_object = evas_object_data_get(ctxpopup, 
"edgar-ctxpopup-owner");
-
-   DBG("EDGAR: Bryce popup delete for gadget:%s", gadget->name);
-   edgar_notify_popup_deleted(gadget, popup_content);
-
-   // remove popup references
-   evas_object_data_del(gadget_object, "edgar-ctxpopup");
-   evas_object_data_del(ctxpopup, "edgar-ctxpopup-owner");
-
-   // delete the ctxpopup itself and the content object
-   evas_object_del(ctxpopup);
-}
-
-
-/*****************************************************************************/
-/*****  Gadget/Bryce Menu   *************************************************/
-/*****************************************************************************/
-static void
-edgar_bryce_menu_info_cb(void *data, E_Menu *m, E_Menu_Item *mi)
-{
-   edgar_show_gadget_info(data);
-}
-
-static void
-edgar_bryce_menu_cb(Evas_Object *gadget_obj, E_Menu *m)
-{
-   Edgar_Py_Gadget *gadget = evas_object_data_get(gadget_obj, "edgar-gadget");
-   E_Menu_Item *mi;
-
-   mi = e_menu_item_new(m);
-   e_menu_item_separator_set(mi, 1);
-
-   mi = e_menu_item_new(m);
-   e_menu_item_label_set(mi, "Gadget info");
-   e_util_menu_item_theme_icon_set(mi, "help-about");
-   e_menu_item_callback_set(mi, edgar_bryce_menu_info_cb, gadget);
-}
-
-static void
-edgar_bryce_mouse_down_cb(void *data, Evas *evas EINA_UNUSED, Evas_Object 
*obj, void *event)
-{
-   Edgar_Py_Gadget *gadget = data;
-   Evas_Event_Mouse_Down *ev = event;
-   Eina_Bool pop_on_desk = (uintptr_t)evas_object_data_get(obj, 
"edgar-pop-on-desk");
-
-   if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
-
-   if (ev->button == 1 && !pop_on_desk)  // left button (gadget popup)
-   {
-      Evas_Object *ctxpopup;
-
-      if ((ctxpopup = evas_object_data_get(obj, "edgar-ctxpopup")))
-        elm_ctxpopup_dismiss(ctxpopup);
-      else if ((ctxpopup = edgar_bryce_popup_new(gadget, obj)))
-        ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
-   }
-}
-
-//static Evas_Object *
-//edgar_bryce_configure_cb(Evas_Object *gadget_obj)
-//{
-   //Edgar_Py_Gadget *gadget = evas_object_data_get(gadget_obj, 
"edgar-gadget");
-   //DBG("EDGAR: Bryce configure for gadget: %s", gadget->name);
-   //return NULL;
-//}
-
-/*****************************************************************************/
-/*****  Gadget/Bryce IFace   *************************************************/
-/*****************************************************************************/
-static void
-edgar_bryce_delete_cb(void *data, const Efl_Event *event)
-{
-   Edgar_Py_Gadget *gadget = data;
-   Evas_Object *gadget_object = event->object;
-   Evas_Object *ctxpopup;
-   PyObject *pyobj, *ret;
-   Eina_Bool pop_on_desk = (uintptr_t)evas_object_data_get(gadget_object,
-                                                           
"edgar-pop-on-desk");
-
-   DBG("EDGAR: Bryce instance del for gadget:%s", gadget->name);
-
-   // is there a popup opened for this gadget object?
-   if ((ctxpopup = evas_object_data_get(gadget_object, "edgar-ctxpopup")))
-     edgar_bryce_popup_del(gadget, ctxpopup);
-
-   // call the correct method in the python gadget
-   pyobj = object_from_instance(gadget_object);
-   if (pop_on_desk)
-   {
-      ret = PyObject_CallMethod(gadget->instance, "popup_destroyed",
-                                "(S)", pyobj);
-      PY_ON_ERROR_RETURN(!ret, , "Cannot call popup_destroyed()");
-   }
-   else
-   {
-      ret = PyObject_CallMethod(gadget->instance, "instance_destroyed",
-                                "(S)", pyobj);
-      PY_ON_ERROR_RETURN(!ret, , "Cannot call instance_destroyed()");
-   }
-   Py_XDECREF(ret);
-   Py_XDECREF(pyobj);
-}
-
-static void
-_edgar_bryce_created_cb(void *data, Evas_Object *obj, void *event_data)
-{
-   Edgar_Py_Gadget *gadget = data;
-   Evas_Object *gadget_obj = event_data;
-
-   evas_object_smart_callback_del_full(obj, "gadget_created",
-                                       _edgar_bryce_created_cb, data);
-   
-   //e_gadget_configure_cb_set(gadget_obj, edgar_bryce_configure_cb);
-   e_gadget_menu_populate_cb_set(gadget_obj, edgar_bryce_menu_cb);
-   evas_object_event_callback_add(gadget_obj, EVAS_CALLBACK_MOUSE_DOWN,
-                                  edgar_bryce_mouse_down_cb, gadget);
-}
-
-EINTERN Evas_Object *
-edgar_bryce_create_cb(Evas_Object *parent, const char *type, int *id, 
E_Gadget_Site_Orient orient)
-{
-   Edgar_Py_Gadget *gadget;
-   Evas_Object *obj;
-   Eina_Bool pop_on_desk = EINA_FALSE;
-
-   gadget = eina_hash_find(edgar_gadgets, type);
-   if (!gadget) return NULL;
-
-   DBG("EDGAR: Bryce create type:%s id:%d (orient:%d) (edjefile:%s)",
-       type, *id, orient, gadget->edjefile);
-
-   // create the python Gadget class instance (if not already done)
-   if (!gadget->instance)
-   {
-      DBG("EDGAR:   Instantiate the python class");
-      gadget->instance = PyObject_CallMethod(gadget->mod, "Gadget", "");
-      PY_ON_ERROR_RETURN(!gadget->instance, NULL, "Cannot create the Gadget 
instance");
-   }
-
-   // do we want the popup expanded on desktop ?
-   if (gadget->opt_pop_on_desk && orient == E_GADGET_SITE_ORIENT_NONE && *id 
>= 0)
-      pop_on_desk = EINA_TRUE;
-
-   if (!pop_on_desk)
-   {
-      // create the main edje object
-      obj = edje_object_add(evas_object_evas_get(parent));
-      if (!edgar_theme_object_set(gadget, obj, "main"))
-      {
-         DBG("EDGAR:   ERROR, cannot find a theme for the gadget: '%s'", type);
-         evas_object_del(obj);
-         return NULL;
-      }
-
-      // notify the gadget about the created object
-      PyObject *pyobj = object_from_instance(obj);
-      PyObject *ret = NULL;
-      ret = PyObject_CallMethod(gadget->instance, "instance_created",
-                                // "(Si)", pyobj, gc->location->site);
-                                "(Si)", pyobj, 0);  // TODO PASS THE CORRECT 
ORIENT !!
-      PY_ON_ERROR_RETURN(!ret, NULL, "Cannot call instance_created()");
-      Py_XDECREF(ret);
-      Py_XDECREF(pyobj);
-   
-   }
-   else
-   {
-      // request the popup content from the python gadget
-      obj = edgar_request_popup_content(gadget, parent);
-      if (!obj) return NULL;
-   }
-   evas_object_data_set(obj, "edgar-gadget", gadget);
-   evas_object_data_set(obj, "edgar-pop-on-desk", 
(void*)(uintptr_t)pop_on_desk);
-   evas_object_smart_callback_add(parent, "gadget_created",
-                                  _edgar_bryce_created_cb, gadget);
-   
-   
-   // keep track of this instance lifetime (I would have really preferred an 
explicit callback here!!)
-   // NOTE: del cb with priority to be called before the python-efl one.
-   //       Otherwise python-efl delete the python obj too soon.
-   efl_event_callback_priority_add(obj, EFL_EVENT_DEL,
-                                   EFL_CALLBACK_PRIORITY_BEFORE,
-                                   edgar_bryce_delete_cb, gadget);
-
-   return obj;
-}
-
-EINTERN char *
-edgar_bryce_name_cb(const char *type)
-{
-   Edgar_Py_Gadget *gadget;
-   Eina_Strbuf *buf = eina_strbuf_new();
-
-   if (!buf) return NULL;
-   gadget = eina_hash_find(edgar_gadgets, type);
-   if (!gadget) return NULL;
-
-   eina_strbuf_append_printf(buf, "%s (python)", gadget->label);
-
-   return eina_strbuf_release(buf);
-}
-#endif
-
-
 /*****************************************************************************/
 /*****  Gadcon IFace   *******************************************************/
 /*****************************************************************************/

-- 


Reply via email to