diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-12-04 13:33:16 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-12-04 13:33:16 +0000 |
commit | f6e77d54ae41bc5b96a3565268e563914a53cacd (patch) | |
tree | 6ebf0e3599b944065a5148175468bee09616bb4c | |
parent | f208fff04a68d723d619431f9cad3c23c293dd65 (diff) | |
download | gnunet-gtk-f6e77d54ae41bc5b96a3565268e563914a53cacd.tar.gz gnunet-gtk-f6e77d54ae41bc5b96a3565268e563914a53cacd.zip |
-adding custom dialogs for a few simple record types
-rw-r--r-- | contrib/Makefile.am | 4 | ||||
-rw-r--r-- | contrib/gnunet_setup_gns_edit_aaaa.glade | 4 | ||||
-rw-r--r-- | contrib/gnunet_setup_gns_edit_cname.glade | 6 | ||||
-rw-r--r-- | contrib/gnunet_setup_gns_edit_leho.glade | 4 | ||||
-rw-r--r-- | contrib/gnunet_setup_gns_edit_mx.glade | 6 | ||||
-rw-r--r-- | contrib/gnunet_setup_gns_edit_ns.glade | 4 | ||||
-rw-r--r-- | contrib/gnunet_setup_gns_edit_pkey.glade | 6 | ||||
-rw-r--r-- | contrib/gnunet_setup_gns_edit_ptr.glade | 4 | ||||
-rw-r--r-- | contrib/gnunet_setup_gns_edit_soa.glade | 2 | ||||
-rw-r--r-- | contrib/gnunet_setup_gns_edit_srv.glade | 2 | ||||
-rw-r--r-- | contrib/gnunet_setup_gns_edit_txt.glade | 4 | ||||
-rw-r--r-- | contrib/gnunet_setup_gns_edit_vpn.glade | 2 | ||||
-rw-r--r-- | src/setup/gnunet-setup-gns-edit.c | 781 | ||||
-rw-r--r-- | src/setup/gnunet-setup-gns-edit.h | 70 | ||||
-rw-r--r-- | src/setup/gnunet-setup-gns.c | 18 |
15 files changed, 891 insertions, 26 deletions
diff --git a/contrib/Makefile.am b/contrib/Makefile.am index 9eab52cb..a2850246 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am | |||
@@ -62,8 +62,8 @@ pkgdata_DATA = \ | |||
62 | gnunet_setup_gns_edit_pkey.glade \ | 62 | gnunet_setup_gns_edit_pkey.glade \ |
63 | gnunet_setup_gns_edit_leho.glade \ | 63 | gnunet_setup_gns_edit_leho.glade \ |
64 | gnunet_setup_gns_edit_srv.glade \ | 64 | gnunet_setup_gns_edit_srv.glade \ |
65 | gnunet_setup_gns_edit_vpn.glade \ | 65 | gnunet_setup_gns_edit_vpn.glade |
66 | gnunet_setup_gns_edit_pseu.glade | 66 | |
67 | 67 | ||
68 | install-data-local: | 68 | install-data-local: |
69 | $(mkinstalldirs) $(DESTDIR)$(pkgpixdir) | 69 | $(mkinstalldirs) $(DESTDIR)$(pkgpixdir) |
diff --git a/contrib/gnunet_setup_gns_edit_aaaa.glade b/contrib/gnunet_setup_gns_edit_aaaa.glade index 98a6abd0..f2851a9d 100644 --- a/contrib/gnunet_setup_gns_edit_aaaa.glade +++ b/contrib/gnunet_setup_gns_edit_aaaa.glade | |||
@@ -24,7 +24,7 @@ | |||
24 | <property name="window_position">center-on-parent</property> | 24 | <property name="window_position">center-on-parent</property> |
25 | <property name="destroy_with_parent">True</property> | 25 | <property name="destroy_with_parent">True</property> |
26 | <property name="type_hint">dialog</property> | 26 | <property name="type_hint">dialog</property> |
27 | <signal name="response" handler="GNS_edit_a_dialog_response_cb" swapped="no"/> | 27 | <signal name="response" handler="GNS_edit_aaaa_dialog_response_cb" swapped="no"/> |
28 | <child internal-child="vbox"> | 28 | <child internal-child="vbox"> |
29 | <object class="GtkVBox" id="edit_dialog_vbox"> | 29 | <object class="GtkVBox" id="edit_dialog_vbox"> |
30 | <property name="visible">True</property> | 30 | <property name="visible">True</property> |
@@ -206,7 +206,7 @@ | |||
206 | <property name="secondary_icon_activatable">False</property> | 206 | <property name="secondary_icon_activatable">False</property> |
207 | <property name="primary_icon_sensitive">True</property> | 207 | <property name="primary_icon_sensitive">True</property> |
208 | <property name="secondary_icon_sensitive">True</property> | 208 | <property name="secondary_icon_sensitive">True</property> |
209 | <signal name="changed" handler="GNS_edit_dialog_a_entry_changed_cb" swapped="no"/> | 209 | <signal name="changed" handler="GNS_edit_dialog_aaaa_entry_changed_cb" swapped="no"/> |
210 | </object> | 210 | </object> |
211 | <packing> | 211 | <packing> |
212 | <property name="expand">False</property> | 212 | <property name="expand">False</property> |
diff --git a/contrib/gnunet_setup_gns_edit_cname.glade b/contrib/gnunet_setup_gns_edit_cname.glade index a713d213..a4af339e 100644 --- a/contrib/gnunet_setup_gns_edit_cname.glade +++ b/contrib/gnunet_setup_gns_edit_cname.glade | |||
@@ -24,7 +24,7 @@ | |||
24 | <property name="window_position">center-on-parent</property> | 24 | <property name="window_position">center-on-parent</property> |
25 | <property name="destroy_with_parent">True</property> | 25 | <property name="destroy_with_parent">True</property> |
26 | <property name="type_hint">dialog</property> | 26 | <property name="type_hint">dialog</property> |
27 | <signal name="response" handler="GNS_edit_a_dialog_response_cb" swapped="no"/> | 27 | <signal name="response" handler="GNS_edit_cname_dialog_response_cb" swapped="no"/> |
28 | <child internal-child="vbox"> | 28 | <child internal-child="vbox"> |
29 | <object class="GtkVBox" id="edit_dialog_vbox"> | 29 | <object class="GtkVBox" id="edit_dialog_vbox"> |
30 | <property name="visible">True</property> | 30 | <property name="visible">True</property> |
@@ -200,13 +200,13 @@ | |||
200 | <property name="can_focus">True</property> | 200 | <property name="can_focus">True</property> |
201 | <property name="has_focus">True</property> | 201 | <property name="has_focus">True</property> |
202 | <property name="tooltip_text" translatable="yes">Enter the name for which this name is an alias.</property> | 202 | <property name="tooltip_text" translatable="yes">Enter the name for which this name is an alias.</property> |
203 | <property name="max_length">15</property> | 203 | <property name="max_length">253</property> |
204 | <property name="invisible_char">●</property> | 204 | <property name="invisible_char">●</property> |
205 | <property name="primary_icon_activatable">False</property> | 205 | <property name="primary_icon_activatable">False</property> |
206 | <property name="secondary_icon_activatable">False</property> | 206 | <property name="secondary_icon_activatable">False</property> |
207 | <property name="primary_icon_sensitive">True</property> | 207 | <property name="primary_icon_sensitive">True</property> |
208 | <property name="secondary_icon_sensitive">True</property> | 208 | <property name="secondary_icon_sensitive">True</property> |
209 | <signal name="changed" handler="GNS_edit_dialog_a_entry_changed_cb" swapped="no"/> | 209 | <signal name="changed" handler="GNS_edit_dialog_cname_entry_changed_cb" swapped="no"/> |
210 | </object> | 210 | </object> |
211 | <packing> | 211 | <packing> |
212 | <property name="expand">False</property> | 212 | <property name="expand">False</property> |
diff --git a/contrib/gnunet_setup_gns_edit_leho.glade b/contrib/gnunet_setup_gns_edit_leho.glade index 2727fa0b..ccd8aaaf 100644 --- a/contrib/gnunet_setup_gns_edit_leho.glade +++ b/contrib/gnunet_setup_gns_edit_leho.glade | |||
@@ -63,7 +63,7 @@ | |||
63 | <property name="window_position">center-on-parent</property> | 63 | <property name="window_position">center-on-parent</property> |
64 | <property name="destroy_with_parent">True</property> | 64 | <property name="destroy_with_parent">True</property> |
65 | <property name="type_hint">dialog</property> | 65 | <property name="type_hint">dialog</property> |
66 | <signal name="response" handler="GNS_edit_a_dialog_response_cb" swapped="no"/> | 66 | <signal name="response" handler="GNS_edit_leho_dialog_response_cb" swapped="no"/> |
67 | <child internal-child="vbox"> | 67 | <child internal-child="vbox"> |
68 | <object class="GtkVBox" id="edit_dialog_vbox"> | 68 | <object class="GtkVBox" id="edit_dialog_vbox"> |
69 | <property name="visible">True</property> | 69 | <property name="visible">True</property> |
@@ -245,7 +245,7 @@ | |||
245 | <property name="secondary_icon_activatable">False</property> | 245 | <property name="secondary_icon_activatable">False</property> |
246 | <property name="primary_icon_sensitive">True</property> | 246 | <property name="primary_icon_sensitive">True</property> |
247 | <property name="secondary_icon_sensitive">True</property> | 247 | <property name="secondary_icon_sensitive">True</property> |
248 | <signal name="changed" handler="GNS_edit_dialog_a_entry_changed_cb" swapped="no"/> | 248 | <signal name="changed" handler="GNS_edit_dialog_leho_entry_changed_cb" swapped="no"/> |
249 | </object> | 249 | </object> |
250 | <packing> | 250 | <packing> |
251 | <property name="expand">False</property> | 251 | <property name="expand">False</property> |
diff --git a/contrib/gnunet_setup_gns_edit_mx.glade b/contrib/gnunet_setup_gns_edit_mx.glade index fa9997cc..d8aa2074 100644 --- a/contrib/gnunet_setup_gns_edit_mx.glade +++ b/contrib/gnunet_setup_gns_edit_mx.glade | |||
@@ -63,7 +63,7 @@ | |||
63 | <property name="window_position">center-on-parent</property> | 63 | <property name="window_position">center-on-parent</property> |
64 | <property name="destroy_with_parent">True</property> | 64 | <property name="destroy_with_parent">True</property> |
65 | <property name="type_hint">dialog</property> | 65 | <property name="type_hint">dialog</property> |
66 | <signal name="response" handler="GNS_edit_a_dialog_response_cb" swapped="no"/> | 66 | <signal name="response" handler="GNS_edit_mx_dialog_response_cb" swapped="no"/> |
67 | <child internal-child="vbox"> | 67 | <child internal-child="vbox"> |
68 | <object class="GtkVBox" id="edit_dialog_vbox"> | 68 | <object class="GtkVBox" id="edit_dialog_vbox"> |
69 | <property name="visible">True</property> | 69 | <property name="visible">True</property> |
@@ -239,13 +239,13 @@ | |||
239 | <property name="can_focus">True</property> | 239 | <property name="can_focus">True</property> |
240 | <property name="has_focus">True</property> | 240 | <property name="has_focus">True</property> |
241 | <property name="tooltip_text" translatable="yes">Enter the hostname of the mail server here</property> | 241 | <property name="tooltip_text" translatable="yes">Enter the hostname of the mail server here</property> |
242 | <property name="max_length">15</property> | 242 | <property name="max_length">253</property> |
243 | <property name="invisible_char">●</property> | 243 | <property name="invisible_char">●</property> |
244 | <property name="primary_icon_activatable">False</property> | 244 | <property name="primary_icon_activatable">False</property> |
245 | <property name="secondary_icon_activatable">False</property> | 245 | <property name="secondary_icon_activatable">False</property> |
246 | <property name="primary_icon_sensitive">True</property> | 246 | <property name="primary_icon_sensitive">True</property> |
247 | <property name="secondary_icon_sensitive">True</property> | 247 | <property name="secondary_icon_sensitive">True</property> |
248 | <signal name="changed" handler="GNS_edit_dialog_a_entry_changed_cb" swapped="no"/> | 248 | <signal name="changed" handler="GNS_edit_dialog_mx_entry_changed_cb" swapped="no"/> |
249 | </object> | 249 | </object> |
250 | <packing> | 250 | <packing> |
251 | <property name="expand">False</property> | 251 | <property name="expand">False</property> |
diff --git a/contrib/gnunet_setup_gns_edit_ns.glade b/contrib/gnunet_setup_gns_edit_ns.glade index 500264ed..0eb32036 100644 --- a/contrib/gnunet_setup_gns_edit_ns.glade +++ b/contrib/gnunet_setup_gns_edit_ns.glade | |||
@@ -63,7 +63,7 @@ | |||
63 | <property name="window_position">center-on-parent</property> | 63 | <property name="window_position">center-on-parent</property> |
64 | <property name="destroy_with_parent">True</property> | 64 | <property name="destroy_with_parent">True</property> |
65 | <property name="type_hint">dialog</property> | 65 | <property name="type_hint">dialog</property> |
66 | <signal name="response" handler="GNS_edit_a_dialog_response_cb" swapped="no"/> | 66 | <signal name="response" handler="GNS_edit_ns_dialog_response_cb" swapped="no"/> |
67 | <child internal-child="vbox"> | 67 | <child internal-child="vbox"> |
68 | <object class="GtkVBox" id="edit_dialog_vbox"> | 68 | <object class="GtkVBox" id="edit_dialog_vbox"> |
69 | <property name="visible">True</property> | 69 | <property name="visible">True</property> |
@@ -245,7 +245,7 @@ | |||
245 | <property name="secondary_icon_activatable">False</property> | 245 | <property name="secondary_icon_activatable">False</property> |
246 | <property name="primary_icon_sensitive">True</property> | 246 | <property name="primary_icon_sensitive">True</property> |
247 | <property name="secondary_icon_sensitive">True</property> | 247 | <property name="secondary_icon_sensitive">True</property> |
248 | <signal name="changed" handler="GNS_edit_dialog_a_entry_changed_cb" swapped="no"/> | 248 | <signal name="changed" handler="GNS_edit_dialog_ns_entry_changed_cb" swapped="no"/> |
249 | </object> | 249 | </object> |
250 | <packing> | 250 | <packing> |
251 | <property name="expand">False</property> | 251 | <property name="expand">False</property> |
diff --git a/contrib/gnunet_setup_gns_edit_pkey.glade b/contrib/gnunet_setup_gns_edit_pkey.glade index e37462a1..40d18554 100644 --- a/contrib/gnunet_setup_gns_edit_pkey.glade +++ b/contrib/gnunet_setup_gns_edit_pkey.glade | |||
@@ -63,7 +63,7 @@ | |||
63 | <property name="window_position">center-on-parent</property> | 63 | <property name="window_position">center-on-parent</property> |
64 | <property name="destroy_with_parent">True</property> | 64 | <property name="destroy_with_parent">True</property> |
65 | <property name="type_hint">dialog</property> | 65 | <property name="type_hint">dialog</property> |
66 | <signal name="response" handler="GNS_edit_a_dialog_response_cb" swapped="no"/> | 66 | <signal name="response" handler="GNS_edit_pkey_dialog_response_cb" swapped="no"/> |
67 | <child internal-child="vbox"> | 67 | <child internal-child="vbox"> |
68 | <object class="GtkVBox" id="edit_dialog_vbox"> | 68 | <object class="GtkVBox" id="edit_dialog_vbox"> |
69 | <property name="visible">True</property> | 69 | <property name="visible">True</property> |
@@ -245,7 +245,7 @@ | |||
245 | <property name="secondary_icon_activatable">False</property> | 245 | <property name="secondary_icon_activatable">False</property> |
246 | <property name="primary_icon_sensitive">True</property> | 246 | <property name="primary_icon_sensitive">True</property> |
247 | <property name="secondary_icon_sensitive">True</property> | 247 | <property name="secondary_icon_sensitive">True</property> |
248 | <signal name="changed" handler="GNS_edit_dialog_a_entry_changed_cb" swapped="no"/> | 248 | <signal name="changed" handler="GNS_edit_dialog_pkey_entry_changed_cb" swapped="no"/> |
249 | </object> | 249 | </object> |
250 | <packing> | 250 | <packing> |
251 | <property name="expand">False</property> | 251 | <property name="expand">False</property> |
@@ -258,7 +258,7 @@ | |||
258 | </object> | 258 | </object> |
259 | </child> | 259 | </child> |
260 | <child type="label"> | 260 | <child type="label"> |
261 | <object class="GtkLabel" id="edit_dialog_a_label"> | 261 | <object class="GtkLabel" id="edit_dialog_pkey_label"> |
262 | <property name="visible">True</property> | 262 | <property name="visible">True</property> |
263 | <property name="can_focus">False</property> | 263 | <property name="can_focus">False</property> |
264 | <property name="label" translatable="yes"><b>GADS authority for the subzone (PKEY)</b></property> | 264 | <property name="label" translatable="yes"><b>GADS authority for the subzone (PKEY)</b></property> |
diff --git a/contrib/gnunet_setup_gns_edit_ptr.glade b/contrib/gnunet_setup_gns_edit_ptr.glade index 5a9d7959..394e7ac4 100644 --- a/contrib/gnunet_setup_gns_edit_ptr.glade +++ b/contrib/gnunet_setup_gns_edit_ptr.glade | |||
@@ -63,7 +63,7 @@ | |||
63 | <property name="window_position">center-on-parent</property> | 63 | <property name="window_position">center-on-parent</property> |
64 | <property name="destroy_with_parent">True</property> | 64 | <property name="destroy_with_parent">True</property> |
65 | <property name="type_hint">dialog</property> | 65 | <property name="type_hint">dialog</property> |
66 | <signal name="response" handler="GNS_edit_a_dialog_response_cb" swapped="no"/> | 66 | <signal name="response" handler="GNS_edit_ptr_dialog_response_cb" swapped="no"/> |
67 | <child internal-child="vbox"> | 67 | <child internal-child="vbox"> |
68 | <object class="GtkVBox" id="edit_dialog_vbox"> | 68 | <object class="GtkVBox" id="edit_dialog_vbox"> |
69 | <property name="visible">True</property> | 69 | <property name="visible">True</property> |
@@ -245,7 +245,7 @@ | |||
245 | <property name="secondary_icon_activatable">False</property> | 245 | <property name="secondary_icon_activatable">False</property> |
246 | <property name="primary_icon_sensitive">True</property> | 246 | <property name="primary_icon_sensitive">True</property> |
247 | <property name="secondary_icon_sensitive">True</property> | 247 | <property name="secondary_icon_sensitive">True</property> |
248 | <signal name="changed" handler="GNS_edit_dialog_a_entry_changed_cb" swapped="no"/> | 248 | <signal name="changed" handler="GNS_edit_dialog_ptr_entry_changed_cb" swapped="no"/> |
249 | </object> | 249 | </object> |
250 | <packing> | 250 | <packing> |
251 | <property name="expand">False</property> | 251 | <property name="expand">False</property> |
diff --git a/contrib/gnunet_setup_gns_edit_soa.glade b/contrib/gnunet_setup_gns_edit_soa.glade index 8c31df61..00ef0874 100644 --- a/contrib/gnunet_setup_gns_edit_soa.glade +++ b/contrib/gnunet_setup_gns_edit_soa.glade | |||
@@ -92,7 +92,7 @@ | |||
92 | <property name="window_position">center-on-parent</property> | 92 | <property name="window_position">center-on-parent</property> |
93 | <property name="destroy_with_parent">True</property> | 93 | <property name="destroy_with_parent">True</property> |
94 | <property name="type_hint">dialog</property> | 94 | <property name="type_hint">dialog</property> |
95 | <signal name="response" handler="GNS_edit_a_dialog_response_cb" swapped="no"/> | 95 | <signal name="response" handler="GNS_edit_soa_dialog_response_cb" swapped="no"/> |
96 | <child internal-child="vbox"> | 96 | <child internal-child="vbox"> |
97 | <object class="GtkVBox" id="edit_dialog_vbox"> | 97 | <object class="GtkVBox" id="edit_dialog_vbox"> |
98 | <property name="visible">True</property> | 98 | <property name="visible">True</property> |
diff --git a/contrib/gnunet_setup_gns_edit_srv.glade b/contrib/gnunet_setup_gns_edit_srv.glade index 0835716a..2cec54e1 100644 --- a/contrib/gnunet_setup_gns_edit_srv.glade +++ b/contrib/gnunet_setup_gns_edit_srv.glade | |||
@@ -78,7 +78,7 @@ | |||
78 | <property name="window_position">center-on-parent</property> | 78 | <property name="window_position">center-on-parent</property> |
79 | <property name="destroy_with_parent">True</property> | 79 | <property name="destroy_with_parent">True</property> |
80 | <property name="type_hint">dialog</property> | 80 | <property name="type_hint">dialog</property> |
81 | <signal name="response" handler="GNS_edit_a_dialog_response_cb" swapped="no"/> | 81 | <signal name="response" handler="GNS_edit_srv_dialog_response_cb" swapped="no"/> |
82 | <child internal-child="vbox"> | 82 | <child internal-child="vbox"> |
83 | <object class="GtkVBox" id="edit_dialog_vbox"> | 83 | <object class="GtkVBox" id="edit_dialog_vbox"> |
84 | <property name="visible">True</property> | 84 | <property name="visible">True</property> |
diff --git a/contrib/gnunet_setup_gns_edit_txt.glade b/contrib/gnunet_setup_gns_edit_txt.glade index 27206616..037d4c62 100644 --- a/contrib/gnunet_setup_gns_edit_txt.glade +++ b/contrib/gnunet_setup_gns_edit_txt.glade | |||
@@ -63,7 +63,7 @@ | |||
63 | <property name="window_position">center-on-parent</property> | 63 | <property name="window_position">center-on-parent</property> |
64 | <property name="destroy_with_parent">True</property> | 64 | <property name="destroy_with_parent">True</property> |
65 | <property name="type_hint">dialog</property> | 65 | <property name="type_hint">dialog</property> |
66 | <signal name="response" handler="GNS_edit_a_dialog_response_cb" swapped="no"/> | 66 | <signal name="response" handler="GNS_edit_txt_dialog_response_cb" swapped="no"/> |
67 | <child internal-child="vbox"> | 67 | <child internal-child="vbox"> |
68 | <object class="GtkVBox" id="edit_dialog_vbox"> | 68 | <object class="GtkVBox" id="edit_dialog_vbox"> |
69 | <property name="visible">True</property> | 69 | <property name="visible">True</property> |
@@ -245,7 +245,7 @@ | |||
245 | <property name="secondary_icon_activatable">False</property> | 245 | <property name="secondary_icon_activatable">False</property> |
246 | <property name="primary_icon_sensitive">True</property> | 246 | <property name="primary_icon_sensitive">True</property> |
247 | <property name="secondary_icon_sensitive">True</property> | 247 | <property name="secondary_icon_sensitive">True</property> |
248 | <signal name="changed" handler="GNS_edit_dialog_a_entry_changed_cb" swapped="no"/> | 248 | <signal name="changed" handler="GNS_edit_dialog_txt_entry_changed_cb" swapped="no"/> |
249 | </object> | 249 | </object> |
250 | <packing> | 250 | <packing> |
251 | <property name="expand">False</property> | 251 | <property name="expand">False</property> |
diff --git a/contrib/gnunet_setup_gns_edit_vpn.glade b/contrib/gnunet_setup_gns_edit_vpn.glade index 6cba2839..3a30c20b 100644 --- a/contrib/gnunet_setup_gns_edit_vpn.glade +++ b/contrib/gnunet_setup_gns_edit_vpn.glade | |||
@@ -63,7 +63,7 @@ | |||
63 | <property name="window_position">center-on-parent</property> | 63 | <property name="window_position">center-on-parent</property> |
64 | <property name="destroy_with_parent">True</property> | 64 | <property name="destroy_with_parent">True</property> |
65 | <property name="type_hint">dialog</property> | 65 | <property name="type_hint">dialog</property> |
66 | <signal name="response" handler="GNS_edit_a_dialog_response_cb" swapped="no"/> | 66 | <signal name="response" handler="GNS_edit_vpn_dialog_response_cb" swapped="no"/> |
67 | <child internal-child="vbox"> | 67 | <child internal-child="vbox"> |
68 | <object class="GtkVBox" id="edit_dialog_vbox"> | 68 | <object class="GtkVBox" id="edit_dialog_vbox"> |
69 | <property name="visible">True</property> | 69 | <property name="visible">True</property> |
diff --git a/src/setup/gnunet-setup-gns-edit.c b/src/setup/gnunet-setup-gns-edit.c index f790572b..b5e4026d 100644 --- a/src/setup/gnunet-setup-gns-edit.c +++ b/src/setup/gnunet-setup-gns-edit.c | |||
@@ -567,4 +567,785 @@ GNS_edit_dialog_a (struct EditDialogContext *edc) | |||
567 | } | 567 | } |
568 | 568 | ||
569 | 569 | ||
570 | /* ************************ AAAA records *********************** */ | ||
571 | |||
572 | /** | ||
573 | * Check validity of the value in the edit dialog for AAAA-records. | ||
574 | * Then call the shared validity check if the result is OK. | ||
575 | * | ||
576 | * @param edc edit dialog context | ||
577 | */ | ||
578 | static void | ||
579 | edit_dialog_aaaa_validity_check (struct EditDialogContext *edc) | ||
580 | { | ||
581 | GtkEditable *entry; | ||
582 | const gchar *preedit; | ||
583 | struct in6_addr v6; | ||
584 | |||
585 | entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder, | ||
586 | "edit_dialog_aaaa_entry")), | ||
587 | preedit = gtk_editable_get_chars (entry, 0, -1); | ||
588 | if ( (NULL == preedit) || | ||
589 | (1 != inet_pton (AF_INET6, preedit, &v6)) ) | ||
590 | { | ||
591 | edit_dialog_disable_save (edc); | ||
592 | return; | ||
593 | } | ||
594 | edit_dialog_check_save (edc); | ||
595 | } | ||
596 | |||
597 | |||
598 | /** | ||
599 | * Editing dialog was closed, get the data and call the | ||
600 | * continuation. | ||
601 | * | ||
602 | * @param dialog editing dialog | ||
603 | * @param user_data the 'struct EditDialogContext' | ||
604 | */ | ||
605 | void | ||
606 | GNS_edit_aaaa_dialog_response_cb (GtkDialog *dialog, | ||
607 | gint response_id, | ||
608 | gpointer user_data) | ||
609 | { | ||
610 | struct EditDialogContext *edc = user_data; | ||
611 | GtkEntry *entry; | ||
612 | const gchar *value; | ||
613 | |||
614 | if (GTK_RESPONSE_OK == response_id) | ||
615 | { | ||
616 | edit_dialog_putes_common_elements (edc); | ||
617 | entry = GTK_ENTRY (gtk_builder_get_object (edc->builder, | ||
618 | "edit_dialog_aaaa_entry")); | ||
619 | value = gtk_entry_get_text (entry); | ||
620 | g_free (edc->n_value); | ||
621 | edc->n_value = g_strdup (value); | ||
622 | } | ||
623 | gtk_widget_destroy (GTK_WIDGET (edc->dialog)); | ||
624 | g_object_unref (edc->builder); | ||
625 | edc->builder = NULL; | ||
626 | edc->cont (edc, response_id); | ||
627 | } | ||
628 | |||
629 | |||
630 | /** | ||
631 | * The user has edited the AAAA record value. Enable/disable 'save' | ||
632 | * button depending on the validity of the value. | ||
633 | * | ||
634 | * @param entry editing widget | ||
635 | * @param preedit new value | ||
636 | * @param user_data the 'struct EditDialogContext' of the dialog | ||
637 | */ | ||
638 | void | ||
639 | GNS_edit_dialog_aaaa_entry_changed_cb (GtkEditable *entry, | ||
640 | gpointer user_data) | ||
641 | { | ||
642 | struct EditDialogContext *edc = user_data; | ||
643 | |||
644 | edit_dialog_a_validity_check (edc); | ||
645 | } | ||
646 | |||
647 | |||
648 | /** | ||
649 | * Run an GNS Edit dialog for an 'AAAA' Record. | ||
650 | * | ||
651 | * @param cont continuation to call when done | ||
652 | * @param edc editing context to use | ||
653 | */ | ||
654 | void | ||
655 | GNS_edit_dialog_aaaa (struct EditDialogContext *edc) | ||
656 | { | ||
657 | edc->builder = GNUNET_GTK_get_new_builder ("gnunet_setup_gns_edit_aaaa.glade", | ||
658 | edc); | ||
659 | if (NULL == edc->builder) | ||
660 | { | ||
661 | GNUNET_break (0); | ||
662 | edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */ | ||
663 | return; | ||
664 | } | ||
665 | if (GNUNET_YES == | ||
666 | edc->old_record_in_namestore) | ||
667 | { | ||
668 | /* set AAAA record */ | ||
669 | gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder, | ||
670 | "edit_dialog_aaaa_entry")), | ||
671 | edc->n_value); | ||
672 | } | ||
673 | edc->validator = &edit_dialog_aaaa_validity_check; | ||
674 | edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder, | ||
675 | "edit_aaaa_dialog")); | ||
676 | run_edit_dialog (edc); | ||
677 | } | ||
678 | |||
679 | |||
680 | /* ************************ CNAME records *********************** */ | ||
681 | |||
682 | /** | ||
683 | * Check validity of the value in the edit dialog for AAAA-records. | ||
684 | * Then call the shared validity check if the result is OK. | ||
685 | * | ||
686 | * @param edc edit dialog context | ||
687 | */ | ||
688 | static void | ||
689 | edit_dialog_cname_validity_check (struct EditDialogContext *edc) | ||
690 | { | ||
691 | GtkEditable *entry; | ||
692 | const gchar *preedit; | ||
693 | |||
694 | entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder, | ||
695 | "edit_dialog_cname_entry")), | ||
696 | preedit = gtk_editable_get_chars (entry, 0, -1); | ||
697 | if ( (NULL == preedit) || | ||
698 | (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) ) | ||
699 | { | ||
700 | edit_dialog_disable_save (edc); | ||
701 | return; | ||
702 | } | ||
703 | edit_dialog_check_save (edc); | ||
704 | } | ||
705 | |||
706 | |||
707 | /** | ||
708 | * Editing dialog was closed, get the data and call the | ||
709 | * continuation. | ||
710 | * | ||
711 | * @param dialog editing dialog | ||
712 | * @param user_data the 'struct EditDialogContext' | ||
713 | */ | ||
714 | void | ||
715 | GNS_edit_cname_dialog_response_cb (GtkDialog *dialog, | ||
716 | gint response_id, | ||
717 | gpointer user_data) | ||
718 | { | ||
719 | struct EditDialogContext *edc = user_data; | ||
720 | GtkEntry *entry; | ||
721 | const gchar *value; | ||
722 | |||
723 | if (GTK_RESPONSE_OK == response_id) | ||
724 | { | ||
725 | edit_dialog_putes_common_elements (edc); | ||
726 | entry = GTK_ENTRY (gtk_builder_get_object (edc->builder, | ||
727 | "edit_dialog_cname_entry")); | ||
728 | value = gtk_entry_get_text (entry); | ||
729 | g_free (edc->n_value); | ||
730 | edc->n_value = g_strdup (value); | ||
731 | } | ||
732 | gtk_widget_destroy (GTK_WIDGET (edc->dialog)); | ||
733 | g_object_unref (edc->builder); | ||
734 | edc->builder = NULL; | ||
735 | edc->cont (edc, response_id); | ||
736 | } | ||
737 | |||
738 | |||
739 | /** | ||
740 | * The user has edited the CNAME record value. Enable/disable 'save' | ||
741 | * button depending on the validity of the value. | ||
742 | * | ||
743 | * @param entry editing widget | ||
744 | * @param preedit new value | ||
745 | * @param user_data the 'struct EditDialogContext' of the dialog | ||
746 | */ | ||
747 | void | ||
748 | GNS_edit_dialog_cname_entry_changed_cb (GtkEditable *entry, | ||
749 | gpointer user_data) | ||
750 | { | ||
751 | struct EditDialogContext *edc = user_data; | ||
752 | |||
753 | edit_dialog_cname_validity_check (edc); | ||
754 | } | ||
755 | |||
756 | |||
757 | /** | ||
758 | * Run an GNS Edit dialog for an 'CNAME' Record. | ||
759 | * | ||
760 | * @param cont continuation to call when done | ||
761 | * @param edc editing context to use | ||
762 | */ | ||
763 | void | ||
764 | GNS_edit_dialog_cname (struct EditDialogContext *edc) | ||
765 | { | ||
766 | edc->builder = GNUNET_GTK_get_new_builder ("gnunet_setup_gns_edit_cname.glade", | ||
767 | edc); | ||
768 | if (NULL == edc->builder) | ||
769 | { | ||
770 | GNUNET_break (0); | ||
771 | edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */ | ||
772 | return; | ||
773 | } | ||
774 | if (GNUNET_YES == | ||
775 | edc->old_record_in_namestore) | ||
776 | { | ||
777 | /* set CNAME record */ | ||
778 | gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder, | ||
779 | "edit_dialog_cname_entry")), | ||
780 | edc->n_value); | ||
781 | } | ||
782 | edc->validator = &edit_dialog_cname_validity_check; | ||
783 | edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder, | ||
784 | "edit_cname_dialog")); | ||
785 | run_edit_dialog (edc); | ||
786 | } | ||
787 | |||
788 | |||
789 | /* ************************ LEHO records *********************** */ | ||
790 | |||
791 | /** | ||
792 | * Check validity of the value in the edit dialog for LEHO-records. | ||
793 | * Then call the shared validity check if the result is OK. | ||
794 | * | ||
795 | * @param edc edit dialog context | ||
796 | */ | ||
797 | static void | ||
798 | edit_dialog_leho_validity_check (struct EditDialogContext *edc) | ||
799 | { | ||
800 | GtkEditable *entry; | ||
801 | const gchar *preedit; | ||
802 | |||
803 | entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder, | ||
804 | "edit_dialog_leho_entry")), | ||
805 | preedit = gtk_editable_get_chars (entry, 0, -1); | ||
806 | if ( (NULL == preedit) || | ||
807 | (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) ) | ||
808 | { | ||
809 | edit_dialog_disable_save (edc); | ||
810 | return; | ||
811 | } | ||
812 | edit_dialog_check_save (edc); | ||
813 | } | ||
814 | |||
815 | |||
816 | /** | ||
817 | * Editing dialog was closed, get the data and call the | ||
818 | * continuation. | ||
819 | * | ||
820 | * @param dialog editing dialog | ||
821 | * @param user_data the 'struct EditDialogContext' | ||
822 | */ | ||
823 | void | ||
824 | GNS_edit_leho_dialog_response_cb (GtkDialog *dialog, | ||
825 | gint response_id, | ||
826 | gpointer user_data) | ||
827 | { | ||
828 | struct EditDialogContext *edc = user_data; | ||
829 | GtkEntry *entry; | ||
830 | const gchar *value; | ||
831 | |||
832 | if (GTK_RESPONSE_OK == response_id) | ||
833 | { | ||
834 | edit_dialog_putes_common_elements (edc); | ||
835 | entry = GTK_ENTRY (gtk_builder_get_object (edc->builder, | ||
836 | "edit_dialog_leho_entry")); | ||
837 | value = gtk_entry_get_text (entry); | ||
838 | g_free (edc->n_value); | ||
839 | edc->n_value = g_strdup (value); | ||
840 | } | ||
841 | gtk_widget_destroy (GTK_WIDGET (edc->dialog)); | ||
842 | g_object_unref (edc->builder); | ||
843 | edc->builder = NULL; | ||
844 | edc->cont (edc, response_id); | ||
845 | } | ||
846 | |||
847 | |||
848 | /** | ||
849 | * The user has edited the LEHO record value. Enable/disable 'save' | ||
850 | * button depending on the validity of the value. | ||
851 | * | ||
852 | * @param entry editing widget | ||
853 | * @param preedit new value | ||
854 | * @param user_data the 'struct EditDialogContext' of the dialog | ||
855 | */ | ||
856 | void | ||
857 | GNS_edit_dialog_leho_entry_changed_cb (GtkEditable *entry, | ||
858 | gpointer user_data) | ||
859 | { | ||
860 | struct EditDialogContext *edc = user_data; | ||
861 | |||
862 | edit_dialog_leho_validity_check (edc); | ||
863 | } | ||
864 | |||
865 | |||
866 | /** | ||
867 | * Run an GNS Edit dialog for an 'LEHO' Record. | ||
868 | * | ||
869 | * @param cont continuation to call when done | ||
870 | * @param edc editing context to use | ||
871 | */ | ||
872 | void | ||
873 | GNS_edit_dialog_leho (struct EditDialogContext *edc) | ||
874 | { | ||
875 | edc->builder = GNUNET_GTK_get_new_builder ("gnunet_setup_gns_edit_leho.glade", | ||
876 | edc); | ||
877 | if (NULL == edc->builder) | ||
878 | { | ||
879 | GNUNET_break (0); | ||
880 | edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */ | ||
881 | return; | ||
882 | } | ||
883 | if (GNUNET_YES == | ||
884 | edc->old_record_in_namestore) | ||
885 | { | ||
886 | /* set LEHO record */ | ||
887 | gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder, | ||
888 | "edit_dialog_leho_entry")), | ||
889 | edc->n_value); | ||
890 | } | ||
891 | edc->validator = &edit_dialog_leho_validity_check; | ||
892 | edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder, | ||
893 | "edit_leho_dialog")); | ||
894 | run_edit_dialog (edc); | ||
895 | } | ||
896 | |||
897 | |||
898 | /* ************************ MX records *********************** */ | ||
899 | |||
900 | /** | ||
901 | * Check validity of the value in the edit dialog for MX-records. | ||
902 | * Then call the shared validity check if the result is OK. | ||
903 | * | ||
904 | * @param edc edit dialog context | ||
905 | */ | ||
906 | static void | ||
907 | edit_dialog_mx_validity_check (struct EditDialogContext *edc) | ||
908 | { | ||
909 | GtkEditable *entry; | ||
910 | const gchar *preedit; | ||
911 | |||
912 | entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder, | ||
913 | "edit_dialog_mx_entry")), | ||
914 | preedit = gtk_editable_get_chars (entry, 0, -1); | ||
915 | if ( (NULL == preedit) || | ||
916 | (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) ) | ||
917 | { | ||
918 | edit_dialog_disable_save (edc); | ||
919 | return; | ||
920 | } | ||
921 | edit_dialog_check_save (edc); | ||
922 | } | ||
923 | |||
924 | |||
925 | /** | ||
926 | * Editing dialog was closed, get the data and call the | ||
927 | * continuation. | ||
928 | * | ||
929 | * @param dialog editing dialog | ||
930 | * @param user_data the 'struct EditDialogContext' | ||
931 | */ | ||
932 | void | ||
933 | GNS_edit_mx_dialog_response_cb (GtkDialog *dialog, | ||
934 | gint response_id, | ||
935 | gpointer user_data) | ||
936 | { | ||
937 | struct EditDialogContext *edc = user_data; | ||
938 | GtkEntry *entry; | ||
939 | const gchar *value; | ||
940 | char *result; | ||
941 | unsigned int distance; | ||
942 | |||
943 | if (GTK_RESPONSE_OK == response_id) | ||
944 | { | ||
945 | edit_dialog_putes_common_elements (edc); | ||
946 | entry = GTK_ENTRY (gtk_builder_get_object (edc->builder, | ||
947 | "edit_dialog_mx_entry")); | ||
948 | value = gtk_entry_get_text (entry); | ||
949 | distance = gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object (edc->builder, | ||
950 | "edit_dialog_mx_distance_spinbutton"))); | ||
951 | g_free (edc->n_value); | ||
952 | GNUNET_asprintf (&result, | ||
953 | "%hu,%s", | ||
954 | distance, | ||
955 | value); | ||
956 | edc->n_value = g_strdup (result); | ||
957 | GNUNET_free (result); | ||
958 | } | ||
959 | gtk_widget_destroy (GTK_WIDGET (edc->dialog)); | ||
960 | g_object_unref (edc->builder); | ||
961 | edc->builder = NULL; | ||
962 | edc->cont (edc, response_id); | ||
963 | } | ||
964 | |||
965 | |||
966 | /** | ||
967 | * The user has edited the MX record value. Enable/disable 'save' | ||
968 | * button depending on the validity of the value. | ||
969 | * | ||
970 | * @param entry editing widget | ||
971 | * @param preedit new value | ||
972 | * @param user_data the 'struct EditDialogContext' of the dialog | ||
973 | */ | ||
974 | void | ||
975 | GNS_edit_dialog_mx_entry_changed_cb (GtkEditable *entry, | ||
976 | gpointer user_data) | ||
977 | { | ||
978 | struct EditDialogContext *edc = user_data; | ||
979 | |||
980 | edit_dialog_mx_validity_check (edc); | ||
981 | } | ||
982 | |||
983 | |||
984 | /** | ||
985 | * Run an GNS Edit dialog for an 'MX' Record. | ||
986 | * | ||
987 | * @param cont continuation to call when done | ||
988 | * @param edc editing context to use | ||
989 | */ | ||
990 | void | ||
991 | GNS_edit_dialog_mx (struct EditDialogContext *edc) | ||
992 | { | ||
993 | uint16_t mx_pref; | ||
994 | char result[253 + 1]; | ||
995 | |||
996 | edc->builder = GNUNET_GTK_get_new_builder ("gnunet_setup_gns_edit_mx.glade", | ||
997 | edc); | ||
998 | if (NULL == edc->builder) | ||
999 | { | ||
1000 | GNUNET_break (0); | ||
1001 | edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */ | ||
1002 | return; | ||
1003 | } | ||
1004 | if (GNUNET_YES == | ||
1005 | edc->old_record_in_namestore) | ||
1006 | { | ||
1007 | if (2 != SSCANF(edc->n_value, | ||
1008 | "%hu,%253s", &mx_pref, result)) | ||
1009 | { | ||
1010 | GNUNET_break (0); | ||
1011 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1012 | _("Unable to parse MX record `%s'\n"), | ||
1013 | edc->n_value); | ||
1014 | } | ||
1015 | else | ||
1016 | { | ||
1017 | gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder, | ||
1018 | "edit_dialog_mx_entry")), | ||
1019 | result); | ||
1020 | gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object (edc->builder, | ||
1021 | "edit_dialog_mx_distance_spinbutton")), | ||
1022 | mx_pref); | ||
1023 | } | ||
1024 | } | ||
1025 | edc->validator = &edit_dialog_mx_validity_check; | ||
1026 | edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder, | ||
1027 | "edit_mx_dialog")); | ||
1028 | run_edit_dialog (edc); | ||
1029 | } | ||
1030 | |||
1031 | |||
1032 | /* ************************ NS records *********************** */ | ||
1033 | |||
1034 | /** | ||
1035 | * Check validity of the value in the edit dialog for NS-records. | ||
1036 | * Then call the shared validity check if the result is OK. | ||
1037 | * | ||
1038 | * @param edc edit dialog context | ||
1039 | */ | ||
1040 | static void | ||
1041 | edit_dialog_ns_validity_check (struct EditDialogContext *edc) | ||
1042 | { | ||
1043 | GtkEditable *entry; | ||
1044 | const gchar *preedit; | ||
1045 | |||
1046 | entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder, | ||
1047 | "edit_dialog_ns_entry")), | ||
1048 | preedit = gtk_editable_get_chars (entry, 0, -1); | ||
1049 | if ( (NULL == preedit) || | ||
1050 | (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) ) | ||
1051 | { | ||
1052 | edit_dialog_disable_save (edc); | ||
1053 | return; | ||
1054 | } | ||
1055 | edit_dialog_check_save (edc); | ||
1056 | } | ||
1057 | |||
1058 | |||
1059 | /** | ||
1060 | * Editing dialog was closed, get the data and call the | ||
1061 | * continuation. | ||
1062 | * | ||
1063 | * @param dialog editing dialog | ||
1064 | * @param user_data the 'struct EditDialogContext' | ||
1065 | */ | ||
1066 | void | ||
1067 | GNS_edit_ns_dialog_response_cb (GtkDialog *dialog, | ||
1068 | gint response_id, | ||
1069 | gpointer user_data) | ||
1070 | { | ||
1071 | struct EditDialogContext *edc = user_data; | ||
1072 | GtkEntry *entry; | ||
1073 | const gchar *value; | ||
1074 | |||
1075 | if (GTK_RESPONSE_OK == response_id) | ||
1076 | { | ||
1077 | edit_dialog_putes_common_elements (edc); | ||
1078 | entry = GTK_ENTRY (gtk_builder_get_object (edc->builder, | ||
1079 | "edit_dialog_ns_entry")); | ||
1080 | value = gtk_entry_get_text (entry); | ||
1081 | g_free (edc->n_value); | ||
1082 | edc->n_value = g_strdup (value); | ||
1083 | } | ||
1084 | gtk_widget_destroy (GTK_WIDGET (edc->dialog)); | ||
1085 | g_object_unref (edc->builder); | ||
1086 | edc->builder = NULL; | ||
1087 | edc->cont (edc, response_id); | ||
1088 | } | ||
1089 | |||
1090 | |||
1091 | /** | ||
1092 | * The user has edited the NS record value. Enable/disable 'save' | ||
1093 | * button depending on the validity of the value. | ||
1094 | * | ||
1095 | * @param entry editing widget | ||
1096 | * @param preedit new value | ||
1097 | * @param user_data the 'struct EditDialogContext' of the dialog | ||
1098 | */ | ||
1099 | void | ||
1100 | GNS_edit_dialog_ns_entry_changed_cb (GtkEditable *entry, | ||
1101 | gpointer user_data) | ||
1102 | { | ||
1103 | struct EditDialogContext *edc = user_data; | ||
1104 | |||
1105 | edit_dialog_ns_validity_check (edc); | ||
1106 | } | ||
1107 | |||
1108 | |||
1109 | /** | ||
1110 | * Run an GNS Edit dialog for an 'NS' Record. | ||
1111 | * | ||
1112 | * @param cont continuation to call when done | ||
1113 | * @param edc editing context to use | ||
1114 | */ | ||
1115 | void | ||
1116 | GNS_edit_dialog_ns (struct EditDialogContext *edc) | ||
1117 | { | ||
1118 | edc->builder = GNUNET_GTK_get_new_builder ("gnunet_setup_gns_edit_ns.glade", | ||
1119 | edc); | ||
1120 | if (NULL == edc->builder) | ||
1121 | { | ||
1122 | GNUNET_break (0); | ||
1123 | edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */ | ||
1124 | return; | ||
1125 | } | ||
1126 | if (GNUNET_YES == | ||
1127 | edc->old_record_in_namestore) | ||
1128 | { | ||
1129 | /* set NS record */ | ||
1130 | gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder, | ||
1131 | "edit_dialog_ns_entry")), | ||
1132 | edc->n_value); | ||
1133 | } | ||
1134 | edc->validator = &edit_dialog_ns_validity_check; | ||
1135 | edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder, | ||
1136 | "edit_ns_dialog")); | ||
1137 | run_edit_dialog (edc); | ||
1138 | } | ||
1139 | |||
1140 | |||
1141 | |||
1142 | /* ************************ PTR records *********************** */ | ||
1143 | |||
1144 | /** | ||
1145 | * Check validity of the value in the edit dialog for PTR-records. | ||
1146 | * Then call the shared validity check if the result is OK. | ||
1147 | * | ||
1148 | * @param edc edit dialog context | ||
1149 | */ | ||
1150 | static void | ||
1151 | edit_dialog_ptr_validity_check (struct EditDialogContext *edc) | ||
1152 | { | ||
1153 | GtkEditable *entry; | ||
1154 | const gchar *preedit; | ||
1155 | |||
1156 | entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder, | ||
1157 | "edit_dialog_ptr_entry")), | ||
1158 | preedit = gtk_editable_get_chars (entry, 0, -1); | ||
1159 | if ( (NULL == preedit) || | ||
1160 | (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) ) | ||
1161 | { | ||
1162 | edit_dialog_disable_save (edc); | ||
1163 | return; | ||
1164 | } | ||
1165 | edit_dialog_check_save (edc); | ||
1166 | } | ||
1167 | |||
1168 | |||
1169 | /** | ||
1170 | * Editing dialog was closed, get the data and call the | ||
1171 | * continuation. | ||
1172 | * | ||
1173 | * @param dialog editing dialog | ||
1174 | * @param user_data the 'struct EditDialogContext' | ||
1175 | */ | ||
1176 | void | ||
1177 | GNS_edit_ptr_dialog_response_cb (GtkDialog *dialog, | ||
1178 | gint response_id, | ||
1179 | gpointer user_data) | ||
1180 | { | ||
1181 | struct EditDialogContext *edc = user_data; | ||
1182 | GtkEntry *entry; | ||
1183 | const gchar *value; | ||
1184 | |||
1185 | if (GTK_RESPONSE_OK == response_id) | ||
1186 | { | ||
1187 | edit_dialog_putes_common_elements (edc); | ||
1188 | entry = GTK_ENTRY (gtk_builder_get_object (edc->builder, | ||
1189 | "edit_dialog_ptr_entry")); | ||
1190 | value = gtk_entry_get_text (entry); | ||
1191 | g_free (edc->n_value); | ||
1192 | edc->n_value = g_strdup (value); | ||
1193 | } | ||
1194 | gtk_widget_destroy (GTK_WIDGET (edc->dialog)); | ||
1195 | g_object_unref (edc->builder); | ||
1196 | edc->builder = NULL; | ||
1197 | edc->cont (edc, response_id); | ||
1198 | } | ||
1199 | |||
1200 | |||
1201 | /** | ||
1202 | * The user has edited the PTR record value. Enable/disable 'save' | ||
1203 | * button depending on the validity of the value. | ||
1204 | * | ||
1205 | * @param entry editing widget | ||
1206 | * @param preedit new value | ||
1207 | * @param user_data the 'struct EditDialogContext' of the dialog | ||
1208 | */ | ||
1209 | void | ||
1210 | GNS_edit_dialog_ptr_entry_changed_cb (GtkEditable *entry, | ||
1211 | gpointer user_data) | ||
1212 | { | ||
1213 | struct EditDialogContext *edc = user_data; | ||
1214 | |||
1215 | edit_dialog_ptr_validity_check (edc); | ||
1216 | } | ||
1217 | |||
1218 | |||
1219 | /** | ||
1220 | * Run an GNS Edit dialog for an 'PTR' Record. | ||
1221 | * | ||
1222 | * @param cont continuation to call when done | ||
1223 | * @param edc editing context to use | ||
1224 | */ | ||
1225 | void | ||
1226 | GNS_edit_dialog_ptr (struct EditDialogContext *edc) | ||
1227 | { | ||
1228 | edc->builder = GNUNET_GTK_get_new_builder ("gnunet_setup_gns_edit_ptr.glade", | ||
1229 | edc); | ||
1230 | if (NULL == edc->builder) | ||
1231 | { | ||
1232 | GNUNET_break (0); | ||
1233 | edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */ | ||
1234 | return; | ||
1235 | } | ||
1236 | if (GNUNET_YES == | ||
1237 | edc->old_record_in_namestore) | ||
1238 | { | ||
1239 | /* set PTR record */ | ||
1240 | gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder, | ||
1241 | "edit_dialog_ptr_entry")), | ||
1242 | edc->n_value); | ||
1243 | } | ||
1244 | edc->validator = &edit_dialog_ptr_validity_check; | ||
1245 | edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder, | ||
1246 | "edit_ptr_dialog")); | ||
1247 | run_edit_dialog (edc); | ||
1248 | } | ||
1249 | |||
1250 | |||
1251 | /* ************************ TXT records *********************** */ | ||
1252 | |||
1253 | /** | ||
1254 | * Check validity of the value in the edit dialog for TXT-records. | ||
1255 | * Then call the shared validity check if the result is OK. | ||
1256 | * | ||
1257 | * @param edc edit dialog context | ||
1258 | */ | ||
1259 | static void | ||
1260 | edit_dialog_txt_validity_check (struct EditDialogContext *edc) | ||
1261 | { | ||
1262 | edit_dialog_check_save (edc); | ||
1263 | } | ||
1264 | |||
1265 | |||
1266 | /** | ||
1267 | * Editing dialog was closed, get the data and call the | ||
1268 | * continuation. | ||
1269 | * | ||
1270 | * @param dialog editing dialog | ||
1271 | * @param user_data the 'struct EditDialogContext' | ||
1272 | */ | ||
1273 | void | ||
1274 | GNS_edit_txt_dialog_response_cb (GtkDialog *dialog, | ||
1275 | gint response_id, | ||
1276 | gpointer user_data) | ||
1277 | { | ||
1278 | struct EditDialogContext *edc = user_data; | ||
1279 | GtkEntry *entry; | ||
1280 | const gchar *value; | ||
1281 | |||
1282 | if (GTK_RESPONSE_OK == response_id) | ||
1283 | { | ||
1284 | edit_dialog_putes_common_elements (edc); | ||
1285 | entry = GTK_ENTRY (gtk_builder_get_object (edc->builder, | ||
1286 | "edit_dialog_txt_entry")); | ||
1287 | value = gtk_entry_get_text (entry); | ||
1288 | g_free (edc->n_value); | ||
1289 | edc->n_value = g_strdup (value); | ||
1290 | } | ||
1291 | gtk_widget_destroy (GTK_WIDGET (edc->dialog)); | ||
1292 | g_object_unref (edc->builder); | ||
1293 | edc->builder = NULL; | ||
1294 | edc->cont (edc, response_id); | ||
1295 | } | ||
1296 | |||
1297 | |||
1298 | /** | ||
1299 | * The user has edited the TXT record value. Enable/disable 'save' | ||
1300 | * button depending on the validity of the value. | ||
1301 | * | ||
1302 | * @param entry editing widget | ||
1303 | * @param preedit new value | ||
1304 | * @param user_data the 'struct EditDialogContext' of the dialog | ||
1305 | */ | ||
1306 | void | ||
1307 | GNS_edit_dialog_txt_entry_changed_cb (GtkEditable *entry, | ||
1308 | gpointer user_data) | ||
1309 | { | ||
1310 | struct EditDialogContext *edc = user_data; | ||
1311 | |||
1312 | edit_dialog_txt_validity_check (edc); | ||
1313 | } | ||
1314 | |||
1315 | |||
1316 | /** | ||
1317 | * Run an GNS Edit dialog for an 'TXT' Record. | ||
1318 | * | ||
1319 | * @param cont continuation to call when done | ||
1320 | * @param edc editing context to use | ||
1321 | */ | ||
1322 | void | ||
1323 | GNS_edit_dialog_txt (struct EditDialogContext *edc) | ||
1324 | { | ||
1325 | edc->builder = GNUNET_GTK_get_new_builder ("gnunet_setup_gns_edit_txt.glade", | ||
1326 | edc); | ||
1327 | if (NULL == edc->builder) | ||
1328 | { | ||
1329 | GNUNET_break (0); | ||
1330 | edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */ | ||
1331 | return; | ||
1332 | } | ||
1333 | if (GNUNET_YES == | ||
1334 | edc->old_record_in_namestore) | ||
1335 | { | ||
1336 | /* set TXT record */ | ||
1337 | gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder, | ||
1338 | "edit_dialog_txt_entry")), | ||
1339 | edc->n_value); | ||
1340 | } | ||
1341 | edc->validator = &edit_dialog_txt_validity_check; | ||
1342 | edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder, | ||
1343 | "edit_txt_dialog")); | ||
1344 | run_edit_dialog (edc); | ||
1345 | } | ||
1346 | |||
1347 | |||
1348 | |||
1349 | |||
1350 | |||
570 | /* end of gnunet-setup-gns-edit.c */ | 1351 | /* end of gnunet-setup-gns-edit.c */ |
diff --git a/src/setup/gnunet-setup-gns-edit.h b/src/setup/gnunet-setup-gns-edit.h index 97403d34..71d1bde7 100644 --- a/src/setup/gnunet-setup-gns-edit.h +++ b/src/setup/gnunet-setup-gns-edit.h | |||
@@ -174,4 +174,74 @@ void | |||
174 | GNS_edit_dialog_a (struct EditDialogContext *edc); | 174 | GNS_edit_dialog_a (struct EditDialogContext *edc); |
175 | 175 | ||
176 | 176 | ||
177 | /** | ||
178 | * Run an GNS Edit dialog for an 'AAAA' Record. | ||
179 | * | ||
180 | * @param cont continuation to call when done | ||
181 | * @param edc editing context to use | ||
182 | */ | ||
183 | void | ||
184 | GNS_edit_dialog_aaaa (struct EditDialogContext *edc); | ||
185 | |||
186 | |||
187 | /** | ||
188 | * Run an GNS Edit dialog for an 'CNAME' Record. | ||
189 | * | ||
190 | * @param cont continuation to call when done | ||
191 | * @param edc editing context to use | ||
192 | */ | ||
193 | void | ||
194 | GNS_edit_dialog_cname (struct EditDialogContext *edc); | ||
195 | |||
196 | |||
197 | /** | ||
198 | * Run an GNS Edit dialog for an 'LEHO' Record. | ||
199 | * | ||
200 | * @param cont continuation to call when done | ||
201 | * @param edc editing context to use | ||
202 | */ | ||
203 | void | ||
204 | GNS_edit_dialog_leho (struct EditDialogContext *edc); | ||
205 | |||
206 | |||
207 | /** | ||
208 | * Run an GNS Edit dialog for an 'MX' Record. | ||
209 | * | ||
210 | * @param cont continuation to call when done | ||
211 | * @param edc editing context to use | ||
212 | */ | ||
213 | void | ||
214 | GNS_edit_dialog_mx (struct EditDialogContext *edc); | ||
215 | |||
216 | |||
217 | /** | ||
218 | * Run an GNS Edit dialog for an 'NS' Record. | ||
219 | * | ||
220 | * @param cont continuation to call when done | ||
221 | * @param edc editing context to use | ||
222 | */ | ||
223 | void | ||
224 | GNS_edit_dialog_ns (struct EditDialogContext *edc); | ||
225 | |||
226 | |||
227 | /** | ||
228 | * Run an GNS Edit dialog for an 'PTR' Record. | ||
229 | * | ||
230 | * @param cont continuation to call when done | ||
231 | * @param edc editing context to use | ||
232 | */ | ||
233 | void | ||
234 | GNS_edit_dialog_ptr (struct EditDialogContext *edc); | ||
235 | |||
236 | |||
237 | /** | ||
238 | * Run an GNS Edit dialog for an 'TXT' Record. | ||
239 | * | ||
240 | * @param cont continuation to call when done | ||
241 | * @param edc editing context to use | ||
242 | */ | ||
243 | void | ||
244 | GNS_edit_dialog_txt (struct EditDialogContext *edc); | ||
245 | |||
246 | |||
177 | #endif | 247 | #endif |
diff --git a/src/setup/gnunet-setup-gns.c b/src/setup/gnunet-setup-gns.c index 7c0b2f5e..bc8f5365 100644 --- a/src/setup/gnunet-setup-gns.c +++ b/src/setup/gnunet-setup-gns.c | |||
@@ -1424,16 +1424,30 @@ edit_selected_row (int old_record_in_namestore) | |||
1424 | GNS_edit_dialog_a (edc); | 1424 | GNS_edit_dialog_a (edc); |
1425 | break; | 1425 | break; |
1426 | case GNUNET_DNSPARSER_TYPE_NS: | 1426 | case GNUNET_DNSPARSER_TYPE_NS: |
1427 | GNS_edit_dialog_ns (edc); | ||
1428 | break; | ||
1427 | case GNUNET_DNSPARSER_TYPE_CNAME: | 1429 | case GNUNET_DNSPARSER_TYPE_CNAME: |
1428 | case GNUNET_DNSPARSER_TYPE_SOA: | 1430 | GNS_edit_dialog_cname (edc); |
1431 | break; | ||
1429 | case GNUNET_DNSPARSER_TYPE_PTR: | 1432 | case GNUNET_DNSPARSER_TYPE_PTR: |
1433 | GNS_edit_dialog_ptr (edc); | ||
1434 | break; | ||
1430 | case GNUNET_DNSPARSER_TYPE_MX: | 1435 | case GNUNET_DNSPARSER_TYPE_MX: |
1436 | GNS_edit_dialog_mx (edc); | ||
1437 | break; | ||
1431 | case GNUNET_DNSPARSER_TYPE_TXT: | 1438 | case GNUNET_DNSPARSER_TYPE_TXT: |
1439 | GNS_edit_dialog_txt (edc); | ||
1440 | break; | ||
1432 | case GNUNET_DNSPARSER_TYPE_AAAA: | 1441 | case GNUNET_DNSPARSER_TYPE_AAAA: |
1442 | GNS_edit_dialog_aaaa (edc); | ||
1443 | break; | ||
1444 | case GNUNET_NAMESTORE_TYPE_LEHO: | ||
1445 | GNS_edit_dialog_leho (edc); | ||
1446 | break; | ||
1447 | case GNUNET_DNSPARSER_TYPE_SOA: | ||
1433 | case GNUNET_DNSPARSER_TYPE_SRV: | 1448 | case GNUNET_DNSPARSER_TYPE_SRV: |
1434 | case GNUNET_DNSPARSER_TYPE_TLSA: | 1449 | case GNUNET_DNSPARSER_TYPE_TLSA: |
1435 | case GNUNET_NAMESTORE_TYPE_PKEY: | 1450 | case GNUNET_NAMESTORE_TYPE_PKEY: |
1436 | case GNUNET_NAMESTORE_TYPE_LEHO: | ||
1437 | case GNUNET_NAMESTORE_TYPE_VPN: | 1451 | case GNUNET_NAMESTORE_TYPE_VPN: |
1438 | GNUNET_break (0); /* FIXME - implement (#2465) */ | 1452 | GNUNET_break (0); /* FIXME - implement (#2465) */ |
1439 | edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */ | 1453 | edc->cont (edc, GTK_RESPONSE_CANCEL); /* treat as 'cancel' */ |