aboutsummaryrefslogtreecommitdiff
path: root/src/peerinfo/gnunet-peerinfo-gtk.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/peerinfo/gnunet-peerinfo-gtk.c')
-rw-r--r--src/peerinfo/gnunet-peerinfo-gtk.c95
1 files changed, 49 insertions, 46 deletions
diff --git a/src/peerinfo/gnunet-peerinfo-gtk.c b/src/peerinfo/gnunet-peerinfo-gtk.c
index e7eef60d..f4e1621d 100644
--- a/src/peerinfo/gnunet-peerinfo-gtk.c
+++ b/src/peerinfo/gnunet-peerinfo-gtk.c
@@ -35,7 +35,7 @@
35#include <unique/unique.h> 35#include <unique/unique.h>
36#endif 36#endif
37 37
38#define UPDATE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) 38#define UPDATE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
39 39
40/** 40/**
41 * Should we show peers that have no connections and 41 * Should we show peers that have no connections and
@@ -167,7 +167,7 @@ enum PEERINFO_ModelColumns
167 /** 167 /**
168 * Last "column" (does not actually exist). 168 * Last "column" (does not actually exist).
169 */ 169 */
170 PEERINFO_MC_END = 26 170 PEERINFO_MC_END = 23
171 171
172}; 172};
173 173
@@ -408,39 +408,27 @@ static UniqueApp *unique_app;
408static void 408static void
409do_update (void *cls) 409do_update (void *cls)
410{ 410{
411 (void) cls;
412 update_task = GNUNET_SCHEDULER_add_delayed (UPDATE_FREQUENCY,
413 &do_update,
414 NULL);
415#if 0
416 GtkTreeStore *sts; 411 GtkTreeStore *sts;
412 GtkTreeIter iter;
413 static int phase;
417 414
418 sts = gtk_tree_store_new (PEERINFO_MC_END, 415 (void) cls;
419 G_TYPE_STRING, /* pid */ 416 phase++;
420 G_TYPE_STRING, /* country name */ 417 if (0 == (phase % 2))
421 GDK_TYPE_PIXBUF, /* country flag */ 418 {
422 G_TYPE_UINT, /* bandwidth_in */ 419 gtk_widget_thaw_child_notify (GTK_WIDGET (tv));
423 G_TYPE_UINT, /* bandwidth_out */ 420 update_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS,
424 GDK_TYPE_PIXBUF, /* ATS led */ 421 &do_update,
425 G_TYPE_BOOLEAN, /* ATS selected */ 422 NULL);
426 GDK_TYPE_PIXBUF, /* CORE led */ 423
427 G_TYPE_UINT, /* core status */ 424 }
428 G_TYPE_BOOLEAN, /* is friend */ 425 else
429 G_TYPE_POINTER, /* peerinfo */ 426 {
430 G_TYPE_STRING, /* plugin name */ 427 gtk_widget_freeze_child_notify (GTK_WIDGET (tv));
431 G_TYPE_STRING, /* address */ 428 update_task = GNUNET_SCHEDULER_add_delayed (UPDATE_FREQUENCY,
432 GDK_TYPE_PIXBUF, /* neighbour connectivity */ 429 &do_update,
433 G_TYPE_BOOLEAN, /* connected status */ 430 NULL);
434 G_TYPE_STRING, /* timeout as string */ 431 }
435 G_TYPE_STRING, /* neighbour state as string */
436 G_TYPE_STRING, /* neighbour state timeout as string */
437 GDK_TYPE_PIXBUF, /* plugin connectivity led */
438 G_TYPE_BOOLEAN, /* plugin connectivity status */
439 G_TYPE_STRING, /* connectivity timeout plugin */
440 G_TYPE_BOOLEAN, /* show friend */
441 G_TYPE_STRING /* peerinfo addr expiration */
442 );
443#endif
444} 432}
445 433
446 434
@@ -689,7 +677,9 @@ get_address (struct PeerInfo *pi,
689 pa); 677 pa);
690 path = gtk_tree_row_reference_get_path (pi->rr); 678 path = gtk_tree_row_reference_get_path (pi->rr);
691 GNUNET_assert (NULL != path); 679 GNUNET_assert (NULL != path);
692 GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ts), &iter, path)); 680 GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ts),
681 &iter,
682 path));
693 gtk_tree_path_free (path); 683 gtk_tree_path_free (path);
694 gtk_tree_store_insert_with_values (ts, 684 gtk_tree_store_insert_with_values (ts,
695 &aiter, 685 &aiter,
@@ -697,14 +687,18 @@ get_address (struct PeerInfo *pi,
697 -1 /* append */, 687 -1 /* append */,
698 PEERINFO_MC_PLUGIN_NAME, addr->transport_name, 688 PEERINFO_MC_PLUGIN_NAME, addr->transport_name,
699 -1); 689 -1);
700 path = gtk_tree_model_get_path (GTK_TREE_MODEL (ts), &aiter); 690 path = gtk_tree_model_get_path (GTK_TREE_MODEL (ts),
701 pa->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts), path); 691 &aiter);
692 pa->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts),
693 path);
702 GNUNET_assert (NULL != pa->rr); 694 GNUNET_assert (NULL != pa->rr);
703 gtk_tree_path_free (path); 695 gtk_tree_path_free (path);
704 pa->tos = GNUNET_TRANSPORT_address_to_string (get_configuration (), addr, 696 pa->tos = GNUNET_TRANSPORT_address_to_string (get_configuration (),
697 addr,
705 GNUNET_NO, 698 GNUNET_NO,
706 GNUNET_TIME_UNIT_FOREVER_REL, 699 GNUNET_TIME_UNIT_FOREVER_REL,
707 &peer_address_string_cb, pa); 700 &peer_address_string_cb,
701 pa);
708 702
709 return pa; 703 return pa;
710} 704}
@@ -730,7 +724,9 @@ peer_address_cb (void *cts,
730 724
731 path = gtk_tree_row_reference_get_path (info->rr); 725 path = gtk_tree_row_reference_get_path (info->rr);
732 GNUNET_assert (NULL != path); 726 GNUNET_assert (NULL != path);
733 GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ts), &iter, path)); 727 GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ts),
728 &iter,
729 path));
734 gtk_tree_path_free (path); 730 gtk_tree_path_free (path);
735 pa = get_address (info, address); 731 pa = get_address (info, address);
736 get_iter_from_rr (pa->rr, &iter); 732 get_iter_from_rr (pa->rr, &iter);
@@ -775,12 +771,16 @@ get_peer_info (const struct GNUNET_PeerIdentity *peer)
775 PEERINFO_MC_PEERINFO, info, 771 PEERINFO_MC_PEERINFO, info,
776 PEERINFO_MC_SHOW_FRIEND, TRUE, 772 PEERINFO_MC_SHOW_FRIEND, TRUE,
777 -1); 773 -1);
778 path = gtk_tree_model_get_path (GTK_TREE_MODEL (ts), &iter); 774 path = gtk_tree_model_get_path (GTK_TREE_MODEL (ts),
779 info->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts), path); 775 &iter);
776 info->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts),
777 path);
780 GNUNET_assert (NULL != info->rr); 778 GNUNET_assert (NULL != info->rr);
781 gtk_tree_path_free (path); 779 gtk_tree_path_free (path);
782 GNUNET_assert (GNUNET_OK == 780 GNUNET_assert (GNUNET_OK ==
783 GNUNET_CONTAINER_multipeermap_put (peer2info, peer, info, 781 GNUNET_CONTAINER_multipeermap_put (peer2info,
782 peer,
783 info,
784 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 784 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
785 return info; 785 return info;
786} 786}
@@ -1337,16 +1337,20 @@ GNUNET_PEERINFO_GTK_main_window_friends_cellrenderertoggle_toggled_cb (GtkCellRe
1337 GNUNET_break (0); 1337 GNUNET_break (0);
1338 return; 1338 return;
1339 } 1339 }
1340 if (! gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ts), &old, path)) 1340 if (! gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ts),
1341 &old,
1342 path))
1341 { 1343 {
1342 GNUNET_break (0); 1344 GNUNET_break (0);
1343 return; 1345 return;
1344 } 1346 }
1345 gtk_tree_model_get (GTK_TREE_MODEL (ts), &old, 1347 gtk_tree_model_get (GTK_TREE_MODEL (ts),
1348 &old,
1346 PEERINFO_MC_PEERINFO, &info, 1349 PEERINFO_MC_PEERINFO, &info,
1347 PEERINFO_MC_IS_FRIEND, &oldvalue, 1350 PEERINFO_MC_IS_FRIEND, &oldvalue,
1348 -1); 1351 -1);
1349 gtk_tree_store_set (ts, &old, 1352 gtk_tree_store_set (ts,
1353 &old,
1350 PEERINFO_MC_IS_FRIEND, ! oldvalue, 1354 PEERINFO_MC_IS_FRIEND, ! oldvalue,
1351 -1); 1355 -1);
1352 if (oldvalue) 1356 if (oldvalue)
@@ -1577,7 +1581,6 @@ run (void *cts)
1577 g_signal_connect (tv, "query-tooltip", 1581 g_signal_connect (tv, "query-tooltip",
1578 G_CALLBACK (query_tooltip_cb), 1582 G_CALLBACK (query_tooltip_cb),
1579 NULL); 1583 NULL);
1580 gtk_widget_freeze_child_notify (GTK_WIDGET (tv));
1581#if HAVE_LIBUNIQUE 1584#if HAVE_LIBUNIQUE
1582 unique_app_watch_window (unique_app, 1585 unique_app_watch_window (unique_app,
1583 GTK_WINDOW (main_window)); 1586 GTK_WINDOW (main_window));