summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-07-26 09:53:44 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-07-26 09:53:44 +0000
commit5924cf3548ac1fb2960455e2fb00a0056e17a89f (patch)
tree348be87e5e12f724c46eb7470af5f146e6a35fa0
parent2d0358d52bd03d91aadce216017092e2d6c86782 (diff)
clouseau: small 15min cleanup.
SVN revision: 74430
-rw-r--r--src/bin/clouseau.c2
-rw-r--r--src/lib/Clouseau.h6
-rw-r--r--src/lib/clouseau_client.c2
-rw-r--r--src/lib/clouseau_data.c2
-rw-r--r--src/lib/clouseau_object_information.c78
-rw-r--r--src/lib/clouseau_private.h4
6 files changed, 50 insertions, 44 deletions
diff --git a/src/bin/clouseau.c b/src/bin/clouseau.c
index a398258..61f87ac 100644
--- a/src/bin/clouseau.c
+++ b/src/bin/clouseau.c
@@ -1187,7 +1187,7 @@ static void
1187_gl_selected(void *data EINA_UNUSED, Evas_Object *pobj EINA_UNUSED, 1187_gl_selected(void *data EINA_UNUSED, Evas_Object *pobj EINA_UNUSED,
1188 void *event_info) 1188 void *event_info)
1189{ 1189{
1190 clouseau_obj_information_list_clear(); 1190 clouseau_object_information_list_clear();
1191 gui_elements *g = data; 1191 gui_elements *g = data;
1192 Clouseau_Tree_Item *treeit = elm_object_item_data_get(event_info); 1192 Clouseau_Tree_Item *treeit = elm_object_item_data_get(event_info);
1193 const Elm_Object_Item *parent; 1193 const Elm_Object_Item *parent;
diff --git a/src/lib/Clouseau.h b/src/lib/Clouseau.h
index 706496d..4890c07 100644
--- a/src/lib/Clouseau.h
+++ b/src/lib/Clouseau.h
@@ -139,10 +139,12 @@ struct _Clouseau_Tree_Item
139 Eina_Bool is_visible; 139 Eina_Bool is_visible;
140}; 140};
141 141
142Clouseau_Object *_obj_information_get(Clouseau_Tree_Item *treeit);
143Eet_Data_Descriptor *clouseau_object_desc_make(void); 142Eet_Data_Descriptor *clouseau_object_desc_make(void);
144void clouseau_object_desc_shutdown(void); 143void clouseau_object_desc_shutdown(void);
145Evas_Object *clouseau_obj_information_list_add(Evas_Object *parent); 144Evas_Object *clouseau_obj_information_list_add(Evas_Object *parent);
146void clouseau_obj_information_list_populate(Clouseau_Tree_Item *treeit, Evas_Object *lb); 145void clouseau_obj_information_list_populate(Clouseau_Tree_Item *treeit, Evas_Object *lb);
147void clouseau_obj_information_list_clear(); 146
147/* Public */
148void clouseau_object_information_list_clear(void);
149
148#endif 150#endif
diff --git a/src/lib/clouseau_client.c b/src/lib/clouseau_client.c
index 68187b9..bc3ad8c 100644
--- a/src/lib/clouseau_client.c
+++ b/src/lib/clouseau_client.c
@@ -29,7 +29,7 @@ libclouseau_item_add(Evas_Object *o, Clouseau_Tree_Item *parent)
29 treeit->name = eina_stringshare_add(evas_object_type_get(o)); 29 treeit->name = eina_stringshare_add(evas_object_type_get(o));
30 treeit->is_clipper = !!evas_object_clipees_get(o); 30 treeit->is_clipper = !!evas_object_clipees_get(o);
31 treeit->is_visible = evas_object_visible_get(o); 31 treeit->is_visible = evas_object_visible_get(o);
32 treeit->info = obj_information_get(treeit); 32 treeit->info = clouseau_object_information_get(treeit);
33 33
34 parent->children = eina_list_append(parent->children, treeit); 34 parent->children = eina_list_append(parent->children, treeit);
35 35
diff --git a/src/lib/clouseau_data.c b/src/lib/clouseau_data.c
index 79512c2..7f86744 100644
--- a/src/lib/clouseau_data.c
+++ b/src/lib/clouseau_data.c
@@ -51,7 +51,7 @@ _clouseau_tree_item_free(Clouseau_Tree_Item *parent)
51 EINA_LIST_FREE(parent->children, treeit) 51 EINA_LIST_FREE(parent->children, treeit)
52 _clouseau_tree_item_free(treeit); 52 _clouseau_tree_item_free(treeit);
53 53
54 obj_information_free(parent->info); 54 clouseau_object_information_free(parent->info);
55 eina_stringshare_del(parent->name); 55 eina_stringshare_del(parent->name);
56 free(parent); 56 free(parent);
57} 57}
diff --git a/src/lib/clouseau_object_information.c b/src/lib/clouseau_object_information.c
index 44930cd..bc84b98 100644
--- a/src/lib/clouseau_object_information.c
+++ b/src/lib/clouseau_object_information.c
@@ -95,13 +95,13 @@ clouseau_obj_information_list_add(Evas_Object *parent)
95} 95}
96 96
97static void 97static void
98_item_tree_item_free(Inf_Clouseau_Tree_Item *parent) 98_clouseau_item_tree_item_free(Inf_Clouseau_Tree_Item *parent)
99{ 99{
100 Inf_Clouseau_Tree_Item *treeit; 100 Inf_Clouseau_Tree_Item *treeit;
101 101
102 EINA_LIST_FREE(parent->children, treeit) 102 EINA_LIST_FREE(parent->children, treeit)
103 { 103 {
104 _item_tree_item_free(treeit); 104 _clouseau_item_tree_item_free(treeit);
105 } 105 }
106 106
107 eina_stringshare_del(parent->string); 107 eina_stringshare_del(parent->string);
@@ -109,18 +109,18 @@ _item_tree_item_free(Inf_Clouseau_Tree_Item *parent)
109} 109}
110 110
111static void 111static void
112_item_tree_free(void) 112_clouseau_item_tree_free(void)
113{ 113{
114 Inf_Clouseau_Tree_Item *treeit; 114 Inf_Clouseau_Tree_Item *treeit;
115 115
116 EINA_LIST_FREE(information_tree, treeit) 116 EINA_LIST_FREE(information_tree, treeit)
117 { 117 {
118 _item_tree_item_free(treeit); 118 _clouseau_item_tree_item_free(treeit);
119 } 119 }
120} 120}
121 121
122void 122void
123obj_information_free(Clouseau_Object *oinfo) 123clouseau_object_information_free(Clouseau_Object *oinfo)
124{ 124{
125 if (!oinfo) 125 if (!oinfo)
126 return; 126 return;
@@ -128,47 +128,49 @@ obj_information_free(Clouseau_Object *oinfo)
128 eina_stringshare_del(oinfo->evas_props.name); 128 eina_stringshare_del(oinfo->evas_props.name);
129 eina_stringshare_del(oinfo->evas_props.bt); 129 eina_stringshare_del(oinfo->evas_props.bt);
130 130
131 if (oinfo->extra_props.type == CLOUSEAU_OBJ_TYPE_ELM) 131 switch (oinfo->extra_props.type)
132 { 132 {
133 eina_stringshare_del(oinfo->extra_props.u.elm.type); 133 case CLOUSEAU_OBJ_TYPE_ELM:
134 eina_stringshare_del(oinfo->extra_props.u.elm.style); 134 eina_stringshare_del(oinfo->extra_props.u.elm.type);
135 } 135 eina_stringshare_del(oinfo->extra_props.u.elm.style);
136 else if (oinfo->extra_props.type == CLOUSEAU_OBJ_TYPE_TEXT) 136 break;
137 { 137 case CLOUSEAU_OBJ_TYPE_TEXT:
138 eina_stringshare_del(oinfo->extra_props.u.text.font); 138 eina_stringshare_del(oinfo->extra_props.u.text.font);
139 eina_stringshare_del(oinfo->extra_props.u.text.source); 139 eina_stringshare_del(oinfo->extra_props.u.text.source);
140 eina_stringshare_del(oinfo->extra_props.u.text.text); 140 eina_stringshare_del(oinfo->extra_props.u.text.text);
141 } 141 break;
142 else if (oinfo->extra_props.type == CLOUSEAU_OBJ_TYPE_IMAGE) 142 case CLOUSEAU_OBJ_TYPE_IMAGE:
143 { 143 eina_stringshare_del(oinfo->extra_props.u.image.file);
144 eina_stringshare_del(oinfo->extra_props.u.image.file); 144 eina_stringshare_del(oinfo->extra_props.u.image.key);
145 eina_stringshare_del(oinfo->extra_props.u.image.key); 145 eina_stringshare_del(oinfo->extra_props.u.image.load_err);
146 eina_stringshare_del(oinfo->extra_props.u.image.load_err); 146 break;
147 } 147 case CLOUSEAU_OBJ_TYPE_EDJE:
148 else if (oinfo->extra_props.type == CLOUSEAU_OBJ_TYPE_EDJE) 148 eina_stringshare_del(oinfo->extra_props.u.edje.file);
149 { 149 eina_stringshare_del(oinfo->extra_props.u.edje.group);
150 eina_stringshare_del(oinfo->extra_props.u.edje.file); 150
151 eina_stringshare_del(oinfo->extra_props.u.edje.group); 151 eina_stringshare_del(oinfo->extra_props.u.edje.load_err);
152 152 break;
153 eina_stringshare_del(oinfo->extra_props.u.edje.load_err); 153 case CLOUSEAU_OBJ_TYPE_TEXTBLOCK:
154 } 154 eina_stringshare_del(oinfo->extra_props.u.textblock.style);
155 else if (oinfo->extra_props.type == CLOUSEAU_OBJ_TYPE_TEXTBLOCK) 155 eina_stringshare_del(oinfo->extra_props.u.textblock.text);
156 { 156 break;
157 eina_stringshare_del(oinfo->extra_props.u.textblock.style); 157 case CLOUSEAU_OBJ_TYPE_UNKNOWN:
158 eina_stringshare_del(oinfo->extra_props.u.textblock.text); 158 case CLOUSEAU_OBJ_TYPE_OTHER:
159 break;
159 } 160 }
160 161
161 free(oinfo); 162 free(oinfo);
162} 163}
163 164
164Clouseau_Object * 165Clouseau_Object *
165obj_information_get(Clouseau_Tree_Item *treeit) 166clouseau_object_information_get(Clouseau_Tree_Item *treeit)
166{ 167{
168 Clouseau_Object *oinfo;
169 Evas_Object *obj = (void*) (uintptr_t) treeit->ptr;
170
167 if (!treeit->is_obj) 171 if (!treeit->is_obj)
168 return NULL; 172 return NULL;
169 173
170 Clouseau_Object *oinfo;
171 Evas_Object *obj = (void*) (uintptr_t) treeit->ptr;
172 oinfo = calloc(1, sizeof(Clouseau_Object)); 174 oinfo = calloc(1, sizeof(Clouseau_Object));
173 175
174 oinfo->evas_props.pass_events = evas_object_pass_events_get(obj); 176 oinfo->evas_props.pass_events = evas_object_pass_events_get(obj);
@@ -417,7 +419,7 @@ clouseau_obj_information_list_populate(Clouseau_Tree_Item *treeit, Evas_Object *
417 char buf[1024]; 419 char buf[1024];
418 unsigned int i; 420 unsigned int i;
419 421
420 clouseau_obj_information_list_clear(); 422 clouseau_object_information_list_clear();
421 423
422 if (!treeit->is_obj) 424 if (!treeit->is_obj)
423 return; 425 return;
@@ -586,8 +588,8 @@ clouseau_obj_information_list_populate(Clouseau_Tree_Item *treeit, Evas_Object *
586} 588}
587 589
588void 590void
589clouseau_obj_information_list_clear() 591clouseau_object_information_list_clear(void)
590{ 592{
591 _item_tree_free(); 593 _clouseau_item_tree_free();
592 elm_genlist_clear(prop_list); 594 elm_genlist_clear(prop_list);
593} 595}
diff --git a/src/lib/clouseau_private.h b/src/lib/clouseau_private.h
index 0985edf..43a576b 100644
--- a/src/lib/clouseau_private.h
+++ b/src/lib/clouseau_private.h
@@ -149,7 +149,6 @@ typedef struct _data_desc data_desc;
149 149
150/* Function Declarations */ 150/* Function Declarations */
151Clouseau_Object *obj_information_get(Clouseau_Tree_Item *treeit); 151Clouseau_Object *obj_information_get(Clouseau_Tree_Item *treeit);
152void obj_information_free(Clouseau_Object *oinfo);
153void item_tree_item_free(Clouseau_Tree_Item *parent); 152void item_tree_item_free(Clouseau_Tree_Item *parent);
154void _item_tree_item_string(Clouseau_Tree_Item *parent); 153void _item_tree_item_string(Clouseau_Tree_Item *parent);
155data_desc *data_descriptors_init(void); 154data_desc *data_descriptors_init(void);
@@ -172,6 +171,9 @@ void libclouseau_lines_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA
172void clouseau_data_descriptors_init(void); 171void clouseau_data_descriptors_init(void);
173void clouseau_data_descriptors_shutdown(void); 172void clouseau_data_descriptors_shutdown(void);
174 173
174Clouseau_Object *clouseau_object_information_get(Clouseau_Tree_Item *treeit);
175void clouseau_object_information_free(Clouseau_Object *oinfo);
176
175/* Exported function */ 177/* Exported function */
176int clouseau_init(void); 178int clouseau_init(void);
177int clouseau_shutdown(void); 179int clouseau_shutdown(void);