aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-06-26 13:06:26 +0200
committerChristian Grothoff <christian@grothoff.org>2018-06-26 13:06:26 +0200
commit1bb62c00e753e2aabfaa7e45ccd66c224e8aebaa (patch)
tree24a0430913515c23ab743b1f122a8e2881a8e33c
parent5e1df7d11813dfdf3b3f24aaae1707101298e69a (diff)
downloadgnunet-gtk-1bb62c00e753e2aabfaa7e45ccd66c224e8aebaa.tar.gz
gnunet-gtk-1bb62c00e753e2aabfaa7e45ccd66c224e8aebaa.zip
peerinfo speedup
-rw-r--r--contrib/gnunet_peerinfo_gtk_main_window.glade27
-rw-r--r--src/peerinfo/gnunet-peerinfo-gtk.c95
2 files changed, 52 insertions, 70 deletions
diff --git a/contrib/gnunet_peerinfo_gtk_main_window.glade b/contrib/gnunet_peerinfo_gtk_main_window.glade
index 4040e962..114a356e 100644
--- a/contrib/gnunet_peerinfo_gtk_main_window.glade
+++ b/contrib/gnunet_peerinfo_gtk_main_window.glade
@@ -1,5 +1,5 @@
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Generated with glade 3.22.1 2<!-- Generated with glade 3.22.1
3 3
4Copyright (C) 4Copyright (C)
5 5
@@ -113,12 +113,6 @@ along with gnunet-peerinfo-gtk. If not, see <http://www.gnu.org/licenses/>.
113 <property name="can_focus">False</property> 113 <property name="can_focus">False</property>
114 <property name="icon_name">help-about</property> 114 <property name="icon_name">help-about</property>
115 </object> 115 </object>
116 <object class="GtkImage" id="validated_image">
117 <property name="visible">True</property>
118 <property name="can_focus">False</property>
119 <property name="tooltip_text" translatable="yes">Address valid?</property>
120 <property name="icon_name">address-book-new</property>
121 </object>
122 <object class="GtkWindow" id="GNUNET_PEERINFO_GTK_main_window"> 116 <object class="GtkWindow" id="GNUNET_PEERINFO_GTK_main_window">
123 <property name="can_focus">False</property> 117 <property name="can_focus">False</property>
124 <property name="title" translatable="yes">gnunet-peerinfo-gtk</property> 118 <property name="title" translatable="yes">gnunet-peerinfo-gtk</property>
@@ -222,7 +216,7 @@ along with gnunet-peerinfo-gtk. If not, see <http://www.gnu.org/licenses/>.
222 <signal name="toggled" handler="GNUNET_PEERINFO_GTK_main_window_friends_cellrenderertoggle_toggled_cb" swapped="no"/> 216 <signal name="toggled" handler="GNUNET_PEERINFO_GTK_main_window_friends_cellrenderertoggle_toggled_cb" swapped="no"/>
223 </object> 217 </object>
224 <attributes> 218 <attributes>
225 <attribute name="visible">24</attribute> 219 <attribute name="visible">21</attribute>
226 <attribute name="active">9</attribute> 220 <attribute name="active">9</attribute>
227 </attributes> 221 </attributes>
228 </child> 222 </child>
@@ -234,24 +228,9 @@ along with gnunet-peerinfo-gtk. If not, see <http://www.gnu.org/licenses/>.
234 <property name="widget">connected_image_plugin</property> 228 <property name="widget">connected_image_plugin</property>
235 <property name="reorderable">True</property> 229 <property name="reorderable">True</property>
236 <property name="sort_indicator">True</property> 230 <property name="sort_indicator">True</property>
237 <property name="sort_column_id">22</property>
238 <child>
239 <object class="GtkCellRendererPixbuf" id="GNUNET_PEERINFO_GTK_main_window_plugin_led_cellrendererpixbuf"/>
240 <attributes>
241 <attribute name="pixbuf">21</attribute>
242 </attributes>
243 </child>
244 </object>
245 </child>
246 <child>
247 <object class="GtkTreeViewColumn" id="GNUNET_PEERINFO_GTK_main_window_validation_status_treeviewcolumn">
248 <property name="visible">False</property>
249 <property name="widget">validated_image</property>
250 <property name="reorderable">True</property>
251 <property name="sort_indicator">True</property>
252 <property name="sort_column_id">19</property> 231 <property name="sort_column_id">19</property>
253 <child> 232 <child>
254 <object class="GtkCellRendererPixbuf" id="GNUNET_PEERINFO_GTK_main_window_valdiation_led_cellrendererpixbuf"/> 233 <object class="GtkCellRendererPixbuf" id="GNUNET_PEERINFO_GTK_main_window_plugin_led_cellrendererpixbuf"/>
255 <attributes> 234 <attributes>
256 <attribute name="pixbuf">18</attribute> 235 <attribute name="pixbuf">18</attribute>
257 </attributes> 236 </attributes>
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));