gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r29942 - in gnunet-gtk: contrib src/peerinfo


From: gnunet
Subject: [GNUnet-SVN] r29942 - in gnunet-gtk: contrib src/peerinfo
Date: Mon, 7 Oct 2013 20:48:20 +0200

Author: grothoff
Date: 2013-10-07 20:48:20 +0200 (Mon, 07 Oct 2013)
New Revision: 29942

Modified:
   gnunet-gtk/contrib/gnunet_peerinfo_gtk_main_window.glade
   gnunet-gtk/src/peerinfo/Makefile.am
   gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c
Log:
-display current friends, editing not yet supported

Modified: gnunet-gtk/contrib/gnunet_peerinfo_gtk_main_window.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_peerinfo_gtk_main_window.glade    2013-10-07 
18:47:57 UTC (rev 29941)
+++ gnunet-gtk/contrib/gnunet_peerinfo_gtk_main_window.glade    2013-10-07 
18:48:20 UTC (rev 29942)
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk+" version="2.20"/>
   <!-- interface-naming-policy project-wide -->
@@ -27,36 +27,43 @@
     </columns>
   </object>
   <object class="GtkWindow" id="GNUNET_PEERINFO_GTK_main_window">
+    <property name="can_focus">False</property>
     <property name="title" translatable="yes">gnunet-peerinfo-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_PEERINFO_GTK_quit_cb" 
after="yes"/>
+    <signal name="delete-event" handler="GNUNET_PEERINFO_GTK_quit_cb" 
after="yes" swapped="no"/>
     <child>
       <object class="GtkVBox" id="GNUNET_PEERINFO_GTK_main_window_vbox">
         <property name="visible">True</property>
-        <property name="orientation">vertical</property>
+        <property name="can_focus">False</property>
         <child>
           <object class="GtkMenuBar" id="GNUNET_PEERINFO_GTK_main_menu">
             <property name="visible">True</property>
+            <property name="can_focus">False</property>
             <child>
               <object class="GtkMenuItem" 
id="GNUNET_PEERINFO_GTK_main_menu_help">
+                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="label" translatable="yes">_Help</property>
                 <property name="use_underline">True</property>
                 <child type="submenu">
                   <object class="GtkMenu" 
id="GNUNET_PEERINFO_GTK_main_menu_help_abou">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <child>
                       <object class="GtkImageMenuItem" 
id="GNUNET_PEERINFO_GTK_main_menu_help_about">
                         <property name="label">gtk-about</property>
+                        <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="tooltip_text" 
translatable="yes">Display information about this version of 
gnunet-peerinfo-gtk</property>
                         <property 
name="accel_path">&lt;gnunet-peerinfo-gtk&gt;/Help/About</property>
                         <property name="use_underline">True</property>
                         <property name="use_stock">True</property>
-                        <signal name="activate" 
handler="GNUNET_PEERINFO_GTK_main_menu_help_about_activate_cb"/>
+                        <signal name="activate" 
handler="GNUNET_PEERINFO_GTK_main_menu_help_about_activate_cb" swapped="no"/>
                       </object>
                     </child>
                   </object>
@@ -66,6 +73,7 @@
           </object>
           <packing>
             <property name="expand">False</property>
+            <property name="fill">True</property>
             <property name="position">0</property>
           </packing>
         </child>
@@ -106,9 +114,26 @@
                   </object>
                 </child>
                 <child>
+                  <object class="GtkTreeViewColumn" 
id="GNUNET_PEERINFO_GTK_main_window_friends_treeviewcolumn">
+                    <property name="title" translatable="yes">Friend</property>
+                    <property name="clickable">True</property>
+                    <property name="reorderable">True</property>
+                    <property name="sort_indicator">True</property>
+                    <property name="sort_column_id">9</property>
+                    <child>
+                      <object class="GtkCellRendererToggle" 
id="GNUNET_PEERINFO_GTK_main_window_friends_cellrenderertoggle">
+                        <signal name="toggled" 
handler="GNUNET_PEERINFO_GTK_main_window_friends_cellrenderertoggle_toggled_cb" 
swapped="no"/>
+                      </object>
+                      <attributes>
+                        <attribute name="active">9</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                </child>
+                <child>
                   <object class="GtkTreeViewColumn" 
id="GNUNET_PEERINFO_GTK_main_window_connectivity_treeviewcolumn">
-                    <property name="sizing">fixed</property>
-                    <property name="fixed_width">20</property>
+                    <property name="spacing">2</property>
+                    <property name="sizing">autosize</property>
                     <property name="reorderable">True</property>
                     <property name="sort_indicator">True</property>
                     <property name="sort_column_id">8</property>
@@ -185,6 +210,8 @@
             </child>
           </object>
           <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
             <property name="position">1</property>
           </packing>
         </child>
@@ -203,4 +230,9 @@
     <property name="page_increment">10</property>
     <property name="page_size">10</property>
   </object>
+  <object class="GtkImage" id="connected_image">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-missing-image</property>
+  </object>
 </interface>

Modified: gnunet-gtk/src/peerinfo/Makefile.am
===================================================================
--- gnunet-gtk/src/peerinfo/Makefile.am 2013-10-07 18:47:57 UTC (rev 29941)
+++ gnunet-gtk/src/peerinfo/Makefile.am 2013-10-07 18:48:20 UTC (rev 29942)
@@ -18,7 +18,7 @@
   $(top_builddir)/src/lib/libgnunetgtk.la \
   @GTK_LIBS@ \
   @GLADE_LIBS@ @GNUNET_LIBS@  @unique_LIBS@ \
-  -lgnunetutil -lgnunetpeerinfo -lgnunettransport -lgnunetats \
+  -lgnunetutil -lgnunetpeerinfo -lgnunettransport -lgnunetats -lgnunetfriends \
   $(INTLLIBS)
 gnunet_peerinfo_gtk_LDFLAGS = \
   -export-dynamic

Modified: gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c
===================================================================
--- gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c       2013-10-07 18:47:57 UTC 
(rev 29941)
+++ gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c       2013-10-07 18:48:20 UTC 
(rev 29942)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2010, 2012 Christian Grothoff (and other contributing authors)
+     (C) 2010, 2012, 2013 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
@@ -27,6 +27,7 @@
 #include <gnunet/gnunet_peerinfo_service.h>
 #include <gnunet/gnunet_transport_service.h>
 #include <gnunet/gnunet_ats_service.h>
+#include <gnunet/gnunet_friends_lib.h>
 #include "gnunet-peerinfo-gtk-flags.h"
 
 #if HAVE_LIBUNIQUE
@@ -158,7 +159,12 @@
  */
 static GtkListStore *ls;
 
+/**
+ * Map of all of our friends.
+ */
+static struct GNUNET_CONTAINER_MultiPeerMap *friends;
 
+
 #if HAVE_LIBUNIQUE
 static UniqueApp *unique_app;
 #endif
@@ -384,6 +390,8 @@
                        PEERINFO_MC_ADDRESS_AS_STRING, "",
                        PEERINFO_MC_CONNECTIVITY_LED, led_red,
                        PEERINFO_MC_CONNECTED_STATUS, FALSE,
+                        PEERINFO_MC_IS_FRIEND, 
GNUNET_CONTAINER_multipeermap_contains (friends,
+                                                                               
        peer),
                         -1);
     path = gtk_tree_model_get_path (GTK_TREE_MODEL (ls), &iter);
     info = GNUNET_malloc (sizeof (struct PeerInfo));
@@ -446,6 +454,23 @@
 
 
 /**
+ * The user has toggled the 'is friend' column for one of the peers.
+ * Update everything.
+ *
+ * @param cell_renderer the cell renderer that issued the toggle signal
+ * @param path which cell was toggled
+ * @param user_data our main window builder
+ */
+void
+GNUNET_PEERINFO_GTK_main_window_friends_cellrenderertoggle_toggled_cb 
(GtkCellRendererToggle *cell_renderer,
+                                                                       gchar 
*path,
+                                                                       
gpointer user_data)
+{
+  GNUNET_break (0); // not implemented
+}
+
+
+/**
  * Callback invoked if the application is supposed to exit.
  *
  * @param object
@@ -482,6 +507,24 @@
 
 
 /**
+ * Add a friend to our friends peer map.
+ *
+ * @param cls NULL
+ * @param friend the friend to add
+ */
+static void
+add_friend (void *cls,
+            const struct GNUNET_PeerIdentity *friend)
+{
+  GNUNET_break (GNUNET_YES ==
+                GNUNET_CONTAINER_multipeermap_put (friends,
+                                                   friend,
+                                                   "true",
+                                                   
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+}
+
+
+/**
  * Actual main function run right after GNUnet's scheduler
  * is initialized.  Initializes up GTK and Glade.
  *
@@ -503,6 +546,13 @@
   led_red = load_led ("red");
   GNUNET_GTK_set_icon_search_path ();
   GNUNET_GTK_setup_nls ();
+  friends = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
+  if (GNUNET_OK !=
+      GNUNET_FRIENDS_parse (get_configuration (),
+                            &add_friend,
+                            NULL))
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                _("Failed to parse list of friends\n"));
   peer2info = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO);
   pnc =
       GNUNET_PEERINFO_notify (get_configuration (),




reply via email to

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