Clouseau: Remove some client specific stuff from the lib.

SVN revision: 83475
This commit is contained in:
Tom Hacohen 2013-01-30 11:13:50 +00:00
parent 3d4fd428a0
commit f8fb1f73f5
3 changed files with 164 additions and 173 deletions

View File

@ -10,6 +10,9 @@
#define TAKE_SCREENSHOT "/images/take-screenshot.png"
#define SCREENSHOT_MISSING "/images/screenshot-missing.png"
static Evas_Object *prop_list = NULL;
static Elm_Genlist_Item_Class _obj_info_itc;
struct _app_data_st
{
app_info_st *app;
@ -64,6 +67,57 @@ static Eina_Bool _add_callback_called = EINA_FALSE;
static void _cancel_bt_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
static void _ofl_bt_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
static void
_clouseau_object_dbg_string_build(Clouseau_Eo_Dbg_Info *eo,
char *buf, int buf_size)
{ /* Build a string from dbg-info in buffer, or return empty buffer */
int i;
*buf = '\0';
if (eo->type == EINA_VALUE_TYPE_STRING)
{ /* First set flags to say if got info from eo */
snprintf(buf, buf_size, "%s",
eo->un_dbg_info.text.s);
for(i = 0; buf[i]; i++)
buf[i] = tolower(buf[i]);
snprintf(buf, buf_size, "%s: %s",
eo->name, eo->un_dbg_info.text.s);
}
else if (eo->type == EINA_VALUE_TYPE_INT)
{
snprintf(buf, buf_size, "%s: %d",
eo->name, eo->un_dbg_info.intg.i);
}
else if (eo->type == EINA_VALUE_TYPE_CHAR)
{
snprintf(buf, buf_size, "%s: %s",
eo->name, (eo->un_dbg_info.bl.b) ?
"TRUE" : "FALSE");
}
else if (eo->type == EINA_VALUE_TYPE_UINT64)
{
snprintf(buf, buf_size, "%s: %llx",
eo->name, eo->un_dbg_info.ptr.p);
}
else if (eo->type == EINA_VALUE_TYPE_DOUBLE)
{
snprintf(buf, buf_size, "%s: %.2f",
eo->name, eo->un_dbg_info.dbl.d);
}
else if (eo->type == EINA_VALUE_TYPE_LIST)
{
snprintf(buf, buf_size, "%s", eo->name);
}
else
{
}
}
static void
_titlebar_string_set(gui_elements *g, Eina_Bool online)
{
@ -1219,8 +1273,29 @@ _gl_selected(void *data, Evas_Object *pobj EINA_UNUSED, void *event_info)
/* Populate object information, then do highlight */
if (g->gl_it != event_info)
{
elm_genlist_clear(prop_list);
clouseau_object_information_list_populate(treeit, g->lb);
g->gl_it = event_info;
{
/* Fetch properties of eo object */
Clouseau_Eo_Dbg_Info *eo;
Eina_List *expand_list = NULL, *l, *l_prev;
Elm_Object_Item *eo_it;
EINA_LIST_FOREACH(treeit->eo_info,l, eo)
{
Elm_Genlist_Item_Type iflag = (eo->type == EINA_VALUE_TYPE_LIST) ?
ELM_GENLIST_ITEM_TREE : ELM_GENLIST_ITEM_NONE;
eo_it = elm_genlist_item_append(prop_list, &_obj_info_itc, eo, NULL,
iflag, _gl_selected, NULL);
expand_list = eina_list_append(expand_list, eo_it);
}
EINA_LIST_REVERSE_FOREACH_SAFE(expand_list, l, l_prev, eo_it)
{
elm_genlist_item_expanded_set(eo_it, EINA_TRUE);
expand_list = eina_list_remove_list(expand_list, l);
}
}
}
if (!do_highlight)
@ -1692,11 +1767,99 @@ _main_list_create(Evas_Object *panes)
"selected", _gl_selected, gui);
}
static void
_clouseau_object_dbg_string_build(Clouseau_Eo_Dbg_Info *eo,
char *buf, int buf_size);
static void
_obj_info_gl_selected(void *data EINA_UNUSED, Evas_Object *pobj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
/* Currently do nothing */
return;
}
static void
_obj_info_gl_exp(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Elm_Object_Item *glit = event_info;
Eina_List *itr;
Clouseau_Eo_Dbg_Info *eo = elm_object_item_data_get(glit);
Clouseau_Eo_Dbg_Info *child;
EINA_LIST_FOREACH(eo->un_dbg_info.dbg.list, itr, child)
{
Elm_Genlist_Item_Type iflag = (child->type == EINA_VALUE_TYPE_LIST) ?
ELM_GENLIST_ITEM_TREE : ELM_GENLIST_ITEM_NONE;
elm_genlist_item_append(prop_list, &_obj_info_itc, child, glit,
iflag, _obj_info_gl_selected, NULL);
}
}
static void
_obj_info_gl_con(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Elm_Object_Item *glit = event_info;
elm_genlist_item_subitems_clear(glit);
}
static void
_obj_info_gl_exp_req(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Elm_Object_Item *glit = event_info;
elm_genlist_item_expanded_set(glit, EINA_TRUE);
}
static void
_obj_info_gl_con_req(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Elm_Object_Item *glit = event_info;
elm_genlist_item_expanded_set(glit, EINA_FALSE);
}
static Evas_Object *
_obj_info_gl_item_icon_get(void *data EINA_UNUSED, Evas_Object *parent EINA_UNUSED,
const char *part EINA_UNUSED)
{
return NULL;
}
static char *
_obj_info_gl_item_text_get(void *data, Evas_Object *obj EINA_UNUSED,
const char *part EINA_UNUSED)
{
Clouseau_Eo_Dbg_Info *eo = data;
char buf[1024];
_clouseau_object_dbg_string_build(eo, (char*)buf, 1024);
return strdup(buf);
}
static Evas_Object *
_clouseau_object_information_list_add(Evas_Object *parent)
{
prop_list = elm_genlist_add(parent);
_obj_info_itc.item_style = "default";
_obj_info_itc.func.text_get = _obj_info_gl_item_text_get;
_obj_info_itc.func.content_get = _obj_info_gl_item_icon_get;
_obj_info_itc.func.state_get = NULL;
_obj_info_itc.func.del = NULL;
evas_object_smart_callback_add(prop_list, "expand,request", _obj_info_gl_exp_req,
prop_list);
evas_object_smart_callback_add(prop_list, "contract,request", _obj_info_gl_con_req,
prop_list);
evas_object_smart_callback_add(prop_list, "expanded", _obj_info_gl_exp, prop_list);
evas_object_smart_callback_add(prop_list, "contracted", _obj_info_gl_con, prop_list);
evas_object_smart_callback_add(prop_list, "selected", _obj_info_gl_selected, NULL);
return prop_list;
}
static void
_property_list_create(Evas_Object *panes)
{
Evas_Object *o= NULL;
gui->prop_list = o = clouseau_object_information_list_add(panes);
gui->prop_list = o = _clouseau_object_information_list_add(panes);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);

