gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet-gtk] branch master updated: peerinfo speedup


From: gnunet
Subject: [GNUnet-SVN] [gnunet-gtk] branch master updated: peerinfo speedup
Date: Tue, 26 Jun 2018 13:06:28 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet-gtk.

The following commit(s) were added to refs/heads/master by this push:
     new 1bb62c00 peerinfo speedup
1bb62c00 is described below

commit 1bb62c00e753e2aabfaa7e45ccd66c224e8aebaa
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue Jun 26 13:06:26 2018 +0200

    peerinfo speedup
---
 contrib/gnunet_peerinfo_gtk_main_window.glade | 27 +-------
 src/peerinfo/gnunet-peerinfo-gtk.c            | 95 ++++++++++++++-------------
 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 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1
+<!-- Generated with glade 3.22.1 
 
 Copyright (C)
 
@@ -113,12 +113,6 @@ along with gnunet-peerinfo-gtk.  If not, see 
<http://www.gnu.org/licenses/>.
     <property name="can_focus">False</property>
     <property name="icon_name">help-about</property>
   </object>
-  <object class="GtkImage" id="validated_image">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="tooltip_text" translatable="yes">Address valid?</property>
-    <property name="icon_name">address-book-new</property>
-  </object>
   <object class="GtkWindow" id="GNUNET_PEERINFO_GTK_main_window">
     <property name="can_focus">False</property>
     <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/>.
                         <signal name="toggled" 
handler="GNUNET_PEERINFO_GTK_main_window_friends_cellrenderertoggle_toggled_cb" 
swapped="no"/>
                       </object>
                       <attributes>
-                        <attribute name="visible">24</attribute>
+                        <attribute name="visible">21</attribute>
                         <attribute name="active">9</attribute>
                       </attributes>
                     </child>
@@ -234,24 +228,9 @@ along with gnunet-peerinfo-gtk.  If not, see 
<http://www.gnu.org/licenses/>.
                     <property name="widget">connected_image_plugin</property>
                     <property name="reorderable">True</property>
                     <property name="sort_indicator">True</property>
-                    <property name="sort_column_id">22</property>
-                    <child>
-                      <object class="GtkCellRendererPixbuf" 
id="GNUNET_PEERINFO_GTK_main_window_plugin_led_cellrendererpixbuf"/>
-                      <attributes>
-                        <attribute name="pixbuf">21</attribute>
-                      </attributes>
-                    </child>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkTreeViewColumn" 
id="GNUNET_PEERINFO_GTK_main_window_validation_status_treeviewcolumn">
-                    <property name="visible">False</property>
-                    <property name="widget">validated_image</property>
-                    <property name="reorderable">True</property>
-                    <property name="sort_indicator">True</property>
                     <property name="sort_column_id">19</property>
                     <child>
-                      <object class="GtkCellRendererPixbuf" 
id="GNUNET_PEERINFO_GTK_main_window_valdiation_led_cellrendererpixbuf"/>
+                      <object class="GtkCellRendererPixbuf" 
id="GNUNET_PEERINFO_GTK_main_window_plugin_led_cellrendererpixbuf"/>
                       <attributes>
                         <attribute name="pixbuf">18</attribute>
                       </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 @@
 #include <unique/unique.h>
 #endif
 
-#define UPDATE_FREQUENCY GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, 10)
+#define UPDATE_FREQUENCY GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, 1)
 
 /**
  * Should we show peers that have no connections and
@@ -167,7 +167,7 @@ enum PEERINFO_ModelColumns
   /**
    * Last "column" (does not actually exist).
    */
-  PEERINFO_MC_END = 26
+  PEERINFO_MC_END = 23
 
 };
 
@@ -408,39 +408,27 @@ static UniqueApp *unique_app;
 static void
 do_update (void *cls)
 {
-  (void) cls;
-  update_task = GNUNET_SCHEDULER_add_delayed (UPDATE_FREQUENCY,
-                                              &do_update,
-                                              NULL);
-#if 0
   GtkTreeStore *sts;
+  GtkTreeIter iter;
+  static int phase;
 
-  sts = gtk_tree_store_new (PEERINFO_MC_END,
-                            G_TYPE_STRING, /* pid */
-                            G_TYPE_STRING, /* country name */
-                            GDK_TYPE_PIXBUF, /* country flag */
-                            G_TYPE_UINT, /* bandwidth_in */
-                            G_TYPE_UINT, /* bandwidth_out */
-                            GDK_TYPE_PIXBUF, /* ATS led */
-                            G_TYPE_BOOLEAN, /* ATS selected */
-                            GDK_TYPE_PIXBUF, /* CORE led */
-                            G_TYPE_UINT, /* core status */
-                            G_TYPE_BOOLEAN, /* is friend */
-                            G_TYPE_POINTER, /* peerinfo */
-                            G_TYPE_STRING, /* plugin name */
-                            G_TYPE_STRING, /* address */
-                            GDK_TYPE_PIXBUF, /* neighbour connectivity */
-                            G_TYPE_BOOLEAN, /* connected status */
-                            G_TYPE_STRING, /* timeout as string */
-                            G_TYPE_STRING, /* neighbour state as string */
-                            G_TYPE_STRING, /* neighbour state timeout as 
string */
-                            GDK_TYPE_PIXBUF, /* plugin connectivity led */
-                            G_TYPE_BOOLEAN, /* plugin connectivity status */
-                            G_TYPE_STRING, /* connectivity timeout plugin */
-                            G_TYPE_BOOLEAN, /* show friend */
-                            G_TYPE_STRING /* peerinfo addr expiration */
-                            );
-#endif
+  (void) cls;
+  phase++;
+  if (0 == (phase % 2))
+  {
+    gtk_widget_thaw_child_notify (GTK_WIDGET (tv));
+    update_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS,
+                                               &do_update,
+                                               NULL);
+
+  }
+  else
+  {
+    gtk_widget_freeze_child_notify (GTK_WIDGET (tv));
+    update_task = GNUNET_SCHEDULER_add_delayed (UPDATE_FREQUENCY,
+                                               &do_update,
+                                               NULL);
+  }
 }
 
 
