diff options
author | Laurent Ghigonis <laurent@p1sec.com> | 2012-12-10 00:25:15 +0100 |
---|---|---|
committer | Laurent Ghigonis <laurent@p1sec.com> | 2012-12-10 00:25:15 +0100 |
commit | ea8c1b485fdc32ae60741c424276d66696772c40 (patch) | |
tree | 32a01f526b7ede34e25cc13c9f752ad3ba2cb8bc /gg_map/gg_map.c | |
parent | first version that acualy displays something ! (diff) | |
download | glouglou-ea8c1b485fdc32ae60741c424276d66696772c40.tar.xz glouglou-ea8c1b485fdc32ae60741c424276d66696772c40.zip |
show node ip on the network graph, and display a black background
Diffstat (limited to '')
-rw-r--r-- | gg_map/gg_map.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/gg_map/gg_map.c b/gg_map/gg_map.c index d646132..9678938 100644 --- a/gg_map/gg_map.c +++ b/gg_map/gg_map.c @@ -21,16 +21,28 @@ _cb_ecore_libevent(void *data) { return EINA_TRUE; } +const char *ip_to_str(u_int ip) +{ + unsigned char bytes[4]; + char buf[16]; + + bytes[0] = ip & 0xFF; + bytes[1] = (ip >> 8) & 0xFF; + bytes[2] = (ip >> 16) & 0xFF; + bytes[3] = (ip >> 24) & 0xFF; + snprintf(buf, sizeof(buf), "%d.%d.%d.%d", + bytes[3], bytes[2], bytes[1], bytes[0]); + return buf; +} + static Egraph_Vertice * _node_to_vertice(struct ggnet_node *n) { Egraph_Vertice *v; - char name[EGRAPH_VERTICE_NAME_MAXLEN]; v = ggnet_node_usrdata_get(n); if (!v) { - snprintf(name, sizeof(name), "%x", n->addr.s_addr); - v = egraph_vertice_add(_egraph, name, n); + v = egraph_vertice_add(_egraph, ip_to_str(n->addr.s_addr), n); ggnet_node_usrdata_set(n, v); } return v; @@ -147,7 +159,7 @@ elm_main(int argc, char **argv) bg = elm_bg_add(win); elm_win_resize_object_add(win, bg); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + evas_object_color_set(bg, 0, 0, 0, 255); evas_object_show(bg); panes = elm_panes_add(win); |