From ea8c1b485fdc32ae60741c424276d66696772c40 Mon Sep 17 00:00:00 2001 From: Laurent Ghigonis Date: Mon, 10 Dec 2012 00:25:15 +0100 Subject: show node ip on the network graph, and display a black background --- gg_map/gg_map.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'gg_map/gg_map.c') 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); -- cgit v1.2.3-59-g8ed1b