summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2013-07-05 16:44:36 +0200
committerLaurent Ghigonis <laurent@p1sec.com>2013-07-05 16:44:36 +0200
commit73b9ca1da05bd1722625cc647875b53a1675f6f6 (patch)
treee560bdc6cc95a299261baaa623de696fa5895008
parent9c42e3eaf43ab3295277163f7a22c93e1a1b5530 (diff)
add egraph_edge_type_get() and egraph_vertice_type_get()
-rw-r--r--Egraph.h15
-rw-r--r--egraph.c33
2 files changed, 47 insertions, 1 deletions
diff --git a/Egraph.h b/Egraph.h
index ead5054..4fe013f 100644
--- a/Egraph.h
+++ b/Egraph.h
@@ -164,6 +164,13 @@ void egraph_edge_del(Evas_Object *obj, Egraph_Edge *e);
164 */ 164 */
165void egraph_edge_type_set(Evas_Object *obj, 165void egraph_edge_type_set(Evas_Object *obj,
166 Egraph_Edge *e, const char *type); 166 Egraph_Edge *e, const char *type);
167
168/**
169 * Get the type of an edge
170 */
171void egraph_edge_type_get(Evas_Object *obj,
172 Egraph_Edge *e, const char **type);
173
167/** 174/**
168 * Finds if an edge exists between 2 vertices 175 * Finds if an edge exists between 2 vertices
169 */ 176 */
@@ -204,7 +211,13 @@ void egraph_vertice_rename(Evas_Object *obj, Egraph_Vertice *v,
204void 211void
205egraph_vertice_type_set(Evas_Object *obj, Egraph_Vertice *v, const char *type); 212egraph_vertice_type_set(Evas_Object *obj, Egraph_Vertice *v, const char *type);
206 213
207 /** 214/**
215 * Get the type of a vertice
216 */
217void egraph_vertice_type_get(Evas_Object *obj,
218 Egraph_Vertice *v, const char **type);
219
220/**
208 * Send a blob from vertice to vertice 221 * Send a blob from vertice to vertice
209 * 222 *
210 * A blob is a visual object that will move quickly from the first node to the 223 * A blob is a visual object that will move quickly from the first node to the
diff --git a/egraph.c b/egraph.c
index 9056545..0948c45 100644
--- a/egraph.c
+++ b/egraph.c
@@ -41,6 +41,7 @@ static void _matrix_minmax_2v(const igraph_matrix_t *m, int row_count,
41 float *c2min, float *c2max); 41 float *c2min, float *c2max);
42static Evas_Object *_edje_obj_new(Egraph *eg, const char *group); 42static Evas_Object *_edje_obj_new(Egraph *eg, const char *group);
43static Evas_Object *_edje_obj_set(Egraph *eg, Evas_Object *o, const char *group); 43static Evas_Object *_edje_obj_set(Egraph *eg, Evas_Object *o, const char *group);
44static Evas_Object *_edje_obj_get(Egraph *eg, Evas_Object *o, const char **group);
44 45
45static const Evas_Smart_Cb_Description _smart_callbacks[] = {{NULL, NULL}}; 46static const Evas_Smart_Cb_Description _smart_callbacks[] = {{NULL, NULL}};
46#define EGRAPH_DATA_GET(o, ptr) \ 47#define EGRAPH_DATA_GET(o, ptr) \
@@ -379,6 +380,15 @@ egraph_edge_type_set(Evas_Object *obj, Egraph_Edge *e, const char *type)
379 } 380 }
380} 381}
381 382
383void
384egraph_edge_type_get(Evas_Object *obj, Egraph_Edge *e, const char **type)
385{
386 EGRAPH_DATA_GET(obj, eg);
387
388 if (e->o)
389 _edje_obj_get(eg, e->o, type);
390}
391
382static void 392static void
383_edge_signal(Egraph *eg, Egraph_Edge *e, const char *signal) 393_edge_signal(Egraph *eg, Egraph_Edge *e, const char *signal)
384{ 394{
@@ -622,6 +632,15 @@ egraph_vertice_type_set(Evas_Object *obj, Egraph_Vertice *v, const char *type)
622 _edje_obj_set(eg, v->o, type); 632 _edje_obj_set(eg, v->o, type);
623} 633}
624 634
635void
636egraph_vertice_type_get(Evas_Object *obj, Egraph_Vertice *v, const char **type)
637{
638 EGRAPH_DATA_GET(obj, eg);
639
640 if (v->o)
641 _edje_obj_get(eg, v->o, type);
642}
643
625static void 644static void
626_vertice_update_status(Egraph *eg, Egraph_Vertice *v) 645_vertice_update_status(Egraph *eg, Egraph_Vertice *v)
627{ 646{
@@ -1223,6 +1242,20 @@ _edje_obj_set(Egraph *eg, Evas_Object *obj, const char *group)
1223 return obj; 1242 return obj;
1224} 1243}
1225 1244
1245static Evas_Object *
1246_edje_obj_get(Egraph *eg, Evas_Object *obj, const char **group)
1247{
1248 if (!obj)
1249 return NULL;
1250 edje_object_file_get(obj, NULL, group);
1251 if (*group == NULL) {
1252 if (DEBUG)
1253 fprintf(stderr, "Could not get edje file group\n");
1254 return NULL;
1255 }
1256 return obj;
1257}
1258
1226Egraph_Vertice * 1259Egraph_Vertice *
1227egraph_group_add(Evas_Object *obj, const char *name, void *data) 1260egraph_group_add(Evas_Object *obj, const char *name, void *data)
1228{ 1261{