gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r30566 - in gnunet-gtk: contrib src/namestore


From: gnunet
Subject: [GNUnet-SVN] r30566 - in gnunet-gtk: contrib src/namestore
Date: Wed, 6 Nov 2013 16:26:06 +0100

Author: grothoff
Date: 2013-11-06 16:26:06 +0100 (Wed, 06 Nov 2013)
New Revision: 30566

Modified:
   gnunet-gtk/contrib/gnunet_namestore_edit_gns2dns.glade
   gnunet-gtk/src/namestore/plugin_gtk_namestore_gns2dns.c
Log:
-implementing updated namestore plugin code for new GNS2DNS records (#3093)

Modified: gnunet-gtk/contrib/gnunet_namestore_edit_gns2dns.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_namestore_edit_gns2dns.glade      2013-11-06 
15:25:55 UTC (rev 30565)
+++ gnunet-gtk/contrib/gnunet_namestore_edit_gns2dns.glade      2013-11-06 
15:26:06 UTC (rev 30566)
@@ -46,67 +46,6 @@
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="spacing">2</property>
-        <child internal-child="action_area">
-          <object class="GtkHButtonBox" id="edit_dialog_action_area">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="edit_dialog_cancel_button">
-                <property name="label">gtk-cancel</property>
-                <property name="use_action_appearance">False</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="edit_dialog_delete_button">
-                <property name="label">gtk-delete</property>
-                <property name="use_action_appearance">False</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="edit_dialog_save_button">
-                <property name="label">gtk-save</property>
-                <property name="use_action_appearance">False</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
-                <property name="receives_default">True</property>
-                <property name="tooltip_text" translatable="yes">Store the 
updated record in the database. If the record is public, GNUnet will begin to 
publish the record to the world, limiting your ability to change it later 
(based on the selected expiration values).</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
         <child>
           <object class="GtkFrame" id="edit_dialog_name_frame">
             <property name="visible">True</property>
@@ -126,6 +65,7 @@
                       <object class="GtkEntry" id="edit_dialog_name_entry">
                         <property name="visible">True</property>
                         <property name="sensitive">False</property>
+                        <property name="can_focus">False</property>
                         <property name="tooltip_text" translatable="yes">Name 
of the record in the zone.</property>
                         <property name="max_length">63</property>
                         <property name="invisible_char">●</property>
@@ -189,38 +129,97 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkFrame" id="edit_dialog_gns2dns_ns_frame">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">none</property>
+            <child>
+              <object class="GtkAlignment" 
id="edit_dialog_gns2dns_ns_alignment">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="top_padding">4</property>
+                <property name="left_padding">12</property>
+                <child>
+                  <object class="GtkVBox" id="edit_dialog_gns2dns_ns_vbox">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <object class="GtkEntry" 
id="edit_dialog_gns2dns_ns_entry">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="tooltip_text" translatable="yes">Enter 
the name of the DNS domain that this label delegates to.  Resolution will 
continue under the given target domain, asking the DNS server specified 
below.</property>
+                        <property name="max_length">253</property>
+                        <property name="invisible_char">●</property>
+                        <property name="invisible_char_set">True</property>
+                        <property 
name="primary_icon_activatable">False</property>
+                        <property 
name="secondary_icon_activatable">False</property>
+                        <property name="primary_icon_sensitive">True</property>
+                        <property 
name="secondary_icon_sensitive">True</property>
+                        <signal name="changed" 
handler="GNS_edit_dialog_gns2dns_ns_entry_changed_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="edit_dialog_gns2dns_ns_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">&lt;b&gt;Name of the 
target DNS domain&lt;/b&gt;</property>
+                <property name="use_markup">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="padding">5</property>
             <property name="position">1</property>
           </packing>
         </child>
         <child>
-          <object class="GtkFrame" id="edit_dialog_gns2dns_frame">
+          <object class="GtkFrame" id="edit_dialog_gns2dns_ip_frame">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="label_xalign">0</property>
             <property name="shadow_type">none</property>
             <child>
-              <object class="GtkAlignment" id="edit_dialog_gns2dns_alignment">
+              <object class="GtkAlignment" 
id="edit_dialog_gns2dns_ip_alignment">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="top_padding">4</property>
                 <property name="left_padding">12</property>
                 <child>
-                  <object class="GtkVBox" id="edit_dialog_gns2dns_vbox">
+                  <object class="GtkVBox" id="edit_dialog_gns2dns_ip_vbox">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <child>
-                      <object class="GtkEntry" id="edit_dialog_gns2dns_entry">
+                      <object class="GtkEntry" 
id="edit_dialog_gns2dns_ip_entry">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="has_focus">True</property>
-                        <property name="tooltip_text" translatable="yes">Enter 
the name of the DNS nameserver for the subzone.</property>
+                        <property name="tooltip_text" translatable="yes">Enter 
the name of the DNS nameserver for the subzone.
+The specified name can be a GNS name, an IPv4 or IPv6 address or even a DNS 
name.
+If you want to specify multiple IPv4 addresses, you should specify a GNS label 
in the current zone (i.e. glue.+) and then add the IP addresses under that glue 
label.
+</property>
                         <property name="max_length">253</property>
                         <property name="invisible_char">●</property>
                         <property 
name="primary_icon_activatable">False</property>
                         <property 
name="secondary_icon_activatable">False</property>
                         <property name="primary_icon_sensitive">True</property>
                         <property 
name="secondary_icon_sensitive">True</property>
-                        <signal name="changed" 
handler="GNS_edit_dialog_gns2dns_entry_changed_cb" swapped="no"/>
+                        <signal name="changed" 
handler="GNS_edit_dialog_gns2dns_ip_entry_changed_cb" swapped="no"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -233,7 +232,7 @@
               </object>
             </child>
             <child type="label">
-              <object class="GtkLabel" id="edit_dialog_gns2dns_label">
+              <object class="GtkLabel" id="edit_dialog_gns2dns_ip_abel">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label" translatable="yes">&lt;b&gt;Name of the 
authoritative name server for the given name&lt;/b&gt;</property>
@@ -266,7 +265,6 @@
                     <child>
                       <object class="GtkCheckButton" 
id="edit_dialog_options_public_checkbutton">
                         <property name="label" translatable="yes">Record is 
public (visible to other users)</property>
-                        <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
@@ -282,7 +280,6 @@
                     <child>
                       <object class="GtkCheckButton" 
id="edit_dialog_options_shadow_checkbutton">
                         <property name="label" translatable="yes">Record is a 
shadow record (valid after other records expire)</property>
-                        <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
@@ -339,7 +336,6 @@
                         <child>
                           <object class="GtkRadioButton" 
id="edit_dialog_expiration_relative_radiobutton">
                             <property name="label" 
translatable="yes">Relative</property>
-                            <property 
name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
@@ -357,7 +353,6 @@
                         <child>
                           <object class="GtkRadioButton" 
id="edit_dialog_expiration_absolute_radiobutton">
                             <property name="label" 
translatable="yes">Absolute</property>
-                            <property 
name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
@@ -376,7 +371,6 @@
                         <child>
                           <object class="GtkRadioButton" 
id="edit_dialog_expiration_never_radiobutton">
                             <property name="label" 
translatable="yes">Never</property>
-                            <property 
name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
@@ -557,9 +551,67 @@
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
-            <property name="position">4</property>
+            <property name="position">5</property>
           </packing>
         </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="edit_dialog_action_area">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="edit_dialog_cancel_button">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="edit_dialog_delete_button">
+                <property name="label">gtk-delete</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="edit_dialog_save_button">
+                <property name="label">gtk-save</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="tooltip_text" translatable="yes">Store the 
updated record in the database. If the record is public, GNUnet will begin to 
publish the record to the world, limiting your ability to change it later 
(based on the selected expiration values).</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">5</property>
+          </packing>
+        </child>
       </object>
     </child>
     <action-widgets>

Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_gns2dns.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_gns2dns.c     2013-11-06 
15:25:55 UTC (rev 30565)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_gns2dns.c     2013-11-06 
15:26:06 UTC (rev 30566)
@@ -56,12 +56,31 @@
  */
 static void
 gns2dns_load (void *cls,
-        gchar *n_value,
-        GtkBuilder *builder)
+              gchar *n_value,
+              GtkBuilder *builder)
 {
+  char *cpy;
+  char *at;
+
+  cpy = GNUNET_strdup (n_value);
+  at = strchr (cpy, '@');
+  if (NULL == at)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                _("Unable to parse GNS2DNS record `%s'\n"),
+                n_value);
+    GNUNET_free (cpy);
+    return;
+  }
+  *at = '\0';
+  at++;
   gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
