gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r37746 - gnunet-gtk/src/statistics


From: gnunet
Subject: [GNUnet-SVN] r37746 - gnunet-gtk/src/statistics
Date: Mon, 22 Aug 2016 14:46:02 +0200

Author: grothoff
Date: 2016-08-22 14:46:02 +0200 (Mon, 22 Aug 2016)
New Revision: 37746

Modified:
   gnunet-gtk/src/statistics/gnunet-statistics-gtk.c
Log:
indentation, DCE

Modified: gnunet-gtk/src/statistics/gnunet-statistics-gtk.c
===================================================================
--- gnunet-gtk/src/statistics/gnunet-statistics-gtk.c   2016-08-20 17:56:20 UTC 
(rev 37745)
+++ gnunet-gtk/src/statistics/gnunet-statistics-gtk.c   2016-08-22 12:46:02 UTC 
(rev 37746)
@@ -119,11 +119,6 @@
 static struct GNUNET_STATISTICS_Handle *statistics;
 
 /**
- * Task that refreshes connection graphic.
- */
-static struct GNUNET_SCHEDULER_Task * connection_task;
-
-/**
  * When did this process start?
  */
 static struct GNUNET_TIME_Absolute start_time;
@@ -136,20 +131,28 @@
  * @param subsystem name of subsystem that created the statistic
  * @param name the name of the datum
  * @param value the current value
- * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
- * @return GNUNET_OK to continue
+ * @param is_persistent #GNUNET_YES if the value is persistent, #GNUNET_NO if 
not
+ * @return #GNUNET_OK to continue
  */
 static int
-process_value_update (void *cls, const char *subsystem, const char *name,
-                      uint64_t value, int is_persistent)
+process_value_update (void *cls,
+                      const char *subsystem,
+                      const char *name,
+                      uint64_t value,
+                      int is_persistent)
 {
   GtkStatistics *stats = cls;
   char *id;
 
-  GNUNET_asprintf (&id, "%s: %s", subsystem, name);
-  gtk_statistics_update_value (stats, id,
+  GNUNET_asprintf (&id,
+                   "%s: %s",
+                   subsystem,
+                   name);
+  gtk_statistics_update_value (stats,
+                               id,
                                GNUNET_TIME_absolute_get_duration
-                               (start_time).rel_value_us / 1000000LL, value);
+                               (start_time).rel_value_us / 1000000LL,
+                               value);
   GNUNET_free (id);
   return GNUNET_OK;
 }
@@ -175,26 +178,39 @@
  * @param info what to draw
  */
 static void
-create_plot (const char *box_name, const struct PlotInfo *info)
+create_plot (const char *box_name,
+             const struct PlotInfo *info)
 {
   GtkBox *box;
   GtkStatistics *ret;
-  unsigned int i;
   char *id;
 
   ret = GTK_STATISTICS (gtk_statistics_new ());
   box = GTK_BOX (get_object (box_name));
 
-  for (i = 0; NULL != info[i].subsystem; i++)
+  for (unsigned int i = 0; NULL != info[i].subsystem; i++)
   {
-    GNUNET_asprintf (&id, "%s: %s", info[i].subsystem, info[i].name);
-    gtk_statistics_add_line (ret, id, info[i].label, info[i].color_name);
+    GNUNET_asprintf (&id,
+                     "%s: %s",
+                     info[i].subsystem,
+                     info[i].name);
+    gtk_statistics_add_line (ret,
+                             id,
+                             info[i].label,
+                             info[i].color_name);
     GNUNET_free (id);
-    GNUNET_STATISTICS_watch (statistics, info[i].subsystem, info[i].name,
-                             &process_value_update, ret);
+    GNUNET_STATISTICS_watch (statistics,
+                             info[i].subsystem,
+                             info[i].name,
+                             &process_value_update,
+                             ret);
   }
   gtk_widget_show (GTK_WIDGET (ret));
-  gtk_box_pack_start (box, GTK_WIDGET (ret), TRUE, TRUE, 0);
+  gtk_box_pack_start (box,
+                      GTK_WIDGET (ret),
+                      TRUE,
+                      TRUE,
+                      0);
 }
 
 
