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.c111
1 files changed, 111 insertions, 0 deletions
diff --git a/src/peerinfo/gnunet-peerinfo-gtk.c b/src/peerinfo/gnunet-peerinfo-gtk.c
index e9d5b8e9..71c3ff15 100644
--- a/src/peerinfo/gnunet-peerinfo-gtk.c
+++ b/src/peerinfo/gnunet-peerinfo-gtk.c
@@ -356,6 +356,36 @@ static GtkTreeStore *ts;
356 */ 356 */
357static struct GNUNET_CONTAINER_MultiPeerMap *friends; 357static struct GNUNET_CONTAINER_MultiPeerMap *friends;
358 358
359/**
360 * Tree view column for CORE connecitivity.
361 */
362static GtkTreeViewColumn *tvc_core_connectivity;
363
364/**
365 * Tree view column for TRANSPORT connecitivity.
366 */
367static GtkTreeViewColumn *tvc_transport_connectivity;
368
369/**
370 * Tree view column for ATS connecitivity.
371 */
372static GtkTreeViewColumn *tvc_ats_connectivity;
373
374/**
375 * Tree view column for plugin connecitivity.
376 */
377static GtkTreeViewColumn *tvc_plugin_connectivity;
378
379/**
380 * Tree view column for validation status
381 */
382static GtkTreeViewColumn *tvc_validation_status;
383
384/**
385 * Tree view column for neighbour_state
386 */
387static GtkTreeViewColumn *tvc_neighbour_state;
388
359 389
360#if HAVE_LIBUNIQUE 390#if HAVE_LIBUNIQUE
361static UniqueApp *unique_app; 391static UniqueApp *unique_app;
@@ -1070,6 +1100,74 @@ add_friend (void *cts,
1070 1100
1071 1101
1072/** 1102/**
1103 * Return the tooltip for the given coordinate.
1104 *
1105 * @param widget our tree view
1106 * @param x x-coordinate
1107 * @param y y-coordinate
1108 * @param keyboard_tip triggered by keyboard?
1109 * @param tooltip tooltip object to fill
1110 * @param data NULL
1111 * @return TRUE if a tooltip was provided
1112 */
1113static gboolean
1114query_tooltip_cb (GtkWidget *widget,
1115 gint x,
1116 gint y,
1117 gboolean keyboard_tip,
1118 GtkTooltip *tooltip,
1119 gpointer data)
1120{
1121 GtkTreeView *tv = GTK_TREE_VIEW (widget);
1122 GtkTreeModel *model = GTK_TREE_MODEL (ts);
1123 GtkTreeIter iter;
1124 GtkTreePath *path;
1125 GtkTreeViewColumn *column;
1126 int model_column = -1;
1127 gchar *tmp;
1128
1129 if (! gtk_tree_view_get_tooltip_context (tv, &x, &y,
1130 keyboard_tip,
1131 &model, &path, &iter))
1132 return FALSE;
1133 if (! gtk_tree_view_get_path_at_pos (tv, x, y, NULL, &column, NULL, NULL))
1134 return FALSE;
1135
1136 if (tvc_core_connectivity == column)
1137 model_column = -1;
1138 else if (tvc_plugin_connectivity == column)
1139 model_column = PEERINFO_MC_PLUGIN_CONNECTIVITY_TIMEOUT_AS_STRING;
1140 else if (tvc_ats_connectivity == column)
1141 model_column = PEERINFO_MC_PEERINFO_ADDRESS_EXPIRATION;
1142 else if (tvc_transport_connectivity == column)
1143 model_column = PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_TIMEOUT_AS_STRING;
1144 else if (tvc_validation_status == column)
1145 model_column = PEERINFO_MC_VALIDATION_TIMEOUT_AS_STRING;
1146 else if (tvc_neighbour_state == column)
1147 model_column = PEERINFO_MC_NEIGHBOUR_STATE_TIMEOUT_AS_STRING;
1148 if (-1 == model_column)
1149 return FALSE;
1150
1151 gtk_tree_model_get (model,
1152 &iter,
1153 model_column, &tmp,
1154 -1);
1155 if (NULL == tmp)
1156 return FALSE;
1157 gtk_tooltip_set_text (tooltip,
1158 tmp);
1159 gtk_tree_view_set_tooltip_cell (tv,
1160 tooltip,
1161 path,
1162 column,
1163 NULL);
1164 g_free (tmp);
1165 gtk_tree_path_free (path);
1166 return TRUE;
1167}
1168
1169
1170/**
1073 * Actual main function run right after GNUnet's scheduler 1171 * Actual main function run right after GNUnet's scheduler
1074 * is initialized. Initializes up GTK and Glade. 1172 * is initialized. Initializes up GTK and Glade.
1075 * 1173 *
@@ -1081,6 +1179,7 @@ run (void *cts,
1081 const struct GNUNET_SCHEDULER_TaskContext *tc) 1179 const struct GNUNET_SCHEDULER_TaskContext *tc)
1082{ 1180{
1083 GtkWidget *main_window; 1181 GtkWidget *main_window;
1182 GtkTreeView *tv;
1084 1183
1085 ml = cts; 1184 ml = cts;
1086 if (GNUNET_OK != 1185 if (GNUNET_OK !=
@@ -1123,6 +1222,12 @@ run (void *cts,
1123 NULL); 1222 NULL);
1124 ats = GNUNET_ATS_performance_init (get_configuration (), 1223 ats = GNUNET_ATS_performance_init (get_configuration (),
1125 &status_cb, NULL); 1224 &status_cb, NULL);
1225 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"));
1227 tvc_plugin_connectivity = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_plugin_connectivity_treeviewcolumn"));
1228 tvc_transport_connectivity = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_transport_connectivity_treeviewcolumn"));
1229 tvc_validation_status = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_validation_status_treeviewcolumn"));
1230 tvc_neighbour_state = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_neighbour_state_treeviewcolumn"));
1126 /* setup main window */ 1231 /* setup main window */
1127 main_window = GTK_WIDGET (get_object ("GNUNET_PEERINFO_GTK_main_window")); 1232 main_window = GTK_WIDGET (get_object ("GNUNET_PEERINFO_GTK_main_window"));
1128 main_window = GNUNET_GTK_plug_me ("GNUNET_PEERINFO_GTK_PLUG", 1233 main_window = GNUNET_GTK_plug_me ("GNUNET_PEERINFO_GTK_PLUG",
@@ -1136,6 +1241,12 @@ run (void *cts,
1136 "gnunet-gtk" /* FIXME: different icon? */ , 1241 "gnunet-gtk" /* FIXME: different icon? */ ,
1137 "gnunet-peerinfo-gtk"); 1242 "gnunet-peerinfo-gtk");
1138 1243
1244 tv = GTK_TREE_VIEW (get_object ("GNUNET_PEERINFO_GTK_main_window_treeview"));
1245 g_object_set (tv, "has-tooltip", TRUE, NULL);
1246 g_signal_connect (tv, "query-tooltip",
1247 G_CALLBACK (query_tooltip_cb),
1248 NULL);
1249
1139#if HAVE_LIBUNIQUE 1250#if HAVE_LIBUNIQUE
1140 unique_app_watch_window (unique_app, GTK_WINDOW (main_window)); 1251 unique_app_watch_window (unique_app, GTK_WINDOW (main_window));
1141#endif 1252#endif