and remove unused code.

SVN revision: 36489
This commit is contained in:
Carsten Haitzler 2008-10-07 02:36:19 +00:00
parent e8ef0d8bab
commit 55b01e9534
3 changed files with 0 additions and 265 deletions

View File

@ -1,58 +0,0 @@
#include <Elementary.h>
#include "elm_priv.h"
Elm_Cb_Class _elm_cb_class =
{
&_elm_obj_class,
ELM_OBJ_CB
};
static void
_elm_cb_del(Elm_Cb *cb)
{
if (_elm_obj_del_defer(ELM_OBJ(cb))) return;
if (cb->parent) /* callbacks are special children */
{
cb->parent->cbs = evas_list_remove(cb->parent->cbs, cb);
cb->parent = NULL;
}
((Elm_Obj_Class *)(((Elm_Cb_Class *)(cb->clas))->parent))->del(ELM_OBJ(cb));
}
Elm_Cb *
_elm_cb_new(void)
{
Elm_Cb *cb;
cb = ELM_NEW(Elm_Cb);
_elm_obj_init(ELM_OBJ(cb));
cb->clas = &_elm_cb_class;
cb->type = ELM_OBJ_CB;
cb->del = _elm_cb_del;
return cb;
}
void
_elm_cb_call(Elm_Obj *obj, Elm_Cb_Type type, void *info)
{
Evas_List *l;
_elm_obj_nest_push();
for (l = obj->cbs; l; l = l->next)
{
Elm_Cb *cb;
cb = l->data;
if (cb->delete_me) continue;
if (cb->cb_type == type)
{
if (cb->func) cb->func(cb->data, obj, type, info);
if (cb->cbs) _elm_cb_call(cb, type, info);
}
}
_elm_obj_nest_pop();
}

View File