@@ -209,13 +225,9 @@
   GNUNET_GTK_tray_icon_destroy ();
   GNUNET_GTK_main_loop_quit (ml);
   ml = NULL;
-  GNUNET_STATISTICS_destroy (statistics, GNUNET_NO);
+  GNUNET_STATISTICS_destroy (statistics,
+                             GNUNET_NO);
   statistics = NULL;
-  if (connection_task != NULL)
-  {
-    GNUNET_SCHEDULER_cancel (connection_task);
-    connection_task = NULL;
-  }
 }
 
 
@@ -223,7 +235,8 @@
  * Callback invoked if the application is supposed to exit.
  */
 void
-GNUNET_STATISTICS_GTK_quit_cb (GObject * object, gpointer user_data)
+GNUNET_STATISTICS_GTK_quit_cb (GObject *object,
+                               gpointer user_data)
 {
   GNUNET_SCHEDULER_shutdown ();
 }
@@ -240,13 +253,15 @@
 
   ml = cls;
 
-  if (GNUNET_OK != GNUNET_GTK_main_loop_build_window (ml, NULL))
+  if (GNUNET_OK !=
+      GNUNET_GTK_main_loop_build_window (ml,
+                                         NULL))
   {
     return;
   }
 
-  statistics =
-      GNUNET_STATISTICS_create ("gnunet-statistics-gtk",
+  statistics
+    = GNUNET_STATISTICS_create ("gnunet-statistics-gtk",
                                 GNUNET_GTK_main_loop_get_configuration (ml));
   if (NULL == statistics)
   {
@@ -265,25 +280,30 @@
   if (NULL == getenv ("GNUNET_STATISTICS_GTK_PLUG"))
     GNUNET_GTK_tray_icon_create (ml,
                                  GTK_WINDOW (main_window),
-                                 "gnunet-gtk" /* FIXME: different icon? */ ,
+                                 "gnunet-gtk" /* FIXME: different icon? */,
                                  "gnunet-statistics-gtk");
 
-  create_plot ("GNUNET_STATISTICS_GTK_connectivity_box", connection_data);
-  create_plot ("GNUNET_STATISTICS_GTK_traffic_box", traffic_data);
-  create_plot ("GNUNET_STATISTICS_GTK_storage_box", storage_data);
+  create_plot ("GNUNET_STATISTICS_GTK_connectivity_box",
+               connection_data);
+  create_plot ("GNUNET_STATISTICS_GTK_traffic_box",
+               traffic_data);
+  create_plot ("GNUNET_STATISTICS_GTK_storage_box",
+               storage_data);
 
   /* make GUI visible */
-  if (!tray_only)
+  if (! tray_only)
   {
     gtk_widget_show (main_window);
     gtk_window_present (GTK_WINDOW (main_window));
   }
-  GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
+  GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
+                                 NULL);
 }
 
 
 int
-main (int argc, char *const *argv)
+main (int argc,
+      char *const *argv)
 {
   static struct GNUNET_GETOPT_CommandLineOption options[] = {
     {'t', "tray", NULL,
@@ -295,8 +315,10 @@
   start_time = GNUNET_TIME_absolute_get ();
   if (GNUNET_OK !=
       GNUNET_GTK_main_loop_start ("gnunet-statistics-gtk",
-                                  "GTK GUI for viewing GNUnet statistics", 
argc,
-                                  argv, options,
+                                  "GTK GUI for viewing GNUnet statistics",
+                                  argc,
+                                  argv,
+                                  options,
                                   "gnunet_statistics_gtk_main_window.glade",
                                   &run))
     return 1;




reply via email to

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