[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30487 - in gnunet-gtk: contrib src/include src/lib src/nam
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30487 - in gnunet-gtk: contrib src/include src/lib src/namestore |
Date: |
Wed, 30 Oct 2013 20:47:24 +0100 |
Author: grothoff
Date: 2013-10-30 20:47:24 +0100 (Wed, 30 Oct 2013)
New Revision: 30487
Removed:
gnunet-gtk/src/namestore/gnunet-namestore-gtk_edit.h
Modified:
gnunet-gtk/contrib/gnunet_namestore_edit_a.glade
gnunet-gtk/contrib/gnunet_namestore_edit_aaaa.glade
gnunet-gtk/contrib/gnunet_namestore_edit_cname.glade
gnunet-gtk/contrib/gnunet_namestore_edit_gns2dns.glade
gnunet-gtk/contrib/gnunet_namestore_edit_leho.glade
gnunet-gtk/contrib/gnunet_namestore_edit_mx.glade
gnunet-gtk/contrib/gnunet_namestore_edit_phone.glade
gnunet-gtk/contrib/gnunet_namestore_edit_pkey.glade
gnunet-gtk/contrib/gnunet_namestore_edit_ptr.glade
gnunet-gtk/contrib/gnunet_namestore_edit_soa.glade
gnunet-gtk/contrib/gnunet_namestore_edit_srv.glade
gnunet-gtk/contrib/gnunet_namestore_edit_txt.glade
gnunet-gtk/contrib/gnunet_namestore_edit_vpn.glade
gnunet-gtk/src/include/gnunet_gtk.h
gnunet-gtk/src/include/gnunet_gtk_namestore_plugin.h
gnunet-gtk/src/lib/glade.c
gnunet-gtk/src/namestore/Makefile.am
gnunet-gtk/src/namestore/gnunet-namestore-gtk.c
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:
-finishing implementation of pluggable dialogs (#3081)
Modified: gnunet-gtk/contrib/gnunet_namestore_edit_a.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_namestore_edit_a.glade 2013-10-30 18:16:01 UTC
(rev 30486)
+++ gnunet-gtk/contrib/gnunet_namestore_edit_a.glade 2013-10-30 19:47:24 UTC
(rev 30487)
@@ -41,7 +41,6 @@
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
- <signal name="response" handler="GNS_edit_a_dialog_response_cb"
swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="edit_dialog_vbox">
<property name="visible">True</property>
Modified: gnunet-gtk/contrib/gnunet_namestore_edit_aaaa.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_namestore_edit_aaaa.glade 2013-10-30 18:16:01 UTC
(rev 30486)
+++ gnunet-gtk/contrib/gnunet_namestore_edit_aaaa.glade 2013-10-30 19:47:24 UTC
(rev 30487)
@@ -24,7 +24,6 @@
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
- <signal name="response" handler="GNS_edit_aaaa_dialog_response_cb"
swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="edit_dialog_vbox">
<property name="visible">True</property>
Modified: gnunet-gtk/contrib/gnunet_namestore_edit_cname.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_namestore_edit_cname.glade 2013-10-30
18:16:01 UTC (rev 30486)
+++ gnunet-gtk/contrib/gnunet_namestore_edit_cname.glade 2013-10-30
19:47:24 UTC (rev 30487)
@@ -24,7 +24,6 @@
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
- <signal name="response" handler="GNS_edit_cname_dialog_response_cb"
swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="edit_dialog_vbox">
<property name="visible">True</property>
Modified: gnunet-gtk/contrib/gnunet_namestore_edit_gns2dns.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_namestore_edit_gns2dns.glade 2013-10-30
18:16:01 UTC (rev 30486)
+++ gnunet-gtk/contrib/gnunet_namestore_edit_gns2dns.glade 2013-10-30
19:47:24 UTC (rev 30487)
@@ -41,7 +41,6 @@
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
- <signal name="response" handler="GNS_edit_gns2dns_dialog_response_cb"
swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="edit_dialog_vbox">
<property name="visible">True</property>
Modified: gnunet-gtk/contrib/gnunet_namestore_edit_leho.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_namestore_edit_leho.glade 2013-10-30 18:16:01 UTC
(rev 30486)
+++ gnunet-gtk/contrib/gnunet_namestore_edit_leho.glade 2013-10-30 19:47:24 UTC
(rev 30487)
@@ -41,7 +41,6 @@
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
- <signal name="response" handler="GNS_edit_leho_dialog_response_cb"
swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="edit_dialog_vbox">
<property name="visible">True</property>
Modified: gnunet-gtk/contrib/gnunet_namestore_edit_mx.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_namestore_edit_mx.glade 2013-10-30 18:16:01 UTC
(rev 30486)
+++ gnunet-gtk/contrib/gnunet_namestore_edit_mx.glade 2013-10-30 19:47:24 UTC
(rev 30487)
@@ -46,7 +46,6 @@
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
- <signal name="response" handler="GNS_edit_mx_dialog_response_cb"
swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="edit_dialog_vbox">
<property name="visible">True</property>
Modified: gnunet-gtk/contrib/gnunet_namestore_edit_phone.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_namestore_edit_phone.glade 2013-10-30
18:16:01 UTC (rev 30486)
+++ gnunet-gtk/contrib/gnunet_namestore_edit_phone.glade 2013-10-30
19:47:24 UTC (rev 30487)
@@ -47,7 +47,6 @@
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
- <signal name="response" handler="GNS_edit_phone_dialog_response_cb"
swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="edit_dialog_vbox">
<property name="visible">True</property>
Modified: gnunet-gtk/contrib/gnunet_namestore_edit_pkey.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_namestore_edit_pkey.glade 2013-10-30 18:16:01 UTC
(rev 30486)
+++ gnunet-gtk/contrib/gnunet_namestore_edit_pkey.glade 2013-10-30 19:47:24 UTC
(rev 30487)
@@ -41,7 +41,6 @@
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
- <signal name="response" handler="GNS_edit_pkey_dialog_response_cb"
swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="edit_dialog_vbox">
<property name="visible">True</property>
Modified: gnunet-gtk/contrib/gnunet_namestore_edit_ptr.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_namestore_edit_ptr.glade 2013-10-30 18:16:01 UTC
(rev 30486)
+++ gnunet-gtk/contrib/gnunet_namestore_edit_ptr.glade 2013-10-30 19:47:24 UTC
(rev 30487)
@@ -41,7 +41,6 @@
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
- <signal name="response" handler="GNS_edit_ptr_dialog_response_cb"
swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="edit_dialog_vbox">
<property name="visible">True</property>
Modified: gnunet-gtk/contrib/gnunet_namestore_edit_soa.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_namestore_edit_soa.glade 2013-10-30 18:16:01 UTC
(rev 30486)
+++ gnunet-gtk/contrib/gnunet_namestore_edit_soa.glade 2013-10-30 19:47:24 UTC
(rev 30487)
@@ -70,7 +70,6 @@
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
- <signal name="response" handler="GNS_edit_soa_dialog_response_cb"
swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="edit_dialog_vbox">
<property name="visible">True</property>
Modified: gnunet-gtk/contrib/gnunet_namestore_edit_srv.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_namestore_edit_srv.glade 2013-10-30 18:16:01 UTC
(rev 30486)
+++ gnunet-gtk/contrib/gnunet_namestore_edit_srv.glade 2013-10-30 19:47:24 UTC
(rev 30487)
@@ -56,7 +56,6 @@
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
- <signal name="response" handler="GNS_edit_srv_dialog_response_cb"
swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="edit_dialog_vbox">
<property name="visible">True</property>
Modified: gnunet-gtk/contrib/gnunet_namestore_edit_txt.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_namestore_edit_txt.glade 2013-10-30 18:16:01 UTC
(rev 30486)
+++ gnunet-gtk/contrib/gnunet_namestore_edit_txt.glade 2013-10-30 19:47:24 UTC
(rev 30487)
@@ -41,7 +41,6 @@
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
- <signal name="response" handler="GNS_edit_txt_dialog_response_cb"
swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="edit_dialog_vbox">
<property name="visible">True</property>
Modified: gnunet-gtk/contrib/gnunet_namestore_edit_vpn.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_namestore_edit_vpn.glade 2013-10-30 18:16:01 UTC
(rev 30486)
+++ gnunet-gtk/contrib/gnunet_namestore_edit_vpn.glade 2013-10-30 19:47:24 UTC
(rev 30487)
@@ -41,7 +41,6 @@
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
- <signal name="response" handler="GNS_edit_vpn_dialog_response_cb"
swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="edit_dialog_vbox">
<property name="visible">True</property>
Modified: gnunet-gtk/src/include/gnunet_gtk.h
===================================================================
--- gnunet-gtk/src/include/gnunet_gtk.h 2013-10-30 18:16:01 UTC (rev 30486)
+++ gnunet-gtk/src/include/gnunet_gtk.h 2013-10-30 19:47:24 UTC (rev 30487)
@@ -107,6 +107,22 @@
/* **************** Glade/Gtk helpers *************** */
/**
+ * Create an initialize a new builder based on the
+ * GNUnet-GTK glade file.
+ *
+ * @param filename name of the resource file to load
+ * @param user_data user_data to pass to signal handlers,
+ * use "NULL" to pass the GtkBuilder itself.
+ * @param cb function to call before connecting signals
+ * @return NULL on error
+ */
+GtkBuilder *
+GNUNET_GTK_get_new_builder2 (const char *filename,
+ void *user_data,
+ GtkBuilderConnectFunc cb);
+
+
+/**
* Create an initialize a new builder based on the GNUnet-GTK glade
* file.
*
@@ -115,9 +131,7 @@
* use "NULL" to pass the GtkBuilder itself.
* @return NULL on error
*/
-GtkBuilder *
-GNUNET_GTK_get_new_builder (const char *filename,
- void *user_data);
+#define GNUNET_GTK_get_new_builder(filename,user_data)
GNUNET_GTK_get_new_builder2(filename,user_data,NULL)
/**
Modified: gnunet-gtk/src/include/gnunet_gtk_namestore_plugin.h
===================================================================
--- gnunet-gtk/src/include/gnunet_gtk_namestore_plugin.h 2013-10-30
18:16:01 UTC (rev 30486)
+++ gnunet-gtk/src/include/gnunet_gtk_namestore_plugin.h 2013-10-30
19:47:24 UTC (rev 30487)
@@ -32,26 +32,125 @@
/**
- * Context for edit operations.
+ * Context for edit operations and environment for plugins.
+ * Typical plugins will only use the @e check_validity callback.
*/
struct GNUNET_GTK_NAMESTORE_PluginEnvironment
{
- /**
- * Closure to pass to @e check_validity.
- */
- void *cls;
/**
* Function that should be called by the plugin whenever values in
* the dialog were edited. It will check the validity of the dialog
* and update the "save" button accordingly.
*/
- void (*check_validity)(void *cls);
+ void (*check_validity)(struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc);
+ /**
+ * Builder for the dialog.
+ */
+ GtkBuilder *builder;
+
+ /**
+ * Main dialog window.
+ */
+ GtkDialog *dialog;
+
+ /**
+ * Where in the tree view are we editing?
+ */
+ struct RecordInfo *ri;
+
+ /**
+ * Name of the record.
+ */
+ gchar *name;
+
+ /**
+ * Value of the record in string format.
+ */
+ gchar *n_value;
+
+ /**
+ * Name of the zone into which the record should be placed.
+ */
+ gchar *new_zone_option;
+
+ /**
+ * Ego of the zone into which the record should be placed.
+ */
+ struct GNUNET_IDENTITY_Ego *ego;
+
+ /**
+ * List of all zones.
+ */
+ GtkListStore *zone_liststore;
+
+ /**
+ * The plugin we used to edit the value.
+ */
+ struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
+
+ /**
+ * Name of the plugin library.
+ */
+ char *liblow;
+
+ /**
+ * Expiration time value (absolute or relative).
+ */
+ guint64 n_exp_time;
+
+ /**
+ * Offset of the record we are editing in the 'rd' list of 'ri'.
+ */
+ unsigned int off;
+
+ /**
+ * Flag indicating if the old record was in the namestore.
+ */
+ int old_record_in_namestore;
+
+ /**
+ * Type of the record.
+ */
+ uint32_t record_type;
+
+ /**
+ * Is this record 'public'?
+ */
+ gboolean n_public;
+
+ /**
+ * Is the expiration time relative?
+ */
+ gboolean n_is_relative;
+
+ /**
+ * Is this record a shadow record?
+ */
+ gboolean n_is_shadow;
+
};
/**
+ * Symbol to give to the GtkBuilder for resolution.
+ */
+struct GNUNET_GTK_NAMESTORE_Symbol
+{
+ /**
+ * Name of the symbol.
+ */
+ const char *name;
+
+ /**
+ * Corresponding callback.
+ */
+ GCallback cb;
+};
+
+
+/**
* Each plugin is required to return a pointer to a struct of this
* type as the return value from its entry point.
*/
@@ -77,6 +176,11 @@
const char *dialog_widget_name;
/**
+ * NULL-terminated array of symbols to add to the gtk builder.
+ */
+ const struct GNUNET_GTK_NAMESTORE_Symbol *symbols;
+
+ /**
* 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.
Modified: gnunet-gtk/src/lib/glade.c
===================================================================
--- gnunet-gtk/src/lib/glade.c 2013-10-30 18:16:01 UTC (rev 30486)
+++ gnunet-gtk/src/lib/glade.c 2013-10-30 19:47:24 UTC (rev 30487)
@@ -99,11 +99,13 @@
* @param filename name of the resource file to load
* @param user_data user_data to pass to signal handlers,
* use "NULL" to pass the GtkBuilder itself.
+ * @param cb function to call before connecting signals
* @return NULL on error
*/
GtkBuilder *
-GNUNET_GTK_get_new_builder (const char *filename,
- void *user_data)
+GNUNET_GTK_get_new_builder2 (const char *filename,
+ void *user_data,
+ GtkBuilderConnectFunc cb)
{
char *glade_path;
GtkBuilder *ret;
@@ -111,17 +113,25 @@
ret = gtk_builder_new ();
gtk_builder_set_translation_domain (ret, "gnunet-gtk");
- GNUNET_asprintf (&glade_path, "%s%s", GNUNET_GTK_get_data_dir (), filename);
+ GNUNET_asprintf (&glade_path, "%s%s",
+ GNUNET_GTK_get_data_dir (),
+ filename);
error = NULL;
if (0 == gtk_builder_add_from_file (ret, glade_path, &error))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to load `%s': %s\n"),
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Failed to load `%s': %s\n"),
glade_path, error->message);
g_error_free (error);
GNUNET_free (glade_path);
return NULL;
}
- gtk_builder_connect_signals (ret, (user_data == NULL) ? ret : user_data);
+ if (NULL == user_data)
+ user_data = ret;
+ if (NULL != cb)
+ gtk_builder_connect_signals_full (ret, cb, user_data);
+ else
+ gtk_builder_connect_signals (ret, user_data);
GNUNET_free (glade_path);
return ret;
}
Modified: gnunet-gtk/src/namestore/Makefile.am
===================================================================
--- gnunet-gtk/src/namestore/Makefile.am 2013-10-30 18:16:01 UTC (rev
30486)
+++ gnunet-gtk/src/namestore/Makefile.am 2013-10-30 19:47:24 UTC (rev
30487)
@@ -12,9 +12,10 @@
gnunet_namestore_gtk_SOURCES = \
gnunet-namestore-gtk.c \
- gnunet-namestore-gtk_edit.c gnunet-namestore-gtk_edit.h
+ gnunet-namestore-gtk_edit.c
gnunet_namestore_gtk_LDADD = \
$(top_builddir)/src/lib/libgnunetgtk.la \
+ -lgmodule-2.0 \
@GTK_LIBS@ @GNUNET_LIBS@ @GLADE_LIBS@ @QR_LIBS@ \
$(WINLIBS) \
-lgnunetutil -lgnunetgnsrecord -lgnunetnamestore -lgnunetdnsparser \
Modified: gnunet-gtk/src/namestore/gnunet-namestore-gtk.c
===================================================================
--- gnunet-gtk/src/namestore/gnunet-namestore-gtk.c 2013-10-30 18:16:01 UTC
(rev 30486)
+++ gnunet-gtk/src/namestore/gnunet-namestore-gtk.c 2013-10-30 19:47:24 UTC
(rev 30487)
@@ -24,7 +24,8 @@
* @brief edit GNS zones
*/
#include "gnunet_gtk.h"
-#include "gnunet-namestore-gtk_edit.h"
+#include "gnunet_gtk_namestore_plugin.h"
+#include <gmodule.h>
#include <gnunet/gnunet_gnsrecord_lib.h>
#include <gnunet/gnunet_gns_service.h>
#include <gnunet/gnunet_identity_service.h>
@@ -183,6 +184,25 @@
/**
+ * Columns in the zone list store.
+ */
+enum ZONE_COLUMNS
+{
+
+ /**
+ * A gchararray
+ */
+ ZONE_LS_NAME = 0,
+
+
+ /**
+ * A `struct GNUNET_IDENTITY_Ego`
+ */
+ ZONE_LS_EGO = 1
+};
+
+
+/**
* Closure for 'operation_done_cont'.
*/
struct OperationContext
@@ -230,7 +250,7 @@
/**
* Info from editing dialog.
*/
- struct EditDialogContext *edc;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc;
/**
* Private key of target zone.
@@ -535,8 +555,8 @@
*/
void
gnunet_namestore_gtk_qr_save_as_dialog_response_cb (GtkDialog *dialog,
- gint response_id,
- gpointer user_data)
+ gint response_id,
+ gpointer user_data)
{
#if HAVE_QRENCODE_H
GtkBuilder *builder = user_data;
@@ -577,7 +597,7 @@
*/
void
gnunet_namestore_gtk_qr_saveas_button_clicked_cb (GtkButton *button,
- gpointer user_data)
+ gpointer user_data)
{
GtkBuilder *builder;
GtkWindow *dialog;
@@ -589,7 +609,7 @@
pseu = gtk_entry_get_text (GTK_ENTRY(entry));
builder =
GNUNET_GTK_get_new_builder ("gnunet_namestore_gtk_qr_save_as_dialog.glade",
- NULL);
+ NULL);
if (NULL == builder)
{
GNUNET_break (0);
@@ -782,7 +802,7 @@
* @param edc resources to free
*/
static void
-free_edit_dialog_context (struct EditDialogContext *edc)
+free_edit_dialog_context (struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc)
{
g_free (edc->name);
g_free (edc->n_value);
@@ -804,7 +824,7 @@
const struct GNUNET_GNSRECORD_Data *rd)
{
struct MoveOperationContext *moc = cls;
- struct EditDialogContext *edc = moc->edc;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = moc->edc;
struct GNUNET_GNSRECORD_Data rd_new[rd_count + 1];
struct OperationContext *oc;
@@ -883,7 +903,7 @@
* @param ret return code of the dialog
*/
static void
-edit_dialog_continuation (struct EditDialogContext *edc,
+edit_dialog_continuation (struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc,
GtkResponseType ret)
{
struct RecordInfo *ri = edc->ri;
@@ -894,6 +914,17 @@
size_t data_size;
struct OperationContext *oc;
+ if (NULL != edc->plugin)
+ {
+ GNUNET_PLUGIN_unload (edc->liblow,
+ edc->plugin);
+ edc->plugin = NULL;
+ }
+ if (NULL != edc->liblow)
+ {
+ GNUNET_free (edc->liblow);
+ edc->liblow = NULL;
+ }
if ( (NULL != ri) &&
(GNUNET_OK !=
GNUNET_GNSRECORD_records_deserialize (ri->data_size,
@@ -1044,6 +1075,440 @@
/**
+ * Disable 'save' button, dialog state is not acceptable.
+ *
+ * @param edc dialog to modify
+ */
+static void
+edit_dialog_disable_save (struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc)
+{
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (edc->builder,
+
"edit_dialog_save_button")),
+ FALSE);
+}
+
+
+/**
+ * Enable 'save' button, dialog state is acceptable.
+ *
+ * @param edc dialog to modify
+ */
+static void
+edit_dialog_enable_save (struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc)
+{
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (edc->builder,
+
"edit_dialog_save_button")),
+ TRUE);
+}
+
+
+/**
+ * Function that should be called by the plugin whenever values in
+ * the dialog were edited. It will check the validity of the dialog
+ * and update the "save" button accordingly.
+ *
+ * @param edc the plugin environment
+ */
+static void
+check_validity (struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc)
+{
+
+ GtkEditable *entry;
+ const gchar *name;
+
+ /* check name */
+ entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder,
+ "edit_dialog_name_entry"));
+ name = gtk_editable_get_chars (entry, 0, -1);
+ if ( (GNUNET_OK != edc->plugin->validate (edc->plugin->cls,
+ edc->builder)) ||
+ ( (GNUNET_SYSERR == GNUNET_DNSPARSER_check_label (name)) &&
+ (0 != strcmp (name, GNUNET_GNS_MASTERZONE_STR))) )
+ {
+ edit_dialog_disable_save (edc);
+ return;
+ }
+ edit_dialog_enable_save (edc);
+}
+
+
+/**
+ * Setup the zone combobox.
+ *
+ * @param edc dialog to setup the combo box for
+ */
+static void
+setup_zone (struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc)
+{
+ GtkTreeIter iter;
+ GtkComboBox *cb;
+ gchar *name;
+
+ cb = GTK_COMBO_BOX (gtk_builder_get_object (edc->builder,
+ "edit_dialog_zone_combobox"));
+
+ gtk_combo_box_set_model (cb,
+ GTK_TREE_MODEL (edc->zone_liststore));
+ GNUNET_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL
(edc->zone_liststore),
+ &iter));
+ do {
+ gtk_tree_model_get (GTK_TREE_MODEL (edc->zone_liststore),
+ &iter,
+ ZONE_LS_NAME, &name,
+ -1);
+ if (0 == strcmp (name,
+ edc->new_zone_option))
+ {
+ g_free (name);
+ break;
+ }
+ g_free (name);
+ } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (edc->zone_liststore),
+ &iter));
+ gtk_combo_box_set_active_iter (cb,
+ &iter);
+}
+
+
+/**
+ * Initialize widgets of the edit dialog that are the same regardless of
+ * the type of the record.
+ *
+ * @param edc dialog context
+ */
+static void
+edit_dialog_setup_common_elements (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc)
+{
+ GtkComboBox *cb;
+ GtkListStore *ls;
+ GtkTreeIter iter;
+ struct GNUNET_TIME_Absolute at;
+ struct GNUNET_TIME_Relative rt;
+ time_t tp;
+ struct tm *ymd;
+ GtkCalendar *cal;
+
+ if (GNUNET_YES !=
+ edc->old_record_in_namestore)
+ {
+ gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
+
"edit_dialog_delete_button")));
+ edit_dialog_disable_save (edc);
+ }
+ gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder,
+
"edit_dialog_name_entry")),
+ edc->name);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
+
"edit_dialog_options_public_checkbutton")),
+ edc->n_public);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
+
"edit_dialog_options_shadow_checkbutton")),
+ edc->n_is_shadow);
+ if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == edc->n_exp_time)
+ {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
+
"edit_dialog_expiration_never_radiobutton")),
+ TRUE);
+ gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
+
"edit_dialog_expiration_absolute_calendar")));
+ gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
+
"edit_dialog_expiration_absolute_hbox")));
+ gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
+
"edit_dialog_expiration_relative_combobox")));
+ }
+ if ( (edc->n_is_relative) &&
+ (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != edc->n_exp_time) )
+ {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
+
"edit_dialog_expiration_relative_radiobutton")),
+ TRUE);
+ gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
+
"edit_dialog_expiration_absolute_calendar")));
+ gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
+
"edit_dialog_expiration_absolute_hbox")));
+ rt.rel_value_us = edc->n_exp_time;
+ }
+ else
+ {
+ /* select a sane default */
+ rt = GNUNET_TIME_UNIT_DAYS;
+ }
+ cb = GTK_COMBO_BOX (gtk_builder_get_object (edc->builder,
+
"edit_dialog_expiration_relative_combobox"));
+ ls = GTK_LIST_STORE (gtk_combo_box_get_model (cb));
+ gtk_list_store_insert_with_values (ls, &iter,
+ -1 /* position: append */,
+ 0, GNUNET_STRINGS_relative_time_to_string
(rt, GNUNET_NO),
+ -1);
+ gtk_combo_box_set_active_iter (cb, &iter);
+ if ( (! edc->n_is_relative) &&
+ (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us != edc->n_exp_time) )
+ {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
+
"edit_dialog_expiration_absolute_radiobutton")),
+ TRUE);
+
+ gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
+
"edit_dialog_expiration_relative_combobox")));
+ at.abs_value_us = edc->n_exp_time;
+ }
+ else
+ {
+ /* select a sane default: right now */
+ at = GNUNET_TIME_absolute_get ();
+ }
+ tp = (time_t) (at.abs_value_us / 1000000LL); /* convert to seconds */
+ ymd = gmtime (&tp);
+ cal = GTK_CALENDAR (gtk_builder_get_object (edc->builder,
+
"edit_dialog_expiration_absolute_calendar"));
+ gtk_calendar_select_month (cal,
+ ymd->tm_mon,
+ ymd->tm_year + 1900);
+ gtk_calendar_mark_day (cal,
+ ymd->tm_mday);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
+
"edit_dialog_expiration_absolute_hours_spinbutton")),
+ (double) ymd->tm_hour);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
+
"edit_dialog_expiration_absolute_minutes_spinbutton")),
+ (double) ymd->tm_min);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
+
"edit_dialog_expiration_absolute_seconds_spinbutton")),
+ (double) ymd->tm_sec);
+}
+
+
+/**
+ * Perform the reverse of the #edit_dialog_setup_common_elements() function,
+ * that is, extract the values from the (common) widgets and store the
+ * values in @a edc.
+ *
+ * @param edc edit dialog to extract data from
+ */
+static void
+edit_dialog_putes_common_elements (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc)
+{
+ const char *rt_s;
+ struct GNUNET_TIME_Relative rt;
+ GtkComboBox *cb;
+ GtkTreeModel *tm;
+ GtkTreeIter iter;
+ gchar *opt;
+ struct GNUNET_IDENTITY_Ego *ego;
+
+ /* is public flag */
+ edc->n_public = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(gtk_builder_get_object (edc->builder,
+
"edit_dialog_options_public_checkbutton")));
+ /* is shadow flag */
+ edc->n_is_shadow = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(gtk_builder_get_object (edc->builder,
+
"edit_dialog_options_shadow_checkbutton")));
+
+ /* 'forever' expiration time */
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
+
"edit_dialog_expiration_never_radiobutton"))))
+ {
+ edc->n_exp_time = GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us;
+ edc->n_is_relative = TRUE; /* doesn't matter, but make sure it is
well-defined anyway */
+ }
+
+ /* 'relative' expiration time */
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
+
"edit_dialog_expiration_relative_radiobutton"))))
+ {
+ cb = GTK_COMBO_BOX (gtk_builder_get_object (edc->builder,
+
"edit_dialog_expiration_relative_combobox"));
+ tm = gtk_combo_box_get_model (cb);
+ if (! gtk_combo_box_get_active_iter (cb, &iter))
+ {
+ GNUNET_break (0);
+ return;
+ }
+ gtk_tree_model_get (tm, &iter,
+ 0, &rt_s,
+ -1);
+ GNUNET_break (GNUNET_YES ==
+ GNUNET_STRINGS_fancy_time_to_relative (rt_s,
+ &rt));
+ edc->n_exp_time = rt.rel_value_us;
+ edc->n_is_relative = TRUE;
+ }
+
+ /* 'absolute' expiration time */
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
+
"edit_dialog_expiration_absolute_radiobutton"))))
+ {
+ guint year;
+ guint month;
+ guint day;
+ guint hour;
+ guint minute;
+ guint second;
+ char fancydate[128];
+ struct GNUNET_TIME_Absolute atime;
+
+ gtk_calendar_get_date (GTK_CALENDAR (gtk_builder_get_object (edc->builder,
+
"edit_dialog_expiration_absolute_calendar")),
+ &year, &month, &day);
+ hour = gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
+
"edit_dialog_expiration_absolute_hours_spinbutton")));
+ minute = gtk_spin_button_get_value (GTK_SPIN_BUTTON
(gtk_builder_get_object (edc->builder,
+
"edit_dialog_expiration_absolute_minutes_spinbutton")));
+ second = gtk_spin_button_get_value (GTK_SPIN_BUTTON
(gtk_builder_get_object (edc->builder,
+
"edit_dialog_expiration_absolute_seconds_spinbutton")));
+ GNUNET_snprintf (fancydate,
+ sizeof (fancydate),
+ "%u-%u-%u %u:%u:%u",
+ (unsigned int) year,
+ (unsigned int) month + 1,
+ (unsigned int) day,
+ (unsigned int) hour,
+ (unsigned int) minute,
+ (unsigned int) second);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_STRINGS_fancy_time_to_absolute (fancydate,
+ &atime));
+ edc->n_exp_time = atime.abs_value_us;
+ edc->n_is_relative = FALSE;
+ }
+
+ /* extract target zone! */
+ cb = GTK_COMBO_BOX (gtk_builder_get_object (edc->builder,
+ "edit_dialog_zone_combobox"));
+ tm = gtk_combo_box_get_model (cb);
+ if (! gtk_combo_box_get_active_iter (cb, &iter))
+ {
+ GNUNET_break (0);
+ }
+ else
+ {
+ gtk_tree_model_get (tm, &iter,
+ ZONE_LS_NAME, &opt,
+ ZONE_LS_EGO, &ego,
+ -1);
+ if (NULL == opt)
+ {
+ GNUNET_break (0);
+ }
+ else
+ {
+ g_free (edc->new_zone_option);
+ edc->new_zone_option = g_strdup (opt);
+ g_free (opt);
+ edc->ego = ego;
+ }
+ }
+}
+
+
+/**
+ * Editing dialog was closed, get the data and call the
+ * continuation.
+ *
+ * @param dialog editing dialog
+ * @param response_id action that caused the dialog to be closed
+ * @param user_data the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment`
+ */
+static void
+edit_dialog_response_cb (GtkDialog *dialog,
+ gint response_id,
+ gpointer user_data)
+{
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
+
+ if (GTK_RESPONSE_OK == response_id)
+ {
+ edit_dialog_putes_common_elements (edc);
+ g_free (edc->n_value);
+ edc->n_value = edc->plugin->store (edc->plugin->cls,
+ edc->builder);
+ }
+ gtk_widget_destroy (GTK_WIDGET (edc->dialog));
+ g_object_unref (edc->builder);
+ edc->builder = NULL;
+ edit_dialog_continuation (edc, response_id);
+}
+
+
+/**
+ * Callback invoked from #GNUNET_GTK_get_new_builder2 to give
+ * us a chance to add symbols from the plugin.
+ *
+ * @param builder the builder under construction
+ * @param object object to bind signal to
+ * @param signal_name name of the signal
+ * @param handler_name name of the handler
+ * @param connect_object a GObject, if non-NULL, use g_signal_connect_object()
+ * @param flags GConnectFlags to use
+ * @param user_data the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment *`
+ */
+static void
+add_symbols (GtkBuilder *builder,
+ GObject *object,
+ const gchar *signal_name,
+ const gchar *handler_name,
+ GObject *connect_object,
+ GConnectFlags flags,
+ gpointer user_data)
+
+{
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
+ unsigned int i;
+ GCallback cb;
+ GModule *m;
+
+ cb = NULL;
+ if (NULL != edc->plugin->symbols)
+ {
+ for (i=0; NULL != edc->plugin->symbols[i].name; i++)
+ {
+ if (0 == strcmp (handler_name,
+ edc->plugin->symbols[i].name))
+ {
+ cb = edc->plugin->symbols[i].cb;
+ break;
+ }
+ }
+ }
+ if (NULL == cb)
+ {
+ m = g_module_open (NULL, 0);
+ if (! g_module_symbol (m,
+ handler_name,
+ (void **) &cb))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Failed to find handler `%s'\n"),
+ handler_name);
+ g_module_close (m);
+ return;
+ }
+ g_module_close (m);
+ }
+ if (NULL != connect_object)
+ g_signal_connect_object (object,
+ signal_name,
+ cb,
+ connect_object,
+ flags);
+ else if (flags & G_CONNECT_SWAPPED)
+ g_signal_connect_swapped (object,
+ signal_name,
+ cb,
+ user_data);
+ else if (flags & G_CONNECT_AFTER)
+ g_signal_connect_after (object,
+ signal_name,
+ cb,
+ user_data);
+ else
+ g_signal_connect (object,
+ signal_name,
+ cb,
+ user_data);
+}
+
+
+/**
* Launch a record editing dialog.
*
* @param n_type type of the record to edit
@@ -1059,9 +1524,9 @@
struct RecordInfo *ri,
unsigned int off)
{
- struct EditDialogContext *edc;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc;
- edc = GNUNET_new (struct EditDialogContext);
+ edc = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginEnvironment);
if ( (NULL != ri) &&
(off < ri->rd_count) )
{
@@ -1090,56 +1555,52 @@
edc->name = GNUNET_strdup (name);
edc->new_zone_option = g_strdup (current_zone_option);
edc->record_type = n_type;
- edc->cont = &edit_dialog_continuation;
edc->zone_liststore = zone_liststore;
- switch (n_type)
+ edc->check_validity = &check_validity;
+ GNUNET_asprintf (&edc->liblow,
+ "libgnunet_plugin_gtk_namestore_%s",
+ GNUNET_GNSRECORD_number_to_typename (n_type));
+ GNUNET_STRINGS_utf8_tolower (edc->liblow,
+ edc->liblow);
+ edc->plugin = GNUNET_PLUGIN_load (edc->liblow, edc);
+ if (NULL == edc->plugin)
{
- case GNUNET_DNSPARSER_TYPE_A:
- GNS_edit_dialog_a (edc);
- break;
- case GNUNET_DNSPARSER_TYPE_AAAA:
- GNS_edit_dialog_aaaa (edc);
- break;
- case GNUNET_DNSPARSER_TYPE_CNAME:
- GNS_edit_dialog_cname (edc);
- break;
- case GNUNET_GNSRECORD_TYPE_LEHO:
- GNS_edit_dialog_leho (edc);
- break;
- case GNUNET_GNSRECORD_TYPE_PHONE:
- GNS_edit_dialog_phone (edc);
- break;
- case GNUNET_GNSRECORD_TYPE_PKEY:
- GNS_edit_dialog_pkey (edc);
- break;
- case GNUNET_DNSPARSER_TYPE_PTR:
- GNS_edit_dialog_ptr (edc);
- break;
- case GNUNET_DNSPARSER_TYPE_MX:
- GNS_edit_dialog_mx (edc);
- break;
- case GNUNET_GNSRECORD_TYPE_GNS2DNS:
- GNS_edit_dialog_gns2dns (edc);
- break;
- case GNUNET_DNSPARSER_TYPE_SOA:
- GNS_edit_dialog_soa (edc);
- break;
- case GNUNET_DNSPARSER_TYPE_SRV:
- GNS_edit_dialog_srv (edc);
- break;
- case GNUNET_DNSPARSER_TYPE_TXT:
- GNS_edit_dialog_txt (edc);
- break;
- case GNUNET_GNSRECORD_TYPE_VPN:
- GNS_edit_dialog_vpn (edc);
- break;
- case GNUNET_DNSPARSER_TYPE_TLSA:
- default:
- GNUNET_break (0);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Failed to load plugin for record type %d\n"),
+ (int) n_type);
edit_dialog_continuation (edc,
- GTK_RESPONSE_CANCEL);
- break;
+ GTK_RESPONSE_CANCEL);
+ return;
}
+ edc->builder = GNUNET_GTK_get_new_builder2
(edc->plugin->dialog_glade_filename,
+ edc,
+ &add_symbols);
+ if (NULL == edc->builder)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Failed to load dialog resource `%s'\n"),
+ edc->plugin->dialog_glade_filename);
+ edit_dialog_continuation (edc, GTK_RESPONSE_CANCEL);
+ return;
+ }
+ if (GNUNET_YES ==
+ edc->old_record_in_namestore)
+ {
+ edc->plugin->load (edc->plugin->cls,
+ edc->n_value,
+ edc->builder);
+ }
+ edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder,
+
edc->plugin->dialog_widget_name));
+ g_signal_connect (edc->dialog,
+ "response",
+ G_CALLBACK (&edit_dialog_response_cb),
+ edc);
+ edit_dialog_setup_common_elements (edc);
+ setup_zone (edc);
+ gtk_dialog_set_default_response (edc->dialog,
+ GTK_RESPONSE_OK);
+ gtk_window_present (GTK_WINDOW (edc->dialog));
}
@@ -1186,7 +1647,7 @@
*/
void
gnunet_namestore_gtk_popup_edit_button_activate_cb (GtkWidget *widget,
- gpointer user_data)
+ gpointer user_data)
{
GtkTreeSelection *sel;
gint n_type;
@@ -1239,9 +1700,9 @@
*/
void
gnunet_namestore_gtk_type_cellrenderercombo_edited_cb (GtkCellRendererText
*text,
- gchar *path_string,
- gchar *new_text,
- gpointer user_data)
+ gchar *path_string,
+ gchar *new_text,
+ gpointer user_data)
{
GtkTreeIter it;
guint type;
@@ -2281,7 +2742,8 @@
if (GNUNET_OK ==
GNUNET_GTK_main_loop_start ("gnunet-namestore-gtk",
"gnunet-namestore-gtk", argc, argv,
- options,
"gnunet_namestore_gtk_main_window.glade",
+ options,
+ "gnunet_namestore_gtk_main_window.glade",
&run))
ret = gret;
else
@@ -2290,5 +2752,4 @@
}
-
/* end of gnunet-namestore-gtk.c */
Modified: gnunet-gtk/src/namestore/gnunet-namestore-gtk_edit.c
===================================================================
--- gnunet-gtk/src/namestore/gnunet-namestore-gtk_edit.c 2013-10-30
18:16:01 UTC (rev 30486)
+++ gnunet-gtk/src/namestore/gnunet-namestore-gtk_edit.c 2013-10-30
19:47:24 UTC (rev 30487)
@@ -20,78 +20,24 @@
/**
* @file src/namestore/gnunet-namestore-gtk_edit.c
* @author Christian Grothoff
- * @brief editing dialogs for GNS records
+ * @brief common functions for editing dialogs for GNS records
*/
-#include "gnunet-namestore-gtk_edit.h"
+#include "gnunet_gtk.h"
#include <gnunet/gnunet_gns_service.h>
+#include "gnunet_gtk_namestore_plugin.h"
/**
- * Disable 'save' button, dialog state is not acceptable.
- *
- * @param edc dialog to modify
- */
-static void
-edit_dialog_disable_save (struct EditDialogContext *edc)
-{
- gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_save_button")),
- FALSE);
-}
-
-
-/**
- * Enable 'save' button, dialog state is acceptable.
- *
- * @param edc dialog to modify
- */
-static void
-edit_dialog_enable_save (struct EditDialogContext *edc)
-{
- gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_save_button")),
- TRUE);
-}
-
-
-/**
- * Check that the common elements of the edit dialog are valid;
- * if so, call 'edit_dialog_enable_save', otherwise 'edit_dialog_disable_save'.
- *
- * @param edc edit dialog to check
- */
-static void
-edit_dialog_check_save (struct EditDialogContext *edc)
-{
- GtkEditable *entry;
- const gchar *name;
-
- /* check name */
- entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder,
- "edit_dialog_name_entry"));
- name = gtk_editable_get_chars (entry, 0, -1);
- if ( (GNUNET_SYSERR == GNUNET_DNSPARSER_check_label (name)) &&
- (0 != strcmp (name, GNUNET_GNS_MASTERZONE_STR)) )
- {
- edit_dialog_disable_save (edc);
- return;
- }
- /* any other checks should go here */
- edit_dialog_enable_save (edc);
-}
-
-
-/**
* The 'relative' expiration time radiobutton was toggled (on or off).
*
* @param button the button
- * @param user_data the 'struct EditDialogContext' of the dialog
+ * @param user_data the '' of the dialog
*/
void
GNS_edit_dialog_expiration_relative_radiobutton_toggled_cb (GtkToggleButton
*button,
gpointer user_data)
{
- struct EditDialogContext *edc = user_data;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
if (gtk_toggle_button_get_active (button))
gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (edc->builder,
@@ -106,7 +52,7 @@
* The 'forever' expiration time radiobutton was toggled (on or off).
*
* @param button the button
- * @param user_data the 'struct EditDialogContext' of the dialog
+ * @param user_data the '' of the dialog
*/
void
GNS_edit_dialog_expiration_forever_radiobutton_toggled_cb (GtkToggleButton
*button,
@@ -120,13 +66,13 @@
* The 'absolute' expiration time radiobutton was toggled (on or off).
*
* @param button the button
- * @param user_data the 'struct EditDialogContext' of the dialog
+ * @param user_data the '' of the dialog
*/
void
GNS_edit_dialog_expiration_absolute_radiobutton_toggled_cb (GtkToggleButton
*button,
gpointer user_data)
{
- struct EditDialogContext *edc = user_data;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
if (gtk_toggle_button_get_active (button))
{
@@ -145,1900 +91,5 @@
}
-/**
- * Setup the zone combobox.
- *
- * @param edc dialog to setup the combo box for
- */
-static void
-setup_zone (struct EditDialogContext *edc)
-{
- GtkTreeIter iter;
- GtkComboBox *cb;
- gchar *name;
- cb = GTK_COMBO_BOX (gtk_builder_get_object (edc->builder,
- "edit_dialog_zone_combobox"));
-
- gtk_combo_box_set_model (cb,
- GTK_TREE_MODEL (edc->zone_liststore));
- GNUNET_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL
(edc->zone_liststore),
- &iter));
- do {
- gtk_tree_model_get (GTK_TREE_MODEL (edc->zone_liststore),
- &iter,
- ZONE_LS_NAME, &name,
- -1);
- if (0 == strcmp (name,
- edc->new_zone_option))
- {
- g_free (name);
- break;
- }
- g_free (name);
- } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (edc->zone_liststore),
- &iter));
- gtk_combo_box_set_active_iter (cb,
- &iter);
-}
-
-
-/**
- * Initialize widgets of the edit dialog that are the same regardless of
- * the type of the record.
- *
- * @param edc dialog context
- */
-static void
-edit_dialog_setup_common_elements (struct EditDialogContext *edc)
-{
- GtkComboBox *cb;
- GtkListStore *ls;
- GtkTreeIter iter;
- struct GNUNET_TIME_Absolute at;
- struct GNUNET_TIME_Relative rt;
- time_t tp;
- struct tm *ymd;
- GtkCalendar *cal;
-
- if (GNUNET_YES !=
- edc->old_record_in_namestore)
- {
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_delete_button")));
- edit_dialog_disable_save (edc);
- }
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_name_entry")),
- edc->name);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_options_public_checkbutton")),
- edc->n_public);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_options_shadow_checkbutton")),
- edc->n_is_shadow);
- if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == edc->n_exp_time)
- {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_never_radiobutton")),
- TRUE);
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_absolute_calendar")));
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_absolute_hbox")));
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_relative_combobox")));
- }
- if ( (edc->n_is_relative) &&
- (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != edc->n_exp_time) )
- {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_relative_radiobutton")),
- TRUE);
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_absolute_calendar")));
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_absolute_hbox")));
- rt.rel_value_us = edc->n_exp_time;
- }
- else
- {
- /* select a sane default */
- rt = GNUNET_TIME_UNIT_DAYS;
- }
- cb = GTK_COMBO_BOX (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_relative_combobox"));
- ls = GTK_LIST_STORE (gtk_combo_box_get_model (cb));
- gtk_list_store_insert_with_values (ls, &iter,
- -1 /* position: append */,
- 0, GNUNET_STRINGS_relative_time_to_string
(rt, GNUNET_NO),
- -1);
- gtk_combo_box_set_active_iter (cb, &iter);
- if ( (! edc->n_is_relative) &&
- (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us != edc->n_exp_time) )
- {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_absolute_radiobutton")),
- TRUE);
-
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_relative_combobox")));
- at.abs_value_us = edc->n_exp_time;
- }
- else
- {
- /* select a sane default: right now */
- at = GNUNET_TIME_absolute_get ();
- }
- tp = (time_t) (at.abs_value_us / 1000000LL); /* convert to seconds */
- ymd = gmtime (&tp);
- cal = GTK_CALENDAR (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_absolute_calendar"));
- gtk_calendar_select_month (cal,
- ymd->tm_mon,
- ymd->tm_year + 1900);
- gtk_calendar_mark_day (cal,
- ymd->tm_mday);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_absolute_hours_spinbutton")),
- (double) ymd->tm_hour);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_absolute_minutes_spinbutton")),
- (double) ymd->tm_min);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_absolute_seconds_spinbutton")),
- (double) ymd->tm_sec);
- setup_zone (edc);
-}
-
-
-/**
- * Perform the reverse of the 'edit_dialog_setup_common_elements' function,
- * that is, extract the values from the (common) widgets and store the
- * values in 'edc'.
- *
- * @param edc edit dialog to extract data from
- */
-static void
-edit_dialog_putes_common_elements (struct EditDialogContext *edc)
-{
- const char *rt_s;
- struct GNUNET_TIME_Relative rt;
- GtkComboBox *cb;
- GtkTreeModel *tm;
- GtkTreeIter iter;
- gchar *opt;
- struct GNUNET_IDENTITY_Ego *ego;
-
- /* is public flag */
- edc->n_public = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(gtk_builder_get_object (edc->builder,
-
"edit_dialog_options_public_checkbutton")));
- /* is shadow flag */
- edc->n_is_shadow = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(gtk_builder_get_object (edc->builder,
-
"edit_dialog_options_shadow_checkbutton")));
-
- /* 'forever' expiration time */
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_never_radiobutton"))))
- {
- edc->n_exp_time = GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us;
- edc->n_is_relative = TRUE; /* doesn't matter, but make sure it is
well-defined anyway */
- }
-
- /* 'relative' expiration time */
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_relative_radiobutton"))))
- {
- cb = GTK_COMBO_BOX (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_relative_combobox"));
- tm = gtk_combo_box_get_model (cb);
- if (! gtk_combo_box_get_active_iter (cb, &iter))
- {
- GNUNET_break (0);
- return;
- }
- gtk_tree_model_get (tm, &iter,
- 0, &rt_s,
- -1);
- GNUNET_break (GNUNET_YES ==
- GNUNET_STRINGS_fancy_time_to_relative (rt_s,
- &rt));
- edc->n_exp_time = rt.rel_value_us;
- edc->n_is_relative = TRUE;
- }
-
- /* 'absolute' expiration time */
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_absolute_radiobutton"))))
- {
- guint year;
- guint month;
- guint day;
- guint hour;
- guint minute;
- guint second;
- char fancydate[128];
- struct GNUNET_TIME_Absolute atime;
-
- gtk_calendar_get_date (GTK_CALENDAR (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_absolute_calendar")),
- &year, &month, &day);
- hour = gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_absolute_hours_spinbutton")));
- minute = gtk_spin_button_get_value (GTK_SPIN_BUTTON
(gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_absolute_minutes_spinbutton")));
- second = gtk_spin_button_get_value (GTK_SPIN_BUTTON
(gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_absolute_seconds_spinbutton")));
- GNUNET_snprintf (fancydate,
- sizeof (fancydate),
- "%u-%u-%u %u:%u:%u",
- (unsigned int) year,
- (unsigned int) month + 1,
- (unsigned int) day,
- (unsigned int) hour,
- (unsigned int) minute,
- (unsigned int) second);
- GNUNET_break (GNUNET_OK ==
- GNUNET_STRINGS_fancy_time_to_absolute (fancydate,
- &atime));
- edc->n_exp_time = atime.abs_value_us;
- edc->n_is_relative = FALSE;
- }
-
- /* extract target zone! */
- cb = GTK_COMBO_BOX (gtk_builder_get_object (edc->builder,
- "edit_dialog_zone_combobox"));
- tm = gtk_combo_box_get_model (cb);
- if (! gtk_combo_box_get_active_iter (cb, &iter))
- {
- GNUNET_break (0);
- }
- else
- {
- gtk_tree_model_get (tm, &iter,
- ZONE_LS_NAME, &opt,
- ZONE_LS_EGO, &ego,
- -1);
- if (NULL == opt)
- {
- GNUNET_break (0);
- }
- else
- {
- g_free (edc->new_zone_option);
- edc->new_zone_option = g_strdup (opt);
- g_free (opt);
- edc->ego = ego;
- }
- }
-}
-
-
-/**
- * Run the edit dialog. Performs all of the common initialization
- * steps to run an edit dialog for records.
- *
- * @param edc editing context
- */
-static void
-run_edit_dialog (struct EditDialogContext *edc)
-{
- edit_dialog_setup_common_elements (edc);
- gtk_dialog_set_default_response (edc->dialog,
- GTK_RESPONSE_OK);
- gtk_window_present (GTK_WINDOW (edc->dialog));
-}
-
-
-/* ************************ A records *********************** */
-
-/**
- * Check validity of the value in the edit dialog for A-records.
- * Then call the shared validity check if the result is OK.
- *
- * @param edc edit dialog context
- */
-static void
-edit_dialog_a_validity_check (struct EditDialogContext *edc)
-{
- GtkEditable *entry;
- const gchar *preedit;
- struct in_addr v4;
-
- entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder,
- "edit_dialog_a_entry")),
- preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (1 != inet_pton (AF_INET, preedit, &v4)) )
- {
- edit_dialog_disable_save (edc);
- return;
- }
- edit_dialog_check_save (edc);
-}
-
-
-/**
- * Editing dialog was closed, get the data and call the
- * continuation.
- *
- * @param dialog editing dialog
- * @param response_id action that caused the dialog to be closed
- * @param user_data the 'struct EditDialogContext'
- */
-void
-GNS_edit_a_dialog_response_cb (GtkDialog *dialog,
- gint response_id,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
- GtkEntry *entry;
- const gchar *value;
-
- if (GTK_RESPONSE_OK == response_id)
- {
- edit_dialog_putes_common_elements (edc);
- entry = GTK_ENTRY (gtk_builder_get_object (edc->builder,
- "edit_dialog_a_entry"));
- value = gtk_entry_get_text (entry);
- g_free (edc->n_value);
- edc->n_value = g_strdup (value);
- }
- gtk_widget_destroy (GTK_WIDGET (edc->dialog));
- g_object_unref (edc->builder);
- edc->builder = NULL;
- edc->cont (edc, response_id);
-}
-
-
-/**
- * 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 'struct EditDialogContext' of the dialog
- */
-void
-GNS_edit_dialog_a_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
-
- edit_dialog_a_validity_check (edc);
-}
-
-
-/**
- * Run an GNS Edit dialog for an 'A' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_a (struct EditDialogContext *edc)
-{
- edc->builder = GNUNET_GTK_get_new_builder ("gnunet_namestore_edit_a.glade",
- edc);
- if (NULL == edc->builder)
- {
- GNUNET_break (0);
- edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */
- return;
- }
- if (GNUNET_YES ==
- edc->old_record_in_namestore)
- {
- /* set A record */
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_a_entry")),
- edc->n_value);
- }
- edc->validator = &edit_dialog_a_validity_check;
- edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder,
- "edit_a_dialog"));
- run_edit_dialog (edc);
-}
-
-
-/* ************************ AAAA records *********************** */
-
-/**
- * Check validity of the value in the edit dialog for AAAA-records.
- * Then call the shared validity check if the result is OK.
- *
- * @param edc edit dialog context
- */
-static void
-edit_dialog_aaaa_validity_check (struct EditDialogContext *edc)
-{
- GtkEditable *entry;
- const gchar *preedit;
- struct in6_addr v6;
-
- entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder,
- "edit_dialog_aaaa_entry")),
- preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (1 != inet_pton (AF_INET6, preedit, &v6)) )
- {
- edit_dialog_disable_save (edc);
- return;
- }
- edit_dialog_check_save (edc);
-}
-
-
-/**
- * Editing dialog was closed, get the data and call the
- * continuation.
- *
- * @param dialog editing dialog
- * @param response_id action that caused the dialog to be closed
- * @param user_data the 'struct EditDialogContext'
- */
-void
-GNS_edit_aaaa_dialog_response_cb (GtkDialog *dialog,
- gint response_id,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
- GtkEntry *entry;
- const gchar *value;
-
- if (GTK_RESPONSE_OK == response_id)
- {
- edit_dialog_putes_common_elements (edc);
- entry = GTK_ENTRY (gtk_builder_get_object (edc->builder,
- "edit_dialog_aaaa_entry"));
- value = gtk_entry_get_text (entry);
- g_free (edc->n_value);
- edc->n_value = g_strdup (value);
- }
- gtk_widget_destroy (GTK_WIDGET (edc->dialog));
- g_object_unref (edc->builder);
- edc->builder = NULL;
- edc->cont (edc, response_id);
-}
-
-
-/**
- * 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 'struct EditDialogContext' of the dialog
- */
-void
-GNS_edit_dialog_aaaa_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
-
- edit_dialog_aaaa_validity_check (edc);
-}
-
-
-/**
- * Run an GNS Edit dialog for an 'AAAA' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_aaaa (struct EditDialogContext *edc)
-{
- edc->builder = GNUNET_GTK_get_new_builder
("gnunet_namestore_edit_aaaa.glade",
- edc);
- if (NULL == edc->builder)
- {
- GNUNET_break (0);
- edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */
- return;
- }
- if (GNUNET_YES ==
- edc->old_record_in_namestore)
- {
- /* set AAAA record */
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_aaaa_entry")),
- edc->n_value);
- }
- edc->validator = &edit_dialog_aaaa_validity_check;
- edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder,
- "edit_aaaa_dialog"));
- run_edit_dialog (edc);
-}
-
-
-/* ************************ CNAME records *********************** */
-
-/**
- * Check validity of the value in the edit dialog for AAAA-records.
- * Then call the shared validity check if the result is OK.
- *
- * @param edc edit dialog context
- */
-static void
-edit_dialog_cname_validity_check (struct EditDialogContext *edc)
-{
- GtkEditable *entry;
- const gchar *preedit;
-
- entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder,
- "edit_dialog_cname_entry")),
- preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
- {
- edit_dialog_disable_save (edc);
- return;
- }
- edit_dialog_check_save (edc);
-}
-
-
-/**
- * Editing dialog was closed, get the data and call the
- * continuation.
- *
- * @param dialog editing dialog
- * @param response_id action that caused the dialog to be closed
- * @param user_data the 'struct EditDialogContext'
- */
-void
-GNS_edit_cname_dialog_response_cb (GtkDialog *dialog,
- gint response_id,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
- GtkEntry *entry;
- const gchar *value;
-
- if (GTK_RESPONSE_OK == response_id)
- {
- edit_dialog_putes_common_elements (edc);
- entry = GTK_ENTRY (gtk_builder_get_object (edc->builder,
- "edit_dialog_cname_entry"));
- value = gtk_entry_get_text (entry);
- g_free (edc->n_value);
- edc->n_value = g_strdup (value);
- }
- gtk_widget_destroy (GTK_WIDGET (edc->dialog));
- g_object_unref (edc->builder);
- edc->builder = NULL;
- edc->cont (edc, response_id);
-}
-
-
-/**
- * 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 'struct EditDialogContext' of the dialog
- */
-void
-GNS_edit_dialog_cname_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
-
- edit_dialog_cname_validity_check (edc);
-}
-
-
-/**
- * Run an GNS Edit dialog for an 'CNAME' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_cname (struct EditDialogContext *edc)
-{
- edc->builder = GNUNET_GTK_get_new_builder
("gnunet_namestore_edit_cname.glade",
- edc);
- if (NULL == edc->builder)
- {
- GNUNET_break (0);
- edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */
- return;
- }
- if (GNUNET_YES ==
- edc->old_record_in_namestore)
- {
- /* set CNAME record */
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_cname_entry")),
- edc->n_value);
- }
- edc->validator = &edit_dialog_cname_validity_check;
- edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder,
- "edit_cname_dialog"));
- run_edit_dialog (edc);
-}
-
-
-/* ************************ LEHO records *********************** */
-
-/**
- * Check validity of the value in the edit dialog for LEHO-records.
- * Then call the shared validity check if the result is OK.
- *
- * @param edc edit dialog context
- */
-static void
-edit_dialog_leho_validity_check (struct EditDialogContext *edc)
-{
- GtkEditable *entry;
- const gchar *preedit;
-
- entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder,
- "edit_dialog_leho_entry")),
- preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
- {
- edit_dialog_disable_save (edc);
- return;
- }
- edit_dialog_check_save (edc);
-}
-
-
-/**
- * Editing dialog was closed, get the data and call the
- * continuation.
- *
- * @param dialog editing dialog
- * @param response_id action that caused the dialog to be closed
- * @param user_data the 'struct EditDialogContext'
- */
-void
-GNS_edit_leho_dialog_response_cb (GtkDialog *dialog,
- gint response_id,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
- GtkEntry *entry;
- const gchar *value;
-
- if (GTK_RESPONSE_OK == response_id)
- {
- edit_dialog_putes_common_elements (edc);
- entry = GTK_ENTRY (gtk_builder_get_object (edc->builder,
- "edit_dialog_leho_entry"));
- value = gtk_entry_get_text (entry);
- g_free (edc->n_value);
- edc->n_value = g_strdup (value);
- }
- gtk_widget_destroy (GTK_WIDGET (edc->dialog));
- g_object_unref (edc->builder);
- edc->builder = NULL;
- edc->cont (edc, response_id);
-}
-
-
-/**
- * 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 'struct EditDialogContext' of the dialog
- */
-void
-GNS_edit_dialog_leho_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
-
- edit_dialog_leho_validity_check (edc);
-}
-
-
-/**
- * Run an GNS Edit dialog for an 'LEHO' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_leho (struct EditDialogContext *edc)
-{
- edc->builder = GNUNET_GTK_get_new_builder
("gnunet_namestore_edit_leho.glade",
- edc);
- if (NULL == edc->builder)
- {
- GNUNET_break (0);
- edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */
- return;
- }
- if (GNUNET_YES ==
- edc->old_record_in_namestore)
- {
- /* set LEHO record */
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_leho_entry")),
- edc->n_value);
- }
- edc->validator = &edit_dialog_leho_validity_check;
- edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder,
- "edit_leho_dialog"));
- run_edit_dialog (edc);
-}
-
-
-/* ************************ MX records *********************** */
-
-/**
- * Check validity of the value in the edit dialog for MX-records.
- * Then call the shared validity check if the result is OK.
- *
- * @param edc edit dialog context
- */
-static void
-edit_dialog_mx_validity_check (struct EditDialogContext *edc)
-{
- GtkEditable *entry;
- const gchar *preedit;
-
- entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder,
- "edit_dialog_mx_entry")),
- preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
- {
- edit_dialog_disable_save (edc);
- return;
- }
- edit_dialog_check_save (edc);
-}
-
-
-/**
- * Editing dialog was closed, get the data and call the
- * continuation.
- *
- * @param dialog editing dialog
- * @param response_id action that caused the dialog to be closed
- * @param user_data the 'struct EditDialogContext'
- */
-void
-GNS_edit_mx_dialog_response_cb (GtkDialog *dialog,
- gint response_id,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
- GtkEntry *entry;
- const gchar *value;
- char *result;
- unsigned int distance;
-
- if (GTK_RESPONSE_OK == response_id)
- {
- edit_dialog_putes_common_elements (edc);
- entry = GTK_ENTRY (gtk_builder_get_object (edc->builder,
- "edit_dialog_mx_entry"));
- value = gtk_entry_get_text (entry);
- distance = gtk_spin_button_get_value (GTK_SPIN_BUTTON
(gtk_builder_get_object (edc->builder,
-
"edit_dialog_mx_distance_spinbutton")));
- g_free (edc->n_value);
- GNUNET_asprintf (&result,
- "%hu,%s",
- distance,
- value);
- edc->n_value = g_strdup (result);
- GNUNET_free (result);
- }
- gtk_widget_destroy (GTK_WIDGET (edc->dialog));
- g_object_unref (edc->builder);
- edc->builder = NULL;
- edc->cont (edc, response_id);
-}
-
-
-/**
- * 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 'struct EditDialogContext' of the dialog
- */
-void
-GNS_edit_dialog_mx_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
-
- edit_dialog_mx_validity_check (edc);
-}
-
-
-/**
- * Run an GNS Edit dialog for an 'MX' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_mx (struct EditDialogContext *edc)
-{
- uint16_t mx_pref;
- char result[253 + 1];
-
- edc->builder = GNUNET_GTK_get_new_builder ("gnunet_namestore_edit_mx.glade",
- edc);
- if (NULL == edc->builder)
- {
- GNUNET_break (0);
- edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */
- return;
- }
- if (GNUNET_YES ==
- edc->old_record_in_namestore)
- {
- if (2 != SSCANF(edc->n_value,
- "%hu,%253s", &mx_pref, result))
- {
- GNUNET_break (0);
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Unable to parse MX record `%s'\n"),
- edc->n_value);
- }
- else
- {
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_mx_entry")),
- result);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_mx_distance_spinbutton")),
- mx_pref);
- }
- }
- edc->validator = &edit_dialog_mx_validity_check;
- edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder,
- "edit_mx_dialog"));
- run_edit_dialog (edc);
-}
-
-
-/* ************************ GNS2DNS records *********************** */
-
-/**
- * Check validity of the value in the edit dialog for GNS2DNS-records.
- * Then call the shared validity check if the result is OK.
- *
- * @param edc edit dialog context
- */
-static void
-edit_dialog_gns2dns_validity_check (struct EditDialogContext *edc)
-{
- GtkEditable *entry;
- const gchar *preedit;
-
- entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder,
- "edit_dialog_gns2dns_entry")),
- preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
- {
- edit_dialog_disable_save (edc);
- return;
- }
- edit_dialog_check_save (edc);
-}
-
-
-/**
- * Editing dialog was closed, get the data and call the
- * continuation.
- *
- * @param dialog editing dialog
- * @param response_id action that caused the dialog to be closed
- * @param user_data the 'struct EditDialogContext'
- */
-void
-GNS_edit_gns2dns_dialog_response_cb (GtkDialog *dialog,
- gint response_id,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
- GtkEntry *entry;
- const gchar *value;
-
- if (GTK_RESPONSE_OK == response_id)
- {
- edit_dialog_putes_common_elements (edc);
- entry = GTK_ENTRY (gtk_builder_get_object (edc->builder,
- "edit_dialog_gns2dns_entry"));
- value = gtk_entry_get_text (entry);
- g_free (edc->n_value);
- edc->n_value = g_strdup (value);
- }
- gtk_widget_destroy (GTK_WIDGET (edc->dialog));
- g_object_unref (edc->builder);
- edc->builder = NULL;
- edc->cont (edc, response_id);
-}
-
-
-/**
- * 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 'struct EditDialogContext' of the dialog
- */
-void
-GNS_edit_dialog_gns2dns_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
-
- edit_dialog_gns2dns_validity_check (edc);
-}
-
-
-/**
- * Run an GNS Edit dialog for a 'GNS2DNS' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_gns2dns (struct EditDialogContext *edc)
-{
- edc->builder = GNUNET_GTK_get_new_builder
("gnunet_namestore_edit_gns2dns.glade",
- edc);
- if (NULL == edc->builder)
- {
- GNUNET_break (0);
- edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */
- return;
- }
- if (GNUNET_YES ==
- edc->old_record_in_namestore)
- {
- /* set NS record */
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_gns2dns_entry")),
- edc->n_value);
- }
- edc->validator = &edit_dialog_gns2dns_validity_check;
- edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder,
- "edit_gns2dns_dialog"));
- run_edit_dialog (edc);
-}
-
-
-/* ************************ PHONE records *********************** */
-
-/**
- * Check validity of the value in the edit dialog for PHONE-records.
- * Then call the shared validity check if the result is OK.
- *
- * @param edc edit dialog context
- */
-static void
-edit_dialog_phone_validity_check (struct EditDialogContext *edc)
-{
- GtkEditable *entry;
- const gchar *preedit;
- struct GNUNET_CRYPTO_EcdsaPublicKey pub;
-
- entry = GTK_EDITABLE (gtk_builder_get_object (edc->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)) )
- {
- edit_dialog_disable_save (edc);
- return;
- }
- edit_dialog_check_save (edc);
-}
-
-
-/**
- * Editing dialog was closed, get the data and call the
- * continuation.
- *
- * @param dialog editing dialog
- * @param response_id action that caused the dialog to be closed
- * @param user_data the 'struct EditDialogContext'
- */
-void
-GNS_edit_phone_dialog_response_cb (GtkDialog *dialog,
- gint response_id,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
- GtkEntry *entry;
- GtkSpinButton *spin;
- const gchar *value;
- unsigned int line;
-
- if (GTK_RESPONSE_OK == response_id)
- {
- edit_dialog_putes_common_elements (edc);
- entry = GTK_ENTRY (gtk_builder_get_object (edc->builder,
- "edit_dialog_phone_peer_entry"));
- value = gtk_entry_get_text (entry);
- spin = GTK_SPIN_BUTTON (gtk_builder_get_object (edc->builder,
-
"edit_dialog_phone_line_spinbutton"));
- line = gtk_spin_button_get_value (spin);
- g_free (edc->n_value);
- GNUNET_asprintf (&edc->n_value,
- "%u-%s",
- line,
- value);
- }
- gtk_widget_destroy (GTK_WIDGET (edc->dialog));
- g_object_unref (edc->builder);
- edc->builder = NULL;
- edc->cont (edc, response_id);
-}
-
-
-/**
- * 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 'struct EditDialogContext' of the dialog
- */
-void
-GNS_edit_dialog_phone_peer_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
-
- edit_dialog_phone_validity_check (edc);
-}
-
-
-/**
- * Run an GNS Edit dialog for a 'PHONE' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_phone (struct EditDialogContext *edc)
-{
- const char *minus;
- unsigned int line;
-
- edc->builder = GNUNET_GTK_get_new_builder
("gnunet_namestore_edit_phone.glade",
- edc);
- if (NULL == edc->builder)
- {
- GNUNET_break (0);
- edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */
- return;
- }
- if (GNUNET_YES ==
- edc->old_record_in_namestore)
- {
- /* set PKEY record */
- if (1 != (sscanf (edc->n_value,
- "%u-",
- &line)))
- {
- GNUNET_break (0);
- }
- else
- {
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_phone_line_spinbutton")),
- line);
-
- }
- if (NULL == (minus = strchr (edc->n_value, '-')))
- {
- GNUNET_break (0);
- }
- else
- {
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_phone_peer_entry")),
- minus + 1);
- }
- }
- edc->validator = &edit_dialog_phone_validity_check;
- edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder,
- "edit_phone_dialog"));
- run_edit_dialog (edc);
-}
-
-
-/* ************************ PKEY records *********************** */
-
-/**
- * Check validity of the value in the edit dialog for PKEY-records.
- * Then call the shared validity check if the result is OK.
- *
- * @param edc edit dialog context
- */
-static void
-edit_dialog_pkey_validity_check (struct EditDialogContext *edc)
-{
- GtkEditable *entry;
- const gchar *preedit;
- struct GNUNET_CRYPTO_EcdsaPublicKey pub;
-
- entry = GTK_EDITABLE (gtk_builder_get_object (edc->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)) )
- {
- edit_dialog_disable_save (edc);
- return;
- }
- edit_dialog_check_save (edc);
-}
-
-
-/**
- * Editing dialog was closed, get the data and call the
- * continuation.
- *
- * @param dialog editing dialog
- * @param response_id action that caused the dialog to be closed
- * @param user_data the 'struct EditDialogContext'
- */
-void
-GNS_edit_pkey_dialog_response_cb (GtkDialog *dialog,
- gint response_id,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
- GtkEntry *entry;
- const gchar *value;
-
- if (GTK_RESPONSE_OK == response_id)
- {
- edit_dialog_putes_common_elements (edc);
- entry = GTK_ENTRY (gtk_builder_get_object (edc->builder,
- "edit_dialog_pkey_entry"));
- value = gtk_entry_get_text (entry);
- g_free (edc->n_value);
- edc->n_value = g_strdup (value);
- }
- gtk_widget_destroy (GTK_WIDGET (edc->dialog));
- g_object_unref (edc->builder);
- edc->builder = NULL;
- edc->cont (edc, response_id);
-}
-
-
-/**
- * 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 'struct EditDialogContext' of the dialog
- */
-void
-GNS_edit_dialog_pkey_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
-
- edit_dialog_pkey_validity_check (edc);
-}
-
-
-/**
- * Run an GNS Edit dialog for an 'PKEY' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_pkey (struct EditDialogContext *edc)
-{
- edc->builder = GNUNET_GTK_get_new_builder
("gnunet_namestore_edit_pkey.glade",
- edc);
- if (NULL == edc->builder)
- {
- GNUNET_break (0);
- edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */
- return;
- }
- if (GNUNET_YES ==
- edc->old_record_in_namestore)
- {
- /* set PKEY record */
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_pkey_entry")),
- edc->n_value);
- }
- edc->validator = &edit_dialog_pkey_validity_check;
- edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder,
- "edit_pkey_dialog"));
- run_edit_dialog (edc);
-}
-
-
-/* ************************ PTR records *********************** */
-
-/**
- * Check validity of the value in the edit dialog for PTR-records.
- * Then call the shared validity check if the result is OK.
- *
- * @param edc edit dialog context
- */
-static void
-edit_dialog_ptr_validity_check (struct EditDialogContext *edc)
-{
- GtkEditable *entry;
- const gchar *preedit;
-
- entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder,
- "edit_dialog_ptr_entry")),
- preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
- {
- edit_dialog_disable_save (edc);
- return;
- }
- edit_dialog_check_save (edc);
-}
-
-
-/**
- * Editing dialog was closed, get the data and call the
- * continuation.
- *
- * @param dialog editing dialog
- * @param response_id action that caused the dialog to be closed
- * @param user_data the 'struct EditDialogContext'
- */
-void
-GNS_edit_ptr_dialog_response_cb (GtkDialog *dialog,
- gint response_id,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
- GtkEntry *entry;
- const gchar *value;
-
- if (GTK_RESPONSE_OK == response_id)
- {
- edit_dialog_putes_common_elements (edc);
- entry = GTK_ENTRY (gtk_builder_get_object (edc->builder,
- "edit_dialog_ptr_entry"));
- value = gtk_entry_get_text (entry);
- g_free (edc->n_value);
- edc->n_value = g_strdup (value);
- }
- gtk_widget_destroy (GTK_WIDGET (edc->dialog));
- g_object_unref (edc->builder);
- edc->builder = NULL;
- edc->cont (edc, response_id);
-}
-
-
-/**
- * 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 'struct EditDialogContext' of the dialog
- */
-void
-GNS_edit_dialog_ptr_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
-
- edit_dialog_ptr_validity_check (edc);
-}
-
-
-/**
- * Run an GNS Edit dialog for an 'PTR' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_ptr (struct EditDialogContext *edc)
-{
- edc->builder = GNUNET_GTK_get_new_builder ("gnunet_namestore_edit_ptr.glade",
- edc);
- if (NULL == edc->builder)
- {
- GNUNET_break (0);
- edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */
- return;
- }
- if (GNUNET_YES ==
- edc->old_record_in_namestore)
- {
- /* set PTR record */
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_ptr_entry")),
- edc->n_value);
- }
- edc->validator = &edit_dialog_ptr_validity_check;
- edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder,
- "edit_ptr_dialog"));
- run_edit_dialog (edc);
-}
-
-
-/* ************************ SOA records *********************** */
-
-/**
- * Check validity of the value in the edit dialog for SOA-records.
- * Then call the shared validity check if the result is OK.
- *
- * @param edc edit dialog context
- */
-static void
-edit_dialog_soa_validity_check (struct EditDialogContext *edc)
-{
- GtkEditable *entry;
- const gchar *preedit;
-
- entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder,
-
"edit_dialog_soa_source_host_entry")),
- preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
- {
- edit_dialog_disable_save (edc);
- return;
- }
- /* check for '@' in the e-mail --- required format uses "." instead! */
- entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder,
-
"edit_dialog_soa_contact_email_entry")),
- preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (NULL != strstr (preedit, "@")) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
- {
- /* E-mail is specified in the RFC also as a 'domain-name', hence
- we check above that it follows those conventions as well; the '@'
- is a common mistake, and while it should be illegal despite IDN,
- it feels better to check explicitly. */
- edit_dialog_disable_save (edc);
- return;
- }
- edit_dialog_check_save (edc);
-}
-
-
-/**
- * Editing dialog was closed, get the data and call the
- * continuation.
- *
- * @param dialog editing dialog
- * @param response_id action that caused the dialog to be closed
- * @param user_data the 'struct EditDialogContext'
- */
-void
-GNS_edit_soa_dialog_response_cb (GtkDialog *dialog,
- gint response_id,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
- GtkEntry *entry;
- const gchar *source_host;
- const gchar *contact_email;
- unsigned int soa_serial;
- unsigned int soa_refresh;
- unsigned int soa_retry;
- unsigned int soa_expire;
- unsigned int soa_min;
- char *result;
-
- if (GTK_RESPONSE_OK == response_id)
- {
- edit_dialog_putes_common_elements (edc);
- entry = GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_soa_source_host_entry"));
- source_host = gtk_entry_get_text (entry);
- entry = GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_soa_contact_email_entry"));
- contact_email = gtk_entry_get_text (entry);
- soa_serial = gtk_spin_button_get_value (GTK_SPIN_BUTTON
(gtk_builder_get_object (edc->builder,
-
"edit_dialog_soa_serial_number_spinbutton")));
- soa_refresh = gtk_spin_button_get_value (GTK_SPIN_BUTTON
(gtk_builder_get_object (edc->builder,
-
"edit_dialog_soa_refresh_time_spinbutton")));
- soa_retry = gtk_spin_button_get_value (GTK_SPIN_BUTTON
(gtk_builder_get_object (edc->builder,
-
"edit_dialog_soa_retry_time_spinbutton")));
- soa_expire = gtk_spin_button_get_value (GTK_SPIN_BUTTON
(gtk_builder_get_object (edc->builder,
-
"edit_dialog_soa_expire_time_spinbutton")));
- soa_min = gtk_spin_button_get_value (GTK_SPIN_BUTTON
(gtk_builder_get_object (edc->builder,
-
"edit_dialog_soa_minimum_ttl_spinbutton")));
- GNUNET_asprintf (&result,
- "rname=%s mname=%s %lu,%lu,%lu,%lu,%lu",
- source_host, contact_email,
- soa_serial,
- soa_refresh,
- soa_retry,
- soa_expire,
- soa_min);
- edc->n_value = g_strdup (result);
- GNUNET_free (result);
- }
- gtk_widget_destroy (GTK_WIDGET (edc->dialog));
- g_object_unref (edc->builder);
- edc->builder = NULL;
- edc->cont (edc, response_id);
-}
-
-
-/**
- * The user has edited the SOA record value. Enable/disable 'save'
- * button depending on the validity of the value.
- *
- * @param entry editing widget
- * @param user_data the 'struct EditDialogContext' of the dialog
- */
-void
-GNS_edit_dialog_soa_contact_email_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
-
- edit_dialog_soa_validity_check (edc);
-}
-
-
-/**
- * The user has edited the SOA record value. Enable/disable 'save'
- * button depending on the validity of the value.
- *
- * @param entry editing widget
- * @param user_data the 'struct EditDialogContext' of the dialog
- */
-void
-GNS_edit_dialog_soa_source_host_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
-
- edit_dialog_soa_validity_check (edc);
-}
-
-
-/**
- * Run an GNS Edit dialog for an 'SOA' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_soa (struct EditDialogContext *edc)
-{
- char soa_rname[253 + 1];
- char soa_mname[253 + 1];
- unsigned int soa_serial;
- unsigned int soa_refresh;
- unsigned int soa_retry;
- unsigned int soa_expire;
- unsigned int soa_min;
-
- edc->builder = GNUNET_GTK_get_new_builder ("gnunet_namestore_edit_soa.glade",
- edc);
- if (NULL == edc->builder)
- {
- GNUNET_break (0);
- edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */
- return;
- }
- if (GNUNET_YES ==
- edc->old_record_in_namestore)
- {
- if (7 != SSCANF (edc->n_value,
- "rname=%253s mname=%253s %u,%u,%u,%u,%u",
- soa_rname, soa_mname,
- &soa_serial, &soa_refresh, &soa_retry, &soa_expire,
&soa_min))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Unable to parse SOA record `%s'\n"),
- edc->n_value);
- }
- else
- {
- /* set SOA record */
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_soa_source_host_entry")),
- soa_rname);
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_soa_contact_email_entry")),
- soa_mname);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_soa_serial_number_spinbutton")),
- soa_serial);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_soa_refresh_time_spinbutton")),
- soa_refresh);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_soa_retry_time_spinbutton")),
- soa_retry);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_soa_expire_time_spinbutton")),
- soa_expire);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_soa_minimum_ttl_spinbutton")),
- soa_min);
- }
- }
- edc->validator = &edit_dialog_soa_validity_check;
- edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder,
- "edit_soa_dialog"));
- run_edit_dialog (edc);
-}
-
-
-/* ************************ SRV records *********************** */
-/* *** Not implemented: namestore_common.c as well as here! *** */
-/* ************************ SRV records *********************** */
-
-/**
- * Check validity of the value in the edit dialog for SRV-records.
- * Then call the shared validity check if the result is OK.
- *
- * @param edc edit dialog context
- */
-static void
-edit_dialog_srv_validity_check (struct EditDialogContext *edc)
-{
- GtkEditable *entry;
- const gchar *preedit;
-
- entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder,
-
"edit_dialog_srv_target_entry")),
- preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
- {
- edit_dialog_disable_save (edc);
- return;
- }
- entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder,
- "edit_dialog_name_entry")),
- preedit = gtk_editable_get_chars (entry, 0, -1);
-#if 0
- /* FIXME: check service name format! */
-#endif
- edit_dialog_check_save (edc);
-}
-
-
-/**
- * Editing dialog was closed, get the data and call the
- * continuation.
- *
- * @param dialog editing dialog
- * @param response_id action that caused the dialog to be closed
- * @param user_data the 'struct EditDialogContext'
- */
-void
-GNS_edit_srv_dialog_response_cb (GtkDialog *dialog,
- gint response_id,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
-
- if (GTK_RESPONSE_OK == response_id)
- {
- edit_dialog_putes_common_elements (edc);
-#if 0
- GtkEntry *entry;
- const gchar *value;
-
- entry = GTK_ENTRY (gtk_builder_get_object (edc->builder,
- "edit_dialog_srv_target_entry"));
- /* FIXME: build srv record */
- value = gtk_entry_get_text (entry);
- g_free (edc->n_value);
- edc->n_value = g_strdup (value);
-#endif
-
- }
- gtk_widget_destroy (GTK_WIDGET (edc->dialog));
- g_object_unref (edc->builder);
- edc->builder = NULL;
- edc->cont (edc, response_id);
-}
-
-
-/**
- * The user has edited the SRV record value. Enable/disable 'save'
- * button depending on the validity of the value.
- *
- * @param entry editing widget
- * @param user_data the 'struct EditDialogContext' of the dialog
- */
-void
-GNS_edit_dialog_srv_target_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
-
- edit_dialog_srv_validity_check (edc);
-}
-
-
-/**
- * Run an GNS Edit dialog for an 'SRV' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_srv (struct EditDialogContext *edc)
-{
- edc->builder = GNUNET_GTK_get_new_builder ("gnunet_namestore_edit_srv.glade",
- edc);
- if (NULL == edc->builder)
- {
- GNUNET_break (0);
- edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */
- return;
- }
- if (GNUNET_YES ==
- edc->old_record_in_namestore)
- {
-#if 0
- /* FIXME */
- /* set SRV record */
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_srv_target_entry")),
- edc->n_value);
-#endif
- }
- edc->validator = &edit_dialog_srv_validity_check;
- edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder,
- "edit_srv_dialog"));
- run_edit_dialog (edc);
-}
-
-
-/* ************************ TXT records *********************** */
-
-/**
- * Check validity of the value in the edit dialog for TXT-records.
- * Then call the shared validity check if the result is OK.
- *
- * @param edc edit dialog context
- */
-static void
-edit_dialog_txt_validity_check (struct EditDialogContext *edc)
-{
- edit_dialog_check_save (edc);
-}
-
-
-/**
- * Editing dialog was closed, get the data and call the
- * continuation.
- *
- * @param dialog editing dialog
- * @param response_id action that caused the dialog to be closed
- * @param user_data the 'struct EditDialogContext'
- */
-void
-GNS_edit_txt_dialog_response_cb (GtkDialog *dialog,
- gint response_id,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
- GtkEntry *entry;
- const gchar *value;
-
- if (GTK_RESPONSE_OK == response_id)
- {
- edit_dialog_putes_common_elements (edc);
- entry = GTK_ENTRY (gtk_builder_get_object (edc->builder,
- "edit_dialog_txt_entry"));
- value = gtk_entry_get_text (entry);
- g_free (edc->n_value);
- edc->n_value = g_strdup (value);
- }
- gtk_widget_destroy (GTK_WIDGET (edc->dialog));
- g_object_unref (edc->builder);
- edc->builder = NULL;
- edc->cont (edc, response_id);
-}
-
-
-/**
- * The user has edited the TXT record value. Enable/disable 'save'
- * button depending on the validity of the value.
- *
- * @param entry editing widget
- * @param user_data the 'struct EditDialogContext' of the dialog
- */
-void
-GNS_edit_dialog_txt_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
-
- edit_dialog_txt_validity_check (edc);
-}
-
-
-/**
- * Run an GNS Edit dialog for an 'TXT' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_txt (struct EditDialogContext *edc)
-{
- edc->builder = GNUNET_GTK_get_new_builder ("gnunet_namestore_edit_txt.glade",
- edc);
- if (NULL == edc->builder)
- {
- GNUNET_break (0);
- edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */
- return;
- }
- if (GNUNET_YES ==
- edc->old_record_in_namestore)
- {
- /* set TXT record */
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_txt_entry")),
- edc->n_value);
- }
- edc->validator = &edit_dialog_txt_validity_check;
- edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder,
- "edit_txt_dialog"));
- run_edit_dialog (edc);
-}
-
-
-/* ************************ VPN records *********************** */
-
-/**
- * Check validity of the value in the edit dialog for VPN-records.
- * Then call the shared validity check if the result is OK.
- *
- * @param edc edit dialog context
- */
-static void
-edit_dialog_vpn_validity_check (struct EditDialogContext *edc)
-{
- GtkEditable *entry;
- const gchar *preedit;
- struct GNUNET_HashCode hc;
-
- entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder,
- "edit_dialog_vpn_peer_entry")),
- preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK !=
- GNUNET_CRYPTO_hash_from_string (preedit, &hc)) )
- {
- edit_dialog_disable_save (edc);
- return;
- }
- edit_dialog_check_save (edc);
-}
-
-
-/**
- * Editing dialog was closed, get the data and call the
- * continuation.
- *
- * @param dialog editing dialog
- * @param response_id action that caused the dialog to be closed
- * @param user_data the 'struct EditDialogContext'
- */
-void
-GNS_edit_vpn_dialog_response_cb (GtkDialog *dialog,
- gint response_id,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
- GtkEntry *entry;
- const gchar *identifier;
- const gchar *peer;
- unsigned int proto;
- char *result;
-
- if (GTK_RESPONSE_OK == response_id)
- {
- edit_dialog_putes_common_elements (edc);
- entry = GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_vpn_identifier_entry"));
- identifier = gtk_entry_get_text (entry);
- entry = GTK_ENTRY (gtk_builder_get_object (edc->builder,
- "edit_dialog_vpn_peer_entry"));
- peer = gtk_entry_get_text (entry);
- proto = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(gtk_builder_get_object (edc->builder,
-
"edit_dialog_vpn_protocol_tcp_radiobutton"))) ? IPPROTO_TCP : IPPROTO_UDP;
- GNUNET_asprintf (&result,
- "%u %s %s",
- proto,
- (const char *) peer,
- (const char *) identifier);
- g_free (edc->n_value);
- edc->n_value = g_strdup (result);
- GNUNET_free (result);
- }
- gtk_widget_destroy (GTK_WIDGET (edc->dialog));
- g_object_unref (edc->builder);
- edc->builder = NULL;
- edc->cont (edc, response_id);
-}
-
-
-/**
- * The user has edited the VPN record value. Enable/disable 'save'
- * button depending on the validity of the value.
- *
- * @param entry editing widget
- * @param user_data the 'struct EditDialogContext' of the dialog
- */
-void
-GNS_edit_dialog_vpn_peer_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
-{
- struct EditDialogContext *edc = user_data;
-
- edit_dialog_vpn_validity_check (edc);
-}
-
-
-/**
- * Run an GNS Edit dialog for an 'VPN' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_vpn (struct EditDialogContext *edc)
-{
- char s_peer[103 + 1];
- char s_serv[253 + 1];
- unsigned int proto;
-
- edc->builder = GNUNET_GTK_get_new_builder ("gnunet_namestore_edit_vpn.glade",
- edc);
- if (NULL == edc->builder)
- {
- GNUNET_break (0);
- edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */
- return;
- }
- if (GNUNET_YES ==
- edc->old_record_in_namestore)
- {
- /* set VPN record */
- if (3 != SSCANF (edc->n_value,"%u %103s %253s",
- &proto, s_peer, s_serv))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Unable to parse VPN record string `%s'\n"),
- edc->n_value);
- }
- else
- {
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_vpn_identifier_entry")),
- s_serv);
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_vpn_peer_entry")),
- s_peer);
- if (IPPROTO_UDP == proto)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_vpn_protocol_udp_radiobutton")), TRUE);
- else
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_vpn_protocol_tcp_radiobutton")), TRUE);
- }
- }
- edc->validator = &edit_dialog_vpn_validity_check;
- edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder,
- "edit_vpn_dialog"));
- run_edit_dialog (edc);
-}
-
-
/* end of gnunet-namestore-gtk_edit.c */
Deleted: gnunet-gtk/src/namestore/gnunet-namestore-gtk_edit.h
===================================================================
--- gnunet-gtk/src/namestore/gnunet-namestore-gtk_edit.h 2013-10-30
18:16:01 UTC (rev 30486)
+++ gnunet-gtk/src/namestore/gnunet-namestore-gtk_edit.h 2013-10-30
19:47:24 UTC (rev 30487)
@@ -1,292 +0,0 @@
-/*
- This file is part of GNUnet
- (C) 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
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-/**
- * @file src/namestore/gnunet-namestore-gtk_edit.h
- * @author Christian Grothoff
- * @brief editing dialogs for GNS records
- */
-#ifndef GNUNET_SETUP_GNS_EDIT_H
-#define GNUNET_SETUP_GNS_EDIT_H
-
-#include "gnunet_gtk.h"
-#include <gnunet/gnunet_namestore_service.h>
-#include <gnunet/gnunet_dnsparser_lib.h>
-
-
-/**
- * Columns in the zone list store.
- */
-enum ZONE_COLUMNS
-{
-
- /**
- * A gchararray
- */
- ZONE_LS_NAME = 0,
-
-
- /**
- * A `struct GNUNET_IDENTITY_Ego`
- */
- ZONE_LS_EGO = 1
-};
-
-
-
-/**
- * Context for edit operations.
- */
-struct EditDialogContext;
-
-
-/**
- * Signature of the continuation function invoked once the
- * edit dialog is done.
- *
- * @param edc dialog context
- * @param ret return code from the dialog
- */
-typedef void (*GNS_EditContinuation)(struct EditDialogContext *edc,
- GtkResponseType ret);
-
-
-/**
- * Signature of a dialog-specific validation function to validate the
- * value. Should either call 'edit_dialog_disable_save' if the value
- * is invalid, or 'edit_dialog_check_save' if the value is valid.
- */
-typedef void (*GNS_EditValidator)(struct EditDialogContext *edc);
-
-
-/**
- * Context for edit operations.
- */
-struct EditDialogContext
-{
-
- /**
- * Where in the tree view are we editing?
- */
- struct RecordInfo *ri;
-
- /**
- * Function to call at the end.
- */
- GNS_EditContinuation cont;
-
- /**
- * Function to call to validate the state of the dialog and
- * ultimately update the 'save' button sensitivity.
- */
- GNS_EditValidator validator;
-
- /**
- * Builder for the dialog (internal to gnunet-setup-gns-edit.c).
- */
- GtkBuilder *builder;
-
- /**
- * Main dialog window.
- */
- GtkDialog *dialog;
-
- /**
- * Name of the record.
- */
- gchar *name;
-
- /**
- * Value of the record in string format.
- */
- gchar *n_value;
-
- /**
- * Name of the zone into which the record should be placed.
- */
- gchar *new_zone_option;
-
- /**
- * Ego of the zone into which the record should be placed.
- */
- struct GNUNET_IDENTITY_Ego *ego;
-
- /**
- * Expiration time value (absolute or relative).
- */
- guint64 n_exp_time;
-
- /**
- * Offset of the record we are editing in the 'rd' list of 'ri'.
- */
- unsigned int off;
-
- /**
- * Flag indicating if the old record was in the namestore.
- */
- int old_record_in_namestore;
-
- /**
- * Type of the record.
- */
- uint32_t record_type;
-
- /**
- * Is this record 'public'?
- */
- gboolean n_public;
-
- /**
- * Is the expiration time relative?
- */
- gboolean n_is_relative;
-
- /**
- * Is this record a shadow record?
- */
- gboolean n_is_shadow;
-
- /**
- * List of all zones.
- */
- GtkListStore *zone_liststore;
-
-};
-
-
-
-/**
- * Run an GNS Edit dialog for an 'A' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_a (struct EditDialogContext *edc);
-
-
-/**
- * Run an GNS Edit dialog for an 'AAAA' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_aaaa (struct EditDialogContext *edc);
-
-
-/**
- * Run an GNS Edit dialog for an 'CNAME' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_cname (struct EditDialogContext *edc);
-
-
-/**
- * Run an GNS Edit dialog for an 'LEHO' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_leho (struct EditDialogContext *edc);
-
-
-/**
- * Run an GNS Edit dialog for an 'MX' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_mx (struct EditDialogContext *edc);
-
-
-/**
- * Run an GNS Edit dialog for an 'NS' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_gns2dns (struct EditDialogContext *edc);
-
-
-/**
- * Run an GNS Edit dialog for a 'PHONE' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_phone (struct EditDialogContext *edc);
-
-
-/**
- * Run an GNS Edit dialog for an 'PKEY' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_pkey (struct EditDialogContext *edc);
-
-
-/**
- * Run an GNS Edit dialog for an 'PTR' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_ptr (struct EditDialogContext *edc);
-
-
-/**
- * Run an GNS Edit dialog for an 'SOA' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_soa (struct EditDialogContext *edc);
-
-
-/**
- * Run an GNS Edit dialog for an 'SRV' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_srv (struct EditDialogContext *edc);
-
-
-/**
- * Run an GNS Edit dialog for an 'TXT' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_txt (struct EditDialogContext *edc);
-
-
-/**
- * Run an GNS Edit dialog for an 'VPN' Record.
- *
- * @param edc editing context to use
- */
-void
-GNS_edit_dialog_vpn (struct EditDialogContext *edc);
-
-
-#endif
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_a.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_a.c 2013-10-30 18:16:01 UTC
(rev 30486)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_a.c 2013-10-30 19:47:24 UTC
(rev 30487)
@@ -34,13 +34,13 @@
* @param entry editing widget
* @param user_data the plugin environment
*/
-void
+static void
GNS_edit_dialog_a_entry_changed_cb (GtkEditable *entry,
gpointer user_data)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
- env->check_validity (env->cls);
+ edc->check_validity (edc);
}
@@ -121,7 +121,7 @@
/**
* Entry point for the plugin.
*
- * @param cls the "struct GNUNET_GTK_NAMESTORE_PluginEnvironment*"
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment`
* @return NULL on error, otherwise the plugin context
*/
void *
@@ -129,11 +129,17 @@
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
+ { "GNS_edit_dialog_a_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_a_entry_changed_cb) },
+ { NULL, NULL }
+ };
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
plugin->dialog_glade_filename = "gnunet_namestore_edit_a.glade";
plugin->dialog_widget_name = "edit_a_dialog";
+ plugin->symbols = symbols;
plugin->load = &a_load;
plugin->store = &a_store;
plugin->validate = &a_validate;
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_aaaa.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_aaaa.c 2013-10-30
18:16:01 UTC (rev 30486)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_aaaa.c 2013-10-30
19:47:24 UTC (rev 30487)
@@ -34,13 +34,13 @@
* @param entry editing widget
* @param user_data the plugin environment
*/
-void
+static void
GNS_edit_dialog_aaaa_entry_changed_cb (GtkEditable *entry,
gpointer user_data)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
- env->check_validity (env->cls);
+ edc->check_validity (edc);
}
@@ -116,7 +116,7 @@
/**
* Entry point for the plugin.
*
- * @param cls the "struct GNUNET_GTK_NAMESTORE_PluginEnvironment*"
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment`
* @return NULL on error, otherwise the plugin context
*/
void *
@@ -124,11 +124,17 @@
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
+ { "GNS_edit_dialog_aaaa_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_aaaa_entry_changed_cb) },
+ { NULL, NULL }
+ };
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
plugin->dialog_glade_filename = "gnunet_namestore_edit_aaaa.glade";
plugin->dialog_widget_name = "edit_aaaa_dialog";
+ plugin->symbols = symbols;
plugin->load = &aaaa_load;
plugin->store = &aaaa_store;
plugin->validate = &aaaa_validate;
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_cname.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_cname.c 2013-10-30
18:16:01 UTC (rev 30486)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_cname.c 2013-10-30
19:47:24 UTC (rev 30487)
@@ -34,13 +34,13 @@
* @param entry editing widget
* @param user_data the plugin environment
*/
-void
+static void
GNS_edit_dialog_cname_entry_changed_cb (GtkEditable *entry,
gpointer user_data)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
- env->check_validity (env->cls);
+ edc->check_validity (edc);
}
@@ -120,7 +120,7 @@
/**
* Entry point for the plugin.
*
- * @param cls the "struct GNUNET_GTK_NAMESTORE_PluginEnvironment*"
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment`
* @return NULL on error, otherwise the plugin context
*/
void *
@@ -128,11 +128,17 @@
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
+ { "GNS_edit_dialog_cname_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_cname_entry_changed_cb) },
+ { NULL, NULL }
+ };
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
plugin->dialog_glade_filename = "gnunet_namestore_edit_cname.glade";
plugin->dialog_widget_name = "edit_cname_dialog";
+ plugin->symbols = symbols;
plugin->load = &cname_load;
plugin->store = &cname_store;
plugin->validate = &cname_validate;
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_gns2dns.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_gns2dns.c 2013-10-30
18:16:01 UTC (rev 30486)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_gns2dns.c 2013-10-30
19:47:24 UTC (rev 30487)
@@ -35,13 +35,13 @@
* @param entry editing widget
* @param user_data the plugin environment
*/
-void
+static void
GNS_edit_dialog_gns2dns_entry_changed_cb (GtkEditable *entry,
gpointer user_data)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
- env->check_validity (env->cls);
+ edc->check_validity (edc);
}
@@ -118,7 +118,7 @@
/**
* Entry point for the plugin.
*
- * @param cls the "struct GNUNET_GTK_NAMESTORE_PluginEnvironment*"
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment`
* @return NULL on error, otherwise the plugin context
*/
void *
@@ -126,11 +126,17 @@
{
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",
+ G_CALLBACK (GNS_edit_dialog_gns2dns_entry_changed_cb) },
+ { NULL, NULL }
+ };
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
plugin->dialog_glade_filename = "gnunet_namestore_edit_gns2dns.glade";
plugin->dialog_widget_name = "edit_gns2dns_dialog";
+ plugin->symbols = symbols;
plugin->load = &gns2dns_load;
plugin->store = &gns2dns_store;
plugin->validate = &gns2dns_validate;
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_leho.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_leho.c 2013-10-30
18:16:01 UTC (rev 30486)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_leho.c 2013-10-30
19:47:24 UTC (rev 30487)
@@ -27,8 +27,6 @@
#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.
@@ -36,13 +34,13 @@
* @param entry editing widget
* @param user_data the plugin environment
*/
-void
+static void
GNS_edit_dialog_leho_entry_changed_cb (GtkEditable *entry,
gpointer user_data)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
- env->check_validity (env->cls);
+ edc->check_validity (edc);
}
@@ -122,7 +120,7 @@
/**
* Entry point for the plugin.
*
- * @param cls the "struct GNUNET_GTK_NAMESTORE_PluginEnvironment*"
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment`
* @return NULL on error, otherwise the plugin context
*/
void *
@@ -130,11 +128,17 @@
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
+ { "GNS_edit_dialog_leho_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_leho_entry_changed_cb) },
+ { NULL, NULL }
+ };
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
plugin->dialog_glade_filename = "gnunet_namestore_edit_leho.glade";
plugin->dialog_widget_name = "edit_leho_dialog";
+ plugin->symbols = symbols;
plugin->load = &leho_load;
plugin->store = &leho_store;
plugin->validate = &leho_validate;
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_mx.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_mx.c 2013-10-30 18:16:01 UTC
(rev 30486)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_mx.c 2013-10-30 19:47:24 UTC
(rev 30487)
@@ -34,13 +34,13 @@
* @param entry editing widget
* @param user_data the plugin environment
*/
-void
+static void
GNS_edit_dialog_mx_entry_changed_cb (GtkEditable *entry,
gpointer user_data)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
- env->check_validity (env->cls);
+ edc->check_validity (edc);
}
@@ -148,7 +148,7 @@
/**
* Entry point for the plugin.
*
- * @param cls the "struct GNUNET_GTK_NAMESTORE_PluginEnvironment*"
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment`
* @return NULL on error, otherwise the plugin context
*/
void *
@@ -156,11 +156,17 @@
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
+ { "GNS_edit_dialog_mx_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_mx_entry_changed_cb) },
+ { NULL, NULL }
+ };
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
plugin->dialog_glade_filename = "gnunet_namestore_edit_mx.glade";
plugin->dialog_widget_name = "edit_mx_dialog";
+ plugin->symbols = symbols;
plugin->load = &mx_load;
plugin->store = &mx_store;
plugin->validate = &mx_validate;
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_phone.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_phone.c 2013-10-30
18:16:01 UTC (rev 30486)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_phone.c 2013-10-30
19:47:24 UTC (rev 30487)
@@ -27,8 +27,6 @@
#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.
@@ -36,13 +34,13 @@
* @param entry editing widget
* @param user_data the plugin environment
*/
-void
+static void
GNS_edit_dialog_phone_peer_entry_changed_cb (GtkEditable *entry,
gpointer user_data)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
- env->check_validity (env->cls);
+ edc->check_validity (edc);
}
@@ -152,7 +150,7 @@
/**
* Entry point for the plugin.
*
- * @param cls the "struct GNUNET_GTK_NAMESTORE_PluginEnvironment*"
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment`
* @return NULL on error, otherwise the plugin context
*/
void *
@@ -160,11 +158,17 @@
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
+ { "GNS_edit_dialog_phone_peer_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_phone_peer_entry_changed_cb) },
+ { NULL, NULL }
+ };
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
plugin->dialog_glade_filename = "gnunet_namestore_edit_phone.glade";
plugin->dialog_widget_name = "edit_phone_dialog";
+ plugin->symbols = symbols;
plugin->load = &phone_load;
plugin->store = &phone_store;
plugin->validate = &phone_validate;
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_pkey.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_pkey.c 2013-10-30
18:16:01 UTC (rev 30486)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_pkey.c 2013-10-30
19:47:24 UTC (rev 30487)
@@ -34,13 +34,13 @@
* @param entry editing widget
* @param user_data the plugin environment
*/
-void
+static void
GNS_edit_dialog_pkey_entry_changed_cb (GtkEditable *entry,
gpointer user_data)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
- env->check_validity (env->cls);
+ edc->check_validity (edc);
}
@@ -121,7 +121,7 @@
/**
* Entry point for the plugin.
*
- * @param cls the "struct GNUNET_GTK_NAMESTORE_PluginEnvironment*"
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment`
* @return NULL on error, otherwise the plugin context
*/
void *
@@ -129,11 +129,17 @@
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
+ { "GNS_edit_dialog_pkey_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_pkey_entry_changed_cb) },
+ { NULL, NULL }
+ };
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
plugin->dialog_glade_filename = "gnunet_namestore_edit_pkey.glade";
plugin->dialog_widget_name = "edit_pkey_dialog";
+ plugin->symbols = symbols;
plugin->load = &pkey_load;
plugin->store = &pkey_store;
plugin->validate = &pkey_validate;
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_ptr.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_ptr.c 2013-10-30 18:16:01 UTC
(rev 30486)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_ptr.c 2013-10-30 19:47:24 UTC
(rev 30487)
@@ -34,13 +34,13 @@
* @param entry editing widget
* @param user_data the plugin environment
*/
-void
+static void
GNS_edit_dialog_ptr_entry_changed_cb (GtkEditable *entry,
gpointer user_data)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
- env->check_validity (env->cls);
+ edc->check_validity (edc);
}
@@ -117,7 +117,7 @@
/**
* Entry point for the plugin.
*
- * @param cls the "struct GNUNET_GTK_NAMESTORE_PluginEnvironment*"
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment`
* @return NULL on error, otherwise the plugin context
*/
void *
@@ -125,11 +125,17 @@
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
+ { "GNS_edit_dialog_ptr_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_ptr_entry_changed_cb) },
+ { NULL, NULL }
+ };
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
plugin->dialog_glade_filename = "gnunet_namestore_edit_ptr.glade";
plugin->dialog_widget_name = "edit_ptr_dialog";
+ plugin->symbols = symbols;
plugin->load = &ptr_load;
plugin->store = &ptr_store;
plugin->validate = &ptr_validate;
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_soa.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_soa.c 2013-10-30 18:16:01 UTC
(rev 30486)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_soa.c 2013-10-30 19:47:24 UTC
(rev 30487)
@@ -34,13 +34,13 @@
* @param entry editing widget
* @param user_data the plugin environment
*/
-void
+static void
GNS_edit_dialog_soa_contact_email_entry_changed_cb (GtkEditable *entry,
gpointer user_data)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
- env->check_validity (env->cls);
+ edc->check_validity (edc);
}
@@ -51,13 +51,13 @@
* @param entry editing widget
* @param user_data the plugin environment
*/
-void
+static void
GNS_edit_dialog_soa_source_host_entry_changed_cb (GtkEditable *entry,
gpointer user_data)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
- env->check_validity (env->cls);
+ edc->check_validity (edc);
}
@@ -216,7 +216,7 @@
/**
* Entry point for the plugin.
*
- * @param cls the "struct GNUNET_GTK_NAMESTORE_PluginEnvironment*"
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment`
* @return NULL on error, otherwise the plugin context
*/
void *
@@ -224,11 +224,19 @@
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
+ { "GNS_edit_dialog_soa_contact_email_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_soa_contact_email_entry_changed_cb) },
+ { "GNS_edit_dialog_soa_source_host_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_soa_source_host_entry_changed_cb) },
+ { NULL, NULL }
+ };
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
plugin->dialog_glade_filename = "gnunet_namestore_edit_soa.glade";
plugin->dialog_widget_name = "edit_soa_dialog";
+ plugin->symbols = symbols;
plugin->load = &soa_load;
plugin->store = &soa_store;
plugin->validate = &soa_validate;
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_srv.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_srv.c 2013-10-30 18:16:01 UTC
(rev 30486)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_srv.c 2013-10-30 19:47:24 UTC
(rev 30487)
@@ -101,7 +101,7 @@
/**
* Entry point for the plugin.
*
- * @param cls the "struct GNUNET_GTK_NAMESTORE_PluginEnvironment*"
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment`
* @return NULL on error, otherwise the plugin context
*/
void *
@@ -109,11 +109,15 @@
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
+ { NULL, NULL }
+ };
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
plugin->dialog_glade_filename = "gnunet_namestore_edit_srv.glade";
plugin->dialog_widget_name = "edit_a_dialog";
+ plugin->symbols = symbols;
plugin->load = &srv_load;
plugin->store = &srv_store;
plugin->validate = &srv_validate;
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_template.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_template.c 2013-10-30
18:16:01 UTC (rev 30486)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_template.c 2013-10-30
19:47:24 UTC (rev 30487)
@@ -34,13 +34,13 @@
* @param entry editing widget
* @param user_data the plugin environment
*/
-void
+static void
FOO_changed_cb (GtkEditable *entry,
gpointer user_data)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+ *edc = user_data;
- env->check_validity (env->cls);
+ edc->check_validity (edc);
}
/**
@@ -101,7 +101,7 @@
/**
* Entry point for the plugin.
*
- * @param cls the "struct GNUNET_GTK_NAMESTORE_PluginEnvironment*"
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment`
* @return NULL on error, otherwise the plugin context
*/
void *
@@ -109,11 +109,17 @@
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
+ { "FOO_changed_cb",
+ G_CALLBACK (FOO_changed_cb) },
+ { NULL, NULL }
+ };
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
plugin->dialog_glade_filename = "gnunet_namestore_edit_template.glade";
plugin->dialog_widget_name = "edit_template_dialog";
+ plugin->symbols = symbols;
plugin->load = &a_load;
plugin->store = &a_store;
plugin->validate = &a_validate;
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_txt.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_txt.c 2013-10-30 18:16:01 UTC
(rev 30486)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_txt.c 2013-10-30 19:47:24 UTC
(rev 30487)
@@ -28,6 +28,23 @@
/**
+ * The user has edited the TXT record value. Enable/disable 'save'
+ * button depending on the validity of the value.
+ *
+ * @param entry editing widget
+ * @param user_data the plugin environment
+ */
+static void
+GNS_edit_dialog_txt_entry_changed_cb (GtkEditable *entry,
+ gpointer user_data)
+{
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
+
+ edc->check_validity (edc);
+}
+
+
+/**
* 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.
@@ -57,7 +74,7 @@
*/
static gchar *
txt_store (void *cls,
- GtkBuilder *builder)
+ GtkBuilder *builder)
{
GtkEntry *entry;
const gchar *value;
@@ -82,7 +99,7 @@
*/
static int
txt_validate (void *cls,
- GtkBuilder *builder)
+ GtkBuilder *builder)
{
return GNUNET_OK;
}
@@ -91,7 +108,7 @@
/**
* Entry point for the plugin.
*
- * @param cls the "struct GNUNET_GTK_NAMESTORE_PluginEnvironment*"
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment`
* @return NULL on error, otherwise the plugin context
*/
void *
@@ -99,11 +116,17 @@
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
+ { "GNS_edit_dialog_txt_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_txt_entry_changed_cb) },
+ { NULL, NULL }
+ };
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
plugin->dialog_glade_filename = "gnunet_namestore_edit_txt.glade";
plugin->dialog_widget_name = "edit_txt_dialog";
+ plugin->symbols = symbols;
plugin->load = &txt_load;
plugin->store = &txt_store;
plugin->validate = &txt_validate;
Modified: gnunet-gtk/src/namestore/plugin_gtk_namestore_vpn.c
===================================================================
--- gnunet-gtk/src/namestore/plugin_gtk_namestore_vpn.c 2013-10-30 18:16:01 UTC
(rev 30486)
+++ gnunet-gtk/src/namestore/plugin_gtk_namestore_vpn.c 2013-10-30 19:47:24 UTC
(rev 30487)
@@ -34,13 +34,13 @@
* @param entry editing widget
* @param user_data the plugin environment
*/
-void
+static void
GNS_edit_dialog_vpn_peer_entry_changed_cb (GtkEditable *entry,
gpointer user_data)
{
- struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = user_data;
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
- env->check_validity (env->cls);
+ edc->check_validity (edc);
}
@@ -154,7 +154,7 @@
/**
* Entry point for the plugin.
*
- * @param cls the "struct GNUNET_GTK_NAMESTORE_PluginEnvironment*"
+ * @param cls the `struct GNUNET_GTK_NAMESTORE_PluginEnvironment`
* @return NULL on error, otherwise the plugin context
*/
void *
@@ -162,11 +162,17 @@
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
+ { "GNS_edit_dialog_vpn_peer_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_vpn_peer_entry_changed_cb) },
+ { NULL, NULL }
+ };
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
plugin->dialog_glade_filename = "gnunet_namestore_edit_vpn.glade";
plugin->dialog_widget_name = "edit_vpn_dialog";
+ plugin->symbols = symbols;
plugin->load = &vpn_load;
plugin->store = &vpn_store;
plugin->validate = &vpn_validate;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30487 - in gnunet-gtk: contrib src/include src/lib src/namestore,
gnunet <=