diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-06-26 08:44:06 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-06-26 08:44:26 +0200 |
commit | aa282263ac88247165e75371994730de10731703 (patch) | |
tree | dd919f8ca2e97870d12c9e5abde36d9d1948de1d | |
parent | 899f2c738e7117fd5c15e78c9c530241287674e9 (diff) | |
download | gnunet-gtk-aa282263ac88247165e75371994730de10731703.tar.gz gnunet-gtk-aa282263ac88247165e75371994730de10731703.zip |
attempt to freeze tv to speed up gnunet-peerinfo-gtk
-rw-r--r-- | src/peerinfo/gnunet-peerinfo-gtk.c | 41 |
1 files changed, 38 insertions, 3 deletions
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,6 +398,16 @@ static GtkTreeViewColumn *tvc_plugin_connectivity; | |||
398 | */ | 398 | */ |
399 | static GtkTreeViewColumn *tvc_neighbour_state; | 399 | static GtkTreeViewColumn *tvc_neighbour_state; |
400 | 400 | ||
401 | /** | ||
402 | * The main tree view. | ||
403 | */ | ||
404 | static GtkTreeView *tv; | ||
405 | |||
406 | /** | ||
407 | * Task to actually update the tree view. | ||
408 | */ | ||
409 | static struct GNUNET_SCHEDULER_Task *update_task; | ||
410 | |||
401 | 411 | ||
402 | #if HAVE_LIBUNIQUE | 412 | #if HAVE_LIBUNIQUE |
403 | static UniqueApp *unique_app; | 413 | static UniqueApp *unique_app; |
@@ -405,6 +415,23 @@ static UniqueApp *unique_app; | |||
405 | 415 | ||
406 | 416 | ||
407 | /** | 417 | /** |
418 | * Periodically unfreezes the tree view to allow updates to show. | ||
419 | * | ||
420 | * @param cls NULL | ||
421 | */ | ||
422 | static void | ||
423 | do_update (void *cls) | ||
424 | { | ||
425 | (void) cls; | ||
426 | update_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | ||
427 | &do_update, | ||
428 | NULL); | ||
429 | gtk_widget_thaw_child_notify (GTK_WIDGET (tv)); | ||
430 | gtk_widget_freeze_child_notify (GTK_WIDGET (tv)); | ||
431 | } | ||
432 | |||
433 | |||
434 | /** | ||
408 | * Get cfg. | 435 | * Get cfg. |
409 | */ | 436 | */ |
410 | static const struct GNUNET_CONFIGURATION_Handle * | 437 | static const struct GNUNET_CONFIGURATION_Handle * |
@@ -488,6 +515,11 @@ free_paths (void *cts, | |||
488 | static void | 515 | static void |
489 | shutdown_task (void *cts) | 516 | shutdown_task (void *cts) |
490 | { | 517 | { |
518 | if (NULL != update_task) | ||
519 | { | ||
520 | GNUNET_SCHEDULER_cancel (update_task); | ||
521 | update_task = NULL; | ||
522 | } | ||
491 | if (NULL == ml) | 523 | if (NULL == ml) |
492 | { | 524 | { |
493 | GNUNET_break (0); | 525 | GNUNET_break (0); |
@@ -1459,13 +1491,13 @@ static void | |||
1459 | run (void *cts) | 1491 | run (void *cts) |
1460 | { | 1492 | { |
1461 | GtkWidget *main_window; | 1493 | GtkWidget *main_window; |
1462 | GtkTreeView *tv; | ||
1463 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 1494 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
1464 | int can_edit_friends; | 1495 | int can_edit_friends; |
1465 | 1496 | ||
1466 | ml = cts; | 1497 | ml = cts; |
1467 | if (GNUNET_OK != | 1498 | if (GNUNET_OK != |
1468 | GNUNET_GTK_main_loop_build_window (ml, NULL)) | 1499 | GNUNET_GTK_main_loop_build_window (ml, |
1500 | NULL)) | ||
1469 | return; | 1501 | return; |
1470 | cfg = get_configuration (); | 1502 | cfg = get_configuration (); |
1471 | led_green = load_led ("green"); | 1503 | led_green = load_led ("green"); |
@@ -1535,7 +1567,7 @@ run (void *cts) | |||
1535 | g_signal_connect (tv, "query-tooltip", | 1567 | g_signal_connect (tv, "query-tooltip", |
1536 | G_CALLBACK (query_tooltip_cb), | 1568 | G_CALLBACK (query_tooltip_cb), |
1537 | NULL); | 1569 | NULL); |
1538 | 1570 | gtk_widget_freeze_child_notify (GTK_WIDGET (tv)); | |
1539 | #if HAVE_LIBUNIQUE | 1571 | #if HAVE_LIBUNIQUE |
1540 | unique_app_watch_window (unique_app, | 1572 | unique_app_watch_window (unique_app, |
1541 | GTK_WINDOW (main_window)); | 1573 | GTK_WINDOW (main_window)); |
@@ -1543,6 +1575,9 @@ run (void *cts) | |||
1543 | /* make GUI visible */ | 1575 | /* make GUI visible */ |
1544 | gtk_widget_show (main_window); | 1576 | gtk_widget_show (main_window); |
1545 | gtk_window_present (GTK_WINDOW (main_window)); | 1577 | gtk_window_present (GTK_WINDOW (main_window)); |
1578 | update_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | ||
1579 | &do_update, | ||
1580 | NULL); | ||
1546 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, | 1581 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, |
1547 | NULL); | 1582 | NULL); |
1548 | } | 1583 | } |