[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25227 - in gnunet-gtk: contrib src/setup
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25227 - in gnunet-gtk: contrib src/setup |
Date: |
Tue, 4 Dec 2012 14:48:51 +0100 |
Author: grothoff
Date: 2012-12-04 14:48:51 +0100 (Tue, 04 Dec 2012)
New Revision: 25227
Modified:
gnunet-gtk/contrib/gnunet_setup_gns_edit_pkey.glade
gnunet-gtk/src/setup/gnunet-setup-gns-edit.c
gnunet-gtk/src/setup/gnunet-setup-gns-edit.h
gnunet-gtk/src/setup/gnunet-setup-gns.c
Log:
-support PKEY records
Modified: gnunet-gtk/contrib/gnunet_setup_gns_edit_pkey.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_setup_gns_edit_pkey.glade 2012-12-04 13:45:39 UTC
(rev 25226)
+++ gnunet-gtk/contrib/gnunet_setup_gns_edit_pkey.glade 2012-12-04 13:48:51 UTC
(rev 25227)
@@ -239,7 +239,7 @@
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="tooltip_text" translatable="yes">Enter
the hash of the public key of the authority here.</property>
- <property name="max_length">15</property>
+ <property name="max_length">105</property>
<property name="invisible_char">●</property>
<property
name="primary_icon_activatable">False</property>
<property
name="secondary_icon_activatable">False</property>
Modified: gnunet-gtk/src/setup/gnunet-setup-gns-edit.c
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup-gns-edit.c 2012-12-04 13:45:39 UTC
(rev 25226)
+++ gnunet-gtk/src/setup/gnunet-setup-gns-edit.c 2012-12-04 13:48:51 UTC
(rev 25227)
@@ -1138,7 +1138,118 @@
}
+/* ************************ 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_HashCode hc;
+
+ 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_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 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 preedit new value
+ * @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 cont continuation to call when done
+ * @param edc editing context to use
+ */
+void
+GNS_edit_dialog_pkey (struct EditDialogContext *edc)
+{
+ edc->builder = GNUNET_GTK_get_new_builder
("gnunet_setup_gns_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 *********************** */
/**
Modified: gnunet-gtk/src/setup/gnunet-setup-gns-edit.h
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup-gns-edit.h 2012-12-04 13:45:39 UTC
(rev 25226)
+++ gnunet-gtk/src/setup/gnunet-setup-gns-edit.h 2012-12-04 13:48:51 UTC
(rev 25227)
@@ -225,6 +225,16 @@
/**
+ * Run an GNS Edit dialog for an 'PKEY' Record.
+ *
+ * @param cont continuation to call when done
+ * @param edc editing context to use
+ */
+void
+GNS_edit_dialog_pkey (struct EditDialogContext *edc);
+
+
+/**
* Run an GNS Edit dialog for an 'PTR' Record.
*
* @param cont continuation to call when done
Modified: gnunet-gtk/src/setup/gnunet-setup-gns.c
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup-gns.c 2012-12-04 13:45:39 UTC (rev
25226)
+++ gnunet-gtk/src/setup/gnunet-setup-gns.c 2012-12-04 13:48:51 UTC (rev
25227)
@@ -1444,11 +1444,14 @@
case GNUNET_NAMESTORE_TYPE_LEHO:
GNS_edit_dialog_leho (edc);
break;
+ case GNUNET_NAMESTORE_TYPE_PKEY:
+ GNS_edit_dialog_pkey (edc);
+ break;
case GNUNET_DNSPARSER_TYPE_SOA:
case GNUNET_DNSPARSER_TYPE_SRV:
+ case GNUNET_NAMESTORE_TYPE_VPN:
case GNUNET_DNSPARSER_TYPE_TLSA:
- case GNUNET_NAMESTORE_TYPE_PKEY:
- case GNUNET_NAMESTORE_TYPE_VPN:
+ default:
GNUNET_break (0); /* FIXME - implement (#2465) */
edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */
break;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25227 - in gnunet-gtk: contrib src/setup,
gnunet <=