*/
#define E_LAYOUT_ITEM_DRAG_RESIST_LEVEL 10
-
+static void _e_gadcon_event_populate(E_Gadcon *gc);
static Eina_Bool _e_gadcon_client_populate(E_Gadcon *gc, const E_Gadcon_Client_Class *cc, E_Config_Gadcon_Client *cf_gcc);
static void _e_gadcon_client_unpopulate(E_Gadcon_Client *gcc);
static void _e_gadcon_free(E_Gadcon *gc);
static void _e_gadcon_provider_populate_request(E_Gadcon *gc, const E_Gadcon_Client_Class *cc);
static void _e_gadcon_provider_populate_unrequest(const E_Gadcon_Client_Class *cc);
static Eina_Bool _e_gadcon_provider_populate_idler(void *data);
+static void _e_gadcon_event_populate_free(void *data __UNUSED__, void *event);
static Eina_Bool _e_gadcon_custom_populate_idler(void *data);
static int _e_gadcon_location_change(E_Gadcon_Client *gcc, E_Gadcon_Location *src, E_Gadcon_Location *dst);
EAPI int E_EVENT_GADCON_CLIENT_CLASS_DEL = -1;
EAPI int E_EVENT_GADCON_CLIENT_ADD = -1;
EAPI int E_EVENT_GADCON_CLIENT_DEL = -1;
+EAPI int E_EVENT_GADCON_POPULATE = -1;
static Eina_Hash *providers = NULL;
static Eina_List *providers_list = NULL;
E_EVENT_GADCON_CLIENT_CLASS_DEL = ecore_event_type_new();
E_EVENT_GADCON_CLIENT_ADD = ecore_event_type_new();
E_EVENT_GADCON_CLIENT_DEL = ecore_event_type_new();
+ E_EVENT_GADCON_POPULATE = ecore_event_type_new();
_module_init_end_handler = ecore_event_handler_add(E_EVENT_MODULE_INIT_END, _module_init_end_cb, NULL);
return 1;
}
if (_module_init_end_handler)
ecore_event_handler_del(_module_init_end_handler);
_module_init_end_handler = NULL;
- E_EVENT_GADCON_CLIENT_ADD = E_EVENT_GADCON_CLIENT_DEL =
- E_EVENT_GADCON_CLIENT_CLASS_ADD = E_EVENT_GADCON_CLIENT_CLASS_DEL = -1;
return 1;
}
e_gadcon_client_queue(gc, cf_gcc);
}
e_gadcon_layout_thaw(gc->o_container);
+ if (gc->populated_classes && (!gc->populate_requests))
+ _e_gadcon_event_populate(gc);
return EINA_TRUE;
}
}
static void
+_e_gadcon_event_populate(E_Gadcon *gc)
+{
+ E_Event_Gadcon_Populate *ev;
+
+ ev = E_NEW(E_Event_Gadcon_Populate, 1);
+ e_object_ref(E_OBJECT(gc));
+ ev->gc = gc;
+ ecore_event_add(E_EVENT_GADCON_POPULATE, ev, _e_gadcon_event_populate_free, NULL);
+}
+
+static void
_e_gadcon_client_delfn(void *d __UNUSED__, void *o)
{
E_Gadcon_Client *gcc = o;
}
}
+static void
+_e_gadcon_event_populate_free(void *data __UNUSED__, void *event)
+{
+ E_Event_Gadcon_Populate *ev = event;
+
+ e_object_unref(E_OBJECT(ev->gc));
+ free(ev);
+}
+
static Eina_Bool
_e_gadcon_custom_populate_idler(void *data __UNUSED__)
{
e_gadcon_populate_class(gc, cc);
}
e_gadcon_layout_thaw(gc->o_container);
+ _e_gadcon_event_populate(gc);
}
#ifndef E17_RELEASE_BUILD
E_Gadcon_Client_Class *cc;
Eina_List *l;
E_Gadcon *gc;
+ Eina_Bool cont = EINA_FALSE;
if (!_modules_loaded) return EINA_TRUE;
- EINA_LIST_FOREACH(gadcons, l, gc)
- e_gadcon_layout_freeze(gc->o_container);
-
#ifndef E17_RELEASE_BUILD
static Eina_Bool first = EINA_TRUE;
if (first)
e_main_ts("gadcon populate idler start");
#endif
EINA_LIST_FOREACH(gadcons, l, gc)
- EINA_LIST_FREE(gc->populate_requests, cc)
- {
+ {
+ int x = 0;
+ Eina_Bool freeze = EINA_FALSE;
+ if (gc->populate_requests)
+ {
+ freeze = EINA_TRUE;
+ e_gadcon_layout_freeze(gc->o_container);
+ }
+ EINA_LIST_FREE(gc->populate_requests, cc)
+ {
+ if (x)
+ {
+ cont = EINA_TRUE;
+ e_gadcon_layout_thaw(gc->o_container);
+ goto out;
+ }
#ifndef E17_RELEASE_BUILD
- if (first) e_main_ts(cc->name);
+ if (first) e_main_ts(cc->name);
#endif
- if (gc->populate_class.func)
- gc->populate_class.func(gc->populate_class.data, gc, cc);
- else
- e_gadcon_populate_class(gc, cc);
- if (!eina_list_data_find(gc->populated_classes, cc))
- {
- gc->populated_classes = eina_list_append(gc->populated_classes, cc);
- if (gc->cf)
- {
- Eina_List *ll;
- E_Config_Gadcon_Client *cf_gcc;
-
- if (!gc->awaiting_classes) continue;
- ll = eina_hash_set(gc->awaiting_classes, cc->name, NULL);
- EINA_LIST_FREE(ll, cf_gcc)
- _e_gadcon_client_populate(gc, cc, cf_gcc);
- }
- }
- }
+ if (gc->populate_class.func)
+ gc->populate_class.func(gc->populate_class.data, gc, cc);
+ else
+ e_gadcon_populate_class(gc, cc);
+ if (!eina_list_data_find(gc->populated_classes, cc))
+ {
+ gc->populated_classes = eina_list_append(gc->populated_classes, cc);
+ if (gc->cf)
+ {
+ Eina_List *ll;
+ E_Config_Gadcon_Client *cf_gcc;
+ if (!gc->awaiting_classes) continue;
+ ll = eina_hash_set(gc->awaiting_classes, cc->name, NULL);
+ EINA_LIST_FREE(ll, cf_gcc)
+ _e_gadcon_client_populate(gc, cc, cf_gcc);
+ }
+ }
+ x++;
+ }
+ if (freeze) e_gadcon_layout_thaw(gc->o_container);
+ if (x) _e_gadcon_event_populate(gc);
+ }
+out:
#ifndef E17_RELEASE_BUILD
if (first)
e_main_ts("gadcon populate idler end");
#endif
- EINA_LIST_FOREACH(gadcons, l, gc)
- e_gadcon_layout_thaw(gc->o_container);
- populate_idler = NULL;
+ if (cont)
+ populate_idler = NULL;
#ifndef E17_RELEASE_BUILD
first = EINA_FALSE;
#endif
- return ECORE_CALLBACK_CANCEL;
+ return cont;
}
static void
static Eina_Bool _e_shelf_on_current_desk(E_Shelf *es, E_Event_Zone_Edge *ev);
static void _e_shelf_cb_dummy_del(E_Shelf *, Evas *e, Evas_Object *obj, void *event_info);
static void _e_shelf_cb_dummy_moveresize(E_Shelf *, Evas *e, Evas_Object *obj, void *event_info);
+static Eina_Bool _e_shelf_gadcon_populate_handler_cb(void *, int, void *);
static Eina_List *shelves = NULL;
static Eina_List *dummies = NULL;
EAPI int E_EVENT_SHELF_ADD = -1;
EAPI int E_EVENT_SHELF_DEL = -1;
+static Ecore_Event_Handler *_e_shelf_gadcon_populate_handler = NULL;
/* externally accessible functions */
EINTERN int
{
E_EVENT_SHELF_ADD = ecore_event_type_new();
E_EVENT_SHELF_DEL = ecore_event_type_new();
+ _e_shelf_gadcon_populate_handler = ecore_event_handler_add(E_EVENT_GADCON_POPULATE, _e_shelf_gadcon_populate_handler_cb, NULL);
return 1;
}
es = eina_list_data_get(shelves);
e_object_del(E_OBJECT(es));
}
+ _e_shelf_gadcon_populate_handler = ecore_event_handler_del(_e_shelf_gadcon_populate_handler);
return 1;
}
e_shelf_config_new(E_Zone *zone, E_Config_Shelf *cf_es)
{
E_Shelf *es;
+ Eina_Bool can_show = EINA_FALSE;
es = e_shelf_zone_new(zone, cf_es->name, cf_es->style,
cf_es->popup, cf_es->layer, cf_es->id);
{
if ((desk->x == sd->x) && (desk->y == sd->y))
{
- e_shelf_show(es);
+ can_show = EINA_TRUE;
break;
}
}
}
else
- e_shelf_show(es);
+ can_show = EINA_TRUE;
+
+ if (can_show)
+ {
+ /* at this point, we cleverly avoid showing the shelf
+ * if its gadcon has not populated; instead we show it in
+ * the E_EVENT_GADCON_POPULATE handler
+ */
+ if (es->gadcon->clients)
+ e_shelf_show(es);
+ }
e_shelf_toggle(es, 0);
return es;
return ECORE_CALLBACK_CANCEL;
}
+static Eina_Bool
+_e_shelf_gadcon_populate_handler_cb(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+ E_Event_Gadcon_Populate *ev = event;
+ Eina_List *l;
+ E_Shelf *es;
+
+ EINA_LIST_FOREACH(shelves, l, es)
+ if (es->gadcon == ev->gc)
+ {
+ /* any shelf that's not already shown at this point will be
+ * waiting for this event to show it so that we don't ever resize the shelf
+ * object
+ */
+ e_shelf_show(es);
+ break;
+ }
+ return ECORE_CALLBACK_RENEW;
+}
+
static void
_e_shelf_cb_menu_rename_yes_cb(void *data, char *text)
{