[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r16545 - in gnunet-gtk/src: . peerinfo
From: |
gnunet |
Subject: |
[GNUnet-SVN] r16545 - in gnunet-gtk/src: . peerinfo |
Date: |
Mon, 15 Aug 2011 16:13:21 +0200 |
Author: grothoff
Date: 2011-08-15 16:13:21 +0200 (Mon, 15 Aug 2011)
New Revision: 16545
Added:
gnunet-gtk/src/peerinfo/
gnunet-gtk/src/peerinfo/Makefile.am
gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c
gnunet-gtk/src/peerinfo/peerinfo.c
gnunet-gtk/src/peerinfo/peerinfo.h
Log:
draft
Added: gnunet-gtk/src/peerinfo/Makefile.am
===================================================================
--- gnunet-gtk/src/peerinfo/Makefile.am (rev 0)
+++ gnunet-gtk/src/peerinfo/Makefile.am 2011-08-15 14:13:21 UTC (rev 16545)
@@ -0,0 +1,17 @@
+SUBDIRS = .
+
+INCLUDES = \
+ -I$(top_srcdir)/ \
+ @GTK_CFLAGS@ \
+ @GNUNETGTK_CFLAGS@
+
+bin_PROGRAMS = gnunet-peerinfo-gtk
+
+gnunet_peerinfo_gtk_SOURCES = \
+ peerinfo.c peerinfo.h
+gnunet_peerinfo_gtk_LDADD = \
+ @GTK_LIBS@ \
+ -lgnunetutil -lgnunetpeerinfo \
+ $(INTLLIBS)
+gnunet_peerinfo_gtk_LDFLAGS = \
+ -export-dynamic
\ No newline at end of file
Added: gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c
===================================================================
--- gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c
(rev 0)
+++ gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c 2011-08-15 14:13:21 UTC
(rev 16545)
@@ -0,0 +1,11 @@
+ mc->pnc = GNUNET_PEERINFO_notify (cfg,
+ &GNUNET_GTK_peerinfo_processor,
+ NULL);
+ if (mc->pnc == NULL)
+ {
+ gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (mc->builder,
+
"GNUNET_GTK_main_window_peerinfo_treeview")));
+ gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (mc->builder,
+
"GNUNET_GTK_main_menu_view_neighbours")));
+ /* FIXME: set warning in status bar... */
+ }
Copied: gnunet-gtk/src/peerinfo/peerinfo.c (from rev 16478,
gnunet-gtk/src/peerinfo.c)
===================================================================
--- gnunet-gtk/src/peerinfo/peerinfo.c (rev 0)
+++ gnunet-gtk/src/peerinfo/peerinfo.c 2011-08-15 14:13:21 UTC (rev 16545)
@@ -0,0 +1,90 @@
+/*
+ This file is part of GNUnet.
+ (C) 2010 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/peerinfo/peerinfo.c
+ * @brief Updates the peerinfo view
+ * @author Christian Grothoff
+ */
+#include "peerinfo.h"
+
+/**
+ * Function called for peers that we know about.
+ *
+ * @param cls closure
+ * @param peer id of the peer, NULL for last call
+ * @param hello hello message for the peer (can be NULL)
+ * @param err_msg NULL if successful, otherwise contains error message
+ */
+void
+GNUNET_GTK_peerinfo_processor (void *cls,
+ const struct GNUNET_PeerIdentity * peer,
+ const struct GNUNET_HELLO_Message * hello,
+ const char * err_msg)
+{
+ GtkListStore *ls;
+ GtkTreeModel *tm;
+ GtkTreeIter iter;
+ int found;
+ gchar *pid;
+ const char *npid;
+ struct GNUNET_CRYPTO_HashAsciiEncoded enc;
+
+ GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey,
+ &enc);
+ npid = (const char*) &enc;
+ ls = GTK_LIST_STORE (GNUNET_GTK_get_main_window_object
("GNUNET_GTK_peer_info_list_store"));
+ tm = GTK_TREE_MODEL (ls);
+ found = GNUNET_NO;
+ if (TRUE == gtk_tree_model_get_iter_first (tm, &iter))
+ {
+ do
+ {
+ pid = NULL;
+ gtk_tree_model_get (tm,
+ &iter,
+ 0, &pid, -1);
+ if (pid != NULL)
+ {
+ if (0 == strcmp (pid, npid))
+ {
+ found = GNUNET_YES;
+ g_free (pid);
+ break;
+ }
+ }
+ g_free (pid);
+ }
+ while ( (found == GNUNET_NO) &&
+ (TRUE == gtk_tree_model_iter_next (tm,
+ &iter)));
+ }
+ if (found == GNUNET_NO)
+ gtk_list_store_append (ls, &iter);
+ gtk_list_store_set (ls,
+ &iter,
+ 0, npid,
+ 1, 0 /* number of known addresses */,
+ 2, "" /* country name */,
+ 3, NULL /* country flag */,
+ -1);
+}
+
+/* end of peerinfo.c */
Copied: gnunet-gtk/src/peerinfo/peerinfo.h (from rev 16478,
gnunet-gtk/src/peerinfo.h)
===================================================================
--- gnunet-gtk/src/peerinfo/peerinfo.h (rev 0)
+++ gnunet-gtk/src/peerinfo/peerinfo.h 2011-08-15 14:13:21 UTC (rev 16545)
@@ -0,0 +1,47 @@
+/*
+ This file is part of GNUnet.
+ (C) 2010 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/peerinfo/peerinfo.h
+ * @brief Updates the peerinfo view
+ * @author Christian Grothoff
+ */
+#ifndef PEERINFO_H
+#define PEERINFO_H
+
+#include "gnunet_gtk.h"
+#include <gnunet/gnunet_peerinfo_service.h>
+
+/**
+ * Function called for peers that we know about.
+ *
+ * @param cls closure
+ * @param peer id of the peer, NULL for last call
+ * @param hello hello message for the peer (can be NULL)
+ * @param err_msg NULL if successful, otherwise contains error message
+ */
+void
+GNUNET_GTK_peerinfo_processor (void *cls,
+ const struct GNUNET_PeerIdentity * peer,
+ const struct GNUNET_HELLO_Message * hello,
+ const char * err_msg);
+
+/* end of peerinfo.h */
+#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r16545 - in gnunet-gtk/src: . peerinfo,
gnunet <=