@ -1,177 +0,0 @@
#include <Elementary.h>
#include "elm_priv.h"
static void _elm_obj_del(Elm_Obj *obj);
static void _elm_obj_ref(Elm_Obj *obj);
static void _elm_obj_unref(Elm_Obj *obj);
static Elm_Cb *_elm_obj_cb_add(Elm_Obj *obj, Elm_Cb_Type type, Elm_Cb_Func func, void *data);
static void _elm_obj_child_add(Elm_Obj *obj, Elm_Obj *child);
static int _elm_obj_hastype(Elm_Obj *obj, Elm_Obj_Type type);
Elm_Obj_Class _elm_obj_class =
{
NULL, /* parent */
ELM_OBJ_OBJ,
_elm_obj_del,
_elm_obj_ref,
_elm_obj_unref,
_elm_obj_cb_add,
_elm_obj_child_add,
};
static int deferred_nest = 0;
static Evas_List *deferred_deletions = NULL;
static void
_elm_obj_del(Elm_Obj *obj)
{
if (_elm_obj_del_defer(obj)) return;
_elm_obj_unref(obj);
}
static void
_elm_obj_ref(Elm_Obj *obj)
{
obj->ref++;
}
static void
_elm_obj_unref(Elm_Obj *obj)
{
obj->ref--;
if (obj->ref > 0) return;
if (!obj->delete_me)
{
obj->del(obj);
return;
}
if (obj->parent)
obj->parent->children = evas_list_remove(obj->parent->children, obj);
while (obj->cbs)
{
((Elm_Obj *)obj->cbs->data)->parent = NULL;
((Elm_Obj *)obj->cbs->data)->del(obj->cbs->data);
obj->cbs = evas_list_remove_list(obj->cbs, obj->cbs);
}
while (obj->children)
{
_elm_cb_call(obj, ELM_CB_CHILD_DEL, obj->children->data);
((Elm_Obj *)obj->children->data)->parent = NULL;
((Elm_Obj *)obj->children->data)->del(obj->children->data);
obj->children = evas_list_remove_list(obj->children, obj->children);
}
free(obj);
}
static Elm_Cb *
_elm_obj_cb_add(Elm_Obj *obj, Elm_Cb_Type type, Elm_Cb_Func func, void *data)
{
Elm_Cb *cb;
cb = _elm_cb_new();
cb->cb_type = type;
cb->func = func;
cb->data = data;
cb->parent = obj;
obj->cbs = evas_list_append(obj->cbs, cb);
}
static void
_elm_obj_child_add(Elm_Obj *obj, Elm_Obj *child)
{
if (child->parent) child->unparent(child);
obj->children = evas_list_prepend(obj->children, child);
child->parent = obj;
_elm_obj_nest_push();
_elm_cb_call(obj, ELM_CB_CHILD_ADD, child);
_elm_cb_call(child, ELM_CB_PARENT, NULL);
_elm_obj_nest_pop();
}
static void
_elm_obj_unparent(Elm_Obj *obj)
{
Elm_Obj *parent;
parent = obj->parent;
obj->parent = NULL;
// FIXME: what if we are walking the children when we unparent?
parent->children = evas_list_remove(parent->children, obj);
_elm_obj_nest_push();
_elm_cb_call(parent, ELM_CB_CHILD_DEL, obj);
_elm_cb_call(obj, ELM_CB_UNPARENT, NULL);
_elm_obj_nest_pop();
}
static int
_elm_obj_class_hastype(Elm_Obj_Class *clas, Elm_Obj_Type type)
{
if (clas->type == type) return 1;
if (!clas->parent) return 0;
return _elm_obj_class_hastype(clas->parent, type);
}
static int
_elm_obj_hastype(Elm_Obj *obj, Elm_Obj_Type type)
{
if (obj->type == type) return 1;
if (obj->clas) return _elm_obj_class_hastype(obj->clas, type);
return 0;
}
void
_elm_obj_init(Elm_Obj *obj)
{
obj->del = _elm_obj_del;
obj->ref = _elm_obj_ref;
obj->unref = _elm_obj_unref;
obj->cb_add = _elm_obj_cb_add;
obj->child_add = _elm_obj_child_add;
obj->unparent = _elm_obj_unparent;
obj->hastype = _elm_obj_hastype;
obj->type = ELM_OBJ_OBJ;
obj->clas = &_elm_obj_class;
obj->refs = 1;
}
void
_elm_obj_nest_push(void)
{
deferred_nest++;
}
void
_elm_obj_nest_pop(void)
{
deferred_nest--;
if (deferred_nest > 0) return;
while (deferred_deletions)
{
((Elm_Obj *)(deferred_deletions->data))->delete_deferred = 0;
((Elm_Obj *)(deferred_deletions->data))->del(ELM_OBJ(deferred_deletions->data));
deferred_deletions = evas_list_remove_list(deferred_deletions, deferred_deletions);
}
}
int
_elm_obj_del_defer(Elm_Obj *obj)
{
if (obj->delete_deferred) return 1;
if (!obj->delete_me)
{
/* will never be called during a deferred delete */
obj->delete_me = 1;
_elm_obj_nest_push();
_elm_cb_call(obj, ELM_CB_DEL, NULL);
_elm_obj_nest_pop();
}
if (deferred_nest > 0)
{
/* mark to be deleted later */
obj->delete_deferred = 1;
deferred_deletions = evas_list_append(deferred_deletions, obj);
return 1;
}
return 0;
}

View File

@ -64,38 +64,8 @@ EAPI void elm_widget_disabled_set(Evas_Object *obj, int disabled);
EAPI int elm_widget_disabled_get(Evas_Object *obj);
EAPI void elm_widget_min_size_resize(Evas_Object *obj);
/*
void _elm_obj_init(Elm_Obj *obj);
void _elm_obj_nest_push(void);
void _elm_obj_nest_pop(void);
int _elm_obj_del_defer(Elm_Obj *obj);
Elm_Cb *_elm_cb_new(void);
void _elm_cb_call(Elm_Obj *obj, Elm_Cb_Type, void *info);
int _elm_theme_set(Evas_Object *o, const char *clas, const char *group);
void _elm_widget_init(Elm_Widget *wid);
void _elm_widget_post_init(Elm_Widget *wid);
*/
extern char *_elm_appname;
extern Elm_Config *_elm_config;
/*
extern Elm_Obj_Class _elm_obj_class;
extern Elm_Win_Class _elm_win_class;
extern Elm_Widget_Class _elm_widget_class;
extern Elm_Bg_Class _elm_bg_class;
extern Elm_Scroller_Class _elm_scroller_class;
extern Elm_Label_Class _elm_label_class;
extern Elm_Box_Class _elm_box_class;
extern Elm_Table_Class _elm_table_class;
extern Elm_Button_Class _elm_button_class;
extern Elm_Icon_Class _elm_icon_class;
extern Elm_Toggle_Class _elm_toggle_class;
extern Elm_Clock_Class _elm_clock_class;
extern Elm_Frame_Class _elm_frame_class;
extern Elm_Pad_Class _elm_pad_class;
extern Elm_Contactlist_Class _elm_contactlist_class;
*/
#endif