]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
Add aslookup support to gtk interface 122/head
authorHajimu UMEMOTO <ume@mahoroba.org>
Wed, 13 Jul 2016 16:52:02 +0000 (01:52 +0900)
committerHajimu UMEMOTO <ume@mahoroba.org>
Wed, 13 Jul 2016 16:52:02 +0000 (01:52 +0900)
display.c
gtk.c

index 3e55a9582b22c8e3aef5add7286b7ff622bba2e9..d98863d87bf3f4c55d7b2ec042b9815c1a4b04ec 100644 (file)
--- a/display.c
+++ b/display.c
@@ -106,6 +106,10 @@ void display_open(void)
     break;
   case DisplayGTK:
     gtk_open();
+#ifdef IPINFO
+    if (ipinfo_no >= 0)
+        asn_open();
+#endif
     break;
   }
 }
diff --git a/gtk.c b/gtk.c
index d0c8c5aed9f5dba3933150570a34ec8a1e56d6c5..24d74ac8c111dfabe9b46e08fa194eeed2efc105 100644 (file)
--- a/gtk.c
+++ b/gtk.c
@@ -33,6 +33,7 @@
 #include "mtr.h"
 #include "net.h"
 #include "dns.h"
+#include "asn.h"
 #include "mtr-gtk.h"
 #include "version.h"
 
@@ -294,6 +295,9 @@ static GtkWidget *ReportTreeView;
 static GtkListStore *ReportStore;
 
 enum {
+#ifdef IPINFO
+  COL_ASN,
+#endif
   COL_HOSTNAME,
   COL_LOSS,
   COL_RCV,
@@ -347,6 +351,9 @@ void TreeViewCreate(void)
   GtkTreeViewColumn *column;
 
   ReportStore = gtk_list_store_new(N_COLS,
+#ifdef IPINFO
+    G_TYPE_STRING,
+#endif
     G_TYPE_STRING,
     G_TYPE_FLOAT,
     G_TYPE_INT,
@@ -363,7 +370,20 @@ void TreeViewCreate(void)
   
   g_signal_connect(GTK_OBJECT(ReportTreeView), "button_press_event", 
                    G_CALLBACK(ReportTreeView_clicked),NULL);
-  
+
+#ifdef IPINFO
+  if (is_printii()) {
+    renderer = gtk_cell_renderer_text_new ();
+    column = gtk_tree_view_column_new_with_attributes ("ASN",
+      renderer,
+      "text", COL_ASN,
+      "foreground", COL_COLOR,
+      NULL);
+    gtk_tree_view_column_set_resizable(column, TRUE);
+    gtk_tree_view_append_column (GTK_TREE_VIEW(ReportTreeView), column);
+  }
+#endif
+
   renderer = gtk_cell_renderer_text_new ();
   column = gtk_tree_view_column_new_with_attributes ("Hostname",
     renderer,
@@ -479,6 +499,10 @@ void update_tree_row(int row, GtkTreeIter *iter)
     COL_COLOR, net_up(row) ? "black" : "red",
 
     -1);
+#ifdef IPINFO
+  if (is_printii())
+    gtk_list_store_set(ReportStore, iter, COL_ASN, fmt_ipinfo(addr), -1);
+#endif
 }
 
 void gtk_redraw(void)