From aa282263ac88247165e75371994730de10731703 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 26 Jun 2018 08:44:06 +0200 Subject: attempt to freeze tv to speed up gnunet-peerinfo-gtk --- src/peerinfo/gnunet-peerinfo-gtk.c | 41 +++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/peerinfo/gnunet-peerinfo-gtk.c b/src/peerinfo/gnunet-peerinfo-gtk.c index f6227cc7..a5ae486a 100644 --- a/src/peerinfo/gnunet-peerinfo-gtk.c +++ b/src/peerinfo/gnunet-peerinfo-gtk.c @@ -398,12 +398,39 @@ static GtkTreeViewColumn *tvc_plugin_connectivity; */ static GtkTreeViewColumn *tvc_neighbour_state; +/** + * The main tree view. + */ +static GtkTreeView *tv; + +/** + * Task to actually update the tree view. + */ +static struct GNUNET_SCHEDULER_Task *update_task; + #if HAVE_LIBUNIQUE static UniqueApp *unique_app; #endif +/** + * Periodically unfreezes the tree view to allow updates to show. + * + * @param cls NULL + */ +static void +do_update (void *cls) +{ + (void) cls; + update_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, + &do_update, + NULL); + gtk_widget_thaw_child_notify (GTK_WIDGET (tv)); + gtk_widget_freeze_child_notify (GTK_WIDGET (tv)); +} + + /** * Get cfg. */ @@ -488,6 +515,11 @@ free_paths (void *cts, static void shutdown_task (void *cts) { + if (NULL != update_task) + { + GNUNET_SCHEDULER_cancel (update_task); + update_task = NULL; + } if (NULL == ml) { GNUNET_break (0); @@ -1459,13 +1491,13 @@ static void run (void *cts) { GtkWidget *main_window; - GtkTreeView *tv; const struct GNUNET_CONFIGURATION_Handle *cfg; int can_edit_friends; ml = cts; if (GNUNET_OK != - GNUNET_GTK_main_loop_build_window (ml, NULL)) + GNUNET_GTK_main_loop_build_window (ml, + NULL)) return; cfg = get_configuration (); led_green = load_led ("green"); @@ -1535,7 +1567,7 @@ run (void *cts) g_signal_connect (tv, "query-tooltip", G_CALLBACK (query_tooltip_cb), NULL); - + gtk_widget_freeze_child_notify (GTK_WIDGET (tv)); #if HAVE_LIBUNIQUE unique_app_watch_window (unique_app, GTK_WINDOW (main_window)); @@ -1543,6 +1575,9 @@ run (void *cts) /* make GUI visible */ gtk_widget_show (main_window); gtk_window_present (GTK_WINDOW (main_window)); + update_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, + &do_update, + NULL); GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); } -- cgit v1.2.3