diff options
Diffstat (limited to 'src/setup/gnunet-setup-gns.c')
-rw-r--r-- | src/setup/gnunet-setup-gns.c | 482 |
1 files changed, 285 insertions, 197 deletions
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 @@ | |||
65 | enum GNSTreestoreColumn | 69 | enum 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 | */ | ||
239 | static void | 252 | static void |
240 | check_name_validity_and_commit_remove_proc (void *cls, | 253 | check_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 | */ | ||
275 | static void | 291 | static void |
276 | check_name_validity_and_commit (gchar *path, char * oldname) | 292 | check_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 | */ | ||
459 | static void | 476 | static void |
460 | check_name_validity_and_remove_proc (void *cls, | 477 | check_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 | */ | ||
495 | static void | 515 | static void |
496 | check_name_validity_and_remove (gchar *path) | 516 | check_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 | */ |
603 | void | 623 | void |
604 | GNUNET_SETUP_gns_type_cellrenderercombo_changed_cb (GtkCellRendererCombo *combo, | 624 | GNUNET_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 | */ |
691 | void | 711 | void |
692 | GNUNET_SETUP_gns_ispublic_cellrenderertoggle_toggled_cb (GtkCellRendererToggle *cell_renderer, | 712 | GNUNET_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 | */ | ||
707 | static char * | 731 | static char * |
708 | convert_time_to_string (struct GNUNET_TIME_Absolute t) | 732 | convert_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 | */ | ||
727 | static int | 754 | static int |
728 | check_time (const char * text) | 755 | check_time (const char * text) |
729 | { | 756 | { |
@@ -750,6 +777,9 @@ check_time (const char * text) | |||
750 | } | 777 | } |
751 | 778 | ||
752 | 779 | ||
780 | /** | ||
781 | * | ||
782 | */ | ||
753 | static const struct GNUNET_TIME_Absolute | 783 | static const struct GNUNET_TIME_Absolute |
754 | convert_string_to_abs_time (const char * text) | 784 | convert_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 | */ |
807 | void | 837 | void |
808 | GNUNET_SETUP_gns_expiration_cellrenderertext_edited_cb (GtkCellRendererText *renderer, | 838 | GNUNET_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 | */ |
875 | void | 905 | void |
876 | GNUNET_SETUP_gns_value_cellrenderertext_edited_cb (GtkCellRendererText *renderer, | 906 | GNUNET_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 | */ |
933 | void | 963 | void |
934 | GNUNET_SETUP_gns_name_cellrenderertext_edited_cb (GtkCellRendererText *renderer, | 964 | GNUNET_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 | */ | ||
1046 | static gboolean | ||
1047 | create_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, ¬_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 | */ |
1018 | gboolean | 1078 | gboolean |
1019 | GNUNET_SETUP_gns_main_treeview_popup_menu_cb (GtkWidget *widget, | 1079 | GNUNET_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 | */ | ||
1089 | static void | ||
1090 | delete_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, ¬_dummy, -1); | 1101 | gtk_tree_model_get(tm, &it, GNS_TREESTORE_COL_NOT_DUMMY_ROW, ¬_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 | */ | ||
1114 | void | ||
1115 | GNUNET_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 | */ | ||
1042 | static void | 1127 | static void |
1043 | set_relative_expiration_time (struct GNUNET_TIME_Relative reltime) | 1128 | set_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, ¬_dummy, -1); | 1142 | gtk_tree_model_get(tm, &it, GNS_TREESTORE_COL_NOT_DUMMY_ROW, ¬_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 | ||
1080 | gboolean | 1164 | /** |
1081 | GNUNET_SETUP_gns_main_treeview_popup_menu_exp1d_cb (GtkWidget *widget, | 1165 | * |
1166 | */ | ||
1167 | void | ||
1168 | GNUNET_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 | ||
1089 | gboolean | 1175 | /** |
1090 | GNUNET_SETUP_gns_main_treeview_popup_menu_exp1w_cb (GtkWidget *widget, | 1176 | * |
1177 | */ | ||
1178 | void | ||
1179 | GNUNET_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 | ||
1098 | gboolean | 1186 | /** |
1099 | GNUNET_SETUP_gns_main_treeview_popup_menu_exp1y_cb (GtkWidget *widget, | 1187 | * |
1100 | gpointer user_data) | 1188 | */ |
1189 | void | ||
1190 | GNUNET_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 | ||
1107 | gboolean | 1197 | /** |
1108 | GNUNET_SETUP_gns_main_treeview_popup_menu_expinf_cb (GtkWidget *widget, | 1198 | * |
1109 | gpointer user_data) | 1199 | */ |
1200 | void | ||
1201 | GNUNET_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 | */ | ||
1116 | gboolean | 1217 | gboolean |
1117 | GNUNET_SETUP_gns_main_treeview_button_press_popup_menu_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data) | 1218 | GNUNET_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 | */ | ||
1128 | gboolean | 1233 | gboolean |
1129 | GNUNET_SETUP_gns_main_treeview_key_press_popup_menu_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data) | 1234 | GNUNET_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 | */ | ||
1250 | void | ||
1251 | GNUNET_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 | */ | ||
1138 | struct ZoneIteration_Context | 1261 | struct 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 | ||
1146 | void | ||
1147 | GNUNET_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, ¬_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 | */ | ||
1170 | static void | 1273 | static void |
1171 | zone_iteration_proc (void *cls, | 1274 | zone_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 | */ | ||
1308 | static void | 1413 | static void |
1309 | pseu_change_cont (void *cls, | 1414 | pseu_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 | ||
1334 | gboolean | ||
1335 | GNUNET_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 | */ |
1358 | void | 1446 | void |
1359 | GNUNET_SETUP_gns_pseu_entry_changed_cb (GtkEditable *editable, | 1447 | GNUNET_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 | */ |
1392 | void | 1480 | void |
1393 | GNUNET_SETUP_gns_public_key_copy_button_clicked_cb (GtkButton *button, | 1481 | GNUNET_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)); |