@@ -689,7 +677,9 @@ get_address (struct PeerInfo *pi,
                                pa);
   path = gtk_tree_row_reference_get_path (pi->rr);
   GNUNET_assert (NULL != path);
-  GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ts), &iter, path));
+  GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ts),
+                                         &iter,
+                                         path));
   gtk_tree_path_free (path);
   gtk_tree_store_insert_with_values (ts,
                                      &aiter,
@@ -697,14 +687,18 @@ get_address (struct PeerInfo *pi,
                                      -1 /* append */,
                                      PEERINFO_MC_PLUGIN_NAME, 
addr->transport_name,
                                      -1);
-  path = gtk_tree_model_get_path (GTK_TREE_MODEL (ts), &aiter);
-  pa->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts), path);
+  path = gtk_tree_model_get_path (GTK_TREE_MODEL (ts),
+                                 &aiter);
+  pa->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts),
+                                      path);
   GNUNET_assert (NULL != pa->rr);
   gtk_tree_path_free (path);
-  pa->tos = GNUNET_TRANSPORT_address_to_string (get_configuration (), addr,
+  pa->tos = GNUNET_TRANSPORT_address_to_string (get_configuration (),
+                                               addr,
                                                 GNUNET_NO,
                                                 GNUNET_TIME_UNIT_FOREVER_REL,
-                                                &peer_address_string_cb, pa);
+                                                &peer_address_string_cb,
+                                               pa);
 
   return pa;
 }
@@ -730,7 +724,9 @@ peer_address_cb (void *cts,
 
   path = gtk_tree_row_reference_get_path (info->rr);
   GNUNET_assert (NULL != path);
-  GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ts), &iter, path));
+  GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ts),
+                                         &iter,
+                                         path));
   gtk_tree_path_free (path);
   pa = get_address (info, address);
   get_iter_from_rr (pa->rr, &iter);
@@ -775,12 +771,16 @@ get_peer_info (const struct GNUNET_PeerIdentity *peer)
                       PEERINFO_MC_PEERINFO, info,
                       PEERINFO_MC_SHOW_FRIEND, TRUE,
                       -1);
-  path = gtk_tree_model_get_path (GTK_TREE_MODEL (ts), &iter);
-  info->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts), path);
+  path = gtk_tree_model_get_path (GTK_TREE_MODEL (ts),
+                                 &iter);
+  info->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts),
+                                        path);
   GNUNET_assert (NULL != info->rr);
   gtk_tree_path_free (path);
   GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CONTAINER_multipeermap_put (peer2info, peer, info,
+                 GNUNET_CONTAINER_multipeermap_put (peer2info,
+                                                   peer,
+                                                   info,
                                                     
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
   return info;
 }
@@ -1337,16 +1337,20 @@ 
GNUNET_PEERINFO_GTK_main_window_friends_cellrenderertoggle_toggled_cb (GtkCellRe
     GNUNET_break (0);
     return;
   }
-  if (! gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ts), &old, path))
+  if (! gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ts),
+                                            &old,
+                                            path))
   {
     GNUNET_break (0);
     return;
   }
-  gtk_tree_model_get (GTK_TREE_MODEL (ts), &old,
+  gtk_tree_model_get (GTK_TREE_MODEL (ts),
+                     &old,
                       PEERINFO_MC_PEERINFO, &info,
                       PEERINFO_MC_IS_FRIEND, &oldvalue,
                       -1);
-  gtk_tree_store_set (ts, &old,
+  gtk_tree_store_set (ts,
+                     &old,
                       PEERINFO_MC_IS_FRIEND, ! oldvalue,
                       -1);
   if (oldvalue)
@@ -1577,7 +1581,6 @@ 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));

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]