-                                                         
"edit_dialog_gns2dns_entry")),
-                      n_value);
+                                                         
"edit_dialog_gns2dns_ns_entry")),
+                      cpy);
+  gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
+                                                         
"edit_dialog_gns2dns_ip_entry")),
+                      at);
+  GNUNET_free (cpy);
 }
 
 
@@ -75,15 +94,24 @@
  */
 static gchar *
 gns2dns_store (void *cls,
-         GtkBuilder *builder)
+               GtkBuilder *builder)
 {
   GtkEntry *entry;
-  const gchar *value;
+  const gchar *ns_value;
+  const gchar *ip_value;
+  char *ret;
 
   entry = GTK_ENTRY (gtk_builder_get_object (builder,
-                                             "edit_dialog_gns2dns_entry"));
-  value = gtk_entry_get_text (entry);
-  return g_strdup (value);
+                                             "edit_dialog_gns2dns_ns_entry"));
+  ns_value = gtk_entry_get_text (entry);
+  entry = GTK_ENTRY (gtk_builder_get_object (builder,
+                                             "edit_dialog_gns2dns_ip_entry"));
+  ip_value = gtk_entry_get_text (entry);
+  GNUNET_asprintf (&ret,
+                   "address@hidden",
+                   ns_value,
+                   ip_value);
+  return ret;
 }
 
 
