You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5922 lines
187 KiB

#include "e.h"
/*
* TODO: gadcon client ordering on drop
*/
#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_client_free(E_Gadcon_Client *gcc);
static void _e_gadcon_moveresize_handle(E_Gadcon_Client *gcc);
static Eina_Bool _e_gadcon_cb_client_scroll_timer(void *data);
static void _e_gadcon_client_scroll_state_update(E_Gadcon_Client *gcc);
static Eina_Bool _e_gadcon_cb_client_scroll_animator(void *data);
static void _e_gadcon_cb_client_frame_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_gadcon_cb_client_frame_moveresize(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_gadcon_client_save(E_Gadcon_Client *gcc);
static void _e_gadcon_client_drag_begin(E_Gadcon_Client *gcc, int x, int y);
static void _e_gadcon_client_inject(E_Gadcon *gc, E_Gadcon_Client *gcc, int x, int y);
static void _e_gadcon_cb_min_size_request(void *data, Evas_Object *obj, void *event_info);
static void _e_gadcon_cb_size_request(void *data, Evas_Object *obj, void *event_info);
static void _e_gadcon_cb_hide(void *data, Evas *evas, Evas_Object *obj, void *event_info);
static void _e_gadcon_cb_show(void *data, Evas *evas, Evas_Object *obj, void *event_info);
static void _e_gadcon_cb_moveresize(void *data, Evas *evas, Evas_Object *obj, void *event_info);
static void _e_gadcon_parent_resize_cb(E_Gadcon *gc, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
static void _e_gadcon_cb_client_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info);
static void _e_gadcon_cb_client_mouse_in(void *data, Evas *evas, Evas_Object *obj, void *event_info);
static void _e_gadcon_cb_client_mouse_out(void *data, Evas *evas, Evas_Object *obj, void *event_info);
static void _e_gadcon_cb_client_move(void *data, Evas *evas, Evas_Object *obj, void *event_info);
static void _e_gadcon_cb_client_resize(void *data, Evas *evas, Evas_Object *obj, void *event_info);
static void _e_gadcon_client_move_start(E_Gadcon_Client *gcc);
static void _e_gadcon_client_move_stop(E_Gadcon_Client *gcc);
static void _e_gadcon_client_move_go(E_Gadcon_Client *gcc);
static void _e_gadcon_cb_signal_move_start(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_gadcon_cb_signal_move_stop(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_gadcon_cb_signal_move_go(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_gadcon_cb_signal_resize_left_start(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_gadcon_cb_signal_resize_left_stop(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_gadcon_cb_signal_resize_left_go(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_gadcon_cb_signal_resize_right_start(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_gadcon_cb_signal_resize_right_stop(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_gadcon_cb_signal_resize_right_go(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_gadcon_cb_dnd_enter(void *data, const char *type, void *event);
static void _e_gadcon_cb_dnd_move(void *data, const char *type, void *event);
static void _e_gadcon_cb_dnd_leave(void *data, const char *type, void *event);
static void _e_gadcon_cb_dnd_drop(void *data, const char *type, void *event);
static int _e_gadcon_client_class_feature_check(const E_Gadcon_Client_Class *cc, const char *name, void *feature);
static void _e_gadcon_client_cb_menu_post(void *data, E_Menu *m);
static void _e_gadcon_client_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_gadcon_client_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_gadcon_client_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_gadcon_client_cb_menu_style_plain(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_gadcon_client_cb_menu_style_inset(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_gadcon_client_cb_menu_autoscroll(void *data, E_Menu *m, E_Menu_Item *mi);
/*static void _e_gadcon_client_cb_menu_resizable(void *data, E_Menu *m, E_Menu_Item *mi);*/
static void _e_gadcon_client_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_gadcon_client_cb_menu_remove(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_gadcon_client_cb_menu_pre(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_gadcon_client_delfn(void *d, void *o);
static void _e_gadcon_client_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_gadcon_client_event_free(void *d, void *e);
static Evas_Object *e_gadcon_layout_add(Evas *evas);
static void e_gadcon_layout_orientation_set(Evas_Object *obj, int horizontal);
static int e_gadcon_layout_orientation_get(Evas_Object *obj);
static void e_gadcon_layout_freeze(Evas_Object *obj);
static void e_gadcon_layout_thaw(Evas_Object *obj);
static void e_gadcon_layout_min_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
static void e_gadcon_layout_asked_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
static int e_gadcon_layout_pack(Evas_Object *obj, Evas_Object *child);
static void e_gadcon_layout_pack_size_set(Evas_Object *obj, int size);
static void e_gadcon_layout_pack_request_set(Evas_Object *obj, int pos, int size);
static void e_gadcon_layout_pack_options_set(Evas_Object *obj, E_Gadcon_Client *gcc);
static void e_gadcon_layout_pack_min_size_set(Evas_Object *obj, int w, int h);
static void e_gadcon_layout_pack_aspect_set(Evas_Object *obj, int w, int h);
static void e_gadcon_layout_pack_aspect_pad_set(Evas_Object *obj, int w, int h);
static void e_gadcon_layout_unpack(Evas_Object *obj);
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 void _e_gadcon_provider_populate_job(void *data);
static void _e_gadcon_event_populate_free(void *data EINA_UNUSED, void *event);
static void _e_gadcon_custom_populate_job(void *data);
static int _e_gadcon_location_change(E_Gadcon_Client *gcc, E_Gadcon_Location *src, E_Gadcon_Location *dst);
typedef struct _E_Smart_Data E_Smart_Data;
typedef struct _E_Layout_Item_Container E_Layout_Item_Container;
static void _e_gadcon_client_current_position_sync(E_Gadcon_Client *gcc);
static void _e_gadcon_layout_smart_sync_clients(E_Gadcon *gc);
static void _e_gadcon_layout_smart_gadcon_position_shrinked_mode(E_Smart_Data *sd);
static void _e_gadcon_layout_smart_gadcons_asked_position_set(E_Smart_Data *sd);
static Eina_List *_e_gadcon_layout_smart_gadcons_wrap(E_Smart_Data *sd);
static void _e_gadcon_layout_smart_gadcons_position(E_Smart_Data *sd, Eina_List **list);
static void _e_gadcon_layout_smart_gadcons_position_static(E_Smart_Data *sd, Eina_List **list);
static E_Layout_Item_Container *_e_gadcon_layout_smart_containers_position_adjust(E_Smart_Data *sd, E_Layout_Item_Container *lc, E_Layout_Item_Container *lc2);
static void _e_gadcon_layout_smart_position_items_inside_container(E_Smart_Data *sd, E_Layout_Item_Container *lc);
static void _e_gadcon_layout_smart_containers_merge(E_Smart_Data *sd, E_Layout_Item_Container *lc, E_Layout_Item_Container *lc2);
static void _e_gadcon_layout_smart_restore_gadcons_position_before_move(E_Smart_Data *sd, E_Layout_Item_Container **lc_moving, E_Layout_Item_Container *lc_back, Eina_List **con_list);
typedef enum _E_Gadcon_Layout_Item_State
{
E_LAYOUT_ITEM_STATE_NONE,
E_LAYOUT_ITEM_STATE_POS_INC,
E_LAYOUT_ITEM_STATE_POS_DEC,
E_LAYOUT_ITEM_STATE_SIZE_MIN_END_INC,
E_LAYOUT_ITEM_STATE_SIZE_MIN_END_DEC,
E_LAYOUT_ITEM_STATE_SIZE_MAX_END_INC,
E_LAYOUT_ITEM_STATE_SIZE_MAX_END_DEC,
} E_Gadcon_Layout_Item_State;
typedef enum _E_Gadcon_Layout_Item_Flags
{
E_GADCON_LAYOUT_ITEM_LOCK_NONE = 0x00000000,
E_GADCON_LAYOUT_ITEM_LOCK_POSITION = 0x00000001,
E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE = 0x00000002
} E_Gadcon_Layout_Item_Flags;
typedef enum _E_Layout_Item_Container_State
{
E_LAYOUT_ITEM_CONTAINER_STATE_NONE,
E_LAYOUT_ITEM_CONTAINER_STATE_POS_INC,
E_LAYOUT_ITEM_CONTAINER_STATE_POS_DEC,
E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_INC,
E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_DEC,
E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_INC,
E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_DEC,
E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED
} E_Layout_Item_Container_State;
struct _E_Layout_Item_Container
{
int pos, size, prev_pos, prev_size;
struct
{
int min_seq, max_seq;
} state_info;
E_Smart_Data *sd;
Eina_List *items;
E_Layout_Item_Container_State state;
};
#define LC_FREE(__lc) \
if (__lc->items) \
eina_list_free(__lc->items); \
E_FREE(__lc)
#define E_LAYOUT_ITEM_CONTAINER_STATE_SET(__con_state, __bi_state) \
if (__bi_state == E_LAYOUT_ITEM_STATE_NONE) \
__con_state = E_LAYOUT_ITEM_CONTAINER_STATE_NONE; \
else if (__bi_state == E_LAYOUT_ITEM_STATE_POS_INC) \
__con_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_INC; \
else if (__bi_state == E_LAYOUT_ITEM_STATE_POS_DEC) \
__con_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_DEC; \
else if (__bi_state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_INC) \
__con_state = E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_INC; \
else if (__bi_state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_DEC) \
__con_state = E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_DEC; \
else if (__bi_state == E_LAYOUT_ITEM_STATE_SIZE_MAX_END_INC) \
__con_state = E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_INC; \
else if (__bi_state == E_LAYOUT_ITEM_STATE_SIZE_MAX_END_DEC) \
__con_state = E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_DEC
#define LC_OVERLAP(__lc, __lc2) \
((((__lc2)->pos >= (__lc)->pos) && ((__lc2)->pos < ((__lc)->pos + (__lc)->size))) || \
(((__lc)->pos >= (__lc2)->pos) && ((__lc)->pos < ((__lc2)->pos + (__lc2)->size))))
#define E_LAYOUT_ITEM_CONTAINER_SIZE_CHANGE_BY(__lc, __bi, __increase) \
{ \
if (__increase) \
__lc->size += __bi->w; \
else \
__lc->size -= __bi->w; \
}
/********************/
E_API int E_EVENT_GADCON_CLIENT_CLASS_ADD = -1;
E_API int E_EVENT_GADCON_CLIENT_CLASS_DEL = -1;
E_API int E_EVENT_GADCON_CLIENT_ADD = -1;
E_API int E_EVENT_GADCON_CLIENT_DEL = -1;
E_API int E_EVENT_GADCON_POPULATE = -1;
static Eina_Hash *providers = NULL;
static Eina_List *providers_list = NULL;
static Eina_List *gadcons = NULL;
static Eina_List *dummies = NULL;
static Ecore_Job *populate_job = NULL;
static Eina_List *custom_populate_requests = NULL;
static Ecore_Job *custom_populate_job = NULL;
13 years ago
static Eina_List *gadcon_locations = NULL;
static Ecore_Event_Handler *_module_init_end_handler = NULL;
static Eina_Bool _modules_loaded = EINA_FALSE;
static inline void
_eina_list_free(Eina_List *l)
{
eina_list_free(l);
}
static int
_e_gadcon_provider_list_sort_cb(E_Gadcon_Client_Class *a, E_Gadcon_Client_Class *b)
{
return strcasecmp(a->name, b->name);
}
static Eina_Bool
_module_init_end_cb(void *d EINA_UNUSED, int type EINA_UNUSED, void *ev EINA_UNUSED)
{
_modules_loaded = EINA_TRUE;
return ECORE_CALLBACK_RENEW;
}
/* externally accessible functions */
EINTERN int
e_gadcon_init(void)
{
E_EVENT_GADCON_CLIENT_CLASS_ADD = ecore_event_type_new();
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;
}
EINTERN int
e_gadcon_shutdown(void)
{
if (populate_job)
{
ecore_job_del(populate_job);
populate_job = NULL;
}
custom_populate_requests = eina_list_free(custom_populate_requests);
if (custom_populate_job)
{
ecore_job_del(custom_populate_job);
custom_populate_job = NULL;
}
_modules_loaded = EINA_FALSE;
if (_module_init_end_handler)
ecore_event_handler_del(_module_init_end_handler);
_module_init_end_handler = NULL;
E_LIST_FOREACH(gadcons, e_gadcon_unpopulate);
return 1;
}
/**
* Registers a new gadget class in e
*
* @param cc version of gadcon, name and callbacks to use
* for handling creation and destroying a gadget
*/
E_API void
e_gadcon_provider_register(const E_Gadcon_Client_Class *cc)
{
E_Gadcon *gc;
Eina_List *l, *ll, *lll;
E_Config_Gadcon_Client *cf_gcc;
EINA_SAFETY_ON_NULL_RETURN(cc->name);
if (!providers) providers = eina_hash_string_superfast_new(NULL);
eina_hash_direct_add(providers, cc->name, cc);
EINA_LIST_FOREACH(gadcons, l, gc)
{
e_gadcon_layout_freeze(gc->o_container);
if (gc->awaiting_classes)
{
ll = eina_hash_find(gc->awaiting_classes, cc->name);
EINA_LIST_FOREACH(ll, lll, cf_gcc)
_e_gadcon_client_populate(gc, cc, cf_gcc);
}
e_gadcon_layout_thaw(gc->o_container);
}
providers_list = eina_list_sorted_insert(providers_list, (Eina_Compare_Cb)_e_gadcon_provider_list_sort_cb, cc);
{
E_Event_Gadcon_Client_Class_Add *ev;
ev = E_NEW(E_Event_Gadcon_Client_Class_Add, 1);
ev->cc = cc;
ecore_event_add(E_EVENT_GADCON_CLIENT_CLASS_ADD, ev, NULL, NULL);
}
}
/**
* unregisters a gadget class in e
*
* @param cc the gadget class that was used to register the gadget
*/
E_API void
e_gadcon_provider_unregister(const E_Gadcon_Client_Class *cc)
{
Eina_List *l, *ll, *dlist = NULL;
E_Gadcon *gc;
E_Gadcon_Client *gcc;
_e_gadcon_provider_populate_unrequest(cc);
EINA_LIST_FOREACH(gadcons, l, gc)
{
EINA_LIST_FOREACH(gc->clients, ll, gcc)
{
if (gcc->client_class == cc)
dlist = eina_list_append(dlist, gcc);
}
gc->populated_classes = eina_list_remove(gc->populated_classes, cc);
}
EINA_LIST_FREE(dlist, gcc)
{
e_gadcon_client_queue(gcc->gadcon, gcc->cf);
gcc->hidden = 0;
e_gadcon_client_hide(gcc);
e_object_del(E_OBJECT(gcc));
}
eina_hash_del(providers, cc->name, cc);
providers_list = eina_list_remove(providers_list, cc);
{
E_Event_Gadcon_Client_Class_Add *ev;
ev = E_NEW(E_Event_Gadcon_Client_Class_Add, 1);
ev->cc = cc;
ecore_event_add(E_EVENT_GADCON_CLIENT_CLASS_DEL, ev, NULL, NULL);
}
}
E_API void
e_gadcon_client_queue(E_Gadcon *gc, E_Config_Gadcon_Client *cf_gcc)
{
Eina_List *l;
if (!gc->awaiting_classes)
gc->awaiting_classes = eina_hash_string_superfast_new((Eina_Free_Cb)_eina_list_free);
l = eina_hash_find(gc->awaiting_classes, cf_gcc->name);
if (eina_list_data_find(l, cf_gcc)) return;
l = eina_list_append(l, cf_gcc);
eina_hash_set(gc->awaiting_classes, cf_gcc->name, l);
}
E_API Eina_List *
e_gadcon_provider_list(void)
{
return providers_list;
}
E_API void
e_gadcon_custom_new(E_Gadcon *gc)
{
E_OBJECT_CHECK(gc);
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
gadcons = eina_list_append(gadcons, gc);
if (!custom_populate_job)
{
custom_populate_job =
ecore_job_add(_e_gadcon_custom_populate_job, NULL);
}
if (!eina_list_data_find(custom_populate_requests, gc))
custom_populate_requests = eina_list_append(custom_populate_requests, gc);
gc->custom = EINA_TRUE;
}
E_API void
e_gadcon_custom_del(E_Gadcon *gc)
{
E_OBJECT_CHECK(gc);
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
if (eina_list_data_find(custom_populate_requests, gc))
custom_populate_requests = eina_list_remove(custom_populate_requests, gc);
gadcons = eina_list_remove(gadcons, gc);
}
E_API void
e_gadcon_custom_populate_request(E_Gadcon *gc)
{
E_OBJECT_CHECK(gc);
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
if (!gc->custom) return;
if (!custom_populate_job)
{
custom_populate_job =
ecore_job_add(_e_gadcon_custom_populate_job, NULL);
}
if (!eina_list_data_find(custom_populate_requests, gc))
custom_populate_requests = eina_list_append(custom_populate_requests, gc);
}
E_API E_Gadcon *
e_gadcon_dummy_new(int id)
{
E_Gadcon *gc;
gc = E_OBJECT_ALLOC(E_Gadcon, E_GADCON_DUMMY_TYPE, _e_gadcon_free);
if (!gc) return NULL;
gc->id = id;
gc->layout_policy = E_GADCON_LAYOUT_POLICY_PANEL;
gc->location = NULL;
gc->dummy = 1;
gc->orient = E_GADCON_ORIENT_HORIZ;
dummies = eina_list_append(dummies, gc);
return gc;
}
E_API void
e_gadcon_config_del(E_Gadcon *gc)
{
E_OBJECT_CHECK(gc);
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
gc->cfg_delete = 1;
}
E_API void
e_gadcon_drop_handler_add(E_Gadcon *gc, E_Gadcon_DND_Cb enter, E_Gadcon_DND_Cb leave, E_Gadcon_DND_Cb move, E_Gadcon_DND_Cb drop, int x, int y, int w, int h)
{
const char *drop_types[] = { "enlightenment/gadcon_client" };
E_OBJECT_CHECK(gc);
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
if (gc->drop_handler) return;
gc->drop_handler =
e_drop_handler_add(E_OBJECT(gc), NULL, gc,
_e_gadcon_cb_dnd_enter, _e_gadcon_cb_dnd_move,
_e_gadcon_cb_dnd_leave, _e_gadcon_cb_dnd_drop,
drop_types, 1, x, y, w, h);
gc->dnd_enter_cb = enter;
gc->dnd_leave_cb = leave;
gc->dnd_move_cb = move;
gc->dnd_drop_cb = drop;
}
E_API E_Gadcon *
e_gadcon_swallowed_new(const char *name, int id, Evas_Object *obj, const char *swallow_name)
{
E_Gadcon *gc;
E_Config_Gadcon *cf_gc;
Eina_List *l;
Evas_Coord x, y, w, h;
gc = E_OBJECT_ALLOC(E_Gadcon, E_GADCON_TYPE, _e_gadcon_free);
if (!gc) return NULL;
gc->name = eina_stringshare_add(name);
gc->id = id;
gc->layout_policy = E_GADCON_LAYOUT_POLICY_PANEL;
13 years ago
gc->location = NULL;
gc->edje.o_parent = obj;
gc->edje.swallow_name = eina_stringshare_add(swallow_name);
gc->orient = E_GADCON_ORIENT_HORIZ;
gc->evas = evas_object_evas_get(obj);
gc->o_container = e_gadcon_layout_add(gc->evas);
evas_object_geometry_get(gc->o_container, &x, &y, &w, &h);
e_gadcon_drop_handler_add(gc, NULL, NULL, NULL, NULL, x, y, w, h);
evas_object_event_callback_add(gc->o_container, EVAS_CALLBACK_MOVE,
_e_gadcon_cb_moveresize, gc);
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
(Evas_Object_Event_Cb)_e_gadcon_parent_resize_cb, gc);
evas_object_event_callback_add(gc->o_container, EVAS_CALLBACK_RESIZE,
_e_gadcon_cb_moveresize, gc);
evas_object_event_callback_add(gc->o_container, EVAS_CALLBACK_SHOW,
_e_gadcon_cb_show, gc);
evas_object_event_callback_add(gc->o_container, EVAS_CALLBACK_HIDE,
_e_gadcon_cb_hide, gc);
evas_object_smart_callback_add(gc->o_container, "size_request",
_e_gadcon_cb_size_request, gc);
evas_object_smart_callback_add(gc->o_container, "min_size_request",
_e_gadcon_cb_min_size_request, gc);
evas_object_show(gc->o_container);
edje_object_part_swallow(gc->edje.o_parent, gc->edje.swallow_name,
gc->o_container);
gadcons = eina_list_append(gadcons, gc);
EINA_LIST_FOREACH(e_config->gadcons, l, cf_gc)
{
if ((!strcmp(cf_gc->name, gc->name)) && (cf_gc->id == gc->id))
{
gc->cf = cf_gc;
break;
}
}
if (!gc->cf)
{
gc->cf = E_NEW(E_Config_Gadcon, 1);
gc->cf->name = eina_stringshare_add(gc->name);
gc->cf->id = gc->id;
e_config->gadcons = eina_list_append(e_config->gadcons, gc->cf);
e_config_save_queue();
}
return gc;
}
E_API void
e_gadcon_swallowed_min_size_set(E_Gadcon *gc, Evas_Coord w, Evas_Coord h)
{
E_OBJECT_CHECK(gc);
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
if (gc->edje.o_parent)
{
evas_object_size_hint_min_set(gc->o_container, w, h);
edje_object_part_swallow(gc->edje.o_parent, gc->edje.swallow_name,
gc->o_container);
}
}
E_API void
e_gadcon_min_size_request_callback_set(E_Gadcon *gc, void (*func)(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data)
{
E_OBJECT_CHECK(gc);
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
gc->min_size_request.func = func;
gc->min_size_request.data = data;
}
E_API void
e_gadcon_size_request_callback_set(E_Gadcon *gc, void (*func)(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data)
{
E_OBJECT_CHECK(gc);
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
gc->resize_request.func = func;
gc->resize_request.data = data;
}
E_API void
e_gadcon_frame_request_callback_set(E_Gadcon *gc, Evas_Object *(*func)(void *data, E_Gadcon_Client * gcc, const char *style), void *data)
{
E_OBJECT_CHECK(gc);
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
gc->frame_request.func = func;
gc->frame_request.data = data;
}
E_API void
e_gadcon_populate_callback_set(E_Gadcon *gc, void (*func)(void *data, E_Gadcon *gc, const E_Gadcon_Client_Class *cc), void *data)
{
E_OBJECT_CHECK(gc);
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
gc->populate_class.func = func;
gc->populate_class.data = data;
}
E_API void
e_gadcon_layout_policy_set(E_Gadcon *gc, E_Gadcon_Layout_Policy layout_policy)
{
E_OBJECT_CHECK(gc);
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
if (gc->layout_policy == layout_policy) return;
gc->layout_policy = layout_policy;
/* FIXME: delete container obj, re-pack all clients */
}
E_API Eina_Bool
e_gadcon_populate(E_Gadcon *gc)
{
Eina_List *l;
E_Config_Gadcon_Client *cf_gcc;
E_Gadcon_Client_Class *cc;
int x = 0;
E_OBJECT_CHECK_RETURN(gc, EINA_FALSE);
E_OBJECT_TYPE_CHECK_RETURN(gc, E_GADCON_TYPE, EINA_FALSE);
e_gadcon_layout_freeze(gc->o_container);
EINA_LIST_FOREACH(gc->cf->clients, l, cf_gcc)
{
if (!cf_gcc->name) continue;
cc = eina_hash_find(providers, cf_gcc->name);
if (cc)
{
if (!eina_list_data_find(gc->populated_classes, cc))
{
_e_gadcon_provider_populate_request(gc, cc);
cc = NULL;
}
}
if (cc)
_e_gadcon_client_populate(gc, cc, cf_gcc);
else
e_gadcon_client_queue(gc, cf_gcc);
}
if (!gc->toolbar)
{
EINA_LIST_FREE(gc->populate_requests, cc)
{
char buf[256];
e_main_ts(cc->name);
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;
if (!gc->awaiting_classes) continue;
ll = eina_hash_set(gc->awaiting_classes, cc->name, NULL);