[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r18477 - in gnunet-gtk: . contrib src src/statistics
From: |
gnunet |
Subject: |
[GNUnet-SVN] r18477 - in gnunet-gtk: . contrib src src/statistics |
Date: |
Tue, 6 Dec 2011 20:54:07 +0100 |
Author: grothoff
Date: 2011-12-06 20:54:07 +0100 (Tue, 06 Dec 2011)
New Revision: 18477
Added:
gnunet-gtk/contrib/gnunet_statistics_gtk_about_dialog.glade
gnunet-gtk/contrib/gnunet_statistics_gtk_main_window.glade
gnunet-gtk/src/statistics/
gnunet-gtk/src/statistics/Makefile.am
gnunet-gtk/src/statistics/functions.c
gnunet-gtk/src/statistics/functions.h
gnunet-gtk/src/statistics/gnunet-statistics-gtk.c
gnunet-gtk/src/statistics/statistics.c
Modified:
gnunet-gtk/configure.ac
gnunet-gtk/contrib/Makefile.am
gnunet-gtk/src/Makefile.am
Log:
adding skeleton for gnunet-statistics-gtk
Modified: gnunet-gtk/configure.ac
===================================================================
--- gnunet-gtk/configure.ac 2011-12-06 19:06:30 UTC (rev 18476)
+++ gnunet-gtk/configure.ac 2011-12-06 19:54:07 UTC (rev 18477)
@@ -367,6 +367,7 @@
src/fs/Makefile
src/peerinfo/Makefile
src/setup/Makefile
+src/statistics/Makefile
pixmaps/Makefile
po/Makefile.in
po/Makefile
Modified: gnunet-gtk/contrib/Makefile.am
===================================================================
--- gnunet-gtk/contrib/Makefile.am 2011-12-06 19:06:30 UTC (rev 18476)
+++ gnunet-gtk/contrib/Makefile.am 2011-12-06 19:54:07 UTC (rev 18477)
@@ -32,6 +32,8 @@
gnunet_gtk_status_bar_menu.glade \
gnunet_peerinfo_gtk_about_dialog.glade \
gnunet_peerinfo_gtk_main_window.glade \
+ gnunet_statistics_gtk_about_dialog.glade \
+ gnunet_statistics_gtk_main_window.glade \
gnunet_setup_gtk_main_window.glade
install-data-local:
Added: gnunet-gtk/contrib/gnunet_statistics_gtk_about_dialog.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_statistics_gtk_about_dialog.glade
(rev 0)
+++ gnunet-gtk/contrib/gnunet_statistics_gtk_about_dialog.glade 2011-12-06
19:54:07 UTC (rev 18477)
@@ -0,0 +1,382 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <requires lib="gtk+" version="2.20"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkAboutDialog" id="GNUNET_STATISTICS_GTK_about_dialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">About
gnunet-statistics-gtk</property>
+ <property name="modal">True</property>
+ <property name="window_position">center</property>
+ <property name="type_hint">normal</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="skip_pager_hint">True</property>
+ <property name="urgency_hint">True</property>
+ <property name="program_name">gnunet-statistics-gtk</property>
+ <property name="version">0.9.0</property>
+ <property name="copyright" translatable="yes">(C) 2011 The GNUnet
Project</property>
+ <property name="website">https://gnunet.org/</property>
+ <property name="website_label" translatable="yes">GNUnet: GNU's Framework
for Secure P2P Networking</property>
+ <property name="license" translatable="yes"> GNU
GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+</property>
+ <property name="authors">Juergen Appel <address@hidden>
+Krista Grothoff <address@hidden>
+James Blackwell <address@hidden>
+Ludovic Courtes <address@hidden>
+Nils Durner <address@hidden>
+Renaldo Ferreira <address@hidden>
+Christian Grothoff <address@hidden>
+Eric Haumant
+Tzvetan Horozov <address@hidden>
+Gerd Knorr <address@hidden>
+Werner Koch <address@hidden>
+Uli Luckas <address@hidden>
+Blake Matheny
+Glenn McGrath
+Hendrik Pagenhardt <address@hidden>
+Ioana Patrascu <address@hidden>
+Marko Raeihae
+Paul Ruth <address@hidden>
+Risto Saarelma
+Antti Salonen
+Tiberius Stef <address@hidden>
+Tuomas Toivonen
+Tomi Tukiainen
+Kevin Vandersloot <address@hidden>
+Simo Viitanen
+Larry Waldo
+Igor Wronsky <address@hidden>
+<address@hidden>
+</property>
+ <property name="documenters">Christian Grothoff <address@hidden>
+Anders Carlsson <address@hidden>
+Nils Durner <address@hidden>
+Nicklas Larsson <address@hidden>
+Milan Bouchet-Valat <address@hidden>
+Igor Wronsky <address@hidden>
+</property>
+ <property name="translator_credits" translatable="yes"
comments="TRANSLATORS: Replace this string with your names, one name per
line.">Di Ma
+Jens Palsberg <address@hidden>
+Christian Grothoff <address@hidden>
+Nils Durner <address@hidden>
+Mathieu <address@hidden>
+Eric Haumant
address@hidden
+Hiroshi Yamauchi <address@hidden>
+Adam Welc <address@hidden>
+Bogdan Carbunar <address@hidden>
+Steven Michael Murphy <address@hidden>
+Phan Vinh Thinh <address@hidden>
+Daniel Nylander <address@hidden>
+</property>
+ <property name="artists">Jakub 'jimmac' Steiner <address@hidden>
+Christian Muellner <address@hidden>
+Alex Jones <address@hidden>
+Nicklas Larsson <address@hidden>
+</property>
+ <property name="logo">gnunet_logo.png</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
Added: gnunet-gtk/contrib/gnunet_statistics_gtk_main_window.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_statistics_gtk_main_window.glade
(rev 0)
+++ gnunet-gtk/contrib/gnunet_statistics_gtk_main_window.glade 2011-12-06
19:54:07 UTC (rev 18477)
@@ -0,0 +1,146 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.20"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkListStore" id="GNUNET_STATISTICS_GTK_list_store">
+ <columns>
+ <!-- column-name peer_identity -->
+ <column type="gchararray"/>
+ <!-- column-name number_of_known_addresses -->
+ <column type="guint"/>
+ <!-- column-name country_name -->
+ <column type="gchararray"/>
+ <!-- column-name country_flag -->
+ <column type="GdkPixbuf"/>
+ <!-- column-name bandwidth_in -->
+ <column type="guint64"/>
+ <!-- column-name bandwidth_out -->
+ <column type="guint64"/>
+ <!-- column-name addresses -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkWindow" id="GNUNET_STATISTICS_GTK_main_window">
+ <property name="title" translatable="yes">gnunet-statistics-gtk</property>
+ <property name="window_position">center</property>
+ <property name="default_width">700</property>
+ <property name="default_height">500</property>
+ <property name="icon_name">gnunet-gtk</property>
+ <signal name="delete_event" handler="GNUNET_STATISTICS_GTK_quit_cb"
after="yes"/>
+ <child>
+ <object class="GtkVBox" id="GNUNET_STATISTICS_GTK_main_window_vbox">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkMenuBar" id="GNUNET_STATISTICS_GTK_main_menu">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkMenuItem"
id="GNUNET_STATISTICS_GTK_main_menu_help">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Help</property>
+ <property name="use_underline">True</property>
+ <child type="submenu">
+ <object class="GtkMenu"
id="GNUNET_STATISTICS_GTK_main_menu_help_abou">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkImageMenuItem"
id="GNUNET_STATISTICS_GTK_main_menu_help_about">
+ <property name="label">gtk-about</property>
+ <property name="visible">True</property>
+ <property name="tooltip_text"
translatable="yes">Display information about this version of
gnunet-statistics-gtk</property>
+ <property
name="accel_path"><gnunet-statistics-gtk>/Help/About</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ <signal name="activate"
handler="GNUNET_STATISTICS_GTK_main_menu_help_about_activate_cb"/>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkNotebook" id="GNUNET_STATISTICS_GTK_main_notebook">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <object class="GtkImage"
id="GNUNET_STATISTICS_GTK_main_notebook_connectivity_image">
+ <property name="visible">True</property>
+ <property name="stock">gtk-missing-image</property>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel"
id="GNUNET_STATISTICS_GTK_main_notebook_connectivity_label">
+ <property name="visible">True</property>
+ <property name="label"
translatable="yes">_Connections</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkImage"
id="GNUNET_STATISTICS_GTK_main_notebook_traffic_image">
+ <property name="visible">True</property>
+ <property name="stock">gtk-missing-image</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel"
id="GNUNET_STATISTICS_GTK_main_notebook_traffic_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Traffic</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkImage"
id="GNUNET_STATISTICS_GTK_main_notebook_storage_image">
+ <property name="visible">True</property>
+ <property name="stock">gtk-missing-image</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel"
id="GNUNET_STATISTICS_GTK_main_notebook_storage_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Storage</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkAdjustment" id="adjustment3">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ <property name="page_size">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment4">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ <property name="page_size">10</property>
+ </object>
+</interface>
Modified: gnunet-gtk/src/Makefile.am
===================================================================
--- gnunet-gtk/src/Makefile.am 2011-12-06 19:06:30 UTC (rev 18476)
+++ gnunet-gtk/src/Makefile.am 2011-12-06 19:54:07 UTC (rev 18477)
@@ -1 +1 @@
-SUBDIRS = . include lib $(GNUNET_FS_APP) $(GNUNET_SETUP_APP)
$(GNUNET_PEERINFO_APP)
+SUBDIRS = . include lib $(GNUNET_FS_APP) $(GNUNET_SETUP_APP)
$(GNUNET_PEERINFO_APP) statistics
Added: gnunet-gtk/src/statistics/Makefile.am
===================================================================
--- gnunet-gtk/src/statistics/Makefile.am (rev 0)
+++ gnunet-gtk/src/statistics/Makefile.am 2011-12-06 19:54:07 UTC (rev
18477)
@@ -0,0 +1,22 @@
+SUBDIRS = .
+
+INCLUDES = \
+ -I$(top_srcdir)/ \
+ -I$(top_srcdir)/src/include \
+ @GTK_CFLAGS@ \
+ @GNUNET_CFLAGS@ \
+ @GLADE_CFLAGS@
+
+bin_PROGRAMS = gnunet-statistics-gtk
+
+gnunet_statistics_gtk_SOURCES = \
+ gnunet-statistics-gtk.c \
+ gnunet-statistics-gtk-about.c
+gnunet_statistics_gtk_LDADD = \
+ $(top_builddir)/src/lib/libgnunetgtk.la \
+ @GTK_LIBS@ \
+ @GLADE_LIBS@ @GNUNET_LIBS@ \
+ -lgnunetutil -lgnunetstatistics -lgnunetcore -lgnunettransport \
+ $(INTLLIBS)
+gnunet_statistics_gtk_LDFLAGS = \
+ -export-dynamic
\ No newline at end of file
Added: gnunet-gtk/src/statistics/functions.c
===================================================================
--- gnunet-gtk/src/statistics/functions.c (rev 0)
+++ gnunet-gtk/src/statistics/functions.c 2011-12-06 19:54:07 UTC (rev
18477)
@@ -0,0 +1,656 @@
+/*
+ This file is part of GNUnet
+ (C) 2004, 2005, 2006, 2008 Christian Grothoff (and other contributing
authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include "platform.h"
+#include "gnunetgtk_common.h"
+#include <GNUnet/gnunet_util_cron.h>
+#include <GNUnet/gnunet_stats_lib.h>
+#include <GNUnet/gnunet_getoption_lib.h>
+#include <GNUnet/gnunet_protocols.h>
+#include "functions.h"
+
+#define FUNCTIONS_DEBUG GNUNET_NO
+
+static StatPair *lastStatValues;
+
+static unsigned int lsv_size;
+
+static struct GNUNET_ClientServerConnection *sock;
+
+static struct GNUNET_Mutex *lock;
+
+static long connectionGoal;
+
+static unsigned long long banddown;
+
+static unsigned long long bandup;
+
+static struct GNUNET_GE_Context *ectx;
+
+static struct GNUNET_GC_Configuration *cfg;
+
+static struct GNUNET_CronManager *cron;
+
+static int
+getStatValue (unsigned long long *value,
+ unsigned long long *lvalue,
+ GNUNET_CronTime * dtime, const char *optName, int monotone)
+{
+ unsigned int i;
+
+ *value = 0;
+ if (lvalue != NULL)
+ *lvalue = 0;
+ for (i = 0; i < lsv_size; i++)
+ {
+ if (0 == strcmp (optName, lastStatValues[i].statName))
+ {
+ *value = lastStatValues[i].value;
+ if (lvalue != NULL)
+ *lvalue = lastStatValues[i].lvalue;
+ if (dtime != NULL)
+ *dtime = lastStatValues[i].delta;
+ if ((monotone == GNUNET_YES) && (lvalue != NULL)
+ && (*lvalue > *value))
+ return GNUNET_SYSERR; /* gnunetd restart? */
+ return GNUNET_OK;
+ }
+ }
+#if FUNCTIONS_DEBUG
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_DEVELOPER | GNUNET_GE_ADMIN |
+ GNUNET_GE_USER | GNUNET_GE_BULK,
+ "Statistic not found: `%s'\n", optName);
+#endif
+ return GNUNET_SYSERR;
+}
+
+static void
+updateConnectionGoal (void *unused)
+{
+ char *cmh;
+ char *availableDown;
+ char *availableUp;
+
+ GNUNET_mutex_lock (lock);
+ cmh =
+ GNUNET_get_daemon_configuration_value (sock, "gnunetd",
+ "connection-max-hosts");
+ availableDown =
+ GNUNET_get_daemon_configuration_value (sock, "LOAD",
+ "MAXNETDOWNBPSTOTAL");
+ availableUp =
+ GNUNET_get_daemon_configuration_value (sock, "LOAD", "MAXNETUPBPSTOTAL");
+ GNUNET_mutex_unlock (lock);
+ if (cmh == NULL)
+ connectionGoal = 0;
+ else
+ connectionGoal = atol (cmh);
+ if (availableDown == NULL)
+ banddown = 0;
+ else
+ banddown = atol (availableDown);
+ if (availableUp == NULL)
+ bandup = 0;
+ else
+ bandup = atol (availableUp);
+
+ GNUNET_free_non_null (cmh);
+ GNUNET_free_non_null (availableDown);
+ GNUNET_free_non_null (availableUp);
+}
+
+static int
+getConnectedNodesStat (const void *closure, gfloat ** data)
+{
+ unsigned long long val;
+
+ if (connectionGoal == 0)
+ return GNUNET_SYSERR;
+ if (GNUNET_OK !=
+ getStatValue (&val, NULL, NULL, "# of connected peers", GNUNET_NO))
+ return GNUNET_SYSERR;
+ data[0][0] = ((gfloat) val) / connectionGoal;
+ return GNUNET_OK;
+}
+
+static int
+getLoadStat (const void *closure, gfloat ** data)
+{
+ unsigned long long valc;
+ unsigned long long vali;
+ unsigned long long valu;
+ unsigned long long vald;
+
+ if (GNUNET_OK !=
+ getStatValue (&valc, NULL, NULL, "% of allowed cpu load", GNUNET_NO))
+ return GNUNET_SYSERR;
+ if (GNUNET_OK !=
+ getStatValue (&vali, NULL, NULL, "% of allowed io load", GNUNET_NO))
+ return GNUNET_SYSERR;
+ if (GNUNET_OK != getStatValue (&valu,
+ NULL, NULL, "% of allowed network load (up)",
+ GNUNET_NO))
+ return GNUNET_SYSERR;
+ if (GNUNET_OK != getStatValue (&vald,
+ NULL, NULL,
+ "% of allowed network load (down)",
+ GNUNET_NO))
+ return GNUNET_SYSERR;
+ data[0][0] = (gfloat) valc / 100.0;
+ data[0][1] = (gfloat) vali / 100.0;
+ data[0][2] = (gfloat) valu / 100.0;
+ data[0][3] = (gfloat) vald / 100.0;
+ return GNUNET_OK;
+}
+
+static int
+getQuotaStat (const void *closure, gfloat ** data)
+{
+ unsigned long long allowed;
+ unsigned long long have;
+
+ data[0][0] = 0;
+ data[0][1] = 0;
+ if ((GNUNET_OK == getStatValue (&allowed,
+ NULL, NULL, "# bytes allowed in datastore",
+ GNUNET_NO)) &&
+ (allowed != 0) &&
+ (GNUNET_OK ==
+ getStatValue (&have, NULL, NULL, "# bytes in datastore", GNUNET_NO)))
+ data[0][0] = ((gfloat) have) / allowed;
+ if ((GNUNET_OK == getStatValue (&allowed,
+ NULL, NULL, "# max bytes allowed in dstore",
+ GNUNET_NO)) &&
+ (allowed != 0) &&
+ (GNUNET_OK ==
+ getStatValue (&have, NULL, NULL, "# bytes in dstore", GNUNET_NO)))
+ data[0][1] = ((gfloat) have) / allowed;
+ return GNUNET_OK;
+}
+
+static int
+getTrafficRecvStats (const void *closure, gfloat ** data)
+{
+ unsigned long long total;
+ unsigned long long noise;
+ unsigned long long content;
+ unsigned long long queries;
+ unsigned long long hellos;
+ unsigned long long rlimit;
+ unsigned long long ltotal;
+ unsigned long long lnoise;
+ unsigned long long lcontent;
+ unsigned long long lqueries;
+ unsigned long long lhellos;
+ unsigned long long lrlimit;
+ GNUNET_CronTime dtime;
+ char *buffer;
+
+ if (GNUNET_OK !=
+ getStatValue (&total, <otal, &dtime, "# bytes received", GNUNET_YES))
+ return GNUNET_SYSERR;
+ if (GNUNET_OK != getStatValue (&noise,
+ &lnoise, NULL, "# bytes of noise received",
+ GNUNET_YES))
+ return GNUNET_SYSERR;
+ buffer = GNUNET_malloc (512);
+ GNUNET_snprintf (buffer, 512, "# bytes received of type %d",
+ GNUNET_P2P_PROTO_GAP_RESULT);
+ if (GNUNET_OK !=
+ getStatValue (&content, &lcontent, NULL, buffer, GNUNET_YES))
+ {
+ content = 0;
+ lcontent = 0;
+ }
+ GNUNET_snprintf (buffer, 512, "# bytes received of type %d",
+ GNUNET_P2P_PROTO_HELLO);
+ if (GNUNET_OK != getStatValue (&hellos, &lhellos, NULL, buffer, GNUNET_YES))
+ {
+ hellos = 0;
+ lhellos = 0;
+ }
+ GNUNET_snprintf (buffer, 512, "# bytes received of type %d",
+ GNUNET_P2P_PROTO_GAP_QUERY);
+ if (GNUNET_OK !=
+ getStatValue (&queries, &lqueries, NULL, buffer, GNUNET_YES))
+ {
+ queries = 0;
+ lqueries = 0;
+ }
+ if (GNUNET_OK != getStatValue (&rlimit,
+ &lrlimit,
+ NULL,
+ "# total bytes per second receive limit",
+ GNUNET_NO))
+ {
+ rlimit = 0;
+ lrlimit = 0;
+ }
+ GNUNET_free (buffer);
+ if (banddown == 0)
+ return GNUNET_SYSERR;
+
+ total -= ltotal;
+ noise -= lnoise;
+ queries -= lqueries;
+ content -= lcontent;
+ hellos -= lhellos;
+ if (banddown <= 0)
+ {
+ data[0][0] = 0.0;
+ data[0][1] = 0.0;
+ data[0][2] = 0.0;
+ data[0][3] = 0.0;
+ data[0][4] = 0.0;
+ data[0][5] = 0.0;
+ return GNUNET_OK;
+ }
+ data[0][0] = ((gfloat) noise) / (banddown * dtime / GNUNET_CRON_SECONDS);
/* red */
+ data[0][1] = ((gfloat) (content + noise)) / (banddown * dtime /
GNUNET_CRON_SECONDS); /* green */
+ data[0][2] = ((gfloat) (queries + content + noise)) / (banddown * dtime /
GNUNET_CRON_SECONDS); /* yellow */
+ data[0][3] = ((gfloat) (queries + content + noise + hellos)) / (banddown *
dtime / GNUNET_CRON_SECONDS); /* blue */
+ data[0][4] = ((gfloat) total) / (banddown * dtime / GNUNET_CRON_SECONDS);
/* gray */
+ data[0][5] = (gfloat) rlimit / banddown; /* magenta */
+#if 0
+ printf ("I: %f %f %f %f\n", data[0][0], data[0][1], data[0][2]);
+#endif
+ return GNUNET_OK;
+}
+
+static int
+getTrafficSendStats (const void *closure, gfloat ** data)
+{
+ unsigned long long total;
+ unsigned long long noise;
+ unsigned long long content;
+ unsigned long long queries;
+ unsigned long long hellos;
+ unsigned long long slimit;
+ unsigned long long ltotal;
+ unsigned long long lnoise;
+ unsigned long long lcontent;
+ unsigned long long lqueries;
+ unsigned long long lhellos;
+ unsigned long long lslimit;
+ GNUNET_CronTime dtime;
+ char *buffer;
+
+ if (GNUNET_OK != getStatValue (&total,
+ <otal, &dtime, "# bytes transmitted",
+ GNUNET_YES))
+ return GNUNET_SYSERR;
+ if (GNUNET_OK !=
+ getStatValue (&noise, &lnoise, NULL, "# bytes noise sent", GNUNET_YES))
+ return GNUNET_SYSERR;
+ buffer = GNUNET_malloc (512);
+ GNUNET_snprintf (buffer,
+ 512, "# bytes transmitted of type %d",
+ GNUNET_P2P_PROTO_GAP_RESULT);
+ if (GNUNET_OK !=
+ getStatValue (&content, &lcontent, NULL, buffer, GNUNET_YES))
+ {
+ content = 0;
+ lcontent = 0;
+ }
+ GNUNET_snprintf (buffer,
+ 512, "# bytes transmitted of type %d",
+ GNUNET_P2P_PROTO_GAP_QUERY);
+ if (GNUNET_OK !=
+ getStatValue (&queries, &lqueries, NULL, buffer, GNUNET_YES))
+ {
+ queries = 0;
+ lqueries = 0;
+ }
+ GNUNET_snprintf (buffer, 512, "# bytes transmitted of type %d",
+ GNUNET_P2P_PROTO_HELLO);
+ if (GNUNET_OK != getStatValue (&hellos, &lhellos, NULL, buffer, GNUNET_YES))
+ {
+ queries = 0;
+ lqueries = 0;
+ }
+ if (GNUNET_OK != getStatValue (&slimit,
+ &lslimit,
+ NULL, "# total bytes per second send limit",
+ GNUNET_NO))
+ {
+ slimit = 0;
+ lslimit = 0;
+ }
+ GNUNET_free (buffer);
+ if (bandup == 0)
+ return GNUNET_SYSERR;
+ total -= ltotal;
+ noise -= lnoise;
+ queries -= lqueries;
+ content -= lcontent;
+ hellos -= lhellos;
+ if (bandup <= 0)
+ {
+ data[0][0] = 0.0;
+ data[0][1] = 0.0;
+ data[0][2] = 0.0;
+ data[0][3] = 0.0;
+ data[0][4] = 0.0;
+ data[0][5] = 0.0;
+ return GNUNET_OK;
+ }
+ data[0][0] = ((gfloat) noise) / (bandup * dtime / GNUNET_CRON_SECONDS);
/* red */
+ data[0][1] = ((gfloat) (noise + content)) / (bandup * dtime /
GNUNET_CRON_SECONDS); /* green */
+ data[0][2] = ((gfloat) (noise + content + queries)) / (bandup * dtime /
GNUNET_CRON_SECONDS); /* yellow */
+ data[0][3] = ((gfloat) (noise + content + queries + hellos)) / (bandup *
dtime / GNUNET_CRON_SECONDS); /* blue */
+ data[0][4] = ((gfloat) total) / (bandup * dtime / GNUNET_CRON_SECONDS);
/* grey */
+ data[0][5] = ((gfloat) slimit) / bandup; /* magenta */
+#if 0
+ printf ("O: %f %f %f %f\n", data[0][0], data[0][1], data[0][2], data[0][3]);
+#endif
+ return GNUNET_OK;
+}
+
+static int
+getTrustStats (const void *closure, gfloat ** data)
+{
+ unsigned long long spent;
+ unsigned long long earned;
+ unsigned long long awarded;
+ unsigned long long lspent;
+ unsigned long long learned;
+ unsigned long long lawarded;
+ unsigned long long max;
+
+ if (GNUNET_OK != getStatValue (&spent,
+ &lspent, NULL, "# trust spent", GNUNET_YES))
+ return GNUNET_SYSERR;
+ if (GNUNET_OK != getStatValue (&earned,
+ &learned,
+ NULL, "# trust earned", GNUNET_YES))
+ return GNUNET_SYSERR;
+ if (GNUNET_OK != getStatValue (&awarded,
+ &lawarded,
+ NULL, "# gap total trust awarded",
+ GNUNET_YES))
+ return GNUNET_SYSERR;
+ max = spent;
+ if (earned > max)
+ max = earned;
+ if (awarded > max)
+ max = awarded;
+ data[0][0] = 0.0;
+ if (max > 0)
+ {
+ data[0][0] = (1.0 * spent) / max;
+ data[0][1] = (1.0 * earned) / max;
+ data[0][2] = (1.0 * awarded) / max;
+ }
+ else
+ {
+ data[0][0] = 0.0;
+ data[0][1] = 0.0;
+ data[0][2] = 0.0;
+ }
+ return GNUNET_OK;
+}
+
+static int
+getEffectivenessStats (const void *closure, gfloat ** data)
+{
+ unsigned long long total; /* total number of queries passed on to remote
*/
+ unsigned long long success; /* responses forwarded (including local and
remote) */
+ unsigned long long ltotal;
+ unsigned long long lsuccess;
+
+ if (GNUNET_OK != getStatValue (&total,
+ <otal,
+ NULL,
+ "# gap requests total sent", GNUNET_YES))
+ return GNUNET_SYSERR;
+ if (GNUNET_OK != getStatValue (&success,
+ &lsuccess,
+ NULL, "# gap routes succeeded", GNUNET_YES))
+ return GNUNET_SYSERR;
+ if (total > 0)
+ data[0][0] = 1.0 * success / total;
+ else
+ data[0][0] = 0.0;
+ return GNUNET_OK;
+}
+
+
+static int
+statsProcessor (const char *optName, unsigned long long value, void *data)
+{
+ /**
+ * Keep track of last match (or, more precisely, position
+ * of next expected match) since 99.99% of the time we
+ * go over the same stats in the same order and thus
+ * this will predict correctly).
+ */
+ static unsigned int last;
+ GNUNET_CronTime *delta = data;
+ unsigned int j;
+ unsigned int found;
+
+ if (last >= lsv_size)
+ last = 0;
+ j = last;
+ found = -1;
+ if ((j < lsv_size) && (0 == strcmp (optName, lastStatValues[j].statName)))
+ found = j;
+ if (found == (unsigned int) -1)
+ {
+ for (j = 0; j < lsv_size; j++)
+ {
+ if (0 == strcmp (optName, lastStatValues[j].statName))
+ {
+ found = j;
+ break;
+ }
+ }
+ }
+ if (found == (unsigned int) -1)
+ {
+ found = lsv_size;
+ GNUNET_array_grow (lastStatValues, lsv_size, lsv_size + 1);
+ lastStatValues[found].statName = GNUNET_strdup (optName);
+ }
+ lastStatValues[found].lvalue = lastStatValues[found].value;
+ lastStatValues[found].value = value;
+ lastStatValues[found].delta = *delta;
+ last = found + 1;
+ return GNUNET_OK;
+}
+
+struct UpdateClosure
+{
+ GNUNET_CronTime delta;
+ int is_running;
+};
+
+/*
+ * Update the status bar indicator about daemon and connexions status
+ */
+static void *
+updateDaemonStatus (void *cls)
+{
+ struct UpdateClosure *uc = cls;
+ unsigned long long connected_peers;
+
+ if (uc->is_running)
+ {
+ if (GNUNET_OK !=
+ getStatValue (&connected_peers, NULL, NULL,
+ "# of connected peers", GNUNET_NO))
+ GNUNET_GTK_display_daemon_status (GNUNET_GTK_STATUS_UNKNOWN, 0);
+ else if (connected_peers > 0)
+ GNUNET_GTK_display_daemon_status (GNUNET_GTK_STATUS_CONNECTED,
+ connected_peers);
+ else
+ GNUNET_GTK_display_daemon_status (GNUNET_GTK_STATUS_DISCONNECTED, 0);
+ }
+ else
+ GNUNET_GTK_display_daemon_status (GNUNET_GTK_STATUS_NODAEMON, 0);
+ return NULL;
+}
+
+/**
+ * Cron-job that updates all stat values.
+ */
+static void
+updateStatValues (void *unused)
+{
+ static GNUNET_CronTime lastUpdate;
+ GNUNET_CronTime now;
+ struct UpdateClosure uc;
+
+ now = GNUNET_get_time ();
+ uc.delta = now - lastUpdate;
+ uc.is_running = GNUNET_OK == GNUNET_test_daemon_running (ectx, cfg);
+ GNUNET_mutex_lock (lock);
+ if (GNUNET_OK ==
+ GNUNET_STATS_get_statistics (ectx, sock, &statsProcessor, &uc.delta))
+ lastUpdate = now;
+ GNUNET_GTK_save_call (&updateDaemonStatus, (void *) &uc);
+ GNUNET_mutex_unlock (lock);
+}
+
+
+StatEntry stats[] = {
+ {
+ gettext_noop ("Connectivity"),
+ gettext_noop ("# connected nodes (100% = connection table size)"),
+ &getConnectedNodesStat,
+ NULL,
+ 1,
+ GNUNET_NO,
+ }
+ ,
+ {
+ gettext_noop ("System load"),
+ gettext_noop
+ ("CPU load (red), IO load (green), Network upload (yellow), Network
download (blue)"),
+ &getLoadStat,
+ NULL,
+ 4,
+ GNUNET_NO,
+ }
+ ,
+ {
+ gettext_noop ("Datastore capacity"),
+ gettext_noop ("Persistent file-sharing data (red) and DHT cache (green)"),
+ &getQuotaStat,
+ NULL,
+ 2,
+ GNUNET_NO,
+ }
+ ,
+ {
+ gettext_noop ("Inbound Traffic"),
+ gettext_noop
+ ("Noise (red), Content (green), Queries (yellow), Hellos (blue), other
(gray), limit (magenta)"),
+ &getTrafficRecvStats,
+ NULL,
+ 6,
+ 5,
+ }
+ ,
+ {
+ gettext_noop ("Outbound Traffic"),
+ gettext_noop
+ ("Noise (red), Content (green), Queries (yellow), Hellos (blue), other
(gray), limit (magenta)"),
+ &getTrafficSendStats,
+ NULL,
+ 6,
+ 5,
+ }
+ ,
+ {
+ gettext_noop ("Trust"),
+ gettext_noop ("Spent (red), Earned (green) and Awarded (yellow)"),
+ &getTrustStats,
+ NULL,
+ 3,
+ GNUNET_NO,
+ }
+ ,
+ {
+ gettext_noop ("Routing Effectiveness"),
+ gettext_noop ("Average (red) effectiveness (100% = perfect)"),
+ &getEffectivenessStats,
+ NULL,
+ 1,
+ GNUNET_NO,
+ }
+ ,
+ {
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ GNUNET_NO,
+ }
+ ,
+};
+
+static unsigned long long UPDATE_INTERVAL;
+
+void
+init_functions (struct GNUNET_GE_Context *e,
+ struct GNUNET_GC_Configuration *c)
+{
+ ectx = e;
+ cfg = c;
+ GNUNET_GC_get_configuration_value_number (cfg,
+ "GNUNET-GTK",
+ "STATS-INTERVAL",
+ 1,
+ 99 * GNUNET_CRON_YEARS,
+ 30 * GNUNET_CRON_SECONDS,
+ &UPDATE_INTERVAL);
+ sock = GNUNET_client_connection_create (ectx, cfg);
+ lock = GNUNET_mutex_create (GNUNET_NO);
+ cron = GNUNET_GTK_get_cron_manager ();
+ GNUNET_cron_add_job (cron,
+ &updateStatValues, UPDATE_INTERVAL, UPDATE_INTERVAL,
+ NULL);
+ GNUNET_cron_add_job (cron, &updateConnectionGoal, 5 * GNUNET_CRON_SECONDS,
+ 5 * GNUNET_CRON_MINUTES, NULL);
+ updateStatValues (NULL);
+}
+
+void
+done_functions ()
+{
+ unsigned int i;
+
+ GNUNET_cron_del_job (cron, &updateConnectionGoal, 5 * GNUNET_CRON_MINUTES,
+ NULL);
+ GNUNET_cron_del_job (cron, &updateStatValues, UPDATE_INTERVAL, NULL);
+ GNUNET_mutex_destroy (lock);
+ GNUNET_client_connection_destroy (sock);
+ for (i = 0; i < lsv_size; i++)
+ GNUNET_free (lastStatValues[i].statName);
+ GNUNET_array_grow (lastStatValues, lsv_size, 0);
+ sock = NULL;
+}
+
+
+/* end of functions.c */
Added: gnunet-gtk/src/statistics/functions.h
===================================================================
--- gnunet-gtk/src/statistics/functions.h (rev 0)
+++ gnunet-gtk/src/statistics/functions.h 2011-12-06 19:54:07 UTC (rev
18477)
@@ -0,0 +1,59 @@
+/*
+ This file is part of GNUnet
+ (C) 2004, 2005 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef STATS_FUNCTIONS_H
+#define STATS_FUNCTIONS_H
+
+#include <GNUnet/gnunet_util.h>
+
+typedef struct
+{
+ char *statName;
+ unsigned long long value;
+ unsigned long long lvalue;
+ GNUNET_CronTime delta;
+} StatPair;
+
+/**
+ * Callback function to obtain the latest stats
+ * data for this stat display.
+ */
+typedef int (*UpdateData) (const void *closure, gfloat ** data);
+
+
+typedef struct SE_
+{
+ char *paneName;
+ char *frameName;
+ UpdateData getData;
+ void *get_closure;
+ unsigned int count;
+ unsigned int fill; /* fill first "fill" entries */
+} StatEntry;
+
+extern StatEntry stats[];
+
+void init_functions (struct GNUNET_GE_Context *e,
+ struct GNUNET_GC_Configuration *c);
+
+void done_functions (void);
+
+#endif
Added: gnunet-gtk/src/statistics/gnunet-statistics-gtk.c
===================================================================
--- gnunet-gtk/src/statistics/gnunet-statistics-gtk.c
(rev 0)
+++ gnunet-gtk/src/statistics/gnunet-statistics-gtk.c 2011-12-06 19:54:07 UTC
(rev 18477)
@@ -0,0 +1,163 @@
+/*
+ This file is part of GNUnet.
+ (C) 2010, 2011 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file src/statistics/gnunet-statistics-gtk.c
+ * @brief Main function of gnunet-statistics-gtk
+ * @author Christian Grothoff
+ */
+#include "gnunet_gtk.h"
+#include <gnunet/gnunet_statistics_service.h>
+
+
+/**
+ * Information we track for each peer outside of the model.
+ */
+struct Statistics
+{
+
+
+};
+
+
+/**
+ * Handle to our main loop.
+ */
+static struct GNUNET_GTK_MainLoop *ml;
+
+/**
+ * Should gnunet-peerinfo-gtk start in tray mode?
+ */
+static int tray_only;
+
+/**
+ * Handle to statistics subsystem.
+ */
+static struct GNUNET_STATISTICS_Handle *statistics;
+
+
+
+/**
+ * Get cfg.
+ */
+static const struct GNUNET_CONFIGURATION_Handle *
+get_configuration ()
+{
+ return GNUNET_GTK_main_loop_get_configuration (ml);
+}
+
+
+/**
+ * Get an object from the main window.
+ *
+ * @param name name of the object
+ * @return NULL on error
+ */
+static GObject *
+get_object (const char *name)
+{
+ return GNUNET_GTK_main_loop_get_object (ml, name);
+}
+
+
+/**
+ * Task run on shutdown.
+ *
+ * @param cls unused
+ * @param tc scheduler context, unused
+ */
+static void
+shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ GNUNET_STATISTICS_destroy (statistics, GNUNET_NO);
+ statistics = NULL;
+}
+
+
+/**
+ * Callback invoked if the application is supposed to exit.
+ */
+void
+GNUNET_STATISTICS_GTK_quit_cb (GObject * object, gpointer user_data)
+{
+ GNUNET_GTK_tray_icon_destroy ();
+ GNUNET_GTK_main_loop_quit (ml);
+ GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
+}
+
+
+/**
+ * Actual main function run right after GNUnet's scheduler
+ * is initialized. Initializes up GTK and Glade.
+ */
+static void
+run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ GtkWidget *main_window;
+
+ ml = cls;
+ statistics = GNUNET_STATISTICS_create ("gnunet-statistics-gtk",
+ get_configuration());
+ if (NULL == statistics)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Failed to initiate connection with statistics service\n"));
+ return;
+ }
+ GNUNET_GTK_set_icon_search_path ();
+ GNUNET_GTK_setup_nls ();
+ /* setup main window */
+ main_window = GTK_WIDGET (get_object ("GNUNET_STATISTICS_GTK_main_window"));
+ gtk_window_maximize (GTK_WINDOW (main_window));
+ GNUNET_GTK_tray_icon_create (GTK_WINDOW (main_window),
+ "gnunet-gtk" /* FIXME: different icon? */ ,
+ "gnunet-statistics-gtk");
+
+ /* make GUI visible */
+ if (!tray_only)
+ {
+ gtk_widget_show (main_window);
+ gtk_window_present (GTK_WINDOW (main_window));
+ }
+}
+
+
+int
+main (int argc, char *const *argv)
+{
+ static struct GNUNET_GETOPT_CommandLineOption options[] = {
+ {'t', "tray", NULL,
+ gettext_noop ("start in tray mode"), 0,
+ &GNUNET_GETOPT_set_one, &tray_only},
+ GNUNET_GETOPT_OPTION_END
+ };
+
+ if (GNUNET_OK !=
+ GNUNET_GTK_main_loop_start ("gnunet-statistics-gtk",
+ "GTK GUI for viewing GNUnet statistics",
argc,
+ argv, options,
+ "gnunet_statistics_gtk_main_window.glade",
+ &run))
+ return 1;
+ return 0;
+}
+
+
+/* end of gnunet-statistics-gtk.c */
Added: gnunet-gtk/src/statistics/statistics.c
===================================================================
--- gnunet-gtk/src/statistics/statistics.c (rev 0)
+++ gnunet-gtk/src/statistics/statistics.c 2011-12-06 19:54:07 UTC (rev
18477)
@@ -0,0 +1,493 @@
+/*
+ This file is part of GNUnet
+ (C) 2004, 2005, 2006 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ Portions of this code were adopted from the
+ gnome-system-monitor v2.0.5, (C) 2001 Kevin Vandersloot
+*/
+
+#include "platform.h"
+#include "gnunetgtk_common.h"
+#include <GNUnet/gnunet_stats_lib.h>
+#include <GNUnet/gnunet_getoption_lib.h>
+#include "functions.h"
+
+#define MAX_COLOR 6
+#define GNOME_PAD_SMALL 2
+#define FRAME_WIDTH 0
+
+
+typedef struct
+{
+ gint type;
+ guint count;
+ guint speed;
+ guint draw_width, draw_height;
+ guint num_points;
+ guint allocated;
+ GdkColor *colors;
+ gfloat **data;
+ gfloat **odata;
+ guint data_size;
+ gint colors_allocated;
+ GtkWidget *main_widget;
+ GtkWidget *disp;
+ GtkWidget *label;
+ GdkPixmap *pixmap;
+ GdkGC *gc;
+ int timer_index;
+ gboolean draw;
+ int statIdx;
+} LoadGraph;
+
+typedef struct
+{
+ GdkColor bg_color;
+ GdkColor frame_color;
+ GdkColor mem_color[MAX_COLOR];
+} ProcConfig;
+
+static unsigned long long UPDATE_INTERVAL;
+
+/**
+ * Redraws the backing pixmap for the load graph and updates the window
+ */
+static void
+load_graph_draw (LoadGraph * g)
+{
+ guint i;
+ guint j;
+ gint dely;
+ float delx;
+ float max;
+ GdkFont *font;
+
+ if (!g->disp->window)
+ return;
+
+ g->draw_width = g->disp->allocation.width;
+ g->draw_height = g->disp->allocation.height;
+
+ if (!g->pixmap)
+ g->pixmap = gdk_pixmap_new (g->disp->window,
+ g->draw_width, g->draw_height,
+ gtk_widget_get_visual (g->disp)->depth);
+
+ /* Create GC if necessary. */
+ if (!g->gc)
+ {
+ g->gc = gdk_gc_new (g->disp->window);
+ gdk_gc_copy (g->gc, g->disp->style->white_gc);
+ }
+
+ /* Allocate colors. */
+ if (!g->colors_allocated)
+ {
+ GdkColormap *colormap;
+
+ colormap = gdk_window_get_colormap (g->disp->window);
+ for (i = 0; i < 2 + g->count; i++)
+ gdk_color_alloc (colormap, &(g->colors[i]));
+
+ g->colors_allocated = 1;
+ }
+ /* Erase Rectangle */
+ gdk_gc_set_foreground (g->gc, &(g->colors[0]));
+ gdk_draw_rectangle (g->pixmap,
+ g->gc,
+ TRUE, 0, 0,
+ g->disp->allocation.width, g->disp->allocation.height);
+
+ /* draw frame */
+ gdk_gc_set_foreground (g->gc, &(g->colors[1]));
+ gdk_draw_rectangle (g->pixmap,
+ g->gc,
+ FALSE, 0, 0, g->draw_width, g->disp->allocation.height);
+
+ max = 0.26; /* force showing at least the 25% line */
+ for (i = 0; i < g->num_points - 1; i++)
+ for (j = 0; j < g->count; j++)
+ if (g->data[i][j] > max)
+ max = g->data[i][j];
+ max = max * 1.01; /* leave top 1% free */
+
+ font = gdk_font_load ("fixed"); /* deprecated, but pango is far more
than
+ what we need here -- fix later? */
+ /* draw lines at 25%, 50%, 75% and 100% of max */
+ dely = g->draw_height / max / 4;
+ for (i = 1; i < 5; i++)
+ {
+ gint y1 = g->draw_height + 1 - i * dely;
+ if ((dely < 30) && (i != 4))
+ continue; /* only print additional
+ lines if there is enough space! */
+ if (y1 > 0)
+ {
+ const gchar *label[] = {
+ NULL,
+ " 25%",
+ " 50%",
+ " 75%",
+ "100%",
+ };
+ gdk_draw_string (g->pixmap, font, g->gc, 10, y1 - 8, label[i]);
+ gdk_draw_line (g->pixmap, g->gc, 0, y1, g->draw_width, y1);
+ if (i == 4)
+ {
+ /* extra-thick line at 100% */
+ gdk_draw_line (g->pixmap, g->gc,
+ 0, y1 - 1, g->draw_width, y1 - 1);
+ gdk_draw_line (g->pixmap, g->gc,
+ 0, y1 + 1, g->draw_width, y1 + 1);
+
+ }
+ }
+ }
+ gdk_gc_set_line_attributes (g->gc,
+ 2,
+ GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_MITER);
+ delx = (float) g->draw_width / (g->num_points - 1);
+
+ for (j = 0; j < g->count; j++)
+ {
+ gdk_gc_set_foreground (g->gc, &(g->colors[j + 2]));
+ for (i = 0; i < g->num_points - 1; i++)
+ {
+ gint x1 = i * delx;
+ gint x2 = (i + 1) * delx;
+ gint y1 = g->data[i][j] / max * g->draw_height - 1;
+ gint y2 = g->data[i + 1][j] / max * g->draw_height - 1;
+
+ if ((g->data[i][j] != -1) && (g->data[i + 1][j] != -1))
+ {
+ if (stats[g->statIdx].fill <= j)
+ {
+ gdk_draw_line (g->pixmap, g->gc,
+ g->draw_width - x2,
+ g->draw_height - y2,
+ g->draw_width - x1, g->draw_height - y1);
+ }
+ else
+ {
+ GdkPoint points[4];
+
+ points[0].x = g->draw_width - x2;
+ points[0].y = g->draw_height - y2;
+ points[1].x = g->draw_width - x1;
+ points[1].y = g->draw_height - y1;
+ points[2].x = g->draw_width - x1;
+ points[3].x = g->draw_width - x2;
+ if (j == 0)
+ {
+ points[2].y = g->draw_height;
+ points[3].y = g->draw_height;
+ }
+ else
+ {
+ gint ly1 = g->data[i][j - 1] / max * g->draw_height - 1;
+ gint ly2 =
+ g->data[i + 1][j - 1] / max * g->draw_height - 1;
+ points[2].y = g->draw_height - ly1;
+ points[3].y = g->draw_height - ly2;
+ }
+ gdk_draw_polygon (g->pixmap, g->gc, 1, points, 4);
+ }
+ }
+ }
+ }
+
+ gdk_gc_set_line_attributes (g->gc, 1,
+ GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_MITER);
+
+ gdk_draw_pixmap (g->disp->window,
+ g->disp->style->fg_gc[GTK_WIDGET_STATE (g->disp)],
+ g->pixmap,
+ 0, 0,
+ 0, 0,
+ g->disp->allocation.width, g->disp->allocation.height);
+}
+
+
+/* Updates the load graph when the timeout expires */
+static gboolean
+load_graph_update (gpointer ptr)
+{
+ LoadGraph *g = ptr;
+ guint i;
+ guint j;
+
+ for (i = 0; i < g->num_points; i++)
+ memcpy (g->odata[i], g->data[i], g->data_size * g->count);
+ stats[g->statIdx].getData (stats[g->statIdx].get_closure, g->data);
+ for (i = 0; i < g->num_points - 1; i++)
+ for (j = 0; j < g->count; j++)
+ g->data[i + 1][j] = g->odata[i][j];
+ if (g->draw)
+ load_graph_draw (g);
+ return TRUE;
+}
+
+static void
+load_graph_unalloc (LoadGraph * g)
+{
+ unsigned int i;
+ if (!g->allocated)
+ return;
+ for (i = 0; i < g->num_points; i++)
+ {
+ GNUNET_free (g->data[i]);
+ GNUNET_free (g->odata[i]);
+ }
+ GNUNET_free (g->data);
+ GNUNET_free (g->odata);
+ g->data = g->odata = NULL;
+ if (g->pixmap)
+ {
+ gdk_pixmap_unref (g->pixmap);
+ g->pixmap = NULL;
+ }
+ g->allocated = FALSE;
+}
+
+static void
+load_graph_alloc (LoadGraph * g)
+{
+ unsigned int i;
+ unsigned int j;
+
+ if (g->allocated)
+ return;
+
+ g->data = GNUNET_malloc (sizeof (gfloat *) * g->num_points);
+ g->odata = GNUNET_malloc (sizeof (gfloat *) * g->num_points);
+ g->data_size = sizeof (gfloat);
+ for (i = 0; i < g->num_points; i++)
+ {
+ g->data[i] = GNUNET_malloc (g->data_size * g->count);
+ g->odata[i] = GNUNET_malloc (g->data_size * g->count);
+ }
+ for (i = 0; i < g->num_points; i++)
+ for (j = 0; j < g->count; j++)
+ g->data[i][j] = -1;
+ g->allocated = TRUE;
+}
+
+static gint
+load_graph_configure (GtkWidget * widget,
+ GdkEventConfigure * event, gpointer data_ptr)
+{
+ LoadGraph *c = (LoadGraph *) data_ptr;
+
+ if (c->pixmap)
+ {
+ gdk_pixmap_unref (c->pixmap);
+ c->pixmap = NULL;
+ }
+
+ if (!c->pixmap)
+ c->pixmap = gdk_pixmap_new (widget->window,
+ widget->allocation.width,
+ widget->allocation.height,
+ gtk_widget_get_visual (c->disp)->depth);
+ gdk_draw_rectangle (c->pixmap,
+ widget->style->black_gc,
+ TRUE, 0, 0,
+ widget->allocation.width, widget->allocation.height);
+ gdk_draw_pixmap (widget->window,
+ c->disp->style->fg_gc[GTK_WIDGET_STATE (widget)],
+ c->pixmap,
+ 0, 0,
+ 0, 0,
+ c->disp->allocation.width, c->disp->allocation.height);
+
+ load_graph_draw (c);
+ return TRUE;
+}
+
+static gint
+load_graph_expose (GtkWidget * widget,
+ GdkEventExpose * event, gpointer data_ptr)
+{
+ LoadGraph *g = (LoadGraph *) data_ptr;
+
+ gdk_draw_pixmap (widget->window,
+ widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+ g->pixmap,
+ event->area.x, event->area.y,
+ event->area.x, event->area.y,
+ event->area.width, event->area.height);
+ return FALSE;
+}
+
+static void
+load_graph_stop (LoadGraph * g)
+{
+ if (!g)
+ return;
+ if (g->timer_index != -1)
+ {
+ gtk_timeout_remove (g->timer_index);
+ g->timer_index = -1;
+ }
+ g->draw = FALSE;
+}
+
+static void
+load_graph_destroy (GtkWidget * widget, gpointer data_ptr)
+{
+ LoadGraph *g = (LoadGraph *) data_ptr;
+ load_graph_stop (g);
+ if (g->timer_index != -1)
+ gtk_timeout_remove (g->timer_index);
+ load_graph_unalloc (g);
+ GNUNET_free (g->colors);
+ GNUNET_free (g);
+}
+
+static LoadGraph *
+load_graph_new (int statIdx, const ProcConfig * config)
+{
+ LoadGraph *g;
+ unsigned int i;
+
+ if (stats[statIdx].count > MAX_COLOR)
+ {
+ GNUNET_GE_BREAK (NULL, 0);
+ return NULL;
+ }
+
+ g = GNUNET_malloc (sizeof (LoadGraph));
+ g->statIdx = statIdx;
+ g->count = stats[statIdx].count;
+ g->speed = UPDATE_INTERVAL / GNUNET_CRON_MILLISECONDS;
+ g->num_points = 600;
+ g->colors = GNUNET_malloc (sizeof (GdkColor) * (2 + g->count));
+ g->colors[0] = config->bg_color;
+ g->colors[1] = config->frame_color;
+ for (i = 0; i < g->count; i++)
+ g->colors[2 + i] = config->mem_color[i];
+ g->timer_index = -1;
+ g->draw = FALSE;
+ g->main_widget = gtk_vbox_new (FALSE, FALSE);
+ gtk_widget_show (g->main_widget);
+ g->disp = gtk_drawing_area_new ();
+ gtk_widget_show (g->disp);
+ gtk_signal_connect (GTK_OBJECT (g->disp),
+ "expose_event", GTK_SIGNAL_FUNC (load_graph_expose), g);
+ gtk_signal_connect (GTK_OBJECT (g->disp),
+ "configure_event",
+ GTK_SIGNAL_FUNC (load_graph_configure), g);
+ gtk_signal_connect (GTK_OBJECT (g->disp),
+ "destroy", GTK_SIGNAL_FUNC (load_graph_destroy), g);
+ gtk_widget_add_events (g->disp, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);
+ gtk_box_pack_start (GTK_BOX (g->main_widget), g->disp, TRUE, TRUE, 0);
+ load_graph_alloc (g);
+ gtk_widget_show_all (g->main_widget);
+ g->timer_index = gtk_timeout_add (g->speed, &load_graph_update, g);
+
+ return g;
+}
+
+static GtkWidget *
+create_sys_view (int statIdx, const ProcConfig * config)
+{
+ GtkWidget *mem_frame;
+ LoadGraph *mem_graph;
+
+ mem_graph = load_graph_new (statIdx, config);
+ if (mem_graph == NULL)
+ return NULL; /* oops */
+ mem_frame = gtk_frame_new (_(stats[statIdx].frameName));
+ gtk_container_add (GTK_CONTAINER (mem_frame), mem_graph->main_widget);
+ gtk_container_set_border_width (GTK_CONTAINER (mem_graph->main_widget),
+ GNOME_PAD_SMALL);
+ gtk_container_set_border_width (GTK_CONTAINER (mem_frame), GNOME_PAD_SMALL);
+ gtk_widget_show (mem_frame);
+ if (mem_graph->timer_index == -1)
+ mem_graph->timer_index
+ = gtk_timeout_add (mem_graph->speed, &load_graph_update, mem_graph);
+ mem_graph->draw = TRUE;
+ return mem_frame;
+}
+
+
+
+
+
+void
+init_stats (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg)
+{
+ GtkWidget *statusConnexionsBox;
+ GtkWidget *statusConnexionsLabel;
+ GtkWidget *sys_box;
+ GtkWidget *label;
+ GtkWidget *notebook;
+ ProcConfig config;
+ int i;
+
+ statusConnexionsLabel =
+ glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
+ "statusConnexionsLabel");
+ gtk_label_set_width_chars (GTK_LABEL (statusConnexionsLabel),
+ g_utf8_strlen (_("Connected to %Lu peers"),
+ 40) - 1);
+ statusConnexionsBox =
+ glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
+ "statusConnexionsBox");
+ gtk_widget_set_sensitive (statusConnexionsBox, TRUE);
+ GNUNET_GC_get_configuration_value_number (cfg,
+ "GNUNET-GTK",
+ "STATS-INTERVAL",
+ 1,
+ 99 * GNUNET_CRON_YEARS,
+ 30 * GNUNET_CRON_SECONDS,
+ &UPDATE_INTERVAL);
+ init_functions (ectx, cfg);
+ notebook =
+ glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "statsNotebook");
+ memset (&config, 0, sizeof (ProcConfig));
+ gdk_color_parse ("black", &config.bg_color);
+ gdk_color_parse ("gray", &config.frame_color);
+ gdk_color_parse ("red", &config.mem_color[0]);
+ gdk_color_parse ("green", &config.mem_color[1]);
+ gdk_color_parse ("yellow", &config.mem_color[2]);
+ gdk_color_parse ("blue", &config.mem_color[3]);
+ gdk_color_parse ("gray", &config.mem_color[4]);
+ gdk_color_parse ("magenta", &config.mem_color[5]);
+ GNUNET_GE_ASSERT (ectx, MAX_COLOR == 6);
+ i = -1;
+ while (stats[++i].paneName != NULL)
+ {
+ sys_box = create_sys_view (i, &config);
+ if (sys_box == NULL)
+ continue; /* oops */
+
+ label = gtk_label_new (gettext (stats[i].paneName));
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sys_box, label);
+ }
+ gtk_widget_show (notebook);
+}
+
+void
+done_stats ()
+{
+ done_functions ();
+}
+
+/* end of statistics.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r18477 - in gnunet-gtk: . contrib src src/statistics,
gnunet <=