clouseau: Cleaned genlist classes a bit.

SVN revision: 62907
This commit is contained in:
Tom Hacohen 2011-08-28 07:17:55 +00:00
parent 2d4622b2c5
commit add4f4ec47
1 changed files with 9 additions and 18 deletions

View File

@ -15,7 +15,7 @@
#include "libclouseau.h" #include "libclouseau.h"
#include "ui/obj_information.h" #include "ui/obj_information.h"
static Elm_Genlist_Item_Class itc, itc_ee; static Elm_Genlist_Item_Class itc;
static Eina_Bool _lib_init = EINA_FALSE; static Eina_Bool _lib_init = EINA_FALSE;
static Eina_List *tree = NULL; static Eina_List *tree = NULL;
static Eina_Bool list_show_clippers = EINA_TRUE, list_show_hidden = EINA_TRUE; static Eina_Bool list_show_clippers = EINA_TRUE, list_show_hidden = EINA_TRUE;
@ -52,6 +52,10 @@ static Evas_Object *
item_icon_get(void *data, Evas_Object *parent, const char *part) item_icon_get(void *data, Evas_Object *parent, const char *part)
{ {
Tree_Item *treeit = data; Tree_Item *treeit = data;
if (!treeit->is_obj)
return NULL;
if (!strcmp(part, "elm.swallow.icon")) if (!strcmp(part, "elm.swallow.icon"))
{ {
char buf[PATH_MAX]; char buf[PATH_MAX];
@ -120,14 +124,6 @@ item_icon_get(void *data, Evas_Object *parent, const char *part)
static char * static char *
item_label_get(void *data, Evas_Object *obj __UNUSED__, item_label_get(void *data, Evas_Object *obj __UNUSED__,
const char *part __UNUSED__) const char *part __UNUSED__)
{
Tree_Item *treeit = data;
return strdup(treeit->name);
}
static char *
item_ee_label_get(void *data, Evas_Object *obj __UNUSED__,
const char *part __UNUSED__)
{ {
Tree_Item *treeit = data; Tree_Item *treeit = data;
char buf[256]; char buf[256];
@ -208,12 +204,12 @@ libclouseau_item_add(Evas_Object *o, Evas_Object *gl, Tree_Item *parent)
treeit->is_obj = EINA_TRUE; treeit->is_obj = EINA_TRUE;
if (elm_widget_is(o)) if (elm_widget_is(o))
{ {
snprintf(buf, sizeof(buf), "%p %s: %s", o, evas_object_type_get(o), snprintf(buf, sizeof(buf), "%s: %s", evas_object_type_get(o),
elm_widget_type_get(o)); elm_widget_type_get(o));
} }
else else
{ {
snprintf(buf, sizeof(buf), "%p %s", o, evas_object_type_get(o)); snprintf(buf, sizeof(buf), "%s", evas_object_type_get(o));
} }
treeit->name = eina_stringshare_add(buf); treeit->name = eina_stringshare_add(buf);
treeit->is_clipper = !!evas_object_clipees_get(o); treeit->is_clipper = !!evas_object_clipees_get(o);
@ -274,10 +270,11 @@ _load_list(Evas_Object *gl)
{ {
Elm_Genlist_Item_Flags glflag = (treeit->children) ? Elm_Genlist_Item_Flags glflag = (treeit->children) ?
ELM_GENLIST_ITEM_SUBITEMS : ELM_GENLIST_ITEM_NONE; ELM_GENLIST_ITEM_SUBITEMS : ELM_GENLIST_ITEM_NONE;
elm_genlist_item_append(gl, &itc_ee, treeit, NULL, elm_genlist_item_append(gl, &itc, treeit, NULL,
glflag, NULL, NULL); glflag, NULL, NULL);
} }
} }
} }
static void static void
@ -376,12 +373,6 @@ libclouseau_init(void)
evas_object_smart_callback_add(show_clippers_check, "changed", evas_object_smart_callback_add(show_clippers_check, "changed",
_show_clippers_check_changed, gl); _show_clippers_check_changed, gl);
itc_ee.item_style = "default";
itc_ee.func.label_get = item_ee_label_get;
itc_ee.func.icon_get = NULL;
itc_ee.func.state_get = NULL;
itc_ee.func.del = NULL;
itc.item_style = "default"; itc.item_style = "default";
itc.func.label_get = item_label_get; itc.func.label_get = item_label_get;
itc.func.icon_get = item_icon_get; itc.func.icon_get = item_icon_get;