aboutsummaryrefslogtreecommitdiffstats
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
parentexport EGRAPH_TYPE_MAXLEN for users (diff)
downloadegraph-73b9ca1da05bd1722625cc647875b53a1675f6f6.tar.gz
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);
*/
void egraph_edge_type_set(Evas_Object *obj,
Egraph_Edge *e, const char *type);
+
+/**
+ * Get the type of an edge
+ */
+void egraph_edge_type_get(Evas_Object *obj,
+ Egraph_Edge *e, const char **type);
+
/**
* Finds if an edge exists between 2 vertices
*/
@@ -204,7 +211,13 @@ void egraph_vertice_rename(Evas_Object *obj, Egraph_Vertice *v,
void
egraph_vertice_type_set(Evas_Object *obj, Egraph_Vertice *v, const char *type);
- /**
+/**
+ * Get the type of a vertice
+ */
+void egraph_vertice_type_get(Evas_Object *obj,
+ Egraph_Vertice *v, const char **type);
+
+/**
* Send a blob from vertice to vertice
*
* 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,
float *c2min, float *c2max);
static Evas_Object *_edje_obj_new(Egraph *eg, const char *group);
static Evas_Object *_edje_obj_set(Egraph *eg, Evas_Object *o, const char *group);
+static Evas_Object *_edje_obj_get(Egraph *eg, Evas_Object *o, const char **group);
static const Evas_Smart_Cb_Description _smart_callbacks[] = {{NULL, NULL}};
#define EGRAPH_DATA_GET(o, ptr) \
@@ -379,6 +380,15 @@ egraph_edge_type_set(Evas_Object *obj, Egraph_Edge *e, const char *type)
}
}
+void
+egraph_edge_type_get(Evas_Object *obj, Egraph_Edge *e, const char **type)
+{
+ EGRAPH_DATA_GET(obj, eg);
+
+ if (e->o)
+ _edje_obj_get(eg, e->o, type);
+}
+
static void
_edge_signal(Egraph *eg, Egraph_Edge *e, const char *signal)
{
@@ -622,6 +632,15 @@ egraph_vertice_type_set(Evas_Object *obj, Egraph_Vertice *v, const char *type)
_edje_obj_set(eg, v->o, type);
}
+void
+egraph_vertice_type_get(Evas_Object *obj, Egraph_Vertice *v, const char **type)
+{
+ EGRAPH_DATA_GET(obj, eg);
+
+ if (v->o)
+ _edje_obj_get(eg, v->o, type);
+}
+
static void
_vertice_update_status(Egraph *eg, Egraph_Vertice *v)
{
@@ -1223,6 +1242,20 @@ _edje_obj_set(Egraph *eg, Evas_Object *obj, const char *group)
return obj;
}
+static Evas_Object *
+_edje_obj_get(Egraph *eg, Evas_Object *obj, const char **group)
+{
+ if (!obj)
+ return NULL;
+ edje_object_file_get(obj, NULL, group);
+ if (*group == NULL) {
+ if (DEBUG)
+ fprintf(stderr, "Could not get edje file group\n");
+ return NULL;
+ }
+ return obj;
+}
+
Egraph_Vertice *
egraph_group_add(Evas_Object *obj, const char *name, void *data)
{