[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33646 - in gnunet-gtk: contrib doc src/peerinfo
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33646 - in gnunet-gtk: contrib doc src/peerinfo |
Date: |
Wed, 11 Jun 2014 12:46:57 +0200 |
Author: grothoff
Date: 2014-06-11 12:46:57 +0200 (Wed, 11 Jun 2014)
New Revision: 33646
Modified:
gnunet-gtk/contrib/gnunet_peerinfo_gtk_main_window.glade
gnunet-gtk/doc/gnunet-peerinfo-gtk.1
gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c
Log:
-hide inactive peers by default
Modified: gnunet-gtk/contrib/gnunet_peerinfo_gtk_main_window.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_peerinfo_gtk_main_window.glade 2014-06-11
10:11:49 UTC (rev 33645)
+++ gnunet-gtk/contrib/gnunet_peerinfo_gtk_main_window.glade 2014-06-11
10:46:57 UTC (rev 33646)
@@ -21,7 +21,7 @@
<!-- column-name core_connectivity_led -->
<column type="GdkPixbuf"/>
<!-- column-name core_connected_status -->
- <column type="gboolean"/>
+ <column type="guint"/>
<!-- column-name is_friend -->
<column type="gboolean"/>
<!-- column-name peerinfo -->
Modified: gnunet-gtk/doc/gnunet-peerinfo-gtk.1
===================================================================
--- gnunet-gtk/doc/gnunet-peerinfo-gtk.1 2014-06-11 10:11:49 UTC (rev
33645)
+++ gnunet-gtk/doc/gnunet-peerinfo-gtk.1 2014-06-11 10:46:57 UTC (rev
33646)
@@ -14,6 +14,9 @@
\fB\-c \fIFILENAME\fR, \fB\-\-config=FILENAME\fR
load config file (default: ~/.config/gnunet.conf)
.TP
+\fB\-s, \fB\-\-show-inactive\fR
+show peers even if we are not connected to them, have no (valid, non-expired)
addresses for the peer, thus only know pretty much only their public keys; this
will essentially list peers that we historically at some point encountered, but
have currently no way to contact and that might not be running at all.
+.TP
\fB\-t, \fB\-\-tray\fR
start with main window minimized (only put icon in tray)
.TP
Modified: gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c
===================================================================
--- gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c 2014-06-11 10:11:49 UTC
(rev 33645)
+++ gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c 2014-06-11 10:46:57 UTC
(rev 33646)
@@ -37,6 +37,13 @@
/**
+ * Should we show peers that have no connections and
+ * no known (valid, non-expired) addresses?
+ */
+static int show_inactive;
+
+
+/**
* Columns in the peerinfo model.
*/
enum PEERINFO_ModelColumns
@@ -82,7 +89,7 @@
PEERINFO_MC_CORE_CONNECTIVITY_LED = 7,
/**
- * A gboolean
+ * A guint for sorting by connectivity
*/
PEERINFO_MC_CORE_CONNECTED_STATUS = 8,
@@ -537,14 +544,15 @@
* Function to call with the text format of an address
*
* @param cts the `struct PeerAddress` for the address
- * @param address address as a string, NULL on error
- * @param res result of the address to string conversion: GNUNET_OK or
GNUNET_SYSERR
- * if GNUNET_OK: address contains address as string
- * if GNUNET_SYSERR: address is invalid
+ * @param address address as a string, NULL on last call
+ * @param res result of the address to string conversion:
+ * if #GNUNET_OK: address contains address as string
+ * if #GNUNET_SYSERR: address is invalid
*/
static void
peer_address_string_cb (void *cts,
- const char *address, int res)
+ const char *address,
+ int res)
{
struct PeerAddress *pa = cts;
GtkTreeIter iter;
@@ -557,15 +565,8 @@
pa->tos = NULL;
return;
}
-
if (GNUNET_SYSERR == res)
- {
- fprintf (stderr, "Failed to convert address for peer `%s' plugin `%s'
length %lu to string \n",
- GNUNET_i2s (&pa->pi->pid),
- pa->plugin,
- pa->addr_len);
- }
-
+ return; /* don't care */
get_iter_from_rr (pa->rr, &iter);
country = NULL;
colon = strstr (address, ":");
@@ -636,10 +637,12 @@
GNUNET_assert (NULL != path);
GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ts), &iter, path));
gtk_tree_path_free (path);
- gtk_tree_store_append (ts, &aiter, &iter);
- gtk_tree_store_set (ts, &iter,
- PEERINFO_MC_PLUGIN_NAME, addr->transport_name,
- -1);
+ gtk_tree_store_insert_with_values (ts,
+ &aiter,
+ &iter,
+ -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);
GNUNET_assert (NULL != pa->rr);
@@ -745,9 +748,12 @@
{
struct PeerInfo *info;
+ if ( (NULL == hello) ||
+ ( (! show_inactive) &&
+ (0 ==
+ GNUNET_TIME_absolute_get_remaining (GNUNET_HELLO_get_last_expiration
(hello)).rel_value_us) ) )
+ return;
info = get_peer_info (peer);
- if (NULL == hello)
- return;
GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO,
&peer_address_cb, info);
}
@@ -1146,7 +1152,7 @@
get_iter_from_rr (info->rr, &iter);
gtk_tree_store_set (ts, &iter,
PEERINFO_MC_CORE_CONNECTIVITY_LED, NULL,
- PEERINFO_MC_CORE_CONNECTED_STATUS, FALSE,
+ PEERINFO_MC_CORE_CONNECTED_STATUS, (guint) 0,
-1);
return GNUNET_OK;
}
@@ -1169,33 +1175,33 @@
struct PeerInfo *info;
GtkTreeIter iter;
GdkPixbuf *led;
- gboolean status;
+ guint status;
switch (state)
{
case GNUNET_CORE_KX_STATE_DOWN:
led = led_black;
- status = FALSE;
+ status = 1;
break;
case GNUNET_CORE_KX_STATE_KEY_SENT:
led = led_yellow;
- status = FALSE;
+ status = 2;
break;
case GNUNET_CORE_KX_STATE_KEY_RECEIVED:
led = led_yellow;
- status = FALSE;
+ status = 2;
break;
case GNUNET_CORE_KX_STATE_UP:
led = led_green;
- status = FALSE;
+ status = 4;
break;
case GNUNET_CORE_KX_STATE_REKEY_SENT:
led = led_blue;
- status = FALSE;
+ status = 4;
break;
case GNUNET_CORE_KX_PEER_DISCONNECT:
led = NULL;
- status = FALSE;
+ status = 1;
break;
case GNUNET_CORE_KX_ITERATION_FINISHED:
return;
@@ -1564,6 +1570,9 @@
main (int argc, char **argv)
{
static struct GNUNET_GETOPT_CommandLineOption options[] = {
+ {'s', "show-inactive", NULL,
+ gettext_noop ("show peers even if the are inactive and we know nothing
except their public key"), 0,
+ &GNUNET_GETOPT_set_one, &show_inactive},
{'t', "tray", NULL,
gettext_noop ("start in tray mode"), 0,
&GNUNET_GETOPT_set_one, &tray_only},
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33646 - in gnunet-gtk: contrib doc src/peerinfo,
gnunet <=