diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-06-07 14:55:00 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-06-07 14:55:00 +0000 |
commit | a9bb4d342d17566d63e66cf32045573be249535e (patch) | |
tree | c1b023e9090e2908de8ab5b600230ea639246dff /src | |
parent | e71aa0ca35aa824711b86c3484eb00c63aabd092 (diff) | |
download | gnunet-gtk-a9bb4d342d17566d63e66cf32045573be249535e.tar.gz gnunet-gtk-a9bb4d342d17566d63e66cf32045573be249535e.zip |
more editing signals in TLSA dialog
Diffstat (limited to 'src')
-rw-r--r-- | src/namestore/plugin_gtk_namestore_box.c | 16 | ||||
-rw-r--r-- | src/namestore/plugin_gtk_namestore_srv.c | 1 | ||||
-rw-r--r-- | src/namestore/plugin_gtk_namestore_tlsa.c | 100 |
3 files changed, 97 insertions, 20 deletions
diff --git a/src/namestore/plugin_gtk_namestore_box.c b/src/namestore/plugin_gtk_namestore_box.c index 20c0efbd..4641613c 100644 --- a/src/namestore/plugin_gtk_namestore_box.c +++ b/src/namestore/plugin_gtk_namestore_box.c | |||
@@ -213,11 +213,25 @@ libgnunet_plugin_gtk_namestore_box_init (void *cls) | |||
213 | struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls; | 213 | struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls; |
214 | struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin; | 214 | struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin; |
215 | static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = { | 215 | static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = { |
216 | /* SRV plugin */ | ||
216 | { "GNS_edit_dialog_srv_target_entry_changed_cb", | 217 | { "GNS_edit_dialog_srv_target_entry_changed_cb", |
217 | G_CALLBACK (GNS_edit_dialog_srv_target_entry_changed_cb) }, | 218 | G_CALLBACK (GNS_edit_dialog_srv_target_entry_changed_cb) }, |
219 | /* TLSA plugin */ | ||
220 | { "tlsa_value_textbuffer_changed_cb", | ||
221 | G_CALLBACK (tlsa_value_textbuffer_changed_cb) }, | ||
222 | { "edit_dialog_tlsa_selector_radiobutton_toggled_cb", | ||
223 | G_CALLBACK (edit_dialog_tlsa_selector_radiobutton_toggled_cb) }, | ||
224 | { "edit_dialog_tlsa_usage_radiobutton_toggled_cb", | ||
225 | G_CALLBACK (edit_dialog_tlsa_usage_radiobutton_toggled_cb) }, | ||
226 | { "edit_dialog_tlsa_matching_type_radiobutton_toggled_cb", | ||
227 | G_CALLBACK (edit_dialog_tlsa_matching_type_radiobutton_toggled_cb) }, | ||
228 | { "tlsa_import_button_clicked_cb", | ||
229 | G_CALLBACK (tlsa_import_button_clicked_cb) }, | ||
230 | { "edit_dialog_tlsa_import_entry_changed_cb", | ||
231 | G_CALLBACK (edit_dialog_tlsa_import_entry_changed_cb) }, | ||
232 | /* generic CBs */ | ||
218 | { "edit_dialog_protocol_combobox_changed_cb", | 233 | { "edit_dialog_protocol_combobox_changed_cb", |
219 | G_CALLBACK (edit_dialog_protocol_combobox_changed_cb) }, | 234 | G_CALLBACK (edit_dialog_protocol_combobox_changed_cb) }, |
220 | /* FIXME: add TLSA symbols! */ | ||
221 | /* need to include symbols from all boxed types here */ | 235 | /* need to include symbols from all boxed types here */ |
222 | { NULL, NULL } | 236 | { NULL, NULL } |
223 | }; | 237 | }; |
diff --git a/src/namestore/plugin_gtk_namestore_srv.c b/src/namestore/plugin_gtk_namestore_srv.c index 6b91566d..e6f4338d 100644 --- a/src/namestore/plugin_gtk_namestore_srv.c +++ b/src/namestore/plugin_gtk_namestore_srv.c | |||
@@ -274,6 +274,7 @@ libgnunet_plugin_gtk_namestore_srv_init (void *cls) | |||
274 | static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = { | 274 | static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = { |
275 | { "GNS_edit_dialog_srv_target_entry_changed_cb", | 275 | { "GNS_edit_dialog_srv_target_entry_changed_cb", |
276 | G_CALLBACK (GNS_edit_dialog_srv_target_entry_changed_cb) }, | 276 | G_CALLBACK (GNS_edit_dialog_srv_target_entry_changed_cb) }, |
277 | /* generic CBs */ | ||
277 | { "edit_dialog_protocol_combobox_changed_cb", | 278 | { "edit_dialog_protocol_combobox_changed_cb", |
278 | G_CALLBACK (edit_dialog_protocol_combobox_changed_cb) }, | 279 | G_CALLBACK (edit_dialog_protocol_combobox_changed_cb) }, |
279 | { NULL, NULL } | 280 | { NULL, NULL } |
diff --git a/src/namestore/plugin_gtk_namestore_tlsa.c b/src/namestore/plugin_gtk_namestore_tlsa.c index 02ca3c5c..c79e92bb 100644 --- a/src/namestore/plugin_gtk_namestore_tlsa.c +++ b/src/namestore/plugin_gtk_namestore_tlsa.c | |||
@@ -42,9 +42,60 @@ | |||
42 | * @param user_data the plugin environment | 42 | * @param user_data the plugin environment |
43 | */ | 43 | */ |
44 | static void | 44 | static void |
45 | edit_dialog_tlsa_value_textview_preedit_changed_cb (GtkTextView *textview, | 45 | tlsa_value_textbuffer_changed_cb (GtkTextView *textview, |
46 | gchar *preedit, | 46 | gchar *preedit, |
47 | gpointer user_data) | 47 | gpointer user_data) |
48 | { | ||
49 | struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data; | ||
50 | |||
51 | edc->check_validity (edc); | ||
52 | } | ||
53 | |||
54 | |||
55 | /** | ||
56 | * The user has changed the selector. Enable/disable 'save' | ||
57 | * button depending on the validity of the value. | ||
58 | * | ||
59 | * @param togglebutton button that changed editing widget | ||
60 | * @param user_data the plugin environment | ||
61 | */ | ||
62 | static void | ||
63 | edit_dialog_tlsa_selector_radiobutton_toggled_cb (GtkToggleButton *togglebutton, | ||
64 | gpointer user_data) | ||
65 | { | ||
66 | struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data; | ||
67 | |||
68 | edc->check_validity (edc); | ||
69 | } | ||
70 | |||
71 | |||
72 | /** | ||
73 | * The user has changed the usage. Enable/disable 'save' | ||
74 | * button depending on the validity of the value. | ||
75 | * | ||
76 | * @param togglebutton button that changed editing widget | ||
77 | * @param user_data the plugin environment | ||
78 | */ | ||
79 | static void | ||
80 | edit_dialog_tlsa_usage_radiobutton_toggled_cb (GtkToggleButton *togglebutton, | ||
81 | gpointer user_data) | ||
82 | { | ||
83 | struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data; | ||
84 | |||
85 | edc->check_validity (edc); | ||
86 | } | ||
87 | |||
88 | |||
89 | /** | ||
90 | * The user has changed the matching type. Enable/disable 'save' | ||
91 | * button depending on the validity of the value. | ||
92 | * | ||
93 | * @param togglebutton button that changed editing widget | ||
94 | * @param user_data the plugin environment | ||
95 | */ | ||
96 | static void | ||
97 | edit_dialog_tlsa_matching_type_radiobutton_toggled_cb (GtkToggleButton *togglebutton, | ||
98 | gpointer user_data) | ||
48 | { | 99 | { |
49 | struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data; | 100 | struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data; |
50 | 101 | ||
@@ -389,8 +440,6 @@ static int | |||
389 | tlsa_validate (void *cls, | 440 | tlsa_validate (void *cls, |
390 | GtkBuilder *builder) | 441 | GtkBuilder *builder) |
391 | { | 442 | { |
392 | GtkEditable *entry; | ||
393 | const gchar *preedit; | ||
394 | GtkComboBox *cb; | 443 | GtkComboBox *cb; |
395 | GtkTreeIter iter; | 444 | GtkTreeIter iter; |
396 | gchar *value; | 445 | gchar *value; |
@@ -402,17 +451,17 @@ tlsa_validate (void *cls, | |||
402 | int ret; | 451 | int ret; |
403 | unsigned int matching_type; | 452 | unsigned int matching_type; |
404 | 453 | ||
405 | entry = GTK_EDITABLE (gtk_builder_get_object (builder, | 454 | fprintf (stderr, |
406 | "edit_dialog_tlsa_target_entry")); | 455 | "Validating...\n"); |
407 | preedit = gtk_editable_get_chars (entry, 0, -1); | ||
408 | if ( (NULL == preedit) || | ||
409 | (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) ) | ||
410 | return GNUNET_SYSERR; | ||
411 | cb = GTK_COMBO_BOX (gtk_builder_get_object (builder, | 456 | cb = GTK_COMBO_BOX (gtk_builder_get_object (builder, |
412 | "edit_dialog_protocol_combobox")); | 457 | "edit_dialog_protocol_combobox")); |
413 | if (! gtk_combo_box_get_active_iter (cb, | 458 | if (! gtk_combo_box_get_active_iter (cb, |
414 | &iter)) | 459 | &iter)) |
460 | { | ||
461 | fprintf (stderr, | ||
462 | "No protocol selected...\n"); | ||
415 | return GNUNET_SYSERR; | 463 | return GNUNET_SYSERR; |
464 | } | ||
416 | 465 | ||
417 | tb = gtk_text_view_get_buffer (GTK_TEXT_VIEW | 466 | tb = gtk_text_view_get_buffer (GTK_TEXT_VIEW |
418 | (gtk_builder_get_object (builder, | 467 | (gtk_builder_get_object (builder, |
@@ -432,6 +481,8 @@ tlsa_validate (void *cls, | |||
432 | bin)) | 481 | bin)) |
433 | { | 482 | { |
434 | /* not hex */ | 483 | /* not hex */ |
484 | fprintf (stderr, | ||
485 | "Certificate value is not in hex...\n"); | ||
435 | return GNUNET_SYSERR; | 486 | return GNUNET_SYSERR; |
436 | } | 487 | } |
437 | matching_type = get_selected_radio_value (builder, | 488 | matching_type = get_selected_radio_value (builder, |
@@ -447,7 +498,11 @@ tlsa_validate (void *cls, | |||
447 | gnutls_pkcs7_import (pkcs7, | 498 | gnutls_pkcs7_import (pkcs7, |
448 | &datum, | 499 | &datum, |
449 | GNUTLS_X509_FMT_DER)) | 500 | GNUTLS_X509_FMT_DER)) |
501 | { | ||
502 | fprintf (stderr, | ||
503 | "Certificate value is not PKCS7...\n"); | ||
450 | ret = GNUNET_SYSERR; | 504 | ret = GNUNET_SYSERR; |
505 | } | ||
451 | else | 506 | else |
452 | ret = GNUNET_OK; | 507 | ret = GNUNET_OK; |
453 | gnutls_pkcs7_deinit (pkcs7); | 508 | gnutls_pkcs7_deinit (pkcs7); |
@@ -489,8 +544,8 @@ tlsa_import_button_clicked_cb (GtkButton *button, | |||
489 | * Update the import button's sensitivity. | 544 | * Update the import button's sensitivity. |
490 | */ | 545 | */ |
491 | static void | 546 | static void |
492 | GNS_edit_dialog_tlsa_entry_changed_cb (GtkEditable *entry, | 547 | edit_dialog_tlsa_import_entry_changed_cb (GtkEditable *entry, |
493 | gpointer user_data) | 548 | gpointer user_data) |
494 | { | 549 | { |
495 | struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data; | 550 | struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data; |
496 | GtkWidget *button; | 551 | GtkWidget *button; |
@@ -522,14 +577,21 @@ libgnunet_plugin_gtk_namestore_tlsa_init (void *cls) | |||
522 | struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls; | 577 | struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls; |
523 | struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin; | 578 | struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin; |
524 | static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = { | 579 | static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = { |
525 | { "edit_dialog_tlsa_value_textview_preedit_changed_cb", | 580 | { "tlsa_value_textbuffer_changed_cb", |
526 | G_CALLBACK (edit_dialog_tlsa_value_textview_preedit_changed_cb) }, | 581 | G_CALLBACK (tlsa_value_textbuffer_changed_cb) }, |
527 | { "edit_dialog_protocol_combobox_changed_cb", | 582 | { "edit_dialog_tlsa_selector_radiobutton_toggled_cb", |
528 | G_CALLBACK (edit_dialog_protocol_combobox_changed_cb) }, | 583 | G_CALLBACK (edit_dialog_tlsa_selector_radiobutton_toggled_cb) }, |
584 | { "edit_dialog_tlsa_usage_radiobutton_toggled_cb", | ||
585 | G_CALLBACK (edit_dialog_tlsa_usage_radiobutton_toggled_cb) }, | ||
586 | { "edit_dialog_tlsa_matching_type_radiobutton_toggled_cb", | ||
587 | G_CALLBACK (edit_dialog_tlsa_matching_type_radiobutton_toggled_cb) }, | ||
529 | { "tlsa_import_button_clicked_cb", | 588 | { "tlsa_import_button_clicked_cb", |
530 | G_CALLBACK (tlsa_import_button_clicked_cb) }, | 589 | G_CALLBACK (tlsa_import_button_clicked_cb) }, |
531 | { "GNS_edit_dialog_tlsa_entry_changed_cb", | 590 | { "edit_dialog_tlsa_import_entry_changed_cb", |
532 | G_CALLBACK (GNS_edit_dialog_tlsa_entry_changed_cb) }, | 591 | G_CALLBACK (edit_dialog_tlsa_import_entry_changed_cb) }, |
592 | /* generic CBs */ | ||
593 | { "edit_dialog_protocol_combobox_changed_cb", | ||
594 | G_CALLBACK (edit_dialog_protocol_combobox_changed_cb) }, | ||
533 | { NULL, NULL } | 595 | { NULL, NULL } |
534 | }; | 596 | }; |
535 | 597 | ||