[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30431 - gnunet-gtk/src/namestore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30431 - gnunet-gtk/src/namestore |
Date: |
Sun, 27 Oct 2013 18:07:02 +0100 |
Author: grothoff
Date: 2013-10-27 18:07:02 +0100 (Sun, 27 Oct 2013)
New Revision: 30431
Modified:
gnunet-gtk/src/namestore/gnunet-namestore-gtk_edit.c
gnunet-gtk/src/namestore/plugin_gtk_namestore_a.c
gnunet-gtk/src/namestore/plugin_gtk_namestore_aaaa.c
gnunet-gtk/src/namestore/plugin_gtk_namestore_cname.c
gnunet-gtk/src/namestore/plugin_gtk_namestore_gns2dns.c
gnunet-gtk/src/namestore/plugin_gtk_namestore_leho.c
gnunet-gtk/src/namestore/plugin_gtk_namestore_mx.c
gnunet-gtk/src/namestore/plugin_gtk_namestore_phone.c
gnunet-gtk/src/namestore/plugin_gtk_namestore_pkey.c
gnunet-gtk/src/namestore/plugin_gtk_namestore_ptr.c
gnunet-gtk/src/namestore/plugin_gtk_namestore_soa.c
gnunet-gtk/src/namestore/plugin_gtk_namestore_srv.c
gnunet-gtk/src/namestore/plugin_gtk_namestore_template.c
gnunet-gtk/src/namestore/plugin_gtk_namestore_txt.c
gnunet-gtk/src/namestore/plugin_gtk_namestore_vpn.c
Log:
-implementing more plugins
Modified: gnunet-gtk/src/namestore/gnunet-namestore-gtk_edit.c
===================================================================
--- gnunet-gtk/src/namestore/gnunet-namestore-gtk_edit.c 2013-10-27
16:35:04 UTC (rev 30430)
+++ gnunet-gtk/src/namestore/gnunet-namestore-gtk_edit.c 2013-10-27
17:07:02 UTC (rev 30431)
@@ -1121,7 +1121,7 @@
struct GNUNET_CRYPTO_EcdsaPublicKey pub;
entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder,
-
"edit_dialog_phone_peer_entry")),
+
"edit_dialog_phone_peer_entry"));
preedit = gtk_editable_get_chars (entry, 0, -1);
if ( (NULL == preedit) ||
(GNUNET_OK !=
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_a.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_a.c 2013-10-27 16:35:04 UTC
(rev 30430)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_a.c 2013-10-27 17:07:02 UTC
(rev 30431)
@@ -28,11 +28,28 @@
/**
+ * The user has edited the A record value. Enable/disable 'save'
+ * button depending on the validity of the value.
+ *
+ * @param entry editing widget
+ * @param user_data the plugin environment
+ */
+void
+GNS_edit_dialog_a_entry_changed_cb (GtkEditable *entry,
+ gpointer user_data)
+{
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+
+ env->check_validity (env->cls);
+}
+
+
+/**
* Function that will be called to initialize the builder's
* widgets from the existing record (if there is one).
* The `n_value` is the existing value of the record as a string.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param n_value the record as a string
* @param builder the edit dialog's builder
*/
@@ -54,7 +71,7 @@
* Function that will be called to retrieve the final value of the
* record (in string format) once the dialog is being closed.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return record value as a string, as specified in the dialog
*/
@@ -79,7 +96,7 @@
* function should highlight fields with invalid inputs for the
* user.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
@@ -110,7 +127,7 @@
void *
libgnunet_plugin_gtk_namestore_a_init (void *cls)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *env = cls;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
@@ -131,7 +148,7 @@
* @return always NULL
*/
void *
-libgnunet_plugin_gtk_namestore_aaaa_done (void *cls)
+libgnunet_plugin_gtk_namestore_a_done (void *cls)
{
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin = cls;
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_aaaa.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_aaaa.c 2013-10-27
16:35:04 UTC (rev 30430)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_aaaa.c 2013-10-27
17:07:02 UTC (rev 30431)
@@ -28,11 +28,28 @@
/**
+ * The user has edited the AAAA record value. Enable/disable 'save'
+ * button depending on the validity of the value.
+ *
+ * @param entry editing widget
+ * @param user_data the plugin environment
+ */
+void
+GNS_edit_dialog_aaaa_entry_changed_cb (GtkEditable *entry,
+ gpointer user_data)
+{
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+
+ env->check_validity (env->cls);
+}
+
+
+/**
* Function that will be called to initialize the builder's
* widgets from the existing record (if there is one).
* The `n_value` is the existing value of the record as a string.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param n_value the record as a string
* @param builder the edit dialog's builder
*/
@@ -49,7 +66,7 @@
* Function that will be called to retrieve the final value of the
* record (in string format) once the dialog is being closed.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return record value as a string, as specified in the dialog
*/
@@ -57,8 +74,13 @@
aaaa_store (void *cls,
GtkBuilder *builder)
{
- GNUNET_break (0);
- return NULL;
+ GtkEntry *entry;
+ const gchar *value;
+
+ entry = GTK_ENTRY (gtk_builder_get_object (builder,
+ "edit_dialog_aaaa_entry"));
+ value = gtk_entry_get_text (entry);
+ return g_strdup (value);
}
@@ -69,7 +91,7 @@
* function should highlight fields with invalid inputs for the
* user.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
@@ -77,7 +99,16 @@
aaaa_validate (void *cls,
GtkBuilder *builder)
{
- GNUNET_break (0);
+ GtkEditable *entry;
+ const gchar *preedit;
+ struct in6_addr v6;
+
+ entry = GTK_EDITABLE (gtk_builder_get_object (builder,
+ "edit_dialog_aaaa_entry")),
+ preedit = gtk_editable_get_chars (entry, 0, -1);
+ if ( (NULL == preedit) ||
+ (1 != inet_pton (AF_INET6, preedit, &v6)) )
+ return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -91,7 +122,7 @@
void *
libgnunet_plugin_gtk_namestore_aaaa_init (void *cls)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *env = cls;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_cname.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_cname.c 2013-10-27
16:35:04 UTC (rev 30430)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_cname.c 2013-10-27
17:07:02 UTC (rev 30431)
@@ -28,11 +28,28 @@
/**
+ * The user has edited the CNAME record value. Enable/disable 'save'
+ * button depending on the validity of the value.
+ *
+ * @param entry editing widget
+ * @param user_data the plugin environment
+ */
+void
+GNS_edit_dialog_cname_entry_changed_cb (GtkEditable *entry,
+ gpointer user_data)
+{
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+
+ env->check_validity (env->cls);
+}
+
+
+/**
* Function that will be called to initialize the builder's
* widgets from the existing record (if there is one).
* The `n_value` is the existing value of the record as a string.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param n_value the record as a string
* @param builder the edit dialog's builder
*/
@@ -41,7 +58,12 @@
gchar *n_value,
GtkBuilder *builder)
{
- GNUNET_break (0);
+ GtkEntry *entry;
+
+ entry = GTK_ENTRY (gtk_builder_get_object (builder,
+ "edit_dialog_cname_entry"));
+ gtk_entry_set_text (entry,
+ n_value);
}
@@ -49,7 +71,7 @@
* Function that will be called to retrieve the final value of the
* record (in string format) once the dialog is being closed.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return record value as a string, as specified in the dialog
*/
@@ -57,8 +79,13 @@
cname_store (void *cls,
GtkBuilder *builder)
{
- GNUNET_break (0);
- return NULL;
+ GtkEntry *entry;
+ const gchar *value;
+
+ entry = GTK_ENTRY (gtk_builder_get_object (builder,
+ "edit_dialog_cname_entry"));
+ value = gtk_entry_get_text (entry);
+ return g_strdup (value);
}
@@ -69,7 +96,7 @@
* function should highlight fields with invalid inputs for the
* user.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
@@ -77,7 +104,15 @@
cname_validate (void *cls,
GtkBuilder *builder)
{
- GNUNET_break (0);
+ GtkEditable *entry;
+ const gchar *preedit;
+
+ entry = GTK_EDITABLE (gtk_builder_get_object (builder,
+ "edit_dialog_cname_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;
}
@@ -91,7 +126,7 @@
void *
libgnunet_plugin_gtk_namestore_cname_init (void *cls)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *env = cls;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_gns2dns.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_gns2dns.c 2013-10-27
16:35:04 UTC (rev 30430)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_gns2dns.c 2013-10-27
17:07:02 UTC (rev 30431)
@@ -27,12 +27,30 @@
#include "gnunet_gtk_namestore_plugin.h"
+
/**
+ * The user has edited the GNS2DNS record value. Enable/disable 'save'
+ * button depending on the validity of the value.
+ *
+ * @param entry editing widget
+ * @param user_data the plugin environment
+ */
+void
+GNS_edit_dialog_gns2dns_entry_changed_cb (GtkEditable *entry,
+ gpointer user_data)
+{
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+
+ env->check_validity (env->cls);
+}
+
+
+/**
* Function that will be called to initialize the builder's
* widgets from the existing record (if there is one).
* The `n_value` is the existing value of the record as a string.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param n_value the record as a string
* @param builder the edit dialog's builder
*/
@@ -41,7 +59,9 @@
gchar *n_value,
GtkBuilder *builder)
{
- GNUNET_break (0);
+ gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
+
"edit_dialog_gns2dns_entry")),
+ n_value);
}
@@ -49,7 +69,7 @@
* Function that will be called to retrieve the final value of the
* record (in string format) once the dialog is being closed.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return record value as a string, as specified in the dialog
*/
@@ -57,8 +77,13 @@
gns2dns_store (void *cls,
GtkBuilder *builder)
{
- GNUNET_break (0);
- return NULL;
+ GtkEntry *entry;
+ const gchar *value;
+
+ entry = GTK_ENTRY (gtk_builder_get_object (builder,
+ "edit_dialog_gns2dns_entry"));
+ value = gtk_entry_get_text (entry);
+ return g_strdup (value);
}
@@ -69,7 +94,7 @@
* function should highlight fields with invalid inputs for the
* user.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
@@ -77,7 +102,15 @@
gns2dns_validate (void *cls,
GtkBuilder *builder)
{
- GNUNET_break (0);
+ GtkEditable *entry;
+ const gchar *preedit;
+
+ entry = GTK_EDITABLE (gtk_builder_get_object (builder,
+ "edit_dialog_gns2dns_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;
}
@@ -91,7 +124,7 @@
void *
libgnunet_plugin_gtk_namestore_gns2dns_init (void *cls)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *env = cls;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_leho.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_leho.c 2013-10-27
16:35:04 UTC (rev 30430)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_leho.c 2013-10-27
17:07:02 UTC (rev 30431)
@@ -27,12 +27,31 @@
#include "gnunet_gtk_namestore_plugin.h"
+
+
/**
+ * The user has edited the LEHO record value. Enable/disable 'save'
+ * button depending on the validity of the value.
+ *
+ * @param entry editing widget
+ * @param user_data the plugin environment
+ */
+void
+GNS_edit_dialog_leho_entry_changed_cb (GtkEditable *entry,
+ gpointer user_data)
+{
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+
+ env->check_validity (env->cls);
+}
+
+
+/**
* Function that will be called to initialize the builder's
* widgets from the existing record (if there is one).
* The `n_value` is the existing value of the record as a string.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param n_value the record as a string
* @param builder the edit dialog's builder
*/
@@ -41,7 +60,12 @@
gchar *n_value,
GtkBuilder *builder)
{
- GNUNET_break (0);
+ GtkEntry *entry;
+
+ entry = GTK_ENTRY (gtk_builder_get_object (builder,
+ "edit_dialog_leho_entry"));
+ gtk_entry_set_text (entry,
+ n_value);
}
@@ -49,7 +73,7 @@
* Function that will be called to retrieve the final value of the
* record (in string format) once the dialog is being closed.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return record value as a string, as specified in the dialog
*/
@@ -57,8 +81,13 @@
leho_store (void *cls,
GtkBuilder *builder)
{
- GNUNET_break (0);
- return NULL;
+ GtkEntry *entry;
+ const gchar *value;
+
+ entry = GTK_ENTRY (gtk_builder_get_object (builder,
+ "edit_dialog_leho_entry"));
+ value = gtk_entry_get_text (entry);
+ return g_strdup (value);
}
@@ -69,7 +98,7 @@
* function should highlight fields with invalid inputs for the
* user.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
@@ -77,7 +106,15 @@
leho_validate (void *cls,
GtkBuilder *builder)
{
- GNUNET_break (0);
+ GtkEditable *entry;
+ const gchar *preedit;
+
+ entry = GTK_EDITABLE (gtk_builder_get_object (builder,
+ "edit_dialog_leho_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;
}
@@ -91,7 +128,7 @@
void *
libgnunet_plugin_gtk_namestore_leho_init (void *cls)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *env = cls;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_mx.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_mx.c 2013-10-27 16:35:04 UTC
(rev 30430)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_mx.c 2013-10-27 17:07:02 UTC
(rev 30431)
@@ -28,11 +28,28 @@
/**
+ * The user has edited the MX record value. Enable/disable 'save'
+ * button depending on the validity of the value.
+ *
+ * @param entry editing widget
+ * @param user_data the plugin environment
+ */
+void
+GNS_edit_dialog_mx_entry_changed_cb (GtkEditable *entry,
+ gpointer user_data)
+{
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+
+ env->check_validity (env->cls);
+}
+
+
+/**
* Function that will be called to initialize the builder's
* widgets from the existing record (if there is one).
* The `n_value` is the existing value of the record as a string.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param n_value the record as a string
* @param builder the edit dialog's builder
*/
@@ -41,7 +58,27 @@
gchar *n_value,
GtkBuilder *builder)
{
- GNUNET_break (0);
+ uint16_t mx_pref;
+ char result[253 + 1];
+
+ if (2 != SSCANF (n_value,
+ "%hu,%253s",
+ &mx_pref, result))
+ {
+ GNUNET_break (0);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Unable to parse MX record `%s'\n"),
+ n_value);
+ return;
+ }
+ gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
+
"edit_dialog_mx_entry")),
+ result);
+ gtk_spin_button_set_value
+ (GTK_SPIN_BUTTON
+ (gtk_builder_get_object (builder,
+ "edit_dialog_mx_distance_spinbutton")),
+ mx_pref);
}
@@ -49,7 +86,7 @@
* Function that will be called to retrieve the final value of the
* record (in string format) once the dialog is being closed.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return record value as a string, as specified in the dialog
*/
@@ -57,8 +94,26 @@
mx_store (void *cls,
GtkBuilder *builder)
{
- GNUNET_break (0);
- return NULL;
+ GtkEntry *entry;
+ const gchar *value;
+ char *result;
+ unsigned int distance;
+ gchar *ret;
+
+ entry = GTK_ENTRY (gtk_builder_get_object (builder,
+ "edit_dialog_mx_entry"));
+ value = gtk_entry_get_text (entry);
+ distance = gtk_spin_button_get_value
+ (GTK_SPIN_BUTTON
+ (gtk_builder_get_object (builder,
+ "edit_dialog_mx_distance_spinbutton")));
+ GNUNET_asprintf (&result,
+ "%hu,%s",
+ distance,
+ value);
+ ret = g_strdup (result);
+ GNUNET_free (result);
+ return ret;
}
@@ -69,7 +124,7 @@
* function should highlight fields with invalid inputs for the
* user.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
@@ -77,7 +132,15 @@
mx_validate (void *cls,
GtkBuilder *builder)
{
- GNUNET_break (0);
+ GtkEditable *entry;
+ const gchar *preedit;
+
+ entry = GTK_EDITABLE (gtk_builder_get_object (builder,
+ "edit_dialog_mx_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;
}
@@ -91,7 +154,7 @@
void *
libgnunet_plugin_gtk_namestore_mx_init (void *cls)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *env = cls;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
@@ -112,7 +175,7 @@
* @return always NULL
*/
void *
-libgnunet_plugin_gtk_namestore_aaaa_done (void *cls)
+libgnunet_plugin_gtk_namestore_mx_done (void *cls)
{
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin = cls;
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_phone.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_phone.c 2013-10-27
16:35:04 UTC (rev 30430)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_phone.c 2013-10-27
17:07:02 UTC (rev 30431)
@@ -27,12 +27,31 @@
#include "gnunet_gtk_namestore_plugin.h"
+
+
/**
+ * The user has edited the PHONE record value. Enable/disable 'save'
+ * button depending on the validity of the value.
+ *
+ * @param entry editing widget
+ * @param user_data the plugin environment
+ */
+void
+GNS_edit_dialog_phone_peer_entry_changed_cb (GtkEditable *entry,
+ gpointer user_data)
+{
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+
+ env->check_validity (env->cls);
+}
+
+
+/**
* Function that will be called to initialize the builder's
* widgets from the existing record (if there is one).
* The `n_value` is the existing value of the record as a string.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param n_value the record as a string
* @param builder the edit dialog's builder
*/
@@ -41,7 +60,28 @@
gchar *n_value,
GtkBuilder *builder)
{
- GNUNET_break (0);
+ const char *minus;
+ unsigned int line;
+
+ if (1 != (sscanf (n_value,
+ "%u-",
+ &line)))
+ {
+ GNUNET_break (0);
+ return;
+ }
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON
+ (gtk_builder_get_object (builder,
+
"edit_dialog_phone_line_spinbutton")),
+ line);
+ if (NULL == (minus = strchr (n_value, '-')))
+ {
+ GNUNET_break (0);
+ return;
+ }
+ gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
+
"edit_dialog_phone_peer_entry")),
+ minus + 1);
}
@@ -49,7 +89,7 @@
* Function that will be called to retrieve the final value of the
* record (in string format) once the dialog is being closed.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return record value as a string, as specified in the dialog
*/
@@ -57,8 +97,23 @@
phone_store (void *cls,
GtkBuilder *builder)
{
- GNUNET_break (0);
- return NULL;
+ GtkEntry *entry;
+ GtkSpinButton *spin;
+ const gchar *value;
+ unsigned int line;
+ char *ret;
+
+ entry = GTK_ENTRY (gtk_builder_get_object (builder,
+ "edit_dialog_phone_peer_entry"));
+ value = gtk_entry_get_text (entry);
+ spin = GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
+
"edit_dialog_phone_line_spinbutton"));
+ line = gtk_spin_button_get_value (spin);
+ GNUNET_asprintf (&ret,
+ "%u-%s",
+ line,
+ value);
+ return ret;
}
@@ -69,7 +124,7 @@
* function should highlight fields with invalid inputs for the
* user.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
@@ -77,7 +132,19 @@
phone_validate (void *cls,
GtkBuilder *builder)
{
- GNUNET_break (0);
+ GtkEditable *entry;
+ const gchar *preedit;
+ struct GNUNET_CRYPTO_EcdsaPublicKey pub;
+
+ entry = GTK_EDITABLE (gtk_builder_get_object (builder,
+
"edit_dialog_phone_peer_entry"));
+ preedit = gtk_editable_get_chars (entry, 0, -1);
+ if ( (NULL == preedit) ||
+ (GNUNET_OK !=
+ GNUNET_CRYPTO_ecdsa_public_key_from_string (preedit,
+ strlen (preedit),
+ &pub)) )
+ return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -91,7 +158,7 @@
void *
libgnunet_plugin_gtk_namestore_phone_init (void *cls)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *env = cls;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_pkey.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_pkey.c 2013-10-27
16:35:04 UTC (rev 30430)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_pkey.c 2013-10-27
17:07:02 UTC (rev 30431)
@@ -28,11 +28,28 @@
/**
+ * The user has edited the PKEY record value. Enable/disable 'save'
+ * button depending on the validity of the value.
+ *
+ * @param entry editing widget
+ * @param user_data the plugin environment
+ */
+void
+GNS_edit_dialog_pkey_entry_changed_cb (GtkEditable *entry,
+ gpointer user_data)
+{
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+
+ env->check_validity (env->cls);
+}
+
+
+/**
* Function that will be called to initialize the builder's
* widgets from the existing record (if there is one).
* The `n_value` is the existing value of the record as a string.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param n_value the record as a string
* @param builder the edit dialog's builder
*/
@@ -41,7 +58,9 @@
gchar *n_value,
GtkBuilder *builder)
{
- GNUNET_break (0);
+ gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
+
"edit_dialog_pkey_entry")),
+ n_value);
}
@@ -49,7 +68,7 @@
* Function that will be called to retrieve the final value of the
* record (in string format) once the dialog is being closed.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return record value as a string, as specified in the dialog
*/
@@ -57,8 +76,13 @@
pkey_store (void *cls,
GtkBuilder *builder)
{
- GNUNET_break (0);
- return NULL;
+ GtkEntry *entry;
+ const gchar *value;
+
+ entry = GTK_ENTRY (gtk_builder_get_object (builder,
+ "edit_dialog_pkey_entry"));
+ value = gtk_entry_get_text (entry);
+ return g_strdup (value);
}
@@ -69,7 +93,7 @@
* function should highlight fields with invalid inputs for the
* user.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
@@ -77,7 +101,19 @@
pkey_validate (void *cls,
GtkBuilder *builder)
{
- GNUNET_break (0);
+ GtkEditable *entry;
+ const gchar *preedit;
+ struct GNUNET_CRYPTO_EcdsaPublicKey pub;
+
+ entry = GTK_EDITABLE (gtk_builder_get_object (builder,
+ "edit_dialog_pkey_entry")),
+ preedit = gtk_editable_get_chars (entry, 0, -1);
+ if ( (NULL == preedit) ||
+ (GNUNET_OK !=
+ GNUNET_CRYPTO_ecdsa_public_key_from_string (preedit,
+ strlen (preedit),
+ &pub)) )
+ return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -91,7 +127,7 @@
void *
libgnunet_plugin_gtk_namestore_pkey_init (void *cls)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *env = cls;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_ptr.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_ptr.c 2013-10-27 16:35:04 UTC
(rev 30430)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_ptr.c 2013-10-27 17:07:02 UTC
(rev 30431)
@@ -28,11 +28,28 @@
/**
+ * The user has edited the PTR record value. Enable/disable 'save'
+ * button depending on the validity of the value.
+ *
+ * @param entry editing widget
+ * @param user_data the plugin environment
+ */
+void
+GNS_edit_dialog_ptr_entry_changed_cb (GtkEditable *entry,
+ gpointer user_data)
+{
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+
+ env->check_validity (env->cls);
+}
+
+
+/**
* Function that will be called to initialize the builder's
* widgets from the existing record (if there is one).
* The `n_value` is the existing value of the record as a string.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param n_value the record as a string
* @param builder the edit dialog's builder
*/
@@ -41,7 +58,9 @@
gchar *n_value,
GtkBuilder *builder)
{
- GNUNET_break (0);
+ gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
+
"edit_dialog_ptr_entry")),
+ n_value);
}
@@ -49,7 +68,7 @@
* Function that will be called to retrieve the final value of the
* record (in string format) once the dialog is being closed.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return record value as a string, as specified in the dialog
*/
@@ -57,8 +76,13 @@
ptr_store (void *cls,
GtkBuilder *builder)
{
- GNUNET_break (0);
- return NULL;
+ GtkEntry *entry;
+ const gchar *value;
+
+ entry = GTK_ENTRY (gtk_builder_get_object (builder,
+ "edit_dialog_ptr_entry"));
+ value = gtk_entry_get_text (entry);
+ return g_strdup (value);
}
@@ -69,7 +93,7 @@
* function should highlight fields with invalid inputs for the
* user.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
@@ -77,7 +101,15 @@
ptr_validate (void *cls,
GtkBuilder *builder)
{
- GNUNET_break (0);
+ GtkEditable *entry;
+ const gchar *preedit;
+
+ entry = GTK_EDITABLE (gtk_builder_get_object (builder,
+ "edit_dialog_ptr_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;
}
@@ -91,7 +123,7 @@
void *
libgnunet_plugin_gtk_namestore_ptr_init (void *cls)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *env = cls;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_soa.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_soa.c 2013-10-27 16:35:04 UTC
(rev 30430)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_soa.c 2013-10-27 17:07:02 UTC
(rev 30431)
@@ -32,7 +32,7 @@
* widgets from the existing record (if there is one).
* The `n_value` is the existing value of the record as a string.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param n_value the record as a string
* @param builder the edit dialog's builder
*/
@@ -49,7 +49,7 @@
* Function that will be called to retrieve the final value of the
* record (in string format) once the dialog is being closed.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return record value as a string, as specified in the dialog
*/
@@ -69,7 +69,7 @@
* function should highlight fields with invalid inputs for the
* user.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
@@ -91,7 +91,7 @@
void *
libgnunet_plugin_gtk_namestore_soa_init (void *cls)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *env = cls;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_srv.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_srv.c 2013-10-27 16:35:04 UTC
(rev 30430)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_srv.c 2013-10-27 17:07:02 UTC
(rev 30431)
@@ -32,7 +32,7 @@
* widgets from the existing record (if there is one).
* The `n_value` is the existing value of the record as a string.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param n_value the record as a string
* @param builder the edit dialog's builder
*/
@@ -49,7 +49,7 @@
* Function that will be called to retrieve the final value of the
* record (in string format) once the dialog is being closed.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return record value as a string, as specified in the dialog
*/
@@ -69,7 +69,7 @@
* function should highlight fields with invalid inputs for the
* user.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
@@ -91,7 +91,7 @@
void *
libgnunet_plugin_gtk_namestore_srv_init (void *cls)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *env = cls;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_template.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_template.c 2013-10-27
16:35:04 UTC (rev 30430)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_template.c 2013-10-27
17:07:02 UTC (rev 30431)
@@ -32,7 +32,7 @@
* widgets from the existing record (if there is one).
* The `n_value` is the existing value of the record as a string.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param n_value the record as a string
* @param builder the edit dialog's builder
*/
@@ -49,7 +49,7 @@
* Function that will be called to retrieve the final value of the
* record (in string format) once the dialog is being closed.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return record value as a string, as specified in the dialog
*/
@@ -69,7 +69,7 @@
* function should highlight fields with invalid inputs for the
* user.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
@@ -91,7 +91,7 @@
void *
libgnunet_plugin_gtk_namestore_a_init (void *cls)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *env = cls;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_txt.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_txt.c 2013-10-27 16:35:04 UTC
(rev 30430)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_txt.c 2013-10-27 17:07:02 UTC
(rev 30431)
@@ -32,7 +32,7 @@
* widgets from the existing record (if there is one).
* The `n_value` is the existing value of the record as a string.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param n_value the record as a string
* @param builder the edit dialog's builder
*/
@@ -49,7 +49,7 @@
* Function that will be called to retrieve the final value of the
* record (in string format) once the dialog is being closed.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return record value as a string, as specified in the dialog
*/
@@ -69,7 +69,7 @@
* function should highlight fields with invalid inputs for the
* user.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
@@ -91,7 +91,7 @@
void *
libgnunet_plugin_gtk_namestore_txt_init (void *cls)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *env = cls;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_vpn.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_vpn.c 2013-10-27 16:35:04 UTC
(rev 30430)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_vpn.c 2013-10-27 17:07:02 UTC
(rev 30431)
@@ -32,7 +32,7 @@
* widgets from the existing record (if there is one).
* The `n_value` is the existing value of the record as a string.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param n_value the record as a string
* @param builder the edit dialog's builder
*/
@@ -49,7 +49,7 @@
* Function that will be called to retrieve the final value of the
* record (in string format) once the dialog is being closed.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return record value as a string, as specified in the dialog
*/
@@ -69,7 +69,7 @@
* function should highlight fields with invalid inputs for the
* user.
*
- * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *`
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
* @param builder the edit dialog's builder
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
@@ -91,7 +91,7 @@
void *
libgnunet_plugin_gtk_namestore_vpn_init (void *cls)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvirionment *env = cls;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30431 - gnunet-gtk/src/namestore,
gnunet <=