View File

@ -153,9 +153,7 @@ struct _Clouseau_Tree_Item
Eet_Data_Descriptor *clouseau_object_desc_make(void);
void clouseau_object_desc_shutdown(void);
void clouseau_object_information_list_clear(void);
/* Public */
EAPI Evas_Object *clouseau_object_information_list_add(Evas_Object *parent);
EAPI void clouseau_object_information_list_populate(Clouseau_Tree_Item *treeit, Evas_Object *lb);
#endif

View File

@ -1,98 +1,5 @@
#include "Clouseau.h"
#include "clouseau_private.h"
#define ELM_INTERNAL_API_ARGESFSDFEFC
#include <elm_widget.h>
static Evas_Object *prop_list = NULL;
static Elm_Genlist_Item_Class itc;
static void
_clouseau_object_dbg_string_build(Clouseau_Eo_Dbg_Info *eo,
char *buf, int buf_size);
static void
_gl_selected(void *data EINA_UNUSED, Evas_Object *pobj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
/* Currently do nothing */
return;
}
static void
gl_exp(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Elm_Object_Item *glit = event_info;
Eina_List *itr;
Clouseau_Eo_Dbg_Info *eo = elm_object_item_data_get(glit);
Clouseau_Eo_Dbg_Info *child;
EINA_LIST_FOREACH(eo->un_dbg_info.dbg.list, itr, child)
{
Elm_Genlist_Item_Type iflag = (child->type == EINA_VALUE_TYPE_LIST) ?
ELM_GENLIST_ITEM_TREE : ELM_GENLIST_ITEM_NONE;
elm_genlist_item_append(prop_list, &itc, child, glit,
iflag, _gl_selected, NULL);
}
}
static void
gl_con(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Elm_Object_Item *glit = event_info;
elm_genlist_item_subitems_clear(glit);
}
static void
gl_exp_req(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Elm_Object_Item *glit = event_info;
elm_genlist_item_expanded_set(glit, EINA_TRUE);
}
static void
gl_con_req(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Elm_Object_Item *glit = event_info;
elm_genlist_item_expanded_set(glit, EINA_FALSE);
}
static Evas_Object *
item_icon_get(void *data EINA_UNUSED, Evas_Object *parent EINA_UNUSED,
const char *part EINA_UNUSED)
{
return NULL;
}
static char *
item_text_get(void *data, Evas_Object *obj EINA_UNUSED,
const char *part EINA_UNUSED)
{
Clouseau_Eo_Dbg_Info *eo = data;
char buf[1024];
_clouseau_object_dbg_string_build(eo, (char*)buf, 1024);
return strdup(buf);
}
EAPI Evas_Object *
clouseau_object_information_list_add(Evas_Object *parent)
{
prop_list = elm_genlist_add(parent);
itc.item_style = "default";
itc.func.text_get = item_text_get;
itc.func.content_get = item_icon_get;
itc.func.state_get = NULL;
itc.func.del = NULL;
evas_object_smart_callback_add(prop_list, "expand,request", gl_exp_req,
prop_list);
evas_object_smart_callback_add(prop_list, "contract,request", gl_con_req,
prop_list);
evas_object_smart_callback_add(prop_list, "expanded", gl_exp, prop_list);
evas_object_smart_callback_add(prop_list, "contracted", gl_con, prop_list);
evas_object_smart_callback_add(prop_list, "selected", _gl_selected, NULL);
return prop_list;
}
EAPI void
clouseau_object_information_free(Clouseau_Object *oinfo)
@ -244,56 +151,6 @@ static const struct {
{ CLOUSEAU_OBJ_TYPE_TEXTBLOCK, "Textblock" }
};
static void
_clouseau_object_dbg_string_build(Clouseau_Eo_Dbg_Info *eo,
char *buf, int buf_size)
{ /* Build a string from dbg-info in buffer, or return empty buffer */
int i;
*buf = '\0';
if (eo->type == EINA_VALUE_TYPE_STRING)
{ /* First set flags to say if got info from eo */
snprintf(buf, buf_size, "%s",
eo->un_dbg_info.text.s);
for(i = 0; buf[i]; i++)
buf[i] = tolower(buf[i]);
snprintf(buf, buf_size, "%s: %s",
eo->name, eo->un_dbg_info.text.s);
}
else if (eo->type == EINA_VALUE_TYPE_INT)
{
snprintf(buf, buf_size, "%s: %d",
eo->name, eo->un_dbg_info.intg.i);
}
else if (eo->type == EINA_VALUE_TYPE_CHAR)
{
snprintf(buf, buf_size, "%s: %s",
eo->name, (eo->un_dbg_info.bl.b) ?
"TRUE" : "FALSE");
}
else if (eo->type == EINA_VALUE_TYPE_UINT64)
{
snprintf(buf, buf_size, "%s: %llx",
eo->name, eo->un_dbg_info.ptr.p);
}
else if (eo->type == EINA_VALUE_TYPE_DOUBLE)
{
snprintf(buf, buf_size, "%s: %.2f",
eo->name, eo->un_dbg_info.dbl.d);
}
else if (eo->type == EINA_VALUE_TYPE_LIST)
{
snprintf(buf, buf_size, "%s", eo->name);
}
else
{
}
}
EAPI void
clouseau_object_information_list_populate(Clouseau_Tree_Item *treeit, Evas_Object *lb)
{
@ -302,8 +159,6 @@ clouseau_object_information_list_populate(Clouseau_Tree_Item *treeit, Evas_Objec
unsigned int i;
Eo_Dbg_Info *root = EO_DBG_INFO_LIST_APPEND(NULL, "");
clouseau_object_information_list_clear();
if (!treeit->is_obj)
return;
@ -468,30 +323,5 @@ clouseau_object_information_list_populate(Clouseau_Tree_Item *treeit, Evas_Objec
treeit->eo_info = _clouseau_eo_list_convert(root);
eo_dbg_info_free(root);
}
{
/* Fetch properties of eo object */
Clouseau_Eo_Dbg_Info *eo;
Eina_List *expand_list = NULL, *l, *l_prev;
Elm_Object_Item *eo_it;
EINA_LIST_FOREACH(treeit->eo_info,l, eo)
{
Elm_Genlist_Item_Type iflag = (eo->type == EINA_VALUE_TYPE_LIST) ?
ELM_GENLIST_ITEM_TREE : ELM_GENLIST_ITEM_NONE;
eo_it = elm_genlist_item_append(prop_list, &itc, eo, NULL,
iflag, _gl_selected, NULL);
expand_list = eina_list_append(expand_list, eo_it);
}
EINA_LIST_REVERSE_FOREACH_SAFE(expand_list, l, l_prev, eo_it)
{
elm_genlist_item_expanded_set(eo_it, EINA_TRUE);
expand_list = eina_list_remove_list(expand_list, l);
}
}
}
EAPI void
clouseau_object_information_list_clear(void)
{
elm_genlist_clear(prop_list);
}