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.c74
1 files changed, 58 insertions, 16 deletions
diff --git a/src/peerinfo/gnunet-peerinfo-gtk.c b/src/peerinfo/gnunet-peerinfo-gtk.c
index 60e9c127..aa717594 100644
--- a/src/peerinfo/gnunet-peerinfo-gtk.c
+++ b/src/peerinfo/gnunet-peerinfo-gtk.c
@@ -677,10 +677,17 @@ get_peer_info (const struct GNUNET_PeerIdentity *peer)
677 info = GNUNET_new (struct PeerInfo); 677 info = GNUNET_new (struct PeerInfo);
678 info->pid = *peer; 678 info->pid = *peer;
679 gtk_tree_store_append (ts, &iter, NULL); 679 gtk_tree_store_append (ts, &iter, NULL);
680
681 if (NULL != friends)
682 {
683 gtk_tree_store_set (ts, &iter,
684 PEERINFO_MC_IS_FRIEND,
685 GNUNET_CONTAINER_multipeermap_contains (friends,
686 peer),
687 -1);
688 }
680 gtk_tree_store_set (ts, &iter, 689 gtk_tree_store_set (ts, &iter,
681 PEERINFO_MC_PEER_IDENTITY_STRING, GNUNET_i2s (peer), 690 PEERINFO_MC_PEER_IDENTITY_STRING, GNUNET_i2s (peer),
682 PEERINFO_MC_IS_FRIEND, GNUNET_CONTAINER_multipeermap_contains (friends,
683 peer),
684 PEERINFO_MC_PEERINFO, info, 691 PEERINFO_MC_PEERINFO, info,
685 PEERINFO_MC_SHOW_FRIEND, TRUE, 692 PEERINFO_MC_SHOW_FRIEND, TRUE,
686 PEERINFO_MC_CORE_CONNECTIVITY_LED, led_red, 693 PEERINFO_MC_CORE_CONNECTIVITY_LED, led_red,
@@ -863,16 +870,19 @@ transport_peer_cb (void *cts,
863 * @param peer peer this update is about, 870 * @param peer peer this update is about,
864 * NULL if this is the final last callback for a iteration operation 871 * NULL if this is the final last callback for a iteration operation
865 * @param address address, NULL for disconnect notification in monitor mode 872 * @param address address, NULL for disconnect notification in monitor mode
873 * @param last_validation when was this address last validated
866 * @param valid_until when does this address expire 874 * @param valid_until when does this address expire
867 * @param next_validation time of the next validation operation 875 * @param next_validation time of the next validation operation
868 * 876 * @param state state in the validation state machine (FIXME: not used yet)
869 */ 877 */
870static void 878static void
871validation_monitor_cb (void *cts, 879validation_monitor_cb (void *cts,
872 const struct GNUNET_PeerIdentity *peer, 880 const struct GNUNET_PeerIdentity *peer,
873 const struct GNUNET_HELLO_Address *address, 881 const struct GNUNET_HELLO_Address *address,
882 struct GNUNET_TIME_Absolute last_validation,
874 struct GNUNET_TIME_Absolute valid_until, 883 struct GNUNET_TIME_Absolute valid_until,
875 struct GNUNET_TIME_Absolute next_validation) 884 struct GNUNET_TIME_Absolute next_validation,
885 enum GNUNET_TRANSPORT_ValidationState state)
876{ 886{
877 struct PeerInfo *info; 887 struct PeerInfo *info;
878 struct PeerAddress *pa; 888 struct PeerAddress *pa;
@@ -1014,6 +1024,11 @@ GNUNET_PEERINFO_GTK_main_window_friends_cellrenderertoggle_toggled_cb (GtkCellRe
1014 struct PeerInfo *info; 1024 struct PeerInfo *info;
1015 gboolean oldvalue; 1025 gboolean oldvalue;
1016 1026
1027 if (NULL == friends)
1028 {
1029 GNUNET_break (0);
1030 return;
1031 }
1017 if (! gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ts), &old, path)) 1032 if (! gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ts), &old, path))
1018 { 1033 {
1019 GNUNET_break (0); 1034 GNUNET_break (0);
@@ -1091,6 +1106,11 @@ static void
1091add_friend (void *cts, 1106add_friend (void *cts,
1092 const struct GNUNET_PeerIdentity *friend) 1107 const struct GNUNET_PeerIdentity *friend)
1093{ 1108{
1109 if (NULL == friends)
1110 {
1111 GNUNET_break (0);
1112 return;
1113 }
1094 GNUNET_break (GNUNET_YES == 1114 GNUNET_break (GNUNET_YES ==
1095 GNUNET_CONTAINER_multipeermap_put (friends, 1115 GNUNET_CONTAINER_multipeermap_put (friends,
1096 friend, 1116 friend,
@@ -1180,24 +1200,46 @@ run (void *cts,
1180{ 1200{
1181 GtkWidget *main_window; 1201 GtkWidget *main_window;
1182 GtkTreeView *tv; 1202 GtkTreeView *tv;
1203 const struct GNUNET_CONFIGURATION_Handle *cfg;
1204 int can_edit_friends;
1183 1205
1184 ml = cts; 1206 ml = cts;
1185 if (GNUNET_OK != 1207 if (GNUNET_OK !=
1186 GNUNET_GTK_main_loop_build_window (ml, NULL)) 1208 GNUNET_GTK_main_loop_build_window (ml, NULL))
1187 return; 1209 return;
1210 cfg = get_configuration ();
1188 led_green = load_led ("green"); 1211 led_green = load_led ("green");
1189 led_red = load_led ("red"); 1212 led_red = load_led ("red");
1190 GNUNET_GTK_set_icon_search_path (); 1213 GNUNET_GTK_set_icon_search_path ();
1191 GNUNET_GTK_setup_nls (); 1214 GNUNET_GTK_setup_nls ();
1192 friends = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); 1215 can_edit_friends =
1193 if (GNUNET_OK != 1216 (GNUNET_NO ==
1194 GNUNET_FRIENDS_parse (get_configuration (), 1217 GNUNET_CONFIGURATION_have_value (cfg,
1195 &add_friend, 1218 "ARM",
1196 NULL)) 1219 "SYSTEM_ONLY")) ||
1197 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1220 (GNUNET_YES ==
1198 _("Failed to parse list of friends\n")); 1221 GNUNET_CONFIGURATION_get_value_yesno (cfg,
1222 "ARM",
1223 "SYSTEM_ONLY"));
1224 if (can_edit_friends)
1225 {
1226 friends = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
1227 if (GNUNET_OK !=
1228 GNUNET_FRIENDS_parse (cfg,
1229 &add_friend,
1230 NULL))
1231 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1232 _("Failed to parse list of friends\n"));
1233 }
1234 else
1235 {
1236 gtk_tree_view_column_set_visible
1237 (GTK_TREE_VIEW_COLUMN
1238 (get_object ("GNUNET_PEERINFO_GTK_main_window_friends_treeviewcolumn")),
1239 FALSE);
1240 }
1199 peer2info = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO); 1241 peer2info = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO);
1200 core = GNUNET_CORE_connect (get_configuration (), 1242 core = GNUNET_CORE_connect (cfg,
1201 NULL, 1243 NULL,
1202 NULL, 1244 NULL,
1203 &handle_core_connect, 1245 &handle_core_connect,
@@ -1205,22 +1247,22 @@ run (void *cts,
1205 NULL, GNUNET_NO, 1247 NULL, GNUNET_NO,
1206 NULL, GNUNET_NO, 1248 NULL, GNUNET_NO,
1207 NULL); 1249 NULL);
1208 pnc = GNUNET_PEERINFO_notify (get_configuration (), 1250 pnc = GNUNET_PEERINFO_notify (cfg,
1209 GNUNET_NO, 1251 GNUNET_NO,
1210 &peerinfo_processor, NULL); 1252 &peerinfo_processor, NULL);
1211 pmc = GNUNET_TRANSPORT_monitor_peers (get_configuration (), 1253 pmc = GNUNET_TRANSPORT_monitor_peers (cfg,
1212 NULL, 1254 NULL,
1213 GNUNET_NO, 1255 GNUNET_NO,
1214 GNUNET_TIME_UNIT_FOREVER_REL, 1256 GNUNET_TIME_UNIT_FOREVER_REL,
1215 &transport_peer_cb, 1257 &transport_peer_cb,
1216 NULL); 1258 NULL);
1217 vmc = GNUNET_TRANSPORT_monitor_validation_entries (get_configuration (), 1259 vmc = GNUNET_TRANSPORT_monitor_validation_entries (cfg,
1218 NULL, 1260 NULL,
1219 GNUNET_NO, 1261 GNUNET_NO,
1220 GNUNET_TIME_UNIT_FOREVER_REL, 1262 GNUNET_TIME_UNIT_FOREVER_REL,
1221 &validation_monitor_cb, 1263 &validation_monitor_cb,
1222 NULL); 1264 NULL);
1223 ats = GNUNET_ATS_performance_init (get_configuration (), 1265 ats = GNUNET_ATS_performance_init (cfg,
1224 &status_cb, NULL); 1266 &status_cb, NULL);
1225 tvc_core_connectivity = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_core_connectivity_treeviewcolumn")); 1267 tvc_core_connectivity = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_core_connectivity_treeviewcolumn"));
1226 tvc_ats_connectivity = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_ats_connectivity_treeviewcolumn")); 1268 tvc_ats_connectivity = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_ats_connectivity_treeviewcolumn"));