aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-06-26 12:56:11 +0000
committerChristian Grothoff <christian@grothoff.org>2012-06-26 12:56:11 +0000
commite1ebbba39f793918c5f31935f5e19820ffd8ec7a (patch)
tree4c98d52ef8c8bcec72ea8fb49c967d7e4b179f83
parent548ce469bc34fe54822e9b0e3ff81148cdabc11a (diff)
downloadgnunet-gtk-e1ebbba39f793918c5f31935f5e19820ffd8ec7a.tar.gz
gnunet-gtk-e1ebbba39f793918c5f31935f5e19820ffd8ec7a.zip
-misc fixes towards integration gnunet-gns-gtk with gnunet-setup
-rw-r--r--contrib/gnunet_setup_gtk_main_window.glade37
-rw-r--r--src/setup/gnunet-setup-gns.c482
2 files changed, 314 insertions, 205 deletions
diff --git a/contrib/gnunet_setup_gtk_main_window.glade b/contrib/gnunet_setup_gtk_main_window.glade
index 253d6703..ab699f1c 100644
--- a/contrib/gnunet_setup_gtk_main_window.glade
+++ b/contrib/gnunet_setup_gtk_main_window.glade
@@ -4453,6 +4453,7 @@
4453 <property name="secondary_icon_activatable">False</property> 4453 <property name="secondary_icon_activatable">False</property>
4454 <property name="primary_icon_sensitive">True</property> 4454 <property name="primary_icon_sensitive">True</property>
4455 <property name="secondary_icon_sensitive">True</property> 4455 <property name="secondary_icon_sensitive">True</property>
4456 <signal name="changed" handler="GNUNET_setup_gns_pseu_entry_changed_cb" swapped="no"/>
4456 </object> 4457 </object>
4457 <packing> 4458 <packing>
4458 <property name="expand">False</property> 4459 <property name="expand">False</property>
@@ -4469,6 +4470,7 @@
4469 <property name="can_focus">True</property> 4470 <property name="can_focus">True</property>
4470 <property name="receives_default">True</property> 4471 <property name="receives_default">True</property>
4471 <property name="use_stock">True</property> 4472 <property name="use_stock">True</property>
4473 <signal name="clicked" handler="GNUNET_setup_gns_public_key_copy_button_clicked_cb" swapped="no"/>
4472 </object> 4474 </object>
4473 <packing> 4475 <packing>
4474 <property name="expand">False</property> 4476 <property name="expand">False</property>
@@ -4510,6 +4512,7 @@
4510 <property name="receives_default">True</property> 4512 <property name="receives_default">True</property>
4511 <property name="tooltip_text" translatable="yes">Save QR code to file</property> 4513 <property name="tooltip_text" translatable="yes">Save QR code to file</property>
4512 <property name="use_stock">True</property> 4514 <property name="use_stock">True</property>
4515 <signal name="clicked" handler="GNUNET_setup_gns_qr_saveas_button_clicked_cb" swapped="no"/>
4513 </object> 4516 </object>
4514 <packing> 4517 <packing>
4515 <property name="expand">False</property> 4518 <property name="expand">False</property>
@@ -4562,6 +4565,9 @@
4562 <property name="can_focus">True</property> 4565 <property name="can_focus">True</property>
4563 <property name="model">GNUNET_setup_gns_treestore</property> 4566 <property name="model">GNUNET_setup_gns_treestore</property>
4564 <property name="search_column">0</property> 4567 <property name="search_column">0</property>
4568 <signal name="button-press-event" handler="GNUNET_setup_gns_main_treeview_button_press_event_cb" swapped="no"/>
4569 <signal name="key-press-event" handler="GNUNET_setup_gns_main_treeview_key_press_event_cb" swapped="no"/>
4570 <signal name="popup-menu" handler="GNUNET_setup_gns_main_treeview_popup_menu_cb" swapped="no"/>
4565 <child> 4571 <child>
4566 <object class="GtkTreeViewColumn" id="GNUNET_setup_gns_name_treeviewcolumn"> 4572 <object class="GtkTreeViewColumn" id="GNUNET_setup_gns_name_treeviewcolumn">
4567 <property name="title">Name</property> 4573 <property name="title">Name</property>
@@ -4570,7 +4576,9 @@
4570 <property name="sort_indicator">True</property> 4576 <property name="sort_indicator">True</property>
4571 <property name="sort_column_id">0</property> 4577 <property name="sort_column_id">0</property>
4572 <child> 4578 <child>
4573 <object class="GtkCellRendererText" id="GNUNET_setup_gns_name_cellrenderertext"/> 4579 <object class="GtkCellRendererText" id="GNUNET_setup_gns_name_cellrenderertext">
4580 <signal name="edited" handler="GNUNET_setup_gns_name_cellrenderertext_edited_cb" swapped="no"/>
4581 </object>
4574 <attributes> 4582 <attributes>
4575 <attribute name="visible">9</attribute> 4583 <attribute name="visible">9</attribute>
4576 <attribute name="background">13</attribute> 4584 <attribute name="background">13</attribute>
@@ -4587,9 +4595,12 @@
4587 <property name="title">Public</property> 4595 <property name="title">Public</property>
4588 <property name="clickable">True</property> 4596 <property name="clickable">True</property>
4589 <child> 4597 <child>
4590 <object class="GtkCellRendererToggle" id="GNUNET_setup_gns_ispublic_cellrenderertoggle"/> 4598 <object class="GtkCellRendererToggle" id="GNUNET_setup_gns_ispublic_cellrenderertoggle">
4599 <signal name="toggled" handler="GNUNET_setup_gns_ispublic_cellrenderertoggle_toggled_cb" swapped="no"/>
4600 </object>
4591 <attributes> 4601 <attributes>
4592 <attribute name="visible">10</attribute> 4602 <attribute name="sensitive">11</attribute>
4603 <attribute name="visible">11</attribute>
4593 <attribute name="active">1</attribute> 4604 <attribute name="active">1</attribute>
4594 </attributes> 4605 </attributes>
4595 </child> 4606 </child>
@@ -4607,10 +4618,12 @@
4607 <child> 4618 <child>
4608 <object class="GtkCellRendererCombo" id="GNUNET_setup_gns_type_cellrenderercombo"> 4619 <object class="GtkCellRendererCombo" id="GNUNET_setup_gns_type_cellrenderercombo">
4609 <property name="editable">True</property> 4620 <property name="editable">True</property>
4621 <property name="model">GNUNET_setup_gns_type_liststore</property>
4610 <property name="text_column">1</property> 4622 <property name="text_column">1</property>
4623 <signal name="changed" handler="GNUNET_setup_gns_type_cellrenderercombo_changed_cb" swapped="no"/>
4611 </object> 4624 </object>
4612 <attributes> 4625 <attributes>
4613 <attribute name="visible">11</attribute> 4626 <attribute name="visible">10</attribute>
4614 <attribute name="text">3</attribute> 4627 <attribute name="text">3</attribute>
4615 </attributes> 4628 </attributes>
4616 </child> 4629 </child>
@@ -4625,11 +4638,13 @@
4625 <property name="sort_column_id">4</property> 4638 <property name="sort_column_id">4</property>
4626 <child> 4639 <child>
4627 <object class="GtkCellRendererText" id="GNUNET_setup_gns_expiration_cellrenderertext"> 4640 <object class="GtkCellRendererText" id="GNUNET_setup_gns_expiration_cellrenderertext">
4628 <property name="editable">True</property> 4641 <signal name="edited" handler="GNUNET_setup_gns_expiration_cellrenderertext_edited_cb" swapped="no"/>
4629 </object> 4642 </object>
4630 <attributes> 4643 <attributes>
4644 <attribute name="sensitive">11</attribute>
4631 <attribute name="visible">10</attribute> 4645 <attribute name="visible">10</attribute>
4632 <attribute name="background">12</attribute> 4646 <attribute name="background">12</attribute>
4647 <attribute name="editable">11</attribute>
4633 <attribute name="text">6</attribute> 4648 <attribute name="text">6</attribute>
4634 </attributes> 4649 </attributes>
4635 </child> 4650 </child>
@@ -4644,11 +4659,13 @@
4644 <property name="sort_column_id">7</property> 4659 <property name="sort_column_id">7</property>
4645 <child> 4660 <child>
4646 <object class="GtkCellRendererText" id="GNUNET_setup_gns_value_cellrenderertext"> 4661 <object class="GtkCellRendererText" id="GNUNET_setup_gns_value_cellrenderertext">
4647 <property name="editable">True</property> 4662 <signal name="edited" handler="GNUNET_setup_gns_value_cellrenderertext_edited_cb" swapped="no"/>
4648 </object> 4663 </object>
4649 <attributes> 4664 <attributes>
4665 <attribute name="sensitive">11</attribute>
4650 <attribute name="visible">10</attribute> 4666 <attribute name="visible">10</attribute>
4651 <attribute name="background">8</attribute> 4667 <attribute name="background">8</attribute>
4668 <attribute name="editable">11</attribute>
4652 <attribute name="text">7</attribute> 4669 <attribute name="text">7</attribute>
4653 </attributes> 4670 </attributes>
4654 </child> 4671 </child>
@@ -4758,6 +4775,7 @@
4758 <property name="can_focus">False</property> 4775 <property name="can_focus">False</property>
4759 <property name="tooltip_text" translatable="yes">Delete GNS entry</property> 4776 <property name="tooltip_text" translatable="yes">Delete GNS entry</property>
4760 <property name="label" translatable="yes">Delete</property> 4777 <property name="label" translatable="yes">Delete</property>
4778 <signal name="activate" handler="GNUNET_setup_gns_popup_delete_button_activate_cb" swapped="no"/>
4761 </object> 4779 </object>
4762 </child> 4780 </child>
4763 <child> 4781 <child>
@@ -4781,6 +4799,7 @@
4781 <property name="visible">True</property> 4799 <property name="visible">True</property>
4782 <property name="can_focus">False</property> 4800 <property name="can_focus">False</property>
4783 <property name="label" translatable="yes">1 week</property> 4801 <property name="label" translatable="yes">1 week</property>
4802 <signal name="activate" handler="GNUNET_setup_gns_popup_1w_exp_button_activate_cb" swapped="no"/>
4784 </object> 4803 </object>
4785 </child> 4804 </child>
4786 <child> 4805 <child>
@@ -4789,6 +4808,7 @@
4789 <property name="visible">True</property> 4808 <property name="visible">True</property>
4790 <property name="can_focus">False</property> 4809 <property name="can_focus">False</property>
4791 <property name="label" translatable="yes">1 year</property> 4810 <property name="label" translatable="yes">1 year</property>
4811 <signal name="activate" handler="GNUNET_setup_gns_popup_1y_exp_button_activate_cb" swapped="no"/>
4792 </object> 4812 </object>
4793 </child> 4813 </child>
4794 <child> 4814 <child>
@@ -4797,6 +4817,7 @@
4797 <property name="visible">True</property> 4817 <property name="visible">True</property>
4798 <property name="can_focus">False</property> 4818 <property name="can_focus">False</property>
4799 <property name="label" translatable="yes">never</property> 4819 <property name="label" translatable="yes">never</property>
4820 <signal name="activate" handler="GNUNET_setup_gns_popup_forever_exp_button_activate_cb" swapped="no"/>
4800 </object> 4821 </object>
4801 </child> 4822 </child>
4802 </object> 4823 </object>
@@ -4834,11 +4855,11 @@
4834 <column type="gchararray"/> 4855 <column type="gchararray"/>
4835 <!-- column-name name_is_editable --> 4856 <!-- column-name name_is_editable -->
4836 <column type="gboolean"/> 4857 <column type="gboolean"/>
4837 <!-- column-name name_is_row --> 4858 <!-- column-name name_is_record_row -->
4838 <column type="gboolean"/> 4859 <column type="gboolean"/>
4839 <!-- column-name not_dummy_row --> 4860 <!-- column-name not_dummy_row -->
4840 <column type="gboolean"/> 4861 <column type="gboolean"/>
4841 <!-- column-name expiration_time_as_color --> 4862 <!-- column-name expiration_time_color -->
4842 <column type="gchararray"/> 4863 <column type="gchararray"/>
4843 <!-- column-name name_color --> 4864 <!-- column-name name_color -->
4844 <column type="gchararray"/> 4865 <column type="gchararray"/>
diff --git a/src/setup/gnunet-setup-gns.c b/src/setup/gnunet-setup-gns.c
index 70f2b991..496b6885 100644
--- a/src/setup/gnunet-setup-gns.c
+++ b/src/setup/gnunet-setup-gns.c
@@ -26,36 +26,40 @@
26#include "gnunet_gtk.h" 26#include "gnunet_gtk.h"
27#include "gnunet-setup-gns.h" 27#include "gnunet-setup-gns.h"
28#include <gnunet/gnunet_namestore_service.h> 28#include <gnunet/gnunet_namestore_service.h>
29#include <gnunet/gnunet_dnsparser_lib.h>
30
29 31
30/** 32/**
31 * FIXME. Also: i18n? 33 * Text we use for the 'name' entry for the user to select
34 * for creating a new name.
32 */ 35 */
33#define NEW_NAME_STR "<new name>" 36#define NEW_NAME_STR gettext_noop ("<new name>")
34 37
35/** 38/**
36 * FIXME. Also: i18n? 39 * Text we use for the 'type' selection for the user to
40 * select when adding a new record.
37 */ 41 */
38#define NEW_RECORD_STR "<new record>" 42#define NEW_RECORD_STR gettext_noop ("<new record>")
39 43
40/** 44/**
41 * FIXME. Also: i18n? 45 * Text we use for 'our own zone'. FIXME: define as constant in GNS?
42 */ 46 */
43#define ROOT_STR "+" 47#define ROOT_STR "+"
44 48
45/** 49/**
46 * FIXME. Also: i18n? 50 * Text we use for the expiration to mean 'never expires'.
47 */ 51 */
48#define EXPIRE_NEVER_STRING "never" 52#define EXPIRE_NEVER_STRING gettext_noop ("never")
49 53
50/** 54/**
51 * FIXME. Also: i18n? 55 * Text we use for invalid values.
52 */ 56 */
53#define EXPIRE_INVALID_STRING "invalid" 57#define EXPIRE_INVALID_STRING gettext_noop ("invalid")
54 58
55/** 59/**
56 * FIXME. Also: i18n? 60 * Text we use for values that have not been set.
57 */ 61 */
58#define PSEU_EMPTY_STR "<empty>" 62#define PSEU_EMPTY_STR gettext_noop ("<not set>")
59 63
60 64
61 65
@@ -65,72 +69,79 @@
65enum GNSTreestoreColumn 69enum GNSTreestoreColumn
66{ 70{
67 /** 71 /**
68 * A gchararray 72 * A gchararray with the value for the 'name' column.
69 */ 73 */
70 GNS_TREESTORE_COL_NAME = 0, 74 GNS_TREESTORE_COL_NAME = 0,
71 75
72 /** 76 /**
73 * A gboolean 77 * A gboolean, TRUE if the record is public, FALSE if it is private.
74 */ 78 */
75 GNS_TREESTORE_COL_IS_PUBLIC, 79 GNS_TREESTORE_COL_IS_PUBLIC,
76 80
77 /** 81 /**
78 * A guint 82 * A guint with the record type (numeric value)
79 */ 83 */
80 GNS_TREESTORE_COL_RECORD_TYPE, 84 GNS_TREESTORE_COL_RECORD_TYPE,
81 85
82 /** 86 /**
83 * A gchararray 87 * A gchararray with the record type (human-readable string)
84 */ 88 */
85 GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, 89 GNS_TREESTORE_COL_RECORD_TYPE_AS_STR,
86 90
87 /** 91 /**
88 * A guint64 92 * A guint64 with the expiration time (relative or absolute)
89 */ 93 */
90 GNS_TREESTORE_COL_EXP_TIME, 94 GNS_TREESTORE_COL_EXP_TIME,
91 95
92 /** 96 /**
93 * A gboolean 97 * A gboolean, TRUE if the expiration time is relative.
94 */ 98 */
95 GNS_TREESTORE_COL_EXP_TIME_IS_REL, 99 GNS_TREESTORE_COL_EXP_TIME_IS_REL,
96 100
97 /** 101 /**
98 * A gchararray 102 * A gchararray with the expiration time as a human-readable string.
99 */ 103 */
100 GNS_TREESTORE_COL_EXP_TIME_AS_STR, 104 GNS_TREESTORE_COL_EXP_TIME_AS_STR,
101 105
102 /** 106 /**
103 * A gchararray 107 * A gchararray with the value of the record as a human-readable string.
104 */ 108 */
105 GNS_TREESTORE_COL_VAL_AS_STR, 109 GNS_TREESTORE_COL_VAL_AS_STR,
106 110
107 /** 111 /**
108 * A gchararray 112 * A gchararray with the background color to use for the value.
109 */ 113 */
110 GNS_TREESTORE_COL_VAL_COLOR, 114 GNS_TREESTORE_COL_VAL_COLOR,
111 115
112 /** 116 /**
113 * A gboolean 117 * A gboolean; TRUE if the 'name' column should be shown,
118 * FALSE for the lines with the individual records under a name.
114 */ 119 */
115 GNS_TREESTORE_COL_NAME_IS_VISIBLE, 120 GNS_TREESTORE_COL_NAME_IS_VISIBLE,
116 121
117 /** 122 /**
118 * A gboolean 123 * A gboolean, TRUE if this row is for editing a record,
124 * FALSE if the 'public', 'type', 'expiration' and 'value'
125 * columns should be hidden.
119 */ 126 */
120 GNS_TREESTORE_COL_IS_RECORD_ROW, 127 GNS_TREESTORE_COL_IS_RECORD_ROW,
121 128
122 /** 129 /**
123 * A gboolean 130 * A gboolean, FALSE if this is one of our 'dummy' rows that
131 * is used to create a new name or record, TRUE if this is
132 * a normal row with either a name or a record.
124 */ 133 */
125 GNS_TREESTORE_COL_NOT_DUMMY_ROW, 134 GNS_TREESTORE_COL_NOT_DUMMY_ROW,
126 135
127 /** 136 /**
128 * A gchararray 137 * A gchararray with the name of the color to use for the
138 * expiration column.
129 */ 139 */
130 GNS_TREESTORE_COL_EXP_TIME_COLOR, 140 GNS_TREESTORE_COL_EXP_TIME_COLOR,
131 141
132 /** 142 /**
133 * A gchararray 143 * A gchararray with the name of the color to use for the
144 * name column.
134 */ 145 */
135 GNS_TREESTORE_COL_NAME_COLOR 146 GNS_TREESTORE_COL_NAME_COLOR
136}; 147};
@@ -235,7 +246,9 @@ static int iteration;
235 246
236 247
237 248
238 249/**
250 *
251 */
239static void 252static void
240check_name_validity_and_commit_remove_proc (void *cls, 253check_name_validity_and_commit_remove_proc (void *cls,
241 int32_t success, 254 int32_t success,
@@ -272,6 +285,9 @@ check_name_validity_and_commit_remove_proc (void *cls,
272} 285}
273 286
274 287
288/**
289 *
290 */
275static void 291static void
276check_name_validity_and_commit (gchar *path, char * oldname) 292check_name_validity_and_commit (gchar *path, char * oldname)
277{ 293{
@@ -286,7 +302,6 @@ check_name_validity_and_commit (gchar *path, char * oldname)
286 void * data; 302 void * data;
287 size_t data_size; 303 size_t data_size;
288 const gchar * pseu; 304 const gchar * pseu;
289
290 char *n_name; 305 char *n_name;
291 int n_type; 306 int n_type;
292 gboolean n_public; 307 gboolean n_public;
@@ -297,7 +312,6 @@ check_name_validity_and_commit (gchar *path, char * oldname)
297 char *n_value; 312 char *n_value;
298 char *n_value_color; 313 char *n_value_color;
299 314
300
301 gtk_tree_model_get_iter_from_string(tm, &it, path); 315 gtk_tree_model_get_iter_from_string(tm, &it, path);
302 316
303 if (FALSE == gtk_tree_model_iter_parent (tm, &parent, &it)) 317 if (FALSE == gtk_tree_model_iter_parent (tm, &parent, &it))
@@ -456,6 +470,9 @@ struct Remove_Context
456}; 470};
457 471
458 472
473/**
474 *
475 */
459static void 476static void
460check_name_validity_and_remove_proc (void *cls, 477check_name_validity_and_remove_proc (void *cls,
461 int32_t success, 478 int32_t success,
@@ -492,6 +509,9 @@ check_name_validity_and_remove_proc (void *cls,
492} 509}
493 510
494 511
512/**
513 *
514 */
495static void 515static void
496check_name_validity_and_remove (gchar *path) 516check_name_validity_and_remove (gchar *path)
497{ 517{
@@ -601,10 +621,10 @@ check_name_validity_and_remove (gchar *path)
601 * @param user_data unused 621 * @param user_data unused
602 */ 622 */
603void 623void
604GNUNET_SETUP_gns_type_cellrenderercombo_changed_cb (GtkCellRendererCombo *combo, 624GNUNET_setup_gns_type_cellrenderercombo_changed_cb (GtkCellRendererCombo *combo,
605 gchar *path, 625 gchar *path,
606 GtkTreeIter *new_iter, 626 GtkTreeIter *new_iter,
607 gpointer user_data) 627 gpointer user_data)
608{ 628{
609 GtkTreeIter it; 629 GtkTreeIter it;
610 GtkTreeIter child; 630 GtkTreeIter child;
@@ -638,15 +658,15 @@ GNUNET_SETUP_gns_type_cellrenderercombo_changed_cb (GtkCellRendererCombo *combo,
638 /* Adding a new record */ 658 /* Adding a new record */
639 659
640 gtk_tree_store_insert_with_values(ts, &child , &it, 0, 660 gtk_tree_store_insert_with_values(ts, &child , &it, 0,
641 GNS_TREESTORE_COL_NAME, name_str, 661 GNS_TREESTORE_COL_NAME, name_str,
642 GNS_TREESTORE_COL_NAME_IS_VISIBLE, FALSE, 662 GNS_TREESTORE_COL_NAME_IS_VISIBLE, FALSE,
643 GNS_TREESTORE_COL_RECORD_TYPE, type, 663 GNS_TREESTORE_COL_RECORD_TYPE, type,
644 GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, type_str, 664 GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, type_str,
645 GNS_TREESTORE_COL_EXP_TIME_AS_STR, EXPIRE_NEVER_STRING, 665 GNS_TREESTORE_COL_EXP_TIME_AS_STR, EXPIRE_NEVER_STRING,
646 GNS_TREESTORE_COL_EXP_TIME, GNUNET_TIME_UNIT_FOREVER_ABS, 666 GNS_TREESTORE_COL_EXP_TIME, GNUNET_TIME_UNIT_FOREVER_ABS,
647 GNS_TREESTORE_COL_EXP_TIME_IS_REL, FALSE, 667 GNS_TREESTORE_COL_EXP_TIME_IS_REL, FALSE,
648 GNS_TREESTORE_COL_IS_RECORD_ROW, GNUNET_YES, 668 GNS_TREESTORE_COL_IS_RECORD_ROW, TRUE,
649 GNS_TREESTORE_COL_NOT_DUMMY_ROW, GNUNET_YES, 669 GNS_TREESTORE_COL_NOT_DUMMY_ROW, TRUE,
650 -1); 670 -1);
651 gtk_tree_view_expand_row (tv, gtk_tree_model_get_path(tm, &it), 0); 671 gtk_tree_view_expand_row (tv, gtk_tree_model_get_path(tm, &it), 0);
652 672
@@ -689,9 +709,9 @@ GNUNET_SETUP_gns_type_cellrenderercombo_changed_cb (GtkCellRendererCombo *combo,
689 * @param user_data unused 709 * @param user_data unused
690 */ 710 */
691void 711void
692GNUNET_SETUP_gns_ispublic_cellrenderertoggle_toggled_cb (GtkCellRendererToggle *cell_renderer, 712GNUNET_setup_gns_ispublic_cellrenderertoggle_toggled_cb (GtkCellRendererToggle *cell_renderer,
693 gchar *path, 713 gchar *path,
694 gpointer user_data) 714 gpointer user_data)
695{ 715{
696 GtkTreeIter it; 716 GtkTreeIter it;
697 gboolean value; 717 gboolean value;
@@ -704,6 +724,10 @@ GNUNET_SETUP_gns_ispublic_cellrenderertoggle_toggled_cb (GtkCellRendererToggle *
704} 724}
705 725
706 726
727/**
728 * FIXME: should use routines from gnunet-util (or move this to
729 * gnunet-util if it doesn't exist there!).
730 */
707static char * 731static char *
708convert_time_to_string (struct GNUNET_TIME_Absolute t) 732convert_time_to_string (struct GNUNET_TIME_Absolute t)
709{ 733{
@@ -724,6 +748,9 @@ convert_time_to_string (struct GNUNET_TIME_Absolute t)
724} 748}
725 749
726 750
751/**
752 *
753 */
727static int 754static int
728check_time (const char * text) 755check_time (const char * text)
729{ 756{
@@ -750,6 +777,9 @@ check_time (const char * text)
750} 777}
751 778
752 779
780/**
781 *
782 */
753static const struct GNUNET_TIME_Absolute 783static const struct GNUNET_TIME_Absolute
754convert_string_to_abs_time (const char * text) 784convert_string_to_abs_time (const char * text)
755{ 785{
@@ -805,60 +835,60 @@ convert_string_to_abs_time (const char * text)
805 * @param user_data unused 835 * @param user_data unused
806 */ 836 */
807void 837void
808GNUNET_SETUP_gns_expiration_cellrenderertext_edited_cb (GtkCellRendererText *renderer, 838GNUNET_setup_gns_expiration_cellrenderertext_edited_cb (GtkCellRendererText *renderer,
809 gchar *path, 839 gchar *path,
810 gchar *new_text, 840 gchar *new_text,
811 gpointer user_data) 841 gpointer user_data)
812{ 842{
813 GtkTreeIter it; 843 GtkTreeIter it;
814 struct GNUNET_TIME_Absolute abstime; 844 struct GNUNET_TIME_Absolute abstime;
815 gboolean is_rel; 845 gboolean is_rel;
816 char *old_text; 846 char *old_text;
817 847
818 if ((NULL != new_text)) 848 if (NULL == new_text)
849 return; /* can this happen? */
850 gtk_tree_model_get_iter_from_string(tm, &it, path);
851 gtk_tree_model_get(tm, &it,
852 GNS_TREESTORE_COL_EXP_TIME_AS_STR, &old_text,
853 GNS_TREESTORE_COL_EXP_TIME_IS_REL, &is_rel,
854 -1);
855 if ( (NULL != old_text) &&
856 (0 == strcmp(new_text, old_text)) )
857 return;
858
859 if ((0 == strcmp(new_text,"")) || (0 == strcmp(new_text,EXPIRE_NEVER_STRING)))
819 { 860 {
820 gtk_tree_model_get_iter_from_string(tm, &it, path); 861 new_text = EXPIRE_NEVER_STRING;
821 gtk_tree_model_get(tm, &it, 862 abstime = GNUNET_TIME_UNIT_FOREVER_ABS;
822 GNS_TREESTORE_COL_EXP_TIME_AS_STR, &old_text, 863 }
823 GNS_TREESTORE_COL_EXP_TIME_IS_REL, &is_rel, 864 else
824 -1); 865 {
825 if (0 == strcmp(new_text, old_text)) 866 if (GNUNET_SYSERR == check_time(new_text))
867 {
868 gtk_tree_store_set (ts, &it,
869 GNS_TREESTORE_COL_EXP_TIME_AS_STR, new_text,
870 GNS_TREESTORE_COL_EXP_TIME_COLOR, "red",
871 GNS_TREESTORE_COL_EXP_TIME, 0,
872 -1);
873 abstime = GNUNET_TIME_UNIT_ZERO_ABS;
826 return; 874 return;
827 875 }
828 if ((0 == strcmp(new_text,"")) || (0 == strcmp(new_text,EXPIRE_NEVER_STRING))) 876 /* TODO: fix this when we have relative time */
877 if (TRUE == is_rel)
829 { 878 {
830 new_text = EXPIRE_NEVER_STRING; 879 abstime = convert_string_to_abs_time(new_text);
831 abstime = GNUNET_TIME_UNIT_FOREVER_ABS;
832 } 880 }
833 else 881 else
834 { 882 {
835 if (GNUNET_SYSERR == check_time(new_text)) 883 abstime = convert_string_to_abs_time(new_text);
836 {
837 gtk_tree_store_set (ts, &it,
838 GNS_TREESTORE_COL_EXP_TIME_AS_STR, new_text,
839 GNS_TREESTORE_COL_EXP_TIME_COLOR, "red",
840 GNS_TREESTORE_COL_EXP_TIME, 0,
841 -1);
842 abstime = GNUNET_TIME_UNIT_ZERO_ABS;
843 return;
844 }
845 /* TODO: fix this when we have relative time */
846 if (TRUE == is_rel)
847 {
848 abstime = convert_string_to_abs_time(new_text);
849 }
850 else
851 {
852 abstime = convert_string_to_abs_time(new_text);
853 }
854 } 884 }
855 gtk_tree_store_set (ts, &it,
856 GNS_TREESTORE_COL_EXP_TIME_AS_STR, new_text,
857 GNS_TREESTORE_COL_EXP_TIME, abstime.abs_value,
858 GNS_TREESTORE_COL_EXP_TIME_COLOR, NULL,
859 -1);
860 check_name_validity_and_commit (path, NULL);
861 } 885 }
886 gtk_tree_store_set (ts, &it,
887 GNS_TREESTORE_COL_EXP_TIME_AS_STR, new_text,
888 GNS_TREESTORE_COL_EXP_TIME, abstime.abs_value,
889 GNS_TREESTORE_COL_EXP_TIME_COLOR, NULL,
890 -1);
891 check_name_validity_and_commit (path, NULL);
862} 892}
863 893
864 894
@@ -873,10 +903,10 @@ GNUNET_SETUP_gns_expiration_cellrenderertext_edited_cb (GtkCellRendererText *ren
873 * @param user_data unused 903 * @param user_data unused
874 */ 904 */
875void 905void
876GNUNET_SETUP_gns_value_cellrenderertext_edited_cb (GtkCellRendererText *renderer, 906GNUNET_setup_gns_value_cellrenderertext_edited_cb (GtkCellRendererText *renderer,
877 gchar *path, 907 gchar *path,
878 gchar *new_text, 908 gchar *new_text,
879 gpointer user_data) 909 gpointer user_data)
880{ 910{
881 GtkTreeModel *tm = GTK_TREE_MODEL(ts); 911 GtkTreeModel *tm = GTK_TREE_MODEL(ts);
882 GtkTreeIter it; 912 GtkTreeIter it;
@@ -931,7 +961,7 @@ GNUNET_SETUP_gns_value_cellrenderertext_edited_cb (GtkCellRendererText *renderer
931 * @param user_data unused 961 * @param user_data unused
932 */ 962 */
933void 963void
934GNUNET_SETUP_gns_name_cellrenderertext_edited_cb (GtkCellRendererText *renderer, 964GNUNET_setup_gns_name_cellrenderertext_edited_cb (GtkCellRendererText *renderer,
935 gchar *path, 965 gchar *path,
936 gchar *new_text, 966 gchar *new_text,
937 gpointer user_data) 967 gpointer user_data)
@@ -955,19 +985,21 @@ GNUNET_SETUP_gns_name_cellrenderertext_edited_cb (GtkCellRendererText *renderer,
955 /* update name */ 985 /* update name */
956 gtk_tree_store_set (ts, &it, 986 gtk_tree_store_set (ts, &it,
957 GNS_TREESTORE_COL_NAME, new_text, 987 GNS_TREESTORE_COL_NAME, new_text,
988 GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE,
958 GNS_TREESTORE_COL_RECORD_TYPE, 0, 989 GNS_TREESTORE_COL_RECORD_TYPE, 0,
959 GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, _(NEW_RECORD_STR), 990 GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, _(NEW_RECORD_STR),
960 GNS_TREESTORE_COL_NOT_DUMMY_ROW, GNUNET_YES, 991 GNS_TREESTORE_COL_NOT_DUMMY_ROW, TRUE,
992 GNS_TREESTORE_COL_IS_RECORD_ROW, TRUE,
961 -1); 993 -1);
962 check_name_validity_and_commit (gtk_tree_model_get_string_from_iter(tm, &it), name); 994 check_name_validity_and_commit (gtk_tree_model_get_string_from_iter(tm, &it), name);
963 995
964 /* add a new dummy line */ 996 /* add a new dummy line */
965 gtk_tree_store_insert_with_values (ts, &it,NULL, 0, 997 gtk_tree_store_insert_with_values (ts, &it,NULL, 0,
966 GNS_TREESTORE_COL_NAME, _(NEW_NAME_STR), 998 GNS_TREESTORE_COL_NAME, _(NEW_NAME_STR),
967 GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE, 999 GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE,
968 GNS_TREESTORE_COL_RECORD_TYPE, 1, 1000 GNS_TREESTORE_COL_RECORD_TYPE, GNUNET_DNSPARSER_TYPE_A,
969 GNS_TREESTORE_COL_NOT_DUMMY_ROW, GNUNET_NO, 1001 GNS_TREESTORE_COL_NOT_DUMMY_ROW, FALSE,
970 GNS_TREESTORE_COL_IS_RECORD_ROW, GNUNET_NO, 1002 GNS_TREESTORE_COL_IS_RECORD_ROW, FALSE,
971 -1); 1003 -1);
972 } 1004 }
973 else 1005 else
@@ -1006,6 +1038,34 @@ GNUNET_SETUP_gns_name_cellrenderertext_edited_cb (GtkCellRendererText *renderer,
1006 1038
1007 1039
1008/** 1040/**
1041 * Create a context (popup) menu for the zone iteration treeview
1042 * (if applicable).
1043 *
1044 * @return TRUE if a menu was activated
1045 */
1046static gboolean
1047create_popup_menu ()
1048{
1049 GtkTreeModel *tm;
1050 GtkTreeIter it;
1051 GtkMenu *popup;
1052 GtkTreeSelection * ts;
1053 int not_dummy;
1054
1055 ts = gtk_tree_view_get_selection(tv);
1056 if (! gtk_tree_selection_get_selected (ts, &tm, &it))
1057 return FALSE;
1058 gtk_tree_model_get(tm, &it, GNS_TREESTORE_COL_NOT_DUMMY_ROW, &not_dummy, -1);
1059 if (GNUNET_NO == not_dummy)
1060 return FALSE;
1061 popup = GTK_MENU (GNUNET_SETUP_get_object ("GNUNET_setup_gns_delete_popup_menu"));
1062 gtk_widget_show_all (GTK_WIDGET(popup));
1063 gtk_menu_popup(popup, NULL, NULL, NULL, NULL, 0, 0);
1064 return TRUE;
1065}
1066
1067
1068/**
1009 * The zone treeview pop up menu is supposed to be created. 1069 * The zone treeview pop up menu is supposed to be created.
1010 * (Note: this is not the only method that might need to be 1070 * (Note: this is not the only method that might need to be
1011 * written to handle events to create pop up menus; right-clicks 1071 * written to handle events to create pop up menus; right-clicks
@@ -1016,29 +1076,54 @@ GNUNET_SETUP_gns_name_cellrenderertext_edited_cb (GtkCellRendererText *renderer,
1016 * @return TRUE if a menu was activated 1076 * @return TRUE if a menu was activated
1017 */ 1077 */
1018gboolean 1078gboolean
1019GNUNET_SETUP_gns_main_treeview_popup_menu_cb (GtkWidget *widget, 1079GNUNET_setup_gns_main_treeview_popup_menu_cb (GtkWidget *widget,
1020 gpointer user_data) 1080 gpointer user_data)
1021{ 1081{
1022 GtkTreeModel *tm; 1082 return create_popup_menu ();
1083}
1084
1085
1086/**
1087 * Delete the selected row from the GtkTreeView (unless it is a dummy row).
1088 */
1089static void
1090delete_selected_row ()
1091{
1023 GtkTreeIter it; 1092 GtkTreeIter it;
1024 GtkMenu *popup; 1093 GtkTreeModel *tm;
1025 GtkTreeSelection * ts; 1094 GtkTreeSelection * ts;
1026 int not_dummy; 1095 int not_dummy;
1096 char *path;
1027 1097
1028 ts = gtk_tree_view_get_selection(tv); 1098 ts = gtk_tree_view_get_selection(tv);
1029 if (! gtk_tree_selection_get_selected (ts, &tm, &it)) 1099 if (! gtk_tree_selection_get_selected (ts, &tm, &it))
1030 return TRUE; 1100 return; /* nothing selected */
1031 gtk_tree_model_get(tm, &it, GNS_TREESTORE_COL_NOT_DUMMY_ROW, &not_dummy, -1); 1101 gtk_tree_model_get(tm, &it, GNS_TREESTORE_COL_NOT_DUMMY_ROW, &not_dummy, -1);
1032 if (GNUNET_NO == not_dummy) 1102 if (GNUNET_NO == not_dummy)
1033 return TRUE; 1103 return; /* do not delete the dummy line */
1104 path = gtk_tree_model_get_string_from_iter (tm, &it);
1105 check_name_validity_and_remove (path);
1106 g_free (path);
1107}
1034 1108
1035 popup = GTK_MENU (GNUNET_SETUP_get_object ("GNUNET_SETUP_gns_delete_popup_menu")); 1109
1036 gtk_widget_show_all (GTK_WIDGET(popup)); 1110/**
1037 gtk_menu_popup(popup, NULL, NULL, NULL, NULL, 0, 0); 1111 * User selected 'delete' in the popup menu. Delete the
1038 return TRUE; 1112 * selected row.
1113 */
1114void
1115GNUNET_setup_gns_popup_delete_button_activate_cb (GtkWidget *widget,
1116 gpointer user_data)
1117{
1118 delete_selected_row ();
1039} 1119}
1040 1120
1041 1121
1122/**
1123 * Set the expiration time of the selected row to the given value.
1124 *
1125 * @param reltime relative expiration time to use
1126 */
1042static void 1127static void
1043set_relative_expiration_time (struct GNUNET_TIME_Relative reltime) 1128set_relative_expiration_time (struct GNUNET_TIME_Relative reltime)
1044{ 1129{
@@ -1054,87 +1139,125 @@ set_relative_expiration_time (struct GNUNET_TIME_Relative reltime)
1054 1139
1055 if (! gtk_tree_selection_get_selected (ts, &tm, &it)) 1140 if (! gtk_tree_selection_get_selected (ts, &tm, &it))
1056 return; 1141 return;
1057
1058 gtk_tree_model_get(tm, &it, GNS_TREESTORE_COL_NOT_DUMMY_ROW, &not_dummy, -1); 1142 gtk_tree_model_get(tm, &it, GNS_TREESTORE_COL_NOT_DUMMY_ROW, &not_dummy, -1);
1059 if (GNUNET_NO == not_dummy) 1143 if (GNUNET_NO == not_dummy)
1060 return; 1144 return;
1061 1145
1062 /* Has parent? */ 1146 /* Has parent? */
1063 has_parent = gtk_tree_model_iter_parent (tm, &parent, &it); 1147 has_parent = gtk_tree_model_iter_parent (tm, &parent, &it);
1064
1065 if (FALSE == has_parent) 1148 if (FALSE == has_parent)
1066 return; 1149 return;
1067 1150
1068 abstime = GNUNET_TIME_absolute_add(GNUNET_TIME_absolute_get(), reltime); 1151 /* FIXME: should keep as relative time! */
1152 abstime = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(), reltime);
1069 1153
1070 /* this is a single record */ 1154 /* this is a single record */
1071 renderer = GTK_CELL_RENDERER_TEXT((GNUNET_SETUP_get_object ("GNUNET_SETUP_gns_name_cellrenderertext"))); 1155 renderer = GTK_CELL_RENDERER_TEXT((GNUNET_SETUP_get_object ("GNUNET_setup_gns_name_cellrenderertext")));
1072 path = gtk_tree_model_get_string_from_iter (tm, &it); 1156 path = gtk_tree_model_get_string_from_iter (tm, &it);
1073 GNUNET_SETUP_gns_expiration_cellrenderertext_edited_cb (renderer, 1157 GNUNET_setup_gns_expiration_cellrenderertext_edited_cb (renderer,
1074 path, 1158 path,
1075 convert_time_to_string (abstime), 1159 convert_time_to_string (abstime),
1076 NULL); 1160 NULL);
1077} 1161}
1078 1162
1079 1163
1080gboolean 1164/**
1081GNUNET_SETUP_gns_main_treeview_popup_menu_exp1d_cb (GtkWidget *widget, 1165 *
1166 */
1167void
1168GNUNET_setup_gns_popup_1d_exp_button_activate_cb (GtkWidget *widget,
1082 gpointer user_data) 1169 gpointer user_data)
1083{ 1170{
1084 set_relative_expiration_time (GNUNET_TIME_UNIT_DAYS); 1171 set_relative_expiration_time (GNUNET_TIME_UNIT_DAYS);
1085 return TRUE;
1086} 1172}
1087 1173
1088 1174
1089gboolean 1175/**
1090GNUNET_SETUP_gns_main_treeview_popup_menu_exp1w_cb (GtkWidget *widget, 1176 *
1177 */
1178void
1179GNUNET_setup_gns_popup_1w_exp_button_activate_cb (GtkWidget *widget,
1091 gpointer user_data) 1180 gpointer user_data)
1092{ 1181{
1093 set_relative_expiration_time (GNUNET_TIME_UNIT_WEEKS); 1182 set_relative_expiration_time (GNUNET_TIME_UNIT_WEEKS);
1094 return TRUE;
1095} 1183}
1096 1184
1097 1185
1098gboolean 1186/**
1099GNUNET_SETUP_gns_main_treeview_popup_menu_exp1y_cb (GtkWidget *widget, 1187 *
1100 gpointer user_data) 1188 */
1189void
1190GNUNET_setup_gns_popup_1y_exp_button_activate_cb (GtkWidget *widget,
1191 gpointer user_data)
1101{ 1192{
1102 set_relative_expiration_time (GNUNET_TIME_UNIT_YEARS); 1193 set_relative_expiration_time (GNUNET_TIME_UNIT_YEARS);
1103 return TRUE;
1104} 1194}
1105 1195
1106 1196
1107gboolean 1197/**
1108GNUNET_SETUP_gns_main_treeview_popup_menu_expinf_cb (GtkWidget *widget, 1198 *
1109 gpointer user_data) 1199 */
1200void
1201GNUNET_setup_gns_popup_forever_exp_button_activate_cb (GtkWidget *widget,
1202 gpointer user_data)
1110{ 1203{
1111 set_relative_expiration_time (GNUNET_TIME_UNIT_FOREVER_REL); 1204 set_relative_expiration_time (GNUNET_TIME_UNIT_FOREVER_REL);
1112 return TRUE;
1113} 1205}
1114 1206
1115 1207
1208/**
1209 * A button was pressed in the GtkTreeView, check for right button and
1210 * if applicable create the popup menu.
1211 *
1212 * @param widget the GtkTreeView
1213 * @param event the event
1214 * @param user_data unused
1215 * @return TRUE if a menu was activated (event was handled)
1216 */
1116gboolean 1217gboolean
1117GNUNET_SETUP_gns_main_treeview_button_press_popup_menu_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data) 1218GNUNET_setup_gns_main_treeview_button_press_event_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
1118{ 1219{
1119 /* Check for right click*/ 1220 /* Check for right click*/
1120 if (NULL == widget) 1221 if (NULL == widget)
1121 return FALSE; 1222 return FALSE;
1122 if (event->type == GDK_BUTTON_PRESS && event->button == 3) 1223 if ( (GDK_BUTTON_PRESS == event->type) && (3 == event->button) )
1123 GNUNET_SETUP_gns_main_treeview_popup_menu_cb (widget, user_data); 1224 return create_popup_menu ();
1124 return FALSE; 1225 return FALSE;
1125} 1226}
1126 1227
1127 1228
1229/**
1230 * User pushed a key in the GtkTreeView. Check for 'del' and if so, delete
1231 * the currently selected row.
1232 */
1128gboolean 1233gboolean
1129GNUNET_SETUP_gns_main_treeview_key_press_popup_menu_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data) 1234GNUNET_setup_gns_main_treeview_key_press_event_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
1130{ 1235{
1131 /* Check for delete key */ 1236 /* Check for delete key */
1132 if ((event->type == GDK_KEY_PRESS) && (GDK_KEY_Delete == event->keyval)) 1237 if ((event->type == GDK_KEY_PRESS) && (GDK_KEY_Delete == event->keyval))
1133 GNUNET_SETUP_gns_main_treeview_popup_menu_cb (widget, user_data); 1238 {
1239 delete_selected_row ();
1240 return TRUE;
1241 }
1134 return FALSE; 1242 return FALSE;
1135} 1243}
1136 1244
1137 1245
1246/**
1247 * User clicked on 'save as' to extract the QR code. Open 'save as'
1248 * dialog to get the desired filename and file type.
1249 */
1250void
1251GNUNET_setup_gns_qr_saveas_button_clicked_cb (GtkButton *button,
1252 gpointer user_data)
1253{
1254 GNUNET_break (0); // FIXME: not implemented
1255}
1256
1257
1258/**
1259 * Closure for 'zone_iteration_proc'.
1260 */
1138struct ZoneIteration_Context 1261struct ZoneIteration_Context
1139{ 1262{
1140 struct GNUNET_CRYPTO_ShortHashCode zone; 1263 struct GNUNET_CRYPTO_ShortHashCode zone;
@@ -1143,30 +1266,10 @@ struct ZoneIteration_Context
1143}; 1266};
1144 1267
1145 1268
1146void
1147GNUNET_SETUP_gns_delete_popup_menu_delete_cb (GtkMenuItem *menuitem,
1148 gpointer user_data)
1149{
1150 GtkTreeIter it;
1151 GtkTreeModel *tm;
1152 GtkTreeSelection * ts;
1153 int not_dummy;
1154 char *path;
1155
1156 ts = gtk_tree_view_get_selection(tv);
1157 if (gtk_tree_selection_get_selected (ts, &tm, &it))
1158 {
1159 gtk_tree_model_get(tm, &it, GNS_TREESTORE_COL_NOT_DUMMY_ROW, &not_dummy, -1);
1160 if (GNUNET_NO == not_dummy)
1161 return; /* do not delete the dummy line */
1162
1163 path = gtk_tree_model_get_string_from_iter (tm, &it);
1164 check_name_validity_and_remove(path);
1165 g_free (path);
1166 }
1167}
1168
1169 1269
1270/**
1271 *
1272 */
1170static void 1273static void
1171zone_iteration_proc (void *cls, 1274zone_iteration_proc (void *cls,
1172 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, 1275 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key,
@@ -1189,14 +1292,14 @@ zone_iteration_proc (void *cls,
1189 int public; 1292 int public;
1190 guint64 exp_t; 1293 guint64 exp_t;
1191 1294
1192 GNUNET_assert (zc_ctx != NULL); 1295 GNUNET_assert (NULL != zc_ctx);
1193 if ((NULL == zone_key) && (NULL == name)) 1296 if ((NULL == zone_key) && (NULL == name))
1194 { 1297 {
1195 GNUNET_CRYPTO_short_hash_to_enc(&zc_ctx->zone, &shenc); 1298 GNUNET_CRYPTO_short_hash_to_enc(&zc_ctx->zone, &shenc);
1196 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Zone `%s 'iteration done\n", &shenc); 1299 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Zone `%s 'iteration done\n", &shenc);
1197 pseu_entry = GTK_ENTRY((GNUNET_SETUP_get_object ("GNUNET_SETUP_gns_pseu_entry"))); 1300 pseu_entry = GTK_ENTRY((GNUNET_SETUP_get_object ("GNUNET_setup_gns_pseu_entry")));
1198 if (zc_ctx->label == NULL) 1301 if (NULL == zc_ctx->label)
1199 GNUNET_asprintf(&zc_ctx->label, "%s", PSEU_EMPTY_STR); 1302 zc_ctx->label = GNUNET_strdup (gettext (PSEU_EMPTY_STR));
1200 gtk_entry_set_text (pseu_entry, zc_ctx->label); 1303 gtk_entry_set_text (pseu_entry, zc_ctx->label);
1201 iteration = GNUNET_NO; 1304 iteration = GNUNET_NO;
1202 GNUNET_free (zc_ctx->label); 1305 GNUNET_free (zc_ctx->label);
@@ -1207,19 +1310,18 @@ zone_iteration_proc (void *cls,
1207 return; 1310 return;
1208 } 1311 }
1209 1312
1210 1313 GNUNET_CRYPTO_short_hash_to_enc (&zc_ctx->zone, &shenc);
1211 GNUNET_CRYPTO_short_hash_to_enc(&zc_ctx->zone, &shenc);
1212 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Zone `%s' iteration result `%s', %u records\n", 1314 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Zone `%s' iteration result `%s', %u records\n",
1213 &shenc, name, rd_count); 1315 &shenc, name, rd_count);
1214 gtk_tree_store_append (ts, &iter_name, NULL); 1316 gtk_tree_store_append (ts, &iter_name, NULL);
1215 gtk_tree_store_set(ts, &iter_name, 1317 gtk_tree_store_set (ts, &iter_name,
1216 GNS_TREESTORE_COL_NAME, name, 1318 GNS_TREESTORE_COL_NAME, name,
1217 GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE, 1319 GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE,
1218 GNS_TREESTORE_COL_RECORD_TYPE, 0, 1320 GNS_TREESTORE_COL_RECORD_TYPE, GNUNET_NAMESTORE_TYPE_ANY,
1219 GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, _(NEW_RECORD_STR), 1321 GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, _(NEW_RECORD_STR),
1220 GNS_TREESTORE_COL_IS_RECORD_ROW, GNUNET_NO, 1322 GNS_TREESTORE_COL_IS_RECORD_ROW, TRUE,
1221 GNS_TREESTORE_COL_NOT_DUMMY_ROW, GNUNET_YES, 1323 GNS_TREESTORE_COL_NOT_DUMMY_ROW, FALSE,
1222 -1); 1324 -1);
1223 1325
1224 if (GNUNET_SYSERR == GNUNET_NAMESTORE_check_name (name)) 1326 if (GNUNET_SYSERR == GNUNET_NAMESTORE_check_name (name))
1225 { 1327 {
@@ -1292,8 +1394,8 @@ zone_iteration_proc (void *cls,
1292 GNS_TREESTORE_COL_EXP_TIME_AS_STR, exp, 1394 GNS_TREESTORE_COL_EXP_TIME_AS_STR, exp,
1293 GNS_TREESTORE_COL_EXP_TIME_IS_REL, time_is_relative, 1395 GNS_TREESTORE_COL_EXP_TIME_IS_REL, time_is_relative,
1294 GNS_TREESTORE_COL_VAL_AS_STR, val, 1396 GNS_TREESTORE_COL_VAL_AS_STR, val,
1295 GNS_TREESTORE_COL_IS_RECORD_ROW, GNUNET_YES, 1397 GNS_TREESTORE_COL_IS_RECORD_ROW, TRUE,
1296 GNS_TREESTORE_COL_NOT_DUMMY_ROW, GNUNET_YES, 1398 GNS_TREESTORE_COL_NOT_DUMMY_ROW, TRUE,
1297 -1); 1399 -1);
1298 } 1400 }
1299 GNUNET_free (type_str); 1401 GNUNET_free (type_str);
@@ -1305,6 +1407,9 @@ zone_iteration_proc (void *cls,
1305} 1407}
1306 1408
1307 1409
1410/**
1411 *
1412 */
1308static void 1413static void
1309pseu_change_cont (void *cls, 1414pseu_change_cont (void *cls,
1310 int32_t success, 1415 int32_t success,
@@ -1331,23 +1436,6 @@ pseu_change_cont (void *cls,
1331} 1436}
1332 1437
1333 1438
1334gboolean
1335GNUNET_SETUP_gns_pseu_entry_enter_cb (GtkWidget *widget,
1336 GdkEvent *event,
1337 gpointer user_data)
1338{
1339 const gchar * pseu;
1340
1341 pseu = gtk_entry_get_text (GTK_ENTRY(widget));
1342
1343 if ((pseu == NULL) || (0 == strcmp (pseu, "")))
1344 {
1345 //gtk_entry_set_text (GTK_ENTRY(widget), PSEU_EMPTY_STR);
1346 }
1347 return FALSE;
1348}
1349
1350
1351/** 1439/**
1352 * The user edited the preferred name (PSEU) of this namespace. 1440 * The user edited the preferred name (PSEU) of this namespace.
1353 * Push the update to the namestore. 1441 * Push the update to the namestore.
@@ -1356,8 +1444,8 @@ GNUNET_SETUP_gns_pseu_entry_enter_cb (GtkWidget *widget,
1356 * @param user_data unused 1444 * @param user_data unused
1357 */ 1445 */
1358void 1446void
1359GNUNET_SETUP_gns_pseu_entry_changed_cb (GtkEditable *editable, 1447GNUNET_setup_gns_pseu_entry_changed_cb (GtkEditable *editable,
1360 gpointer user_data) 1448 gpointer user_data)
1361{ 1449{
1362 struct GNUNET_NAMESTORE_RecordData rd; 1450 struct GNUNET_NAMESTORE_RecordData rd;
1363 const gchar * pseu; 1451 const gchar * pseu;
@@ -1390,8 +1478,8 @@ GNUNET_SETUP_gns_pseu_entry_changed_cb (GtkEditable *editable,
1390 * @param user_data unused 1478 * @param user_data unused
1391 */ 1479 */
1392void 1480void
1393GNUNET_SETUP_gns_public_key_copy_button_clicked_cb (GtkButton *button, 1481GNUNET_setup_gns_public_key_copy_button_clicked_cb (GtkButton *button,
1394 gpointer user_data) 1482 gpointer user_data)
1395{ 1483{
1396 GtkClipboard *cb; 1484 GtkClipboard *cb;
1397 1485
@@ -1486,9 +1574,9 @@ GNUNET_SETUP_gns_init ()
1486 gtk_tree_store_insert_with_values (ts, &toplevel, NULL, 0, 1574 gtk_tree_store_insert_with_values (ts, &toplevel, NULL, 0,
1487 GNS_TREESTORE_COL_NAME, _(NEW_NAME_STR), 1575 GNS_TREESTORE_COL_NAME, _(NEW_NAME_STR),
1488 GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE, 1576 GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE,
1489 GNS_TREESTORE_COL_RECORD_TYPE, 1, 1577 GNS_TREESTORE_COL_RECORD_TYPE, GNUNET_DNSPARSER_TYPE_A,
1490 GNS_TREESTORE_COL_IS_RECORD_ROW, GNUNET_NO, 1578 GNS_TREESTORE_COL_IS_RECORD_ROW, FALSE,
1491 GNS_TREESTORE_COL_NOT_DUMMY_ROW, GNUNET_NO, 1579 GNS_TREESTORE_COL_NOT_DUMMY_ROW, FALSE,
1492 -1); 1580 -1);
1493 1581
1494 zc_ctx = GNUNET_malloc (sizeof (struct ZoneIteration_Context)); 1582 zc_ctx = GNUNET_malloc (sizeof (struct ZoneIteration_Context));