@@ -100,17 +128,23 @@
  */
 static int
 gns2dns_validate (void *cls,
-            GtkBuilder *builder)
+                  GtkBuilder *builder)
 {
   GtkEditable *entry;
   const gchar *preedit;
 
   entry = GTK_EDITABLE (gtk_builder_get_object (builder,
-                                               "edit_dialog_gns2dns_entry")),
+                                               
"edit_dialog_gns2dns_ns_entry")),
   preedit = gtk_editable_get_chars (entry, 0, -1);
   if ( (NULL == preedit) ||
        (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
     return GNUNET_SYSERR;
+  entry = GTK_EDITABLE (gtk_builder_get_object (builder,
+                                               
"edit_dialog_gns2dns_ip_entry")),
+  preedit = gtk_editable_get_chars (entry, 0, -1);
+  if ( (NULL == preedit) ||
+       (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
+    return GNUNET_SYSERR;
   return GNUNET_OK;
 }
 
@@ -127,8 +161,10 @@
   struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
   struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
   static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
-    { "GNS_edit_dialog_gns2dns_entry_changed_cb",
+    { "GNS_edit_dialog_gns2dns_ip_entry_changed_cb",
       G_CALLBACK (GNS_edit_dialog_gns2dns_entry_changed_cb) },
+    { "GNS_edit_dialog_gns2dns_ns_entry_changed_cb",
+      G_CALLBACK (GNS_edit_dialog_gns2dns_entry_changed_cb) },
     { NULL, NULL }
   };
 




reply via email to

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