gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r33600 - in gnunet-gtk: contrib src/conversation


From: gnunet
Subject: [GNUnet-SVN] r33600 - in gnunet-gtk: contrib src/conversation
Date: Sun, 8 Jun 2014 12:44:06 +0200

Author: grothoff
Date: 2014-06-08 12:44:05 +0200 (Sun, 08 Jun 2014)
New Revision: 33600

Modified:
   gnunet-gtk/contrib/gnunet_conversation_gtk_main_window.glade
   gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c
Log:
implement #3439

Modified: gnunet-gtk/contrib/gnunet_conversation_gtk_main_window.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_conversation_gtk_main_window.glade        
2014-06-08 10:18:07 UTC (rev 33599)
+++ gnunet-gtk/contrib/gnunet_conversation_gtk_main_window.glade        
2014-06-08 10:44:05 UTC (rev 33600)
@@ -30,6 +30,12 @@
       <column type="gchararray"/>
       <!-- column-name contact_type -->
       <column type="gchararray"/>
+      <!-- column-name contact_value -->
+      <column type="gchararray"/>
+      <!-- column-name contact_is_public -->
+      <column type="gboolean"/>
+      <!-- column-name contact_is_editable -->
+      <column type="gboolean"/>
     </columns>
   </object>
   <object class="GtkListStore" 
id="gnunet_conversation_gtk_contacts_zone_liststore">
@@ -759,7 +765,12 @@
                                             </child>
                                             <child>
                                               <object 
class="GtkTreeViewColumn" id="gnunet_conversation_gtk_contact_list_type_column">
+                                                <property 
name="sizing">fixed</property>
+                                                <property 
name="fixed_width">60</property>
                                                 <property name="title" 
translatable="yes">Type</property>
+                                                <property 
name="reorderable">True</property>
+                                                <property 
name="sort_indicator">True</property>
+                                                <property 
name="sort_column_id">1</property>
                                                 <child>
                                                   <object 
class="GtkCellRendererText" 
id="gnunet_conversation_gtk_contact_list_type_renderer"/>
                                                   <attributes>
@@ -769,18 +780,57 @@
                                               </object>
                                             </child>
                                             <child>
-                                              <object 
class="GtkTreeViewColumn" 
id="gnunet_conversation_gtk_contact_list_value_column">
+                                              <object 
class="GtkTreeViewColumn" 
id="gnunet_conversation_gtk_contact_list_label_column">
                                                 <property 
name="resizable">True</property>
+                                                <property 
name="sizing">autosize</property>
                                                 <property name="title" 
translatable="yes">Name</property>
                                                 <property 
name="expand">True</property>
+                                                <property 
name="clickable">True</property>
+                                                <property 
name="reorderable">True</property>
+                                                <property 
name="sort_indicator">True</property>
+                                                <property 
name="sort_column_id">0</property>
                                                 <child>
-                                                  <object 
class="GtkCellRendererText" 
id="gnunet_conversation_gtk_contact_list_value_renderer"/>
+                                                  <object 
class="GtkCellRendererText" 
id="gnunet_conversation_gtk_contact_list_label_renderer"/>
                                                   <attributes>
                                                     <attribute 
name="text">0</attribute>
                                                   </attributes>
                                                 </child>
                                               </object>
                                             </child>
+                                            <child>
+                                              <object 
class="GtkTreeViewColumn" 
id="gnunet_conversation_gtk_contact_list_value_treeviewcolumn">
+                                                <property 
name="resizable">True</property>
+                                                <property 
name="sizing">autosize</property>
+                                                <property name="title" 
translatable="yes">Value</property>
+                                                <property 
name="reorderable">True</property>
+                                                <property 
name="sort_indicator">True</property>
+                                                <property 
name="sort_column_id">2</property>
+                                                <child>
+                                                  <object 
class="GtkCellRendererText" 
id="gnunet_conversation_gtk_contact_list_value_cellrenderertext"/>
+                                                  <attributes>
+                                                    <attribute 
name="text">2</attribute>
+                                                  </attributes>
+                                                </child>
+                                              </object>
+                                            </child>
+                                            <child>
+                                              <object 
class="GtkTreeViewColumn" 
id="gnunet_conversation_gtk_contact_list_value_is_public_treeviewcolumn">
+                                                <property 
name="sizing">fixed</property>
+                                                <property 
name="fixed_width">60</property>
+                                                <property name="title" 
translatable="yes">Public?</property>
+                                                <property 
name="reorderable">True</property>
+                                                <property 
name="sort_indicator">True</property>
+                                                <property 
name="sort_column_id">3</property>
+                                                <child>
+                                                  <object 
class="GtkCellRendererToggle" 
id="gnunet_conversation_gtk_contact_list_is_public_cellrenderertoggle"/>
+                                                  <attributes>
+                                                    <attribute 
name="sensitive">4</attribute>
+                                                    <attribute 
name="activatable">4</attribute>
+                                                    <attribute 
name="active">3</attribute>
+                                                  </attributes>
+                                                </child>
+                                              </object>
+                                            </child>
                                           </object>
                                         </child>
                                       </object>

Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c      
2014-06-08 10:18:07 UTC (rev 33599)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c      
2014-06-08 10:44:05 UTC (rev 33600)
@@ -44,9 +44,25 @@
   CONTACTS_LS_NAME = 0,
 
   /**
-   * Type of the label (as a 'const char *')
+   * Type of the label (as a `const char *`)
    */
-  CONTACTS_LS_TYPE = 1
+  CONTACTS_LS_TYPE = 1,
+
+  /**
+   * Value stored under the label (as a `const char *`)
+   */
+  CONTACTS_LS_VALUE = 2,
+
+  /**
+   * Is the record public (as a `gboolean`)
+   */
+  CONTACTS_LS_IS_PUBLIC = 3,
+
+  /**
+   * Is the 'public' flag editable (once implemented, negation
+   * of #CONTACT_IS_PUBLIC), a `gboolean`.
+   */
+  CONTACTS_LS_IS_EDITABLE = 4
 };
 
 
@@ -149,6 +165,8 @@
   const char *type;
   gchar *lname;
   gboolean update;
+  gboolean is_public;
+  char *value;
 
   if (NULL == zone_key)
   {
@@ -158,6 +176,7 @@
     return;
   }
   do_display = FALSE;
+  value = NULL;
   for (i = 0; i < rd_len; i++)
   {
     switch (rd[i].record_type)
@@ -178,6 +197,14 @@
       /* ignore, not useful for conversation */
       break;
     }
+    if (do_display)
+    {
+      value = GNUNET_GNSRECORD_value_to_string (rd[i].record_type,
+                                                rd[i].data,
+                                                rd[i].data_size);
+      is_public = (0 == (rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE));
+      break;
+    }
   }
 
   /* check if exists, if so, update or remove */
@@ -200,6 +227,7 @@
           gtk_list_store_remove (contacts_liststore,
                                  &iter);
           g_free (lname);
+          GNUNET_free (value);
           return;
         }
         /* update */
@@ -214,7 +242,10 @@
 
   /* insert new record */
   if (! do_display)
+  {
+    GNUNET_assert (NULL == value);
     return;
+  }
   if (! update)
     gtk_list_store_append (contacts_liststore,
                            &iter);
@@ -222,7 +253,11 @@
                       &iter,
                       CONTACTS_LS_NAME, rname,
                       CONTACTS_LS_TYPE, type,
+                      CONTACTS_LS_VALUE, value,
+                      CONTACTS_LS_IS_PUBLIC, is_public,
+                      CONTACTS_LS_IS_EDITABLE, FALSE /* FIXME: editing to be 
implemented */,
                       -1);
+  GNUNET_free (value);
 }
 
 




reply via email to

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