diff options
-rw-r--r-- | contrib/gnunet_setup_gtk_main_window.glade | 332 | ||||
-rw-r--r-- | src/gns/gnunet-gns-gtk.c | 10 | ||||
-rw-r--r-- | src/gns/gnunet-gns-gtk_zone.c | 369 |
3 files changed, 423 insertions, 288 deletions
diff --git a/contrib/gnunet_setup_gtk_main_window.glade b/contrib/gnunet_setup_gtk_main_window.glade index 20a6576d..9827a3bf 100644 --- a/contrib/gnunet_setup_gtk_main_window.glade +++ b/contrib/gnunet_setup_gtk_main_window.glade | |||
@@ -2,140 +2,6 @@ | |||
2 | <interface> | 2 | <interface> |
3 | <requires lib="gtk+" version="2.20"/> | 3 | <requires lib="gtk+" version="2.20"/> |
4 | <!-- interface-naming-policy toplevel-contextual --> | 4 | <!-- interface-naming-policy toplevel-contextual --> |
5 | <object class="GtkMenu" id="GNUNET_GNS_GTK_delete_popup_menu"> | ||
6 | <property name="visible">True</property> | ||
7 | <property name="can_focus">False</property> | ||
8 | <child> | ||
9 | <object class="GtkMenuItem" id="GNUNET_GNS_GTK_delete_button"> | ||
10 | <property name="use_action_appearance">False</property> | ||
11 | <property name="visible">True</property> | ||
12 | <property name="can_focus">False</property> | ||
13 | <property name="tooltip_text" translatable="yes">Delete GNS entry</property> | ||
14 | <property name="label" translatable="yes">Delete</property> | ||
15 | </object> | ||
16 | </child> | ||
17 | <child> | ||
18 | <object class="GtkSeparatorMenuItem" id="GNUNET_GTK_delete_sep"> | ||
19 | <property name="use_action_appearance">False</property> | ||
20 | <property name="visible">True</property> | ||
21 | <property name="can_focus">False</property> | ||
22 | </object> | ||
23 | </child> | ||
24 | <child> | ||
25 | <object class="GtkMenuItem" id="1d_exp"> | ||
26 | <property name="use_action_appearance">False</property> | ||
27 | <property name="visible">True</property> | ||
28 | <property name="can_focus">False</property> | ||
29 | <property name="label" translatable="yes">1 day</property> | ||
30 | </object> | ||
31 | </child> | ||
32 | <child> | ||
33 | <object class="GtkMenuItem" id="1w_exp"> | ||
34 | <property name="use_action_appearance">False</property> | ||
35 | <property name="visible">True</property> | ||
36 | <property name="can_focus">False</property> | ||
37 | <property name="label" translatable="yes">1 week</property> | ||
38 | </object> | ||
39 | </child> | ||
40 | <child> | ||
41 | <object class="GtkMenuItem" id="1y_exp"> | ||
42 | <property name="use_action_appearance">False</property> | ||
43 | <property name="visible">True</property> | ||
44 | <property name="can_focus">False</property> | ||
45 | <property name="label" translatable="yes">1 year</property> | ||
46 | </object> | ||
47 | </child> | ||
48 | <child> | ||
49 | <object class="GtkMenuItem" id="exp_inf"> | ||
50 | <property name="use_action_appearance">False</property> | ||
51 | <property name="visible">True</property> | ||
52 | <property name="can_focus">False</property> | ||
53 | <property name="label" translatable="yes">never</property> | ||
54 | </object> | ||
55 | </child> | ||
56 | </object> | ||
57 | <object class="GtkTreeStore" id="GNUNET_GNS_GTK_treestore"> | ||
58 | <columns> | ||
59 | <!-- column-name name --> | ||
60 | <column type="gchararray"/> | ||
61 | <!-- column-name is_public --> | ||
62 | <column type="gboolean"/> | ||
63 | <!-- column-name record_type --> | ||
64 | <column type="guint"/> | ||
65 | <!-- column-name record_type_as_string --> | ||
66 | <column type="gchararray"/> | ||
67 | <!-- column-name expiration_time --> | ||
68 | <column type="guint64"/> | ||
69 | <!-- column-name expiration_time_is_relative --> | ||
70 | <column type="gboolean"/> | ||
71 | <!-- column-name expiration_time_as_string --> | ||
72 | <column type="gchararray"/> | ||
73 | <!-- column-name value_as_string --> | ||
74 | <column type="gchararray"/> | ||
75 | <!-- column-name value_color --> | ||
76 | <column type="gchararray"/> | ||
77 | <!-- column-name name_is_editable --> | ||
78 | <column type="gboolean"/> | ||
79 | <!-- column-name name_is_row --> | ||
80 | <column type="gboolean"/> | ||
81 | <!-- column-name not_dummy_row --> | ||
82 | <column type="gboolean"/> | ||
83 | <!-- column-name expiration_time_as_color --> | ||
84 | <column type="gchararray"/> | ||
85 | <!-- column-name name_color --> | ||
86 | <column type="gchararray"/> | ||
87 | </columns> | ||
88 | </object> | ||
89 | <object class="GtkListStore" id="GNUNET_GNS_GTK_type_liststore"> | ||
90 | <columns> | ||
91 | <!-- column-name type --> | ||
92 | <column type="guint"/> | ||
93 | <!-- column-name typename --> | ||
94 | <column type="gchararray"/> | ||
95 | </columns> | ||
96 | <data> | ||
97 | <row> | ||
98 | <col id="0">1</col> | ||
99 | <col id="1" translatable="yes">A</col> | ||
100 | </row> | ||
101 | <row> | ||
102 | <col id="0">2</col> | ||
103 | <col id="1" translatable="yes">NS</col> | ||
104 | </row> | ||
105 | <row> | ||
106 | <col id="0">5</col> | ||
107 | <col id="1" translatable="yes">CNAME</col> | ||
108 | </row> | ||
109 | <row> | ||
110 | <col id="0">6</col> | ||
111 | <col id="1" translatable="yes">SOA</col> | ||
112 | </row> | ||
113 | <row> | ||
114 | <col id="0">12</col> | ||
115 | <col id="1" translatable="yes">PTR</col> | ||
116 | </row> | ||
117 | <row> | ||
118 | <col id="0">15</col> | ||
119 | <col id="1" translatable="yes">MX</col> | ||
120 | </row> | ||
121 | <row> | ||
122 | <col id="0">16</col> | ||
123 | <col id="1" translatable="yes">TXT</col> | ||
124 | </row> | ||
125 | <row> | ||
126 | <col id="0">28</col> | ||
127 | <col id="1" translatable="yes">AAAA</col> | ||
128 | </row> | ||
129 | <row> | ||
130 | <col id="0">65536</col> | ||
131 | <col id="1" translatable="yes">PKEY</col> | ||
132 | </row> | ||
133 | <row> | ||
134 | <col id="0">65538</col> | ||
135 | <col id="1" translatable="yes">LEHO</col> | ||
136 | </row> | ||
137 | </data> | ||
138 | </object> | ||
139 | <object class="GtkAdjustment" id="GNUNET_setup_bandwidth_in_adjustment"> | 5 | <object class="GtkAdjustment" id="GNUNET_setup_bandwidth_in_adjustment"> |
140 | <property name="lower">5000</property> | 6 | <property name="lower">5000</property> |
141 | <property name="upper">999999999</property> | 7 | <property name="upper">999999999</property> |
@@ -150,27 +16,6 @@ | |||
150 | <property name="step_increment">1</property> | 16 | <property name="step_increment">1</property> |
151 | <property name="page_increment">10</property> | 17 | <property name="page_increment">10</property> |
152 | </object> | 18 | </object> |
153 | <object class="GtkAdjustment" id="GNUNET_setup_exit_interface_mask_adjustment"> | ||
154 | <property name="lower">1</property> | ||
155 | <property name="upper">127</property> | ||
156 | <property name="value">48</property> | ||
157 | <property name="step_increment">1</property> | ||
158 | <property name="page_increment">10</property> | ||
159 | </object> | ||
160 | <object class="GtkAdjustment" id="GNUNET_setup_fs_datacache_mysql_port_adjustment"> | ||
161 | <property name="lower">1</property> | ||
162 | <property name="upper">65535</property> | ||
163 | <property name="value">3306</property> | ||
164 | <property name="step_increment">1</property> | ||
165 | <property name="page_increment">10</property> | ||
166 | </object> | ||
167 | <object class="GtkAdjustment" id="GNUNET_setup_fs_datacache_quota_adjustment"> | ||
168 | <property name="lower">65536</property> | ||
169 | <property name="upper">9999999999</property> | ||
170 | <property name="value">1024000</property> | ||
171 | <property name="step_increment">65536</property> | ||
172 | <property name="page_increment">1024000</property> | ||
173 | </object> | ||
174 | <object class="GtkDialog" id="GNUNET_setup_dialog"> | 19 | <object class="GtkDialog" id="GNUNET_setup_dialog"> |
175 | <property name="can_focus">False</property> | 20 | <property name="can_focus">False</property> |
176 | <property name="border_width">5</property> | 21 | <property name="border_width">5</property> |
@@ -4445,7 +4290,7 @@ | |||
4445 | <object class="GtkTreeView" id="GNUNET_setup_gns_main_treeview"> | 4290 | <object class="GtkTreeView" id="GNUNET_setup_gns_main_treeview"> |
4446 | <property name="visible">True</property> | 4291 | <property name="visible">True</property> |
4447 | <property name="can_focus">True</property> | 4292 | <property name="can_focus">True</property> |
4448 | <property name="model"></property> | 4293 | <property name="model">GNUNET_setup_gns_treestore</property> |
4449 | <property name="search_column">0</property> | 4294 | <property name="search_column">0</property> |
4450 | <child> | 4295 | <child> |
4451 | <object class="GtkTreeViewColumn" id="GNUNET_setup_gns_name_treeviewcolumn"> | 4296 | <object class="GtkTreeViewColumn" id="GNUNET_setup_gns_name_treeviewcolumn"> |
@@ -4599,6 +4444,27 @@ | |||
4599 | <action-widget response="-3">GNUNET_setup_save_button</action-widget> | 4444 | <action-widget response="-3">GNUNET_setup_save_button</action-widget> |
4600 | </action-widgets> | 4445 | </action-widgets> |
4601 | </object> | 4446 | </object> |
4447 | <object class="GtkAdjustment" id="GNUNET_setup_exit_interface_mask_adjustment"> | ||
4448 | <property name="lower">1</property> | ||
4449 | <property name="upper">127</property> | ||
4450 | <property name="value">48</property> | ||
4451 | <property name="step_increment">1</property> | ||
4452 | <property name="page_increment">10</property> | ||
4453 | </object> | ||
4454 | <object class="GtkAdjustment" id="GNUNET_setup_fs_datacache_mysql_port_adjustment"> | ||
4455 | <property name="lower">1</property> | ||
4456 | <property name="upper">65535</property> | ||
4457 | <property name="value">3306</property> | ||
4458 | <property name="step_increment">1</property> | ||
4459 | <property name="page_increment">10</property> | ||
4460 | </object> | ||
4461 | <object class="GtkAdjustment" id="GNUNET_setup_fs_datacache_quota_adjustment"> | ||
4462 | <property name="lower">65536</property> | ||
4463 | <property name="upper">9999999999</property> | ||
4464 | <property name="value">1024000</property> | ||
4465 | <property name="step_increment">65536</property> | ||
4466 | <property name="page_increment">1024000</property> | ||
4467 | </object> | ||
4602 | <object class="GtkAdjustment" id="GNUNET_setup_fs_datastore_mysql_port_adjustment"> | 4468 | <object class="GtkAdjustment" id="GNUNET_setup_fs_datastore_mysql_port_adjustment"> |
4603 | <property name="lower">1</property> | 4469 | <property name="lower">1</property> |
4604 | <property name="upper">65535</property> | 4470 | <property name="upper">65535</property> |
@@ -4613,10 +4479,60 @@ | |||
4613 | <property name="step_increment">1000000</property> | 4479 | <property name="step_increment">1000000</property> |
4614 | <property name="page_increment">1000000000</property> | 4480 | <property name="page_increment">1000000000</property> |
4615 | </object> | 4481 | </object> |
4616 | <object class="GtkListStore" id="GNUNET_setup_gns_liststore"> | 4482 | <object class="GtkMenu" id="GNUNET_setup_gns_delete_popup_menu"> |
4483 | <property name="visible">True</property> | ||
4484 | <property name="can_focus">False</property> | ||
4485 | <child> | ||
4486 | <object class="GtkMenuItem" id="GNUNET_setup_gns_popup_delete_button"> | ||
4487 | <property name="use_action_appearance">False</property> | ||
4488 | <property name="visible">True</property> | ||
4489 | <property name="can_focus">False</property> | ||
4490 | <property name="tooltip_text" translatable="yes">Delete GNS entry</property> | ||
4491 | <property name="label" translatable="yes">Delete</property> | ||
4492 | </object> | ||
4493 | </child> | ||
4494 | <child> | ||
4495 | <object class="GtkSeparatorMenuItem" id="GNUNET_GTK_delete_sep"> | ||
4496 | <property name="use_action_appearance">False</property> | ||
4497 | <property name="visible">True</property> | ||
4498 | <property name="can_focus">False</property> | ||
4499 | </object> | ||
4500 | </child> | ||
4501 | <child> | ||
4502 | <object class="GtkMenuItem" id="GNUNET_setup_gns_popup_1d_exp_button"> | ||
4503 | <property name="use_action_appearance">False</property> | ||
4504 | <property name="visible">True</property> | ||
4505 | <property name="can_focus">False</property> | ||
4506 | <property name="label" translatable="yes">1 day</property> | ||
4507 | </object> | ||
4508 | </child> | ||
4509 | <child> | ||
4510 | <object class="GtkMenuItem" id="GNUNET_setup_gns_popup_1w_exp_button"> | ||
4511 | <property name="use_action_appearance">False</property> | ||
4512 | <property name="visible">True</property> | ||
4513 | <property name="can_focus">False</property> | ||
4514 | <property name="label" translatable="yes">1 week</property> | ||
4515 | </object> | ||
4516 | </child> | ||
4517 | <child> | ||
4518 | <object class="GtkMenuItem" id="GNUNET_setup_gns_popup_1y_exp_button"> | ||
4519 | <property name="use_action_appearance">False</property> | ||
4520 | <property name="visible">True</property> | ||
4521 | <property name="can_focus">False</property> | ||
4522 | <property name="label" translatable="yes">1 year</property> | ||
4523 | </object> | ||
4524 | </child> | ||
4525 | <child> | ||
4526 | <object class="GtkMenuItem" id="GNUNET_setup_gns_popup_forever_exp_button"> | ||
4527 | <property name="use_action_appearance">False</property> | ||
4528 | <property name="visible">True</property> | ||
4529 | <property name="can_focus">False</property> | ||
4530 | <property name="label" translatable="yes">never</property> | ||
4531 | </object> | ||
4532 | </child> | ||
4533 | </object> | ||
4534 | <object class="GtkListStore" id="GNUNET_setup_gns_exit_dialog_liststore"> | ||
4617 | <columns> | 4535 | <columns> |
4618 | <!-- column-name hostname --> | ||
4619 | <column type="gchararray"/> | ||
4620 | <!-- column-name sourceport --> | 4536 | <!-- column-name sourceport --> |
4621 | <column type="guint"/> | 4537 | <column type="guint"/> |
4622 | <!-- column-name targetport --> | 4538 | <!-- column-name targetport --> |
@@ -4627,6 +4543,104 @@ | |||
4627 | <column type="gchararray"/> | 4543 | <column type="gchararray"/> |
4628 | </columns> | 4544 | </columns> |
4629 | </object> | 4545 | </object> |
4546 | <object class="GtkTreeStore" id="GNUNET_setup_gns_treestore"> | ||
4547 | <columns> | ||
4548 | <!-- column-name name --> | ||
4549 | <column type="gchararray"/> | ||
4550 | <!-- column-name is_public --> | ||
4551 | <column type="gboolean"/> | ||
4552 | <!-- column-name record_type --> | ||
4553 | <column type="guint"/> | ||
4554 | <!-- column-name record_type_as_string --> | ||
4555 | <column type="gchararray"/> | ||
4556 | <!-- column-name expiration_time --> | ||
4557 | <column type="guint64"/> | ||
4558 | <!-- column-name expiration_time_is_relative --> | ||
4559 | <column type="gboolean"/> | ||
4560 | <!-- column-name expiration_time_as_string --> | ||
4561 | <column type="gchararray"/> | ||
4562 | <!-- column-name value_as_string --> | ||
4563 | <column type="gchararray"/> | ||
4564 | <!-- column-name value_color --> | ||
4565 | <column type="gchararray"/> | ||
4566 | <!-- column-name name_is_editable --> | ||
4567 | <column type="gboolean"/> | ||
4568 | <!-- column-name name_is_row --> | ||
4569 | <column type="gboolean"/> | ||
4570 | <!-- column-name not_dummy_row --> | ||
4571 | <column type="gboolean"/> | ||
4572 | <!-- column-name expiration_time_as_color --> | ||
4573 | <column type="gchararray"/> | ||
4574 | <!-- column-name name_color --> | ||
4575 | <column type="gchararray"/> | ||
4576 | </columns> | ||
4577 | </object> | ||
4578 | <object class="GtkListStore" id="GNUNET_setup_gns_type_liststore"> | ||
4579 | <columns> | ||
4580 | <!-- column-name type --> | ||
4581 | <column type="guint"/> | ||
4582 | <!-- column-name typename --> | ||
4583 | <column type="gchararray"/> | ||
4584 | </columns> | ||
4585 | <data> | ||
4586 | <row> | ||
4587 | <col id="0">1</col> | ||
4588 | <col id="1" translatable="yes">A</col> | ||
4589 | </row> | ||
4590 | <row> | ||
4591 | <col id="0">2</col> | ||
4592 | <col id="1" translatable="yes">NS</col> | ||
4593 | </row> | ||
4594 | <row> | ||
4595 | <col id="0">5</col> | ||
4596 | <col id="1" translatable="yes">CNAME</col> | ||
4597 | </row> | ||
4598 | <row> | ||
4599 | <col id="0">6</col> | ||
4600 | <col id="1" translatable="yes">SOA</col> | ||
4601 | </row> | ||
4602 | <row> | ||
4603 | <col id="0">12</col> | ||
4604 | <col id="1" translatable="yes">PTR</col> | ||
4605 | </row> | ||
4606 | <row> | ||
4607 | <col id="0">15</col> | ||
4608 | <col id="1" translatable="yes">MX</col> | ||
4609 | </row> | ||
4610 | <row> | ||
4611 | <col id="0">16</col> | ||
4612 | <col id="1" translatable="yes">TXT</col> | ||
4613 | </row> | ||
4614 | <row> | ||
4615 | <col id="0">28</col> | ||
4616 | <col id="1" translatable="yes">AAAA</col> | ||
4617 | </row> | ||
4618 | <row> | ||
4619 | <col id="0">65536</col> | ||
4620 | <col id="1" translatable="yes">PKEY</col> | ||
4621 | </row> | ||
4622 | <row> | ||
4623 | <col id="0">65538</col> | ||
4624 | <col id="1" translatable="yes">LEHO</col> | ||
4625 | </row> | ||
4626 | <row> | ||
4627 | <col id="0">33</col> | ||
4628 | <col id="1" translatable="yes">SRV</col> | ||
4629 | </row> | ||
4630 | <row> | ||
4631 | <col id="0">65539</col> | ||
4632 | <col id="1" translatable="yes">VPN</col> | ||
4633 | </row> | ||
4634 | <row> | ||
4635 | <col id="0">65540</col> | ||
4636 | <col id="1" translatable="yes">REV</col> | ||
4637 | </row> | ||
4638 | <row> | ||
4639 | <col id="0">65537</col> | ||
4640 | <col id="1" translatable="yes">PSEU</col> | ||
4641 | </row> | ||
4642 | </data> | ||
4643 | </object> | ||
4630 | <object class="GtkAdjustment" id="GNUNET_setup_hostlist_server_port_adjustment"> | 4644 | <object class="GtkAdjustment" id="GNUNET_setup_hostlist_server_port_adjustment"> |
4631 | <property name="lower">1</property> | 4645 | <property name="lower">1</property> |
4632 | <property name="upper">65535</property> | 4646 | <property name="upper">65535</property> |
diff --git a/src/gns/gnunet-gns-gtk.c b/src/gns/gnunet-gns-gtk.c index 99a49d83..7ea8c6c3 100644 --- a/src/gns/gnunet-gns-gtk.c +++ b/src/gns/gnunet-gns-gtk.c | |||
@@ -141,9 +141,10 @@ get_object (const char *name) | |||
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
144 | void pseu_change_cont (void *cls, | 144 | static void |
145 | int32_t success, | 145 | pseu_change_cont (void *cls, |
146 | const char *emsg) | 146 | int32_t success, |
147 | const char *emsg) | ||
147 | { | 148 | { |
148 | struct GNUNET_GNS_Context *gns = cls; | 149 | struct GNUNET_GNS_Context *gns = cls; |
149 | GtkWidget *dialog; | 150 | GtkWidget *dialog; |
@@ -204,6 +205,7 @@ GNUNET_GNS_GTK_shutdown (struct GNUNET_GNS_Context *gns) | |||
204 | GNUNET_SCHEDULER_add_now (&shutdown_task, gns); | 205 | GNUNET_SCHEDULER_add_now (&shutdown_task, gns); |
205 | } | 206 | } |
206 | 207 | ||
208 | |||
207 | gboolean | 209 | gboolean |
208 | GNUNET_GNS_GTK_pseu_entry_enter_cb (GtkWidget *widget, | 210 | GNUNET_GNS_GTK_pseu_entry_enter_cb (GtkWidget *widget, |
209 | GdkEvent *event, | 211 | GdkEvent *event, |
@@ -439,7 +441,7 @@ GNUNET_GNS_GTK_main_window_delete_event_cb (GtkWidget *widget, | |||
439 | } | 441 | } |
440 | 442 | ||
441 | 443 | ||
442 | void | 444 | static void |
443 | close_error_box (GtkDialog *dialog, | 445 | close_error_box (GtkDialog *dialog, |
444 | gint response_id, | 446 | gint response_id, |
445 | gpointer user_data) | 447 | gpointer user_data) |
diff --git a/src/gns/gnunet-gns-gtk_zone.c b/src/gns/gnunet-gns-gtk_zone.c index c3b6a095..4015248d 100644 --- a/src/gns/gnunet-gns-gtk_zone.c +++ b/src/gns/gnunet-gns-gtk_zone.c | |||
@@ -26,38 +26,130 @@ | |||
26 | #include "gnunet_gtk.h" | 26 | #include "gnunet_gtk.h" |
27 | #include "gnunet-gns-gtk.h" | 27 | #include "gnunet-gns-gtk.h" |
28 | 28 | ||
29 | enum TREESTORE_COLUMNS | 29 | |
30 | /** | ||
31 | * FIXME: duplicated with "enum GNS_ModelColumns"! | ||
32 | */ | ||
33 | enum GNSTreestoreColumn | ||
30 | { | 34 | { |
31 | TREE_COL_NAME = 0, | 35 | /** |
32 | TREE_COL_IS_PUBLIC, | 36 | * |
33 | TREE_COL_RECORD_TYPE, | 37 | */ |
34 | TREE_COL_RECORD_TYPE_AS_STR, | 38 | GNS_TREESTORE_COL_NAME = 0, |
35 | TREE_COL_EXP_TIME, | 39 | |
36 | TREE_COL_EXP_TIME_IS_REL, | 40 | /** |
37 | TREE_COL_EXP_TIME_AS_STR, | 41 | * |
38 | TREE_COL_VAL_AS_STR, | 42 | */ |
39 | TREE_COL_VAL_COLOR, | 43 | GNS_TREESTORE_COL_IS_PUBLIC, |
40 | TREE_COL_NAME_IS_VISIBLE, | 44 | |
41 | TREE_COL_IS_RECORD_ROW, | 45 | /** |
42 | TREE_COL_NOT_DUMMY_ROW, | 46 | * |
43 | TREE_COL_EXP_TIME_COLOR, | 47 | */ |
44 | TREE_COL_NAME_COLOR | 48 | GNS_TREESTORE_COL_RECORD_TYPE, |
49 | |||
50 | /** | ||
51 | * | ||
52 | */ | ||
53 | GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, | ||
54 | |||
55 | /** | ||
56 | * | ||
57 | */ | ||
58 | GNS_TREESTORE_COL_EXP_TIME, | ||
59 | |||
60 | /** | ||
61 | * | ||
62 | */ | ||
63 | GNS_TREESTORE_COL_EXP_TIME_IS_REL, | ||
64 | |||
65 | /** | ||
66 | * | ||
67 | */ | ||
68 | GNS_TREESTORE_COL_EXP_TIME_AS_STR, | ||
69 | |||
70 | /** | ||
71 | * | ||
72 | */ | ||
73 | GNS_TREESTORE_COL_VAL_AS_STR, | ||
74 | |||
75 | /** | ||
76 | * | ||
77 | */ | ||
78 | GNS_TREESTORE_COL_VAL_COLOR, | ||
79 | |||
80 | /** | ||
81 | * | ||
82 | */ | ||
83 | GNS_TREESTORE_COL_NAME_IS_VISIBLE, | ||
84 | |||
85 | /** | ||
86 | * | ||
87 | */ | ||
88 | GNS_TREESTORE_COL_IS_RECORD_ROW, | ||
89 | |||
90 | /** | ||
91 | * | ||
92 | */ | ||
93 | GNS_TREESTORE_COL_NOT_DUMMY_ROW, | ||
94 | |||
95 | /** | ||
96 | * | ||
97 | */ | ||
98 | GNS_TREESTORE_COL_EXP_TIME_COLOR, | ||
99 | |||
100 | /** | ||
101 | * | ||
102 | */ | ||
103 | GNS_TREESTORE_COL_NAME_COLOR | ||
45 | }; | 104 | }; |
46 | 105 | ||
106 | |||
107 | /** | ||
108 | * | ||
109 | */ | ||
47 | enum LIST_COLUMNS | 110 | enum LIST_COLUMNS |
48 | { | 111 | { |
49 | TYPE_LIST_TYPE = 0, | 112 | |
50 | TYPE_LIST_TYPENAME | 113 | /** |
114 | * | ||
115 | */ | ||
116 | GNS_TYPE_TO_NAME_LISTSTORE_COLUMN_TYPE = 0, | ||
117 | |||
118 | |||
119 | /** | ||
120 | * | ||
121 | */ | ||
122 | GNS_TYPE_TO_NAME_LISTSTORE_COLUMN_TYPENAME | ||
51 | }; | 123 | }; |
52 | 124 | ||
125 | |||
126 | /** | ||
127 | * | ||
128 | */ | ||
53 | struct UpdateContext | 129 | struct UpdateContext |
54 | { | 130 | { |
131 | /** | ||
132 | * | ||
133 | */ | ||
55 | struct GNUNET_GNS_Context *gns; | 134 | struct GNUNET_GNS_Context *gns; |
135 | |||
136 | /** | ||
137 | * | ||
138 | */ | ||
56 | struct GNUNET_NAMESTORE_RecordData *rd; | 139 | struct GNUNET_NAMESTORE_RecordData *rd; |
57 | unsigned int rd_count; | 140 | |
141 | /** | ||
142 | * | ||
143 | */ | ||
58 | char * name; | 144 | char * name; |
145 | |||
146 | /** | ||
147 | * | ||
148 | */ | ||
149 | unsigned int rd_count; | ||
59 | }; | 150 | }; |
60 | 151 | ||
152 | |||
61 | static void | 153 | static void |
62 | check_name_validity_and_commit_remove_proc (void *cls, | 154 | check_name_validity_and_commit_remove_proc (void *cls, |
63 | int32_t success, | 155 | int32_t success, |
@@ -92,6 +184,7 @@ check_name_validity_and_commit_remove_proc (void *cls, | |||
92 | } | 184 | } |
93 | } | 185 | } |
94 | 186 | ||
187 | |||
95 | static void | 188 | static void |
96 | check_name_validity_and_commit (struct GNUNET_GNS_Context *gns, gchar *path, char * oldname) | 189 | check_name_validity_and_commit (struct GNUNET_GNS_Context *gns, gchar *path, char * oldname) |
97 | { | 190 | { |
@@ -130,7 +223,7 @@ check_name_validity_and_commit (struct GNUNET_GNS_Context *gns, gchar *path, cha | |||
130 | } | 223 | } |
131 | 224 | ||
132 | gtk_tree_model_get(gns->tm, &parent, | 225 | gtk_tree_model_get(gns->tm, &parent, |
133 | TREE_COL_NAME, &name, | 226 | GNS_TREESTORE_COL_NAME, &name, |
134 | -1); | 227 | -1); |
135 | 228 | ||
136 | if (0 == strcmp (name, ROOT_STR)) | 229 | if (0 == strcmp (name, ROOT_STR)) |
@@ -153,15 +246,15 @@ check_name_validity_and_commit (struct GNUNET_GNS_Context *gns, gchar *path, cha | |||
153 | for (c = 0; c < children; c++) | 246 | for (c = 0; c < children; c++) |
154 | { | 247 | { |
155 | gtk_tree_model_get(gns->tm, &it, | 248 | gtk_tree_model_get(gns->tm, &it, |
156 | TREE_COL_NAME, &n_name, | 249 | GNS_TREESTORE_COL_NAME, &n_name, |
157 | TREE_COL_RECORD_TYPE, &n_type, | 250 | GNS_TREESTORE_COL_RECORD_TYPE, &n_type, |
158 | TREE_COL_IS_PUBLIC, &n_public, | 251 | GNS_TREESTORE_COL_IS_PUBLIC, &n_public, |
159 | TREE_COL_EXP_TIME_COLOR, &n_exp_color, | 252 | GNS_TREESTORE_COL_EXP_TIME_COLOR, &n_exp_color, |
160 | TREE_COL_EXP_TIME, &n_exp_time, | 253 | GNS_TREESTORE_COL_EXP_TIME, &n_exp_time, |
161 | TREE_COL_EXP_TIME_IS_REL, &n_is_relative, | 254 | GNS_TREESTORE_COL_EXP_TIME_IS_REL, &n_is_relative, |
162 | TREE_COL_EXP_TIME_AS_STR, &n_exp_str, | 255 | GNS_TREESTORE_COL_EXP_TIME_AS_STR, &n_exp_str, |
163 | TREE_COL_VAL_AS_STR, &n_value, | 256 | GNS_TREESTORE_COL_VAL_AS_STR, &n_value, |
164 | TREE_COL_VAL_COLOR, &n_value_color, | 257 | GNS_TREESTORE_COL_VAL_COLOR, &n_value_color, |
165 | -1); | 258 | -1); |
166 | /* valid name */ | 259 | /* valid name */ |
167 | if (NULL == n_name) | 260 | if (NULL == n_name) |
@@ -263,16 +356,29 @@ check_name_validity_and_commit (struct GNUNET_GNS_Context *gns, gchar *path, cha | |||
263 | } | 356 | } |
264 | } | 357 | } |
265 | 358 | ||
359 | |||
360 | /** | ||
361 | * | ||
362 | */ | ||
266 | struct Remove_Context | 363 | struct Remove_Context |
267 | { | 364 | { |
365 | |||
366 | /** | ||
367 | * | ||
368 | */ | ||
268 | struct GNUNET_GNS_Context *gns; | 369 | struct GNUNET_GNS_Context *gns; |
370 | |||
371 | /** | ||
372 | * | ||
373 | */ | ||
269 | char *path; | 374 | char *path; |
270 | }; | 375 | }; |
271 | 376 | ||
272 | void | 377 | |
378 | static void | ||
273 | check_name_validity_and_remove_proc (void *cls, | 379 | check_name_validity_and_remove_proc (void *cls, |
274 | int32_t success, | 380 | int32_t success, |
275 | const char *emsg) | 381 | const char *emsg) |
276 | { | 382 | { |
277 | struct Remove_Context *rcc = cls; | 383 | struct Remove_Context *rcc = cls; |
278 | GtkDialog *dialog; | 384 | GtkDialog *dialog; |
@@ -300,7 +406,8 @@ check_name_validity_and_remove_proc (void *cls, | |||
300 | GNUNET_free (rcc); | 406 | GNUNET_free (rcc); |
301 | } | 407 | } |
302 | 408 | ||
303 | void | 409 | |
410 | static void | ||
304 | check_name_validity_and_remove (struct GNUNET_GNS_Context *gns, gchar *path) | 411 | check_name_validity_and_remove (struct GNUNET_GNS_Context *gns, gchar *path) |
305 | { | 412 | { |
306 | GtkTreeIter it; | 413 | GtkTreeIter it; |
@@ -322,7 +429,7 @@ check_name_validity_and_remove (struct GNUNET_GNS_Context *gns, gchar *path) | |||
322 | 429 | ||
323 | gtk_tree_model_get_iter_from_string(gns->tm, &it, path); | 430 | gtk_tree_model_get_iter_from_string(gns->tm, &it, path); |
324 | gtk_tree_model_get(gns->tm, &it, | 431 | gtk_tree_model_get(gns->tm, &it, |
325 | TREE_COL_NAME, &name, | 432 | GNS_TREESTORE_COL_NAME, &name, |
326 | -1); | 433 | -1); |
327 | 434 | ||
328 | if (TRUE == gtk_tree_model_iter_parent (gns->tm, &parent, &it)) | 435 | if (TRUE == gtk_tree_model_iter_parent (gns->tm, &parent, &it)) |
@@ -332,15 +439,15 @@ check_name_validity_and_remove (struct GNUNET_GNS_Context *gns, gchar *path) | |||
332 | "Removing single record for name `%s'\n", name); | 439 | "Removing single record for name `%s'\n", name); |
333 | 440 | ||
334 | gtk_tree_model_get(gns->tm, &it, | 441 | gtk_tree_model_get(gns->tm, &it, |
335 | TREE_COL_NAME, &n_name, | 442 | GNS_TREESTORE_COL_NAME, &n_name, |
336 | TREE_COL_RECORD_TYPE, &n_type, | 443 | GNS_TREESTORE_COL_RECORD_TYPE, &n_type, |
337 | TREE_COL_IS_PUBLIC, &n_public, | 444 | GNS_TREESTORE_COL_IS_PUBLIC, &n_public, |
338 | TREE_COL_EXP_TIME_COLOR, &n_exp_color, | 445 | GNS_TREESTORE_COL_EXP_TIME_COLOR, &n_exp_color, |
339 | TREE_COL_EXP_TIME, &n_exp_time, | 446 | GNS_TREESTORE_COL_EXP_TIME, &n_exp_time, |
340 | TREE_COL_EXP_TIME_IS_REL, &n_is_relative, | 447 | GNS_TREESTORE_COL_EXP_TIME_IS_REL, &n_is_relative, |
341 | TREE_COL_EXP_TIME_AS_STR, &n_exp_str, | 448 | GNS_TREESTORE_COL_EXP_TIME_AS_STR, &n_exp_str, |
342 | TREE_COL_VAL_AS_STR, &n_value, | 449 | GNS_TREESTORE_COL_VAL_AS_STR, &n_value, |
343 | TREE_COL_VAL_COLOR, &n_value_color, | 450 | GNS_TREESTORE_COL_VAL_COLOR, &n_value_color, |
344 | -1); | 451 | -1); |
345 | 452 | ||
346 | /* valid name */ | 453 | /* valid name */ |
@@ -399,6 +506,7 @@ check_name_validity_and_remove (struct GNUNET_GNS_Context *gns, gchar *path) | |||
399 | g_free (name); | 506 | g_free (name); |
400 | } | 507 | } |
401 | 508 | ||
509 | |||
402 | /** | 510 | /** |
403 | * The user has selected a new record type. Update the | 511 | * The user has selected a new record type. Update the |
404 | * model, possibly invalidating (marking 'red') the existing | 512 | * model, possibly invalidating (marking 'red') the existing |
@@ -427,20 +535,20 @@ GNUNET_GNS_GTK_type_cellrenderercombo_changed_cb (GtkCellRendererCombo *combo, | |||
427 | size_t data_size; | 535 | size_t data_size; |
428 | 536 | ||
429 | gtk_tree_model_get(GTK_TREE_MODEL(gns->ls), new_iter, 0, &type, -1); | 537 | gtk_tree_model_get(GTK_TREE_MODEL(gns->ls), new_iter, 0, &type, -1); |
430 | gtk_tree_model_get(GTK_TREE_MODEL(gns->ls), new_iter, TYPE_LIST_TYPENAME, &type_str, -1); | 538 | gtk_tree_model_get(GTK_TREE_MODEL(gns->ls), new_iter, GNS_TYPE_TO_NAME_LISTSTORE_COLUMN_TYPENAME, &type_str, -1); |
431 | 539 | ||
432 | 540 | ||
433 | /* check if this is a new record */ | 541 | /* check if this is a new record */ |
434 | gtk_tree_model_get_iter_from_string(gns->tm, &it, path); | 542 | gtk_tree_model_get_iter_from_string(gns->tm, &it, path); |
435 | gtk_tree_model_get(gns->tm, &it, TREE_COL_IS_RECORD_ROW, &record_row, -1); | 543 | gtk_tree_model_get(gns->tm, &it, GNS_TREESTORE_COL_IS_RECORD_ROW, &record_row, -1); |
436 | gtk_tree_model_get(gns->tm, &it, TREE_COL_NAME, &name_str, -1); | 544 | gtk_tree_model_get(gns->tm, &it, GNS_TREESTORE_COL_NAME, &name_str, -1); |
437 | 545 | ||
438 | if (GNUNET_YES == record_row) | 546 | if (GNUNET_YES == record_row) |
439 | { | 547 | { |
440 | /* Updating an existing record */ | 548 | /* Updating an existing record */ |
441 | gtk_tree_store_set(gns->ts, &it, | 549 | gtk_tree_store_set(gns->ts, &it, |
442 | TREE_COL_RECORD_TYPE, type, | 550 | GNS_TREESTORE_COL_RECORD_TYPE, type, |
443 | TREE_COL_RECORD_TYPE_AS_STR, type_str, | 551 | GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, type_str, |
444 | -1); | 552 | -1); |
445 | } | 553 | } |
446 | else if ((NULL != name_str) && (0 != strcmp (NEW_NAME_STR, name_str))) | 554 | else if ((NULL != name_str) && (0 != strcmp (NEW_NAME_STR, name_str))) |
@@ -448,15 +556,15 @@ GNUNET_GNS_GTK_type_cellrenderercombo_changed_cb (GtkCellRendererCombo *combo, | |||
448 | /* Adding a new record */ | 556 | /* Adding a new record */ |
449 | 557 | ||
450 | gtk_tree_store_insert_with_values(gns->ts, &child , &it, 0, | 558 | gtk_tree_store_insert_with_values(gns->ts, &child , &it, 0, |
451 | TREE_COL_NAME, name_str, | 559 | GNS_TREESTORE_COL_NAME, name_str, |
452 | TREE_COL_NAME_IS_VISIBLE, FALSE, | 560 | GNS_TREESTORE_COL_NAME_IS_VISIBLE, FALSE, |
453 | TREE_COL_RECORD_TYPE, type, | 561 | GNS_TREESTORE_COL_RECORD_TYPE, type, |
454 | TREE_COL_RECORD_TYPE_AS_STR, type_str, | 562 | GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, type_str, |
455 | TREE_COL_EXP_TIME_AS_STR, EXPIRE_NEVER_STRING, | 563 | GNS_TREESTORE_COL_EXP_TIME_AS_STR, EXPIRE_NEVER_STRING, |
456 | TREE_COL_EXP_TIME, GNUNET_TIME_UNIT_FOREVER_ABS, | 564 | GNS_TREESTORE_COL_EXP_TIME, GNUNET_TIME_UNIT_FOREVER_ABS, |
457 | TREE_COL_EXP_TIME_IS_REL, FALSE, | 565 | GNS_TREESTORE_COL_EXP_TIME_IS_REL, FALSE, |
458 | TREE_COL_IS_RECORD_ROW, GNUNET_YES, | 566 | GNS_TREESTORE_COL_IS_RECORD_ROW, GNUNET_YES, |
459 | TREE_COL_NOT_DUMMY_ROW, GNUNET_YES, | 567 | GNS_TREESTORE_COL_NOT_DUMMY_ROW, GNUNET_YES, |
460 | -1); | 568 | -1); |
461 | gtk_tree_view_expand_row (gns->tv, gtk_tree_model_get_path(gns->tm, &it), 0); | 569 | gtk_tree_view_expand_row (gns->tv, gtk_tree_model_get_path(gns->tm, &it), 0); |
462 | 570 | ||
@@ -464,25 +572,25 @@ GNUNET_GNS_GTK_type_cellrenderercombo_changed_cb (GtkCellRendererCombo *combo, | |||
464 | GNUNET_free (type_str); | 572 | GNUNET_free (type_str); |
465 | 573 | ||
466 | /* check if value is still valid */ | 574 | /* check if value is still valid */ |
467 | gtk_tree_model_get(gns->tm, &it, TREE_COL_VAL_AS_STR, &value_str, -1); | 575 | gtk_tree_model_get(gns->tm, &it, GNS_TREESTORE_COL_VAL_AS_STR, &value_str, -1); |
468 | if (NULL != value_str) | 576 | if (NULL != value_str) |
469 | { | 577 | { |
470 | if (GNUNET_OK != GNUNET_NAMESTORE_string_to_value (type, | 578 | if (GNUNET_OK != GNUNET_NAMESTORE_string_to_value (type, |
471 | value_str, | 579 | value_str, |
472 | &data, | 580 | &data, |
473 | &data_size)) | 581 | &data_size)) |
474 | gtk_tree_store_set (gns->ts, &it, TREE_COL_VAL_COLOR, "red", -1); | 582 | gtk_tree_store_set (gns->ts, &it, GNS_TREESTORE_COL_VAL_COLOR, "red", -1); |
475 | else | 583 | else |
476 | gtk_tree_store_set (gns->ts, &it, TREE_COL_VAL_COLOR, NULL, -1); | 584 | gtk_tree_store_set (gns->ts, &it, GNS_TREESTORE_COL_VAL_COLOR, NULL, -1); |
477 | GNUNET_free (value_str); | 585 | GNUNET_free (value_str); |
478 | } | 586 | } |
479 | else if (NULL == value_str) | 587 | else if (NULL == value_str) |
480 | { | 588 | { |
481 | /* Empty value field */ | 589 | /* Empty value field */ |
482 | if (GNUNET_YES == record_row) | 590 | if (GNUNET_YES == record_row) |
483 | gtk_tree_store_set (gns->ts, &it, TREE_COL_VAL_COLOR, "red", -1); | 591 | gtk_tree_store_set (gns->ts, &it, GNS_TREESTORE_COL_VAL_COLOR, "red", -1); |
484 | else | 592 | else |
485 | gtk_tree_store_set (gns->ts, &child, TREE_COL_VAL_COLOR, "red", -1); | 593 | gtk_tree_store_set (gns->ts, &child, GNS_TREESTORE_COL_VAL_COLOR, "red", -1); |
486 | } | 594 | } |
487 | 595 | ||
488 | check_name_validity_and_commit (gns, path, NULL); | 596 | check_name_validity_and_commit (gns, path, NULL); |
@@ -508,14 +616,15 @@ GNUNET_GNS_GTK_ispublic_cellrenderertoggle_toggled_cb (GtkCellRendererToggle *ce | |||
508 | gboolean value; | 616 | gboolean value; |
509 | 617 | ||
510 | gtk_tree_model_get_iter_from_string(gns->tm, &it, path); | 618 | gtk_tree_model_get_iter_from_string(gns->tm, &it, path); |
511 | gtk_tree_model_get(gns->tm, &it, TREE_COL_IS_PUBLIC, &value, -1); | 619 | gtk_tree_model_get(gns->tm, &it, GNS_TREESTORE_COL_IS_PUBLIC, &value, -1); |
512 | gtk_tree_store_set(gns->ts, &it, TREE_COL_IS_PUBLIC, !value, -1); | 620 | gtk_tree_store_set(gns->ts, &it, GNS_TREESTORE_COL_IS_PUBLIC, !value, -1); |
513 | 621 | ||
514 | check_name_validity_and_commit (gns, path, NULL); | 622 | check_name_validity_and_commit (gns, path, NULL); |
515 | } | 623 | } |
516 | 624 | ||
517 | static | 625 | |
518 | char * convert_time_to_string (struct GNUNET_TIME_Absolute t) | 626 | static char * |
627 | convert_time_to_string (struct GNUNET_TIME_Absolute t) | ||
519 | { | 628 | { |
520 | time_t tt; | 629 | time_t tt; |
521 | struct tm *time; | 630 | struct tm *time; |
@@ -533,8 +642,9 @@ char * convert_time_to_string (struct GNUNET_TIME_Absolute t) | |||
533 | return ret; | 642 | return ret; |
534 | } | 643 | } |
535 | 644 | ||
536 | static | 645 | |
537 | int check_time (const char * text) | 646 | static int |
647 | check_time (const char * text) | ||
538 | { | 648 | { |
539 | unsigned int t_mon; | 649 | unsigned int t_mon; |
540 | unsigned int t_day; | 650 | unsigned int t_day; |
@@ -558,8 +668,9 @@ int check_time (const char * text) | |||
558 | return GNUNET_OK; | 668 | return GNUNET_OK; |
559 | } | 669 | } |
560 | 670 | ||
561 | static | 671 | |
562 | const struct GNUNET_TIME_Absolute convert_string_to_abs_time (const char * text) | 672 | static const struct GNUNET_TIME_Absolute |
673 | convert_string_to_abs_time (const char * text) | ||
563 | { | 674 | { |
564 | static struct GNUNET_TIME_Absolute abs_t; | 675 | static struct GNUNET_TIME_Absolute abs_t; |
565 | struct tm time; | 676 | struct tm time; |
@@ -628,8 +739,8 @@ GNUNET_GNS_GTK_expiration_cellrenderertext_edited_cb (GtkCellRendererText *rende | |||
628 | { | 739 | { |
629 | gtk_tree_model_get_iter_from_string(gns->tm, &it, path); | 740 | gtk_tree_model_get_iter_from_string(gns->tm, &it, path); |
630 | gtk_tree_model_get(gns->tm, &it, | 741 | gtk_tree_model_get(gns->tm, &it, |
631 | TREE_COL_EXP_TIME_AS_STR, &old_text, | 742 | GNS_TREESTORE_COL_EXP_TIME_AS_STR, &old_text, |
632 | TREE_COL_EXP_TIME_IS_REL, &is_rel, | 743 | GNS_TREESTORE_COL_EXP_TIME_IS_REL, &is_rel, |
633 | -1); | 744 | -1); |
634 | if (0 == strcmp(new_text, old_text)) | 745 | if (0 == strcmp(new_text, old_text)) |
635 | return; | 746 | return; |
@@ -644,9 +755,9 @@ GNUNET_GNS_GTK_expiration_cellrenderertext_edited_cb (GtkCellRendererText *rende | |||
644 | if (GNUNET_SYSERR == check_time(new_text)) | 755 | if (GNUNET_SYSERR == check_time(new_text)) |
645 | { | 756 | { |
646 | gtk_tree_store_set (gns->ts, &it, | 757 | gtk_tree_store_set (gns->ts, &it, |
647 | TREE_COL_EXP_TIME_AS_STR, new_text, | 758 | GNS_TREESTORE_COL_EXP_TIME_AS_STR, new_text, |
648 | TREE_COL_EXP_TIME_COLOR, "red", | 759 | GNS_TREESTORE_COL_EXP_TIME_COLOR, "red", |
649 | TREE_COL_EXP_TIME, 0, | 760 | GNS_TREESTORE_COL_EXP_TIME, 0, |
650 | -1); | 761 | -1); |
651 | abstime = GNUNET_TIME_UNIT_ZERO_ABS; | 762 | abstime = GNUNET_TIME_UNIT_ZERO_ABS; |
652 | return; | 763 | return; |
@@ -662,9 +773,9 @@ GNUNET_GNS_GTK_expiration_cellrenderertext_edited_cb (GtkCellRendererText *rende | |||
662 | } | 773 | } |
663 | } | 774 | } |
664 | gtk_tree_store_set (gns->ts, &it, | 775 | gtk_tree_store_set (gns->ts, &it, |
665 | TREE_COL_EXP_TIME_AS_STR, new_text, | 776 | GNS_TREESTORE_COL_EXP_TIME_AS_STR, new_text, |
666 | TREE_COL_EXP_TIME, abstime.abs_value, | 777 | GNS_TREESTORE_COL_EXP_TIME, abstime.abs_value, |
667 | TREE_COL_EXP_TIME_COLOR, NULL, | 778 | GNS_TREESTORE_COL_EXP_TIME_COLOR, NULL, |
668 | -1); | 779 | -1); |
669 | check_name_validity_and_commit (gns, path, NULL); | 780 | check_name_validity_and_commit (gns, path, NULL); |
670 | } | 781 | } |
@@ -699,8 +810,8 @@ GNUNET_GNS_GTK_value_cellrenderertext_edited_cb (GtkCellRendererText *renderer, | |||
699 | { | 810 | { |
700 | gtk_tree_model_get_iter_from_string(tm, &it, path); | 811 | gtk_tree_model_get_iter_from_string(tm, &it, path); |
701 | gtk_tree_model_get(tm, &it, | 812 | gtk_tree_model_get(tm, &it, |
702 | TREE_COL_RECORD_TYPE, &type, | 813 | GNS_TREESTORE_COL_RECORD_TYPE, &type, |
703 | TREE_COL_VAL_AS_STR, &old_value, | 814 | GNS_TREESTORE_COL_VAL_AS_STR, &old_value, |
704 | -1); | 815 | -1); |
705 | 816 | ||
706 | if (old_value != NULL) | 817 | if (old_value != NULL) |
@@ -718,14 +829,14 @@ GNUNET_GNS_GTK_value_cellrenderertext_edited_cb (GtkCellRendererText *renderer, | |||
718 | &data, | 829 | &data, |
719 | &data_size)) | 830 | &data_size)) |
720 | { | 831 | { |
721 | gtk_tree_store_set (gns->ts, &it, TREE_COL_VAL_COLOR, NULL, -1); | 832 | gtk_tree_store_set (gns->ts, &it, GNS_TREESTORE_COL_VAL_COLOR, NULL, -1); |
722 | gtk_tree_store_set (gns->ts, &it, TREE_COL_VAL_AS_STR, new_text, -1); | 833 | gtk_tree_store_set (gns->ts, &it, GNS_TREESTORE_COL_VAL_AS_STR, new_text, -1); |
723 | check_name_validity_and_commit (gns, path, NULL); | 834 | check_name_validity_and_commit (gns, path, NULL); |
724 | } | 835 | } |
725 | else | 836 | else |
726 | { | 837 | { |
727 | gtk_tree_store_set (gns->ts, &it, TREE_COL_VAL_COLOR, "red", -1); | 838 | gtk_tree_store_set (gns->ts, &it, GNS_TREESTORE_COL_VAL_COLOR, "red", -1); |
728 | gtk_tree_store_set (gns->ts, &it, TREE_COL_VAL_AS_STR, new_text, -1); | 839 | gtk_tree_store_set (gns->ts, &it, GNS_TREESTORE_COL_VAL_AS_STR, new_text, -1); |
729 | } | 840 | } |
730 | } | 841 | } |
731 | } | 842 | } |
@@ -758,40 +869,40 @@ GNUNET_GNS_GTK_name_cellrenderertext_edited_cb (GtkCellRendererText *renderer, | |||
758 | return; | 869 | return; |
759 | 870 | ||
760 | gtk_tree_model_get_iter_from_string(tm, &it, path); | 871 | gtk_tree_model_get_iter_from_string(tm, &it, path); |
761 | gtk_tree_model_get(tm, &it, TREE_COL_NOT_DUMMY_ROW, ¬_dummy, -1); | 872 | gtk_tree_model_get(tm, &it, GNS_TREESTORE_COL_NOT_DUMMY_ROW, ¬_dummy, -1); |
762 | gtk_tree_model_get(tm, &it, TREE_COL_NAME, &name, -1); | 873 | gtk_tree_model_get(tm, &it, GNS_TREESTORE_COL_NAME, &name, -1); |
763 | 874 | ||
764 | if (not_dummy == GNUNET_NO) | 875 | if (not_dummy == GNUNET_NO) |
765 | { | 876 | { |
766 | /* update name */ | 877 | /* update name */ |
767 | gtk_tree_store_set (gns->ts, &it, | 878 | gtk_tree_store_set (gns->ts, &it, |
768 | TREE_COL_NAME, new_text, | 879 | GNS_TREESTORE_COL_NAME, new_text, |
769 | TREE_COL_RECORD_TYPE, 0, | 880 | GNS_TREESTORE_COL_RECORD_TYPE, 0, |
770 | TREE_COL_RECORD_TYPE_AS_STR, _(NEW_RECORD_STR), | 881 | GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, _(NEW_RECORD_STR), |
771 | TREE_COL_NOT_DUMMY_ROW, GNUNET_YES, | 882 | GNS_TREESTORE_COL_NOT_DUMMY_ROW, GNUNET_YES, |
772 | -1); | 883 | -1); |
773 | check_name_validity_and_commit (gns, gtk_tree_model_get_string_from_iter(gns->tm, &it), name); | 884 | check_name_validity_and_commit (gns, gtk_tree_model_get_string_from_iter(gns->tm, &it), name); |
774 | 885 | ||
775 | /* add a new dummy line */ | 886 | /* add a new dummy line */ |
776 | gtk_tree_store_insert_with_values (gns->ts, &it,NULL, 0, | 887 | gtk_tree_store_insert_with_values (gns->ts, &it,NULL, 0, |
777 | TREE_COL_NAME, _(NEW_NAME_STR), | 888 | GNS_TREESTORE_COL_NAME, _(NEW_NAME_STR), |
778 | TREE_COL_NAME_IS_VISIBLE, TRUE, | 889 | GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE, |
779 | TREE_COL_RECORD_TYPE, 1, | 890 | GNS_TREESTORE_COL_RECORD_TYPE, 1, |
780 | TREE_COL_NOT_DUMMY_ROW, GNUNET_NO, | 891 | GNS_TREESTORE_COL_NOT_DUMMY_ROW, GNUNET_NO, |
781 | TREE_COL_IS_RECORD_ROW, GNUNET_NO, | 892 | GNS_TREESTORE_COL_IS_RECORD_ROW, GNUNET_NO, |
782 | -1); | 893 | -1); |
783 | } | 894 | } |
784 | else | 895 | else |
785 | { | 896 | { |
786 | /* update name */ | 897 | /* update name */ |
787 | gtk_tree_store_set (gns->ts, &it, TREE_COL_NAME, new_text, -1); | 898 | gtk_tree_store_set (gns->ts, &it, GNS_TREESTORE_COL_NAME, new_text, -1); |
788 | 899 | ||
789 | if (TRUE == gtk_tree_model_iter_children (gns->tm, &child, &it)) | 900 | if (TRUE == gtk_tree_model_iter_children (gns->tm, &child, &it)) |
790 | { | 901 | { |
791 | do | 902 | do |
792 | { | 903 | { |
793 | gtk_tree_store_set (gns->ts, &child, | 904 | gtk_tree_store_set (gns->ts, &child, |
794 | TREE_COL_NAME, &new_text, | 905 | GNS_TREESTORE_COL_NAME, &new_text, |
795 | -1); | 906 | -1); |
796 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New text for `%s' is `%s'\n", path, new_text); | 907 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New text for `%s' is `%s'\n", path, new_text); |
797 | } | 908 | } |
@@ -804,17 +915,18 @@ GNUNET_GNS_GTK_name_cellrenderertext_edited_cb (GtkCellRendererText *renderer, | |||
804 | if (GNUNET_SYSERR == GNUNET_NAMESTORE_check_name (new_text)) | 915 | if (GNUNET_SYSERR == GNUNET_NAMESTORE_check_name (new_text)) |
805 | { | 916 | { |
806 | gtk_tree_store_set (gns->ts, &it, | 917 | gtk_tree_store_set (gns->ts, &it, |
807 | TREE_COL_NAME_COLOR, "red", | 918 | GNS_TREESTORE_COL_NAME_COLOR, "red", |
808 | -1); | 919 | -1); |
809 | } | 920 | } |
810 | else | 921 | else |
811 | { | 922 | { |
812 | gtk_tree_store_set (gns->ts, &it, | 923 | gtk_tree_store_set (gns->ts, &it, |
813 | TREE_COL_NAME_COLOR, NULL, | 924 | GNS_TREESTORE_COL_NAME_COLOR, NULL, |
814 | -1); | 925 | -1); |
815 | } | 926 | } |
816 | } | 927 | } |
817 | 928 | ||
929 | |||
818 | /** | 930 | /** |
819 | * The zone treeview pop up menu is supposed to be created. | 931 | * The zone treeview pop up menu is supposed to be created. |
820 | * (Note: this is not the only method that might need to be | 932 | * (Note: this is not the only method that might need to be |
@@ -839,7 +951,7 @@ GNUNET_GNS_GTK_main_treeview_popup_menu_cb (GtkWidget *widget, | |||
839 | ts = gtk_tree_view_get_selection(gns->tv); | 951 | ts = gtk_tree_view_get_selection(gns->tv); |
840 | if (! gtk_tree_selection_get_selected (ts, &tm, &it)) | 952 | if (! gtk_tree_selection_get_selected (ts, &tm, &it)) |
841 | return TRUE; | 953 | return TRUE; |
842 | gtk_tree_model_get(gns->tm, &it, TREE_COL_NOT_DUMMY_ROW, ¬_dummy, -1); | 954 | gtk_tree_model_get(gns->tm, &it, GNS_TREESTORE_COL_NOT_DUMMY_ROW, ¬_dummy, -1); |
843 | if (GNUNET_NO == not_dummy) | 955 | if (GNUNET_NO == not_dummy) |
844 | return TRUE; | 956 | return TRUE; |
845 | 957 | ||
@@ -849,6 +961,7 @@ GNUNET_GNS_GTK_main_treeview_popup_menu_cb (GtkWidget *widget, | |||
849 | return TRUE; | 961 | return TRUE; |
850 | } | 962 | } |
851 | 963 | ||
964 | |||
852 | static void | 965 | static void |
853 | set_relative_expiration_time (struct GNUNET_GNS_Context *gns, struct GNUNET_TIME_Relative reltime) | 966 | set_relative_expiration_time (struct GNUNET_GNS_Context *gns, struct GNUNET_TIME_Relative reltime) |
854 | { | 967 | { |
@@ -865,7 +978,7 @@ set_relative_expiration_time (struct GNUNET_GNS_Context *gns, struct GNUNET_TIME | |||
865 | if (! gtk_tree_selection_get_selected (ts, &tm, &it)) | 978 | if (! gtk_tree_selection_get_selected (ts, &tm, &it)) |
866 | return; | 979 | return; |
867 | 980 | ||
868 | gtk_tree_model_get(tm, &it, TREE_COL_NOT_DUMMY_ROW, ¬_dummy, -1); | 981 | gtk_tree_model_get(tm, &it, GNS_TREESTORE_COL_NOT_DUMMY_ROW, ¬_dummy, -1); |
869 | if (GNUNET_NO == not_dummy) | 982 | if (GNUNET_NO == not_dummy) |
870 | return; | 983 | return; |
871 | 984 | ||
@@ -904,6 +1017,7 @@ GNUNET_GNS_GTK_main_treeview_popup_menu_exp1w_cb (GtkWidget *widget, | |||
904 | return TRUE; | 1017 | return TRUE; |
905 | } | 1018 | } |
906 | 1019 | ||
1020 | |||
907 | gboolean | 1021 | gboolean |
908 | GNUNET_GNS_GTK_main_treeview_popup_menu_exp1y_cb (GtkWidget *widget, | 1022 | GNUNET_GNS_GTK_main_treeview_popup_menu_exp1y_cb (GtkWidget *widget, |
909 | gpointer user_data) | 1023 | gpointer user_data) |
@@ -912,6 +1026,7 @@ GNUNET_GNS_GTK_main_treeview_popup_menu_exp1y_cb (GtkWidget *widget, | |||
912 | return TRUE; | 1026 | return TRUE; |
913 | } | 1027 | } |
914 | 1028 | ||
1029 | |||
915 | gboolean | 1030 | gboolean |
916 | GNUNET_GNS_GTK_main_treeview_popup_menu_expinf_cb (GtkWidget *widget, | 1031 | GNUNET_GNS_GTK_main_treeview_popup_menu_expinf_cb (GtkWidget *widget, |
917 | gpointer user_data) | 1032 | gpointer user_data) |
@@ -921,7 +1036,6 @@ GNUNET_GNS_GTK_main_treeview_popup_menu_expinf_cb (GtkWidget *widget, | |||
921 | } | 1036 | } |
922 | 1037 | ||
923 | 1038 | ||
924 | |||
925 | gboolean | 1039 | gboolean |
926 | GNUNET_GNS_GTK_main_treeview_button_press_popup_menu_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data) | 1040 | GNUNET_GNS_GTK_main_treeview_button_press_popup_menu_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data) |
927 | { | 1041 | { |
@@ -933,6 +1047,7 @@ GNUNET_GNS_GTK_main_treeview_button_press_popup_menu_cb (GtkWidget *widget, GdkE | |||
933 | return FALSE; | 1047 | return FALSE; |
934 | } | 1048 | } |
935 | 1049 | ||
1050 | |||
936 | gboolean | 1051 | gboolean |
937 | GNUNET_GNS_GTK_main_treeview_key_press_popup_menu_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data) | 1052 | GNUNET_GNS_GTK_main_treeview_key_press_popup_menu_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data) |
938 | { | 1053 | { |
@@ -942,6 +1057,7 @@ GNUNET_GNS_GTK_main_treeview_key_press_popup_menu_cb (GtkWidget *widget, GdkEven | |||
942 | return FALSE; | 1057 | return FALSE; |
943 | } | 1058 | } |
944 | 1059 | ||
1060 | |||
945 | struct ZoneIteration_Context | 1061 | struct ZoneIteration_Context |
946 | { | 1062 | { |
947 | struct GNUNET_GNS_Context *gns; | 1063 | struct GNUNET_GNS_Context *gns; |
@@ -950,6 +1066,7 @@ struct ZoneIteration_Context | |||
950 | char *label; | 1066 | char *label; |
951 | }; | 1067 | }; |
952 | 1068 | ||
1069 | |||
953 | void | 1070 | void |
954 | GNUNET_GNS_GTK_delete_popup_menu_delete_cb (GtkMenuItem *menuitem, | 1071 | GNUNET_GNS_GTK_delete_popup_menu_delete_cb (GtkMenuItem *menuitem, |
955 | gpointer user_data) | 1072 | gpointer user_data) |
@@ -964,7 +1081,7 @@ GNUNET_GNS_GTK_delete_popup_menu_delete_cb (GtkMenuItem *menuitem, | |||
964 | ts = gtk_tree_view_get_selection(gns->tv); | 1081 | ts = gtk_tree_view_get_selection(gns->tv); |
965 | if (gtk_tree_selection_get_selected (ts, &tm, &it)) | 1082 | if (gtk_tree_selection_get_selected (ts, &tm, &it)) |
966 | { | 1083 | { |
967 | gtk_tree_model_get(tm, &it, TREE_COL_NOT_DUMMY_ROW, ¬_dummy, -1); | 1084 | gtk_tree_model_get(tm, &it, GNS_TREESTORE_COL_NOT_DUMMY_ROW, ¬_dummy, -1); |
968 | if (GNUNET_NO == not_dummy) | 1085 | if (GNUNET_NO == not_dummy) |
969 | return; /* do not delete the dummy line */ | 1086 | return; /* do not delete the dummy line */ |
970 | 1087 | ||
@@ -974,6 +1091,7 @@ GNUNET_GNS_GTK_delete_popup_menu_delete_cb (GtkMenuItem *menuitem, | |||
974 | } | 1091 | } |
975 | } | 1092 | } |
976 | 1093 | ||
1094 | |||
977 | static void | 1095 | static void |
978 | zone_iteration_proc (void *cls, | 1096 | zone_iteration_proc (void *cls, |
979 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | 1097 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, |
@@ -1021,18 +1139,18 @@ zone_iteration_proc (void *cls, | |||
1021 | GNUNET_assert(GTK_IS_TREE_STORE(zc_ctx->gns->ts)); | 1139 | GNUNET_assert(GTK_IS_TREE_STORE(zc_ctx->gns->ts)); |
1022 | gtk_tree_store_append(zc_ctx->gns->ts, &iter_name, NULL); | 1140 | gtk_tree_store_append(zc_ctx->gns->ts, &iter_name, NULL); |
1023 | gtk_tree_store_set(zc_ctx->gns->ts, &iter_name, | 1141 | gtk_tree_store_set(zc_ctx->gns->ts, &iter_name, |
1024 | TREE_COL_NAME, name, | 1142 | GNS_TREESTORE_COL_NAME, name, |
1025 | TREE_COL_NAME_IS_VISIBLE, TRUE, | 1143 | GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE, |
1026 | TREE_COL_RECORD_TYPE, 0, | 1144 | GNS_TREESTORE_COL_RECORD_TYPE, 0, |
1027 | TREE_COL_RECORD_TYPE_AS_STR, _(NEW_RECORD_STR), | 1145 | GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, _(NEW_RECORD_STR), |
1028 | TREE_COL_IS_RECORD_ROW, GNUNET_NO, | 1146 | GNS_TREESTORE_COL_IS_RECORD_ROW, GNUNET_NO, |
1029 | TREE_COL_NOT_DUMMY_ROW, GNUNET_YES, | 1147 | GNS_TREESTORE_COL_NOT_DUMMY_ROW, GNUNET_YES, |
1030 | -1); | 1148 | -1); |
1031 | 1149 | ||
1032 | if (GNUNET_SYSERR == GNUNET_NAMESTORE_check_name (name)) | 1150 | if (GNUNET_SYSERR == GNUNET_NAMESTORE_check_name (name)) |
1033 | { | 1151 | { |
1034 | gtk_tree_store_set (zc_ctx->gns->ts, &iter_name, | 1152 | gtk_tree_store_set (zc_ctx->gns->ts, &iter_name, |
1035 | TREE_COL_NAME_COLOR, "red", | 1153 | GNS_TREESTORE_COL_NAME_COLOR, "red", |
1036 | -1); | 1154 | -1); |
1037 | } | 1155 | } |
1038 | /* Append elements for records */ | 1156 | /* Append elements for records */ |
@@ -1091,17 +1209,17 @@ zone_iteration_proc (void *cls, | |||
1091 | else | 1209 | else |
1092 | { | 1210 | { |
1093 | gtk_tree_store_insert_with_values(zc_ctx->gns->ts, &iter_record , &iter_name, 0, | 1211 | gtk_tree_store_insert_with_values(zc_ctx->gns->ts, &iter_record , &iter_name, 0, |
1094 | TREE_COL_NAME, name, | 1212 | GNS_TREESTORE_COL_NAME, name, |
1095 | TREE_COL_NAME_IS_VISIBLE, FALSE, | 1213 | GNS_TREESTORE_COL_NAME_IS_VISIBLE, FALSE, |
1096 | TREE_COL_RECORD_TYPE, rd[c].record_type, | 1214 | GNS_TREESTORE_COL_RECORD_TYPE, rd[c].record_type, |
1097 | TREE_COL_RECORD_TYPE_AS_STR, type_str, | 1215 | GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, type_str, |
1098 | TREE_COL_IS_PUBLIC, public, | 1216 | GNS_TREESTORE_COL_IS_PUBLIC, public, |
1099 | TREE_COL_EXP_TIME, exp_t, | 1217 | GNS_TREESTORE_COL_EXP_TIME, exp_t, |
1100 | TREE_COL_EXP_TIME_AS_STR, exp, | 1218 | GNS_TREESTORE_COL_EXP_TIME_AS_STR, exp, |
1101 | TREE_COL_EXP_TIME_IS_REL, time_is_relative, | 1219 | GNS_TREESTORE_COL_EXP_TIME_IS_REL, time_is_relative, |
1102 | TREE_COL_VAL_AS_STR, val, | 1220 | GNS_TREESTORE_COL_VAL_AS_STR, val, |
1103 | TREE_COL_IS_RECORD_ROW, GNUNET_YES, | 1221 | GNS_TREESTORE_COL_IS_RECORD_ROW, GNUNET_YES, |
1104 | TREE_COL_NOT_DUMMY_ROW, GNUNET_YES, | 1222 | GNS_TREESTORE_COL_NOT_DUMMY_ROW, GNUNET_YES, |
1105 | -1); | 1223 | -1); |
1106 | } | 1224 | } |
1107 | GNUNET_free (type_str); | 1225 | GNUNET_free (type_str); |
@@ -1112,6 +1230,7 @@ zone_iteration_proc (void *cls, | |||
1112 | GNUNET_NAMESTORE_zone_iterator_next(zc_ctx->it); | 1230 | GNUNET_NAMESTORE_zone_iterator_next(zc_ctx->it); |
1113 | } | 1231 | } |
1114 | 1232 | ||
1233 | |||
1115 | /** | 1234 | /** |
1116 | * The zone treeview was realized. Setup the model. | 1235 | * The zone treeview was realized. Setup the model. |
1117 | * | 1236 | * |
@@ -1128,11 +1247,11 @@ GNUNET_GNS_GTK_main_treeview_realize_cb (GtkWidget *widget, | |||
1128 | 1247 | ||
1129 | /* Append a top level row and leave it empty */ | 1248 | /* Append a top level row and leave it empty */ |
1130 | gtk_tree_store_insert_with_values(gns->ts, &toplevel, NULL, 0, | 1249 | gtk_tree_store_insert_with_values(gns->ts, &toplevel, NULL, 0, |
1131 | TREE_COL_NAME, _(NEW_NAME_STR), | 1250 | GNS_TREESTORE_COL_NAME, _(NEW_NAME_STR), |
1132 | TREE_COL_NAME_IS_VISIBLE, TRUE, | 1251 | GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE, |
1133 | TREE_COL_RECORD_TYPE, 1, | 1252 | GNS_TREESTORE_COL_RECORD_TYPE, 1, |
1134 | TREE_COL_IS_RECORD_ROW, GNUNET_NO, | 1253 | GNS_TREESTORE_COL_IS_RECORD_ROW, GNUNET_NO, |
1135 | TREE_COL_NOT_DUMMY_ROW, GNUNET_NO, | 1254 | GNS_TREESTORE_COL_NOT_DUMMY_ROW, GNUNET_NO, |
1136 | -1); | 1255 | -1); |
1137 | 1256 | ||
1138 | zc_ctx = GNUNET_malloc (sizeof (struct ZoneIteration_Context)); | 1257 | zc_ctx = GNUNET_malloc (sizeof (struct ZoneIteration_Context)); |