[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r20425 - gnunet-gtk/src/peerinfo
From: |
gnunet |
Subject: |
[GNUnet-SVN] r20425 - gnunet-gtk/src/peerinfo |
Date: |
Sat, 10 Mar 2012 20:10:37 +0100 |
Author: grothoff
Date: 2012-03-10 20:10:37 +0100 (Sat, 10 Mar 2012)
New Revision: 20425
Modified:
gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c
Log:
-introducing enum for model
Modified: gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c
===================================================================
--- gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c 2012-03-10 15:09:21 UTC
(rev 20424)
+++ gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c 2012-03-10 19:10:37 UTC
(rev 20425)
@@ -31,6 +31,48 @@
/**
+ * Columns in the peerinfo model.
+ */
+enum PEERINFO_ModelColumns
+ {
+ /**
+ * A gchararray
+ */
+ PEERINFO_MC_PEER_IDENTITY_STRING = 0,
+
+ /**
+ * A guint
+ */
+ PEERINFO_MC_NUMBER_OF_ADDRESSES = 1,
+
+ /**
+ * A gchararray
+ */
+ PEERINFO_MC_COUNTRY_NAME = 2,
+
+ /**
+ * A GdkPixbuf
+ */
+ PEERINFO_MC_COUNTRY_FLAG = 3,
+
+ /**
+ * A guint64
+ */
+ PEERINFO_MC_BANDWIDTH_IN = 4,
+
+ /**
+ * A guint64
+ */
+ PEERINFO_MC_BANDWIDTH_OUT = 5,
+
+ /**
+ * A gchararray
+ */
+ PEERINFO_MC_ADDRESS_AS_STRING = 6
+ };
+
+
+/**
* Information we track for each peer outside of the model.
*/
struct PeerInfo
@@ -186,7 +228,12 @@
if (NULL == address)
{
/* error */
- gtk_list_store_set (ls, &iter, 1, 1, 2, NULL, 3, NULL, 6, "<error>", -1);
+ gtk_list_store_set (ls, &iter,
+ PEERINFO_MC_NUMBER_OF_ADDRESSES, (guint) 1,
+ PEERINFO_MC_COUNTRY_NAME, NULL,
+ PEERINFO_MC_COUNTRY_FLAG, NULL,
+ PEERINFO_MC_ADDRESS_AS_STRING, "<error>",
+ -1);
}
else
{
@@ -234,7 +281,11 @@
GNUNET_assert (NULL != path);
GNUNET_assert (TRUE == gtk_tree_model_get_iter (tm, &iter, path));
gtk_tree_path_free (path);
- gtk_list_store_set (ls, &iter, 1, 0, 2, NULL, 3, NULL, 6, "<disconnected>",
+ gtk_list_store_set (ls, &iter,
+ PEERINFO_MC_NUMBER_OF_ADDRESSES, (guint) 0,
+ PEERINFO_MC_COUNTRY_NAME, NULL,
+ PEERINFO_MC_COUNTRY_FLAG, NULL,
+ PEERINFO_MC_ADDRESS_AS_STRING, "<disconnected>",
-1);
return;
}
@@ -283,13 +334,14 @@
npid = (char *) &enc;
npid[4] = '\0';
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 */ ,
- 4, (guint64) 0 /* bandwidth-in */ ,
- 5, (guint64) 0 /* bandwidth-out */ ,
- 6, "" /* addresses as strings */ ,
+ gtk_list_store_set (ls, &iter,
+ PEERINFO_MC_PEER_IDENTITY_STRING, npid,
+ PEERINFO_MC_NUMBER_OF_ADDRESSES, (guint) 0,
+ PEERINFO_MC_COUNTRY_NAME, "",
+ PEERINFO_MC_COUNTRY_FLAG, NULL,
+ PEERINFO_MC_BANDWIDTH_IN, (guint64) 0,
+ PEERINFO_MC_BANDWIDTH_OUT, (guint64) 0,
+ PEERINFO_MC_ADDRESS_AS_STRING, "",
-1);
path = gtk_tree_model_get_path (tm, &iter);
info = GNUNET_malloc (sizeof (struct PeerInfo));
@@ -344,8 +396,10 @@
GNUNET_assert (NULL != path);
GNUNET_assert (TRUE == gtk_tree_model_get_iter (tm, &iter, path));
gtk_tree_path_free (path);
- gtk_list_store_set (ls, &iter, 4, (guint64) ntohl (bandwidth_in.value__), 5,
- (guint64) ntohl (bandwidth_out.value__), -1);
+ gtk_list_store_set (ls, &iter,
+ PEERINFO_MC_BANDWIDTH_IN, (guint64) ntohl
(bandwidth_in.value__),
+ PEERINFO_MC_BANDWIDTH_OUT, (guint64) ntohl
(bandwidth_out.value__),
+ -1);
}
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r20425 - gnunet-gtk/src/peerinfo,
gnunet <=