aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-12-23 08:38:28 +0000
committerChristian Grothoff <christian@grothoff.org>2011-12-23 08:38:28 +0000
commita0ea6b8725b4399a9a9e3b906fe1bebf9f633b02 (patch)
tree49028d12d0c00ea9ed5b5b4f29abcd1c4076d8a2
parentc4cbcde4ee0e49a9594a5016bef26f9dff443ef2 (diff)
downloadgnunet-gtk-a0ea6b8725b4399a9a9e3b906fe1bebf9f633b02.tar.gz
gnunet-gtk-a0ea6b8725b4399a9a9e3b906fe1bebf9f633b02.zip
LRN: #1759: get rid of gtk_dialog_run
-rw-r--r--contrib/gnunet_fs_gtk_create_namespace_dialog.glade19
-rw-r--r--contrib/gnunet_fs_gtk_main_window.glade2090
-rw-r--r--contrib/gnunet_fs_gtk_open_directory_dialog.glade18
-rw-r--r--contrib/gnunet_fs_gtk_select_pseudonym_dialog.glade111
-rw-r--r--src/fs/gnunet-fs-gtk-download.c2
-rw-r--r--src/fs/gnunet-fs-gtk-edit_publish_dialog.c1074
-rw-r--r--src/fs/gnunet-fs-gtk-edit_publish_dialog.h16
-rw-r--r--src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c631
-rw-r--r--src/fs/gnunet-fs-gtk-main_window_create_pseudonym.c49
-rw-r--r--src/fs/gnunet-fs-gtk-main_window_file_publish.c516
-rw-r--r--src/fs/gnunet-fs-gtk-main_window_open_directory.c50
-rw-r--r--src/fs/gnunet-fs-gtk.c34
-rw-r--r--src/fs/gnunet-fs-gtk.h13
13 files changed, 3385 insertions, 1238 deletions
diff --git a/contrib/gnunet_fs_gtk_create_namespace_dialog.glade b/contrib/gnunet_fs_gtk_create_namespace_dialog.glade
index 025d41c4..3557705e 100644
--- a/contrib/gnunet_fs_gtk_create_namespace_dialog.glade
+++ b/contrib/gnunet_fs_gtk_create_namespace_dialog.glade
@@ -4,6 +4,7 @@
4 <!-- interface-naming-policy project-wide --> 4 <!-- interface-naming-policy project-wide -->
5 <object class="GtkDialog" id="GNUNET_GTK_create_namespace_dialog"> 5 <object class="GtkDialog" id="GNUNET_GTK_create_namespace_dialog">
6 <property name="visible">True</property> 6 <property name="visible">True</property>
7 <property name="can_focus">False</property>
7 <property name="can_default">True</property> 8 <property name="can_default">True</property>
8 <property name="border_width">5</property> 9 <property name="border_width">5</property>
9 <property name="title" translatable="yes">Create namespace</property> 10 <property name="title" translatable="yes">Create namespace</property>
@@ -13,17 +14,20 @@
13 <property name="icon_name">folder-new</property> 14 <property name="icon_name">folder-new</property>
14 <property name="type_hint">dialog</property> 15 <property name="type_hint">dialog</property>
15 <property name="skip_taskbar_hint">True</property> 16 <property name="skip_taskbar_hint">True</property>
16 <property name="has_separator">False</property> 17 <signal name="response" handler="GNUNET_GTK_create_namespace_dialog_response_cb" swapped="no"/>
17 <child internal-child="vbox"> 18 <child internal-child="vbox">
18 <object class="GtkVBox" id="GNUNET_GTK_create_namespace_vbox"> 19 <object class="GtkVBox" id="GNUNET_GTK_create_namespace_vbox">
19 <property name="visible">True</property> 20 <property name="visible">True</property>
21 <property name="can_focus">False</property>
20 <property name="spacing">2</property> 22 <property name="spacing">2</property>
21 <child> 23 <child>
22 <object class="GtkHBox" id="GNUNET_GTK_create_namespace_value_hbox"> 24 <object class="GtkHBox" id="GNUNET_GTK_create_namespace_value_hbox">
23 <property name="visible">True</property> 25 <property name="visible">True</property>
26 <property name="can_focus">False</property>
24 <child> 27 <child>
25 <object class="GtkLabel" id="GNUNET_GTK_create_namespace_name_label"> 28 <object class="GtkLabel" id="GNUNET_GTK_create_namespace_name_label">
26 <property name="visible">True</property> 29 <property name="visible">True</property>
30 <property name="can_focus">False</property>
27 <property name="label" translatable="yes">_Name:</property> 31 <property name="label" translatable="yes">_Name:</property>
28 <property name="use_underline">True</property> 32 <property name="use_underline">True</property>
29 </object> 33 </object>
@@ -40,8 +44,14 @@
40 <property name="can_focus">True</property> 44 <property name="can_focus">True</property>
41 <property name="invisible_char">●</property> 45 <property name="invisible_char">●</property>
42 <property name="activates_default">True</property> 46 <property name="activates_default">True</property>
47 <property name="primary_icon_activatable">False</property>
48 <property name="secondary_icon_activatable">False</property>
49 <property name="primary_icon_sensitive">True</property>
50 <property name="secondary_icon_sensitive">True</property>
43 </object> 51 </object>
44 <packing> 52 <packing>
53 <property name="expand">True</property>
54 <property name="fill">True</property>
45 <property name="position">1</property> 55 <property name="position">1</property>
46 </packing> 56 </packing>
47 </child> 57 </child>
@@ -56,14 +66,15 @@
56 <child internal-child="action_area"> 66 <child internal-child="action_area">
57 <object class="GtkHButtonBox" id="GNUNET_GTK_create_namespace_dialog-action_area"> 67 <object class="GtkHButtonBox" id="GNUNET_GTK_create_namespace_dialog-action_area">
58 <property name="visible">True</property> 68 <property name="visible">True</property>
69 <property name="can_focus">False</property>
59 <property name="layout_style">end</property> 70 <property name="layout_style">end</property>
60 <child> 71 <child>
61 <object class="GtkButton" id="GNUNET_GTK_create_namespace_cancel_button"> 72 <object class="GtkButton" id="GNUNET_GTK_create_namespace_cancel_button">
62 <property name="label">gtk-cancel</property> 73 <property name="label">gtk-cancel</property>
74 <property name="use_action_appearance">False</property>
63 <property name="visible">True</property> 75 <property name="visible">True</property>
64 <property name="can_focus">True</property> 76 <property name="can_focus">True</property>
65 <property name="receives_default">True</property> 77 <property name="receives_default">True</property>
66 <property name="use_action_appearance">False</property>
67 <property name="use_stock">True</property> 78 <property name="use_stock">True</property>
68 </object> 79 </object>
69 <packing> 80 <packing>
@@ -75,12 +86,12 @@
75 <child> 86 <child>
76 <object class="GtkButton" id="GNUNET_GTK_create_namespace_ok_button"> 87 <object class="GtkButton" id="GNUNET_GTK_create_namespace_ok_button">
77 <property name="label">gtk-ok</property> 88 <property name="label">gtk-ok</property>
89 <property name="use_action_appearance">False</property>
78 <property name="visible">True</property> 90 <property name="visible">True</property>
79 <property name="can_focus">True</property> 91 <property name="can_focus">True</property>
80 <property name="can_default">True</property> 92 <property name="can_default">True</property>
81 <property name="has_default">True</property> 93 <property name="has_default">True</property>
82 <property name="receives_default">True</property> 94 <property name="receives_default">True</property>
83 <property name="use_action_appearance">False</property>
84 <property name="use_stock">True</property> 95 <property name="use_stock">True</property>
85 </object> 96 </object>
86 <packing> 97 <packing>
@@ -92,6 +103,8 @@
92 </object> 103 </object>
93 <packing> 104 <packing>
94 <property name="expand">False</property> 105 <property name="expand">False</property>
106 <property name="fill">True</property>
107 <property name="pack_type">end</property>
95 <property name="position">1</property> 108 <property name="position">1</property>
96 </packing> 109 </packing>
97 </child> 110 </child>
diff --git a/contrib/gnunet_fs_gtk_main_window.glade b/contrib/gnunet_fs_gtk_main_window.glade
index d8b4d108..2a5c4f51 100644
--- a/contrib/gnunet_fs_gtk_main_window.glade
+++ b/contrib/gnunet_fs_gtk_main_window.glade
@@ -2,6 +2,823 @@
2<interface> 2<interface>
3 <requires lib="gtk+" version="2.20"/> 3 <requires lib="gtk+" version="2.20"/>
4 <!-- interface-naming-policy project-wide --> 4 <!-- interface-naming-policy project-wide -->
5 <object class="GtkAdjustment" id="GNUNET_GTK_edit_publication_metadata_preview_image_horizontal_adjustment">
6 <property name="upper">100</property>
7 <property name="step_increment">1</property>
8 <property name="page_increment">10</property>
9 </object>
10 <object class="GtkAdjustment" id="GNUNET_GTK_edit_publication_metadata_preview_image_verticall_adjustment">
11 <property name="upper">100</property>
12 <property name="step_increment">1</property>
13 <property name="page_increment">10</property>
14 </object>
15 <object class="GtkWindow" id="GNUNET_GTK_edit_publication_window">
16 <property name="can_focus">False</property>
17 <property name="border_width">4</property>
18 <property name="modal">True</property>
19 <property name="window_position">center-on-parent</property>
20 <property name="destroy_with_parent">True</property>
21 <property name="skip_taskbar_hint">True</property>
22 <property name="skip_pager_hint">True</property>
23 <property name="deletable">False</property>
24 <property name="transient_for">GNUNET_GTK_main_window</property>
25 <signal name="realize" handler="GNUNET_GTK_edit_publication_window_realize_cb" swapped="no"/>
26 <child>
27 <object class="GtkVBox" id="GNUNET_GTK_edit_publication_master_vbox">
28 <property name="visible">True</property>
29 <property name="can_focus">False</property>
30 <property name="spacing">2</property>
31 <child>
32 <object class="GtkVPaned" id="GNUNET_GTK_edit_publication_main_vpaned">
33 <property name="visible">True</property>
34 <property name="can_focus">True</property>
35 <child>
36 <object class="GtkHPaned" id="GNUNET_GTK_edit_publication_top_hpaned">
37 <property name="visible">True</property>
38 <property name="can_focus">True</property>
39 <property name="position_set">True</property>
40 <child>
41 <object class="GtkVBox" id="GNUNET_GTK_edit_publication_metadata_vbox">
42 <property name="visible">True</property>
43 <property name="can_focus">False</property>
44 <property name="spacing">5</property>
45 <child>
46 <object class="GtkHBox" id="GNUNET_GTK_edit_publication_hbox">
47 <property name="visible">True</property>
48 <property name="can_focus">False</property>
49 <child>
50 <object class="GtkLabel" id="GNUNET_GTK_edit_publication_type_label">
51 <property name="visible">True</property>
52 <property name="can_focus">False</property>
53 <property name="label" translatable="yes">_Publication type:</property>
54 <property name="use_underline">True</property>
55 </object>
56 <packing>
57 <property name="expand">False</property>
58 <property name="fill">False</property>
59 <property name="position">0</property>
60 </packing>
61 </child>
62 <child>
63 <object class="GtkComboBox" id="_GNUNET_GTK_edit_publication_type_combo">
64 <property name="visible">True</property>
65 <property name="can_focus">False</property>
66 <property name="model">GNUNET_GTK_publication_types_liststore</property>
67 <property name="active">0</property>
68 <child>
69 <object class="GtkCellRendererText" id="cellrenderertext2"/>
70 <attributes>
71 <attribute name="text">1</attribute>
72 </attributes>
73 </child>
74 </object>
75 <packing>
76 <property name="expand">False</property>
77 <property name="fill">False</property>
78 <property name="position">1</property>
79 </packing>
80 </child>
81 <child>
82 <object class="GtkButton" id="GNUNET_GTK_edit_publication_add_button">
83 <property name="label">gtk-add</property>
84 <property name="use_action_appearance">False</property>
85 <property name="visible">True</property>
86 <property name="can_focus">True</property>
87 <property name="receives_default">True</property>
88 <property name="use_stock">True</property>
89 <signal name="clicked" handler="GNUNET_GTK_edit_publication_add_button_clicked_cb" swapped="no"/>
90 </object>
91 <packing>
92 <property name="expand">False</property>
93 <property name="fill">False</property>
94 <property name="position">2</property>
95 </packing>
96 </child>
97 <child>
98 <object class="GtkButton" id="GNUNET_GTK_edit_publication_delete_button">
99 <property name="label">gtk-delete</property>
100 <property name="use_action_appearance">False</property>
101 <property name="visible">True</property>
102 <property name="sensitive">False</property>
103 <property name="can_focus">True</property>
104 <property name="receives_default">True</property>
105 <property name="use_stock">True</property>
106 <signal name="clicked" handler="GNUNET_GTK_edit_publication_delete_button_clicked_cb" swapped="no"/>
107 </object>
108 <packing>
109 <property name="expand">False</property>
110 <property name="fill">False</property>
111 <property name="padding">5</property>
112 <property name="position">3</property>
113 </packing>
114 </child>
115 </object>
116 <packing>
117 <property name="expand">False</property>
118 <property name="fill">False</property>
119 <property name="position">0</property>
120 </packing>
121 </child>
122 <child>
123 <object class="GtkScrolledWindow" id="GNUNET_GTK_edit_publication_metadata_scrolled_window">
124 <property name="width_request">400</property>
125 <property name="height_request">120</property>
126 <property name="visible">True</property>
127 <property name="can_focus">True</property>
128 <property name="hscrollbar_policy">automatic</property>
129 <property name="vscrollbar_policy">automatic</property>
130 <property name="shadow_type">in</property>
131 <child>
132 <object class="GtkTreeView" id="GNUNET_GTK_edit_publication_metadata_tree_view">
133 <property name="visible">True</property>
134 <property name="can_focus">True</property>
135 <property name="model">GNUNET_GTK_publication_metadata_liststore</property>
136 <property name="enable_search">False</property>
137 <property name="search_column">0</property>
138 <property name="tooltip_column">4</property>
139 <child>
140 <object class="GtkTreeViewColumn" id="GNUNET_GTK_edit_publication_metadata_tree_view_type_column">
141 <property name="resizable">True</property>
142 <property name="title" translatable="yes">Type</property>
143 <property name="clickable">True</property>
144 <property name="sort_column_id">1</property>
145 <child>
146 <object class="GtkCellRendererCombo" id="GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer">
147 <property name="editable">True</property>
148 <property name="has_entry">False</property>
149 <property name="model">GNUNET_GTK_publication_metadata_types_liststore</property>
150 <property name="text_column">2</property>
151 <signal name="changed" handler="GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_changed_cb" swapped="no"/>
152 <signal name="edited" handler="GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_edited_cb" swapped="no"/>
153 </object>
154 <attributes>
155 <attribute name="text">2</attribute>
156 </attributes>
157 </child>
158 </object>
159 </child>
160 <child>
161 <object class="GtkTreeViewColumn" id="GNUNET_GTK_edit_publication_metadata_tree_view_description_column">
162 <property name="sizing">autosize</property>
163 <property name="title" translatable="yes">Value</property>
164 <property name="expand">True</property>
165 <property name="clickable">True</property>
166 <property name="sort_column_id">2</property>
167 <child>
168 <object class="GtkCellRendererText" id="GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer">
169 <property name="editable">True</property>
170 <signal name="edited" handler="GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer_edited_cb" swapped="no"/>
171 </object>
172 <attributes>
173 <attribute name="text">3</attribute>
174 </attributes>
175 </child>
176 </object>
177 </child>
178 </object>
179 </child>
180 </object>
181 <packing>
182 <property name="expand">True</property>
183 <property name="fill">True</property>
184 <property name="position">1</property>
185 </packing>
186 </child>
187 </object>
188 <packing>
189 <property name="resize">True</property>
190 <property name="shrink">False</property>
191 </packing>
192 </child>
193 <child>
194 <object class="GtkFrame" id="GNUNET_GTK_edit_publication_metadata_preview_frame">
195 <property name="visible">True</property>
196 <property name="can_focus">False</property>
197 <property name="label_xalign">0</property>
198 <child>
199 <object class="GtkAlignment" id="GNUNET_GTK_edit_publication_metadata_preview_alignment">
200 <property name="visible">True</property>
201 <property name="can_focus">False</property>
202 <property name="left_padding">12</property>
203 <child>
204 <object class="GtkVBox" id="GNUNET_GTK_edit_publication_metadata_preview_vbox">
205 <property name="visible">True</property>
206 <property name="can_focus">False</property>
207 <child>
208 <object class="GtkFileChooserButton" id="GNUNET_GTK_edit_publication_metadata_preview_file_chooser_button">
209 <property name="visible">True</property>
210 <property name="can_focus">True</property>
211 <property name="create_folders">False</property>
212 <property name="title" translatable="yes">Select file</property>
213 <signal name="file-set" handler="GNUNET_GTK_edit_publication_metadata_preview_file_chooser_button_file_set_cb" swapped="no"/>
214 </object>
215 <packing>
216 <property name="expand">False</property>
217 <property name="fill">False</property>
218 <property name="position">0</property>
219 </packing>
220 </child>
221 <child>
222 <object class="GtkScrolledWindow" id="GNUNET_GTK_edit_publication_metadata_preview_image_scrolled_window">
223 <property name="visible">True</property>
224 <property name="can_focus">True</property>
225 <property name="hadjustment">GNUNET_GTK_edit_publication_metadata_preview_image_horizontal_adjustment</property>
226 <property name="vadjustment">GNUNET_GTK_edit_publication_metadata_preview_image_verticall_adjustment</property>
227 <property name="hscrollbar_policy">automatic</property>
228 <property name="vscrollbar_policy">automatic</property>
229 <child>
230 <object class="GtkViewport" id="GNUNET_GTK_edit_publication_metadata_preview_image_viewport">
231 <property name="visible">True</property>
232 <property name="can_focus">False</property>
233 <property name="hadjustment">GNUNET_GTK_edit_publication_metadata_preview_image_horizontal_adjustment</property>
234 <property name="vadjustment">GNUNET_GTK_edit_publication_metadata_preview_image_verticall_adjustment</property>
235 <property name="shadow_type">none</property>
236 <child>
237 <object class="GtkImage" id="GNUNET_GTK_edit_publication_metadata_preview_image">
238 <property name="can_focus">False</property>
239 <property name="stock">gtk-missing-image</property>
240 </object>
241 </child>
242 </object>
243 </child>
244 </object>
245 <packing>
246 <property name="expand">True</property>
247 <property name="fill">True</property>
248 <property name="position">1</property>
249 </packing>
250 </child>
251 </object>
252 </child>
253 </object>
254 </child>
255 <child type="label">
256 <object class="GtkLabel" id="label1">
257 <property name="visible">True</property>
258 <property name="can_focus">False</property>
259 <property name="label" translatable="yes">Preview:</property>
260 <property name="use_markup">True</property>
261 </object>
262 </child>
263 </object>
264 <packing>
265 <property name="resize">True</property>
266 <property name="shrink">False</property>
267 </packing>
268 </child>
269 </object>
270 <packing>
271 <property name="resize">True</property>
272 <property name="shrink">False</property>
273 </packing>
274 </child>
275 <child>
276 <object class="GtkHBox" id="GNUNET_GTK_edit_publication_secondary_hbox">
277 <property name="visible">True</property>
278 <property name="can_focus">False</property>
279 <child>
280 <object class="GtkHBox" id="GNUNET_GTK_edit_publication_keyword_list_hbox">
281 <property name="visible">True</property>
282 <property name="can_focus">False</property>
283 <child>
284 <object class="GtkVBox" id="vbox2">
285 <property name="visible">True</property>
286 <property name="can_focus">False</property>
287 <child>
288 <object class="GtkHBox" id="hbox3">
289 <property name="visible">True</property>
290 <property name="can_focus">False</property>
291 <child>
292 <object class="GtkLabel" id="GNUNET_GTK_edit_publication_keyword_label">
293 <property name="visible">True</property>
294 <property name="can_focus">False</property>
295 <property name="label" translatable="yes">_Keyword:</property>
296 <property name="use_underline">True</property>
297 <property name="mnemonic_widget">GNUNET_GTK_edit_publication_keyword_entry</property>
298 </object>
299 <packing>
300 <property name="expand">False</property>
301 <property name="fill">False</property>
302 <property name="position">0</property>
303 </packing>
304 </child>
305 <child>
306 <object class="GtkEntry" id="GNUNET_GTK_edit_publication_keyword_entry">
307 <property name="visible">True</property>
308 <property name="can_focus">True</property>
309 <property name="invisible_char">●</property>
310 <property name="invisible_char_set">True</property>
311 <property name="caps_lock_warning">False</property>
312 <property name="primary_icon_activatable">False</property>
313 <property name="secondary_icon_activatable">False</property>
314 <property name="primary_icon_sensitive">True</property>
315 <property name="secondary_icon_sensitive">True</property>
316 <signal name="key-press-event" handler="GNUNET_GTK_edit_publication_keyword_entry_key_press_event_cb" swapped="no"/>
317 </object>
318 <packing>
319 <property name="expand">True</property>
320 <property name="fill">True</property>
321 <property name="position">1</property>
322 </packing>
323 </child>
324 </object>
325 <packing>
326 <property name="expand">False</property>
327 <property name="fill">True</property>
328 <property name="position">0</property>
329 </packing>
330 </child>
331 <child>
332 <object class="GtkScrolledWindow" id="GNUNET_GTK_edit_publication_keyword_scrolled_window">
333 <property name="width_request">400</property>
334 <property name="height_request">120</property>
335 <property name="visible">True</property>
336 <property name="can_focus">True</property>
337 <property name="hscrollbar_policy">never</property>
338 <property name="vscrollbar_policy">automatic</property>
339 <property name="shadow_type">in</property>
340 <child>
341 <object class="GtkTreeView" id="GNUNET_GTK_edit_publication_keyword_list_tree_view">
342 <property name="visible">True</property>
343 <property name="can_focus">True</property>
344 <property name="model">GNUNET_GTK_publication_keywords_liststore</property>
345 <property name="search_column">0</property>
346 <child>
347 <object class="GtkTreeViewColumn" id="GNUNET_GTK_edit_publication_keyword_list_tree_view_column">
348 <property name="title" translatable="yes">Keywords</property>
349 <property name="clickable">True</property>
350 <property name="reorderable">True</property>
351 <property name="sort_column_id">0</property>
352 <child>
353 <object class="GtkCellRendererText" id="GNUNET_GTK_edit_publication_keyword_list_tree_view_renderer"/>
354 <attributes>
355 <attribute name="text">0</attribute>
356 </attributes>
357 </child>
358 </object>
359 </child>
360 </object>
361 </child>
362 </object>
363 <packing>
364 <property name="expand">True</property>
365 <property name="fill">True</property>
366 <property name="position">1</property>
367 </packing>
368 </child>
369 <child>
370 <object class="GtkCheckButton" id="GNUNET_GTK_edit_publication_normalization_checkbox">
371 <property name="label" translatable="yes">Normalize all keywords a_utomatically after "OK" is pressed</property>
372 <property name="use_action_appearance">False</property>
373 <property name="sensitive">False</property>
374 <property name="can_focus">True</property>
375 <property name="receives_default">False</property>
376 <property name="use_underline">True</property>
377 <property name="draw_indicator">True</property>
378 <signal name="toggled" handler="GNUNET_GTK_edit_publication_normalization_checkbox_toggled_cb" swapped="no"/>
379 </object>
380 <packing>
381 <property name="expand">False</property>
382 <property name="fill">False</property>
383 <property name="position">2</property>
384 </packing>
385 </child>
386 </object>
387 <packing>
388 <property name="expand">True</property>
389 <property name="fill">True</property>
390 <property name="position">0</property>
391 </packing>
392 </child>
393 <child>
394 <object class="GtkVBox" id="GNUNET_GTK_edit_publication_keyword_list_button_vbox">
395 <property name="visible">True</property>
396 <property name="can_focus">False</property>
397 <child>
398 <object class="GtkButton" id="GNUNET_GTK_edit_publication_keyword_list_add_button">
399 <property name="label">Add key_word</property>
400 <property name="use_action_appearance">False</property>
401 <property name="visible">True</property>
402 <property name="can_focus">True</property>
403 <property name="receives_default">True</property>
404 <property name="image">add_stock_image</property>
405 <property name="use_underline">True</property>
406 <signal name="clicked" handler="GNUNET_GTK_edit_publication_keyword_list_add_button_clicked_cb" swapped="no"/>
407 </object>
408 <packing>
409 <property name="expand">False</property>
410 <property name="fill">False</property>
411 <property name="position">0</property>
412 </packing>
413 </child>
414 <child>
415 <object class="GtkButton" id="GNUNET_GTK_edit_publication_keyword_list_normalize_button">
416 <property name="label" translatable="yes">_Normalize selected</property>
417 <property name="use_action_appearance">False</property>
418 <property name="sensitive">False</property>
419 <property name="can_focus">True</property>
420 <property name="receives_default">True</property>
421 <property name="use_underline">True</property>
422 <signal name="clicked" handler="GNUNET_GTK_edit_publication_keyword_list_normalize_button_clicked_cb" swapped="no"/>
423 </object>
424 <packing>
425 <property name="expand">False</property>
426 <property name="fill">False</property>
427 <property name="pack_type">end</property>
428 <property name="position">0</property>
429 </packing>
430 </child>
431 <child>
432 <object class="GtkButton" id="GNUNET_GTK_edit_publication_keyword_list_del_button">
433 <property name="label">Delete _selected</property>
434 <property name="use_action_appearance">False</property>
435 <property name="visible">True</property>
436 <property name="sensitive">False</property>
437 <property name="can_focus">True</property>
438 <property name="receives_default">True</property>
439 <property name="use_underline">True</property>
440 <signal name="clicked" handler="GNUNET_GTK_edit_publication_keyword_list_del_button_clicked_cb" swapped="no"/>
441 </object>
442 <packing>
443 <property name="expand">False</property>
444 <property name="fill">False</property>
445 <property name="padding">5</property>
446 <property name="pack_type">end</property>
447 <property name="position">1</property>
448 </packing>
449 </child>
450 </object>
451 <packing>
452 <property name="expand">False</property>
453 <property name="fill">False</property>
454 <property name="padding">5</property>
455 <property name="position">1</property>
456 </packing>
457 </child>
458 </object>
459 <packing>
460 <property name="expand">True</property>
461 <property name="fill">True</property>
462 <property name="padding">4</property>
463 <property name="position">0</property>
464 </packing>
465 </child>
466 <child>
467 <object class="GtkFrame" id="frame3">
468 <property name="visible">True</property>
469 <property name="can_focus">False</property>
470 <property name="label_xalign">0</property>
471 <child>
472 <object class="GtkAlignment" id="alignment3">
473 <property name="visible">True</property>
474 <property name="can_focus">False</property>
475 <property name="yalign">0</property>
476 <property name="yscale">0</property>
477 <property name="left_padding">4</property>
478 <property name="right_padding">4</property>
479 <child>
480 <object class="GtkVBox" id="GNUNET_GTK_edit_publication_misc_vbox">
481 <property name="visible">True</property>
482 <property name="can_focus">False</property>
483 <child>
484 <object class="GtkHBox" id="GNUNET_GTK_edit_publication_anonymity_hbox">
485 <property name="visible">True</property>
486 <property name="can_focus">False</property>
487 <child>
488 <object class="GtkLabel" id="GNUNET_GTK_edit_publication_anonymity_label">
489 <property name="visible">True</property>
490 <property name="can_focus">False</property>
491 <property name="xalign">1</property>
492 <property name="label" translatable="yes">A_nonymity:</property>
493 <property name="use_underline">True</property>
494 </object>
495 <packing>
496 <property name="expand">False</property>
497 <property name="fill">False</property>
498 <property name="padding">5</property>
499 <property name="position">0</property>
500 </packing>
501 </child>
502 <child>
503 <object class="GtkAlignment" id="GNUNET_GTK_edit_publication_anonymity_combobox_alignment">
504 <property name="visible">True</property>
505 <property name="can_focus">False</property>
506 <property name="yscale">0</property>
507 <child>
508 <object class="GtkComboBox" id="GNUNET_GTK_edit_publication_anonymity_combobox">
509 <property name="visible">True</property>
510 <property name="can_focus">False</property>
511 <property name="model">main_window_search_anonymity_liststore</property>
512 <property name="active">1</property>
513 <child>
514 <object class="GtkCellRendererText" id="GNUNET_GTK_edit_publication_anonymity_combobox_renderer"/>
515 <attributes>
516 <attribute name="foreground">2</attribute>
517 <attribute name="text">0</attribute>
518 </attributes>
519 </child>
520 <child>
521 <object class="GtkCellRendererText" id="GNUNET_GTK_edit_publication_anonymity_combobox_renerer_level"/>
522 <attributes>
523 <attribute name="text">1</attribute>
524 </attributes>
525 </child>
526 </object>
527 </child>
528 </object>
529 <packing>
530 <property name="expand">False</property>
531 <property name="fill">False</property>
532 <property name="position">1</property>
533 </packing>
534 </child>
535 </object>
536 <packing>
537 <property name="expand">False</property>
538 <property name="fill">False</property>
539 <property name="position">0</property>
540 </packing>
541 </child>
542 <child>
543 <object class="GtkHBox" id="GNUNET_GTK_edit_publication_priority_hbox">
544 <property name="visible">True</property>
545 <property name="can_focus">False</property>
546 <child>
547 <object class="GtkLabel" id="GNUNET_GTK_edit_publication_priority_label">
548 <property name="visible">True</property>
549 <property name="can_focus">False</property>
550 <property name="xalign">1</property>
551 <property name="label" translatable="yes">_Priority:</property>
552 <property name="use_underline">True</property>
553 </object>
554 <packing>
555 <property name="expand">False</property>
556 <property name="fill">False</property>
557 <property name="padding">5</property>
558 <property name="position">0</property>
559 </packing>
560 </child>
561 <child>
562 <object class="GtkSpinButton" id="GNUNET_GTK_edit_publication_priority_spin_button">
563 <property name="visible">True</property>
564 <property name="can_focus">True</property>
565 <property name="invisible_char">●</property>
566 <property name="invisible_char_set">True</property>
567 <property name="primary_icon_activatable">False</property>
568 <property name="secondary_icon_activatable">False</property>
569 <property name="primary_icon_sensitive">True</property>
570 <property name="secondary_icon_sensitive">True</property>
571 <property name="adjustment">priority_adjustment</property>
572 <property name="numeric">True</property>
573 </object>
574 <packing>
575 <property name="expand">False</property>
576 <property name="fill">False</property>
577 <property name="position">1</property>
578 </packing>
579 </child>
580 </object>
581 <packing>
582 <property name="expand">False</property>
583 <property name="fill">False</property>
584 <property name="position">1</property>
585 </packing>
586 </child>
587 <child>
588 <object class="GtkHBox" id="GNUNET_GTK_edit_publication_root_hbox">
589 <property name="visible">True</property>
590 <property name="can_focus">False</property>
591 <child>
592 <object class="GtkLabel" id="GNUNET_GTK_edit_publication_root_label">
593 <property name="visible">True</property>
594 <property name="can_focus">False</property>
595 <property name="xalign">1</property>
596 <property name="label" translatable="yes">_Root keyword:</property>
597 <property name="use_underline">True</property>
598 </object>
599 <packing>
600 <property name="expand">False</property>
601 <property name="fill">False</property>
602 <property name="padding">5</property>
603 <property name="position">0</property>
604 </packing>
605 </child>
606 <child>
607 <object class="GtkEntry" id="GNUNET_GTK_edit_publication_root_entry">
608 <property name="visible">True</property>
609 <property name="can_focus">True</property>
610 <property name="invisible_char">•</property>
611 <property name="text">root</property>
612 <property name="invisible_char_set">True</property>
613 <property name="primary_icon_activatable">False</property>
614 <property name="secondary_icon_activatable">False</property>
615 <property name="primary_icon_sensitive">True</property>
616 <property name="secondary_icon_sensitive">True</property>
617 </object>
618 <packing>
619 <property name="expand">False</property>
620 <property name="fill">False</property>
621 <property name="position">1</property>
622 </packing>
623 </child>
624 </object>
625 <packing>
626 <property name="expand">False</property>
627 <property name="fill">False</property>
628 <property name="position">2</property>
629 </packing>
630 </child>
631 <child>
632 <object class="GtkHBox" id="hbox4">
633 <property name="visible">True</property>
634 <property name="can_focus">False</property>
635 <child>
636 <object class="GtkLabel" id="GNUNET_GTK_edit_publication_expiration_label">
637 <property name="visible">True</property>
638 <property name="can_focus">False</property>
639 <property name="xalign">1</property>
640 <property name="label" translatable="yes">_Expriation year:</property>
641 <property name="use_underline">True</property>
642 </object>
643 <packing>
644 <property name="expand">False</property>
645 <property name="fill">False</property>
646 <property name="padding">5</property>
647 <property name="position">0</property>
648 </packing>
649 </child>
650 <child>
651 <object class="GtkSpinButton" id="GNUNET_GTK_edit_publication_expiration_year_spin_button">
652 <property name="visible">True</property>
653 <property name="can_focus">True</property>
654 <property name="max_length">4</property>
655 <property name="invisible_char">•</property>
656 <property name="invisible_char_set">True</property>
657 <property name="primary_icon_activatable">False</property>
658 <property name="secondary_icon_activatable">False</property>
659 <property name="primary_icon_sensitive">True</property>
660 <property name="secondary_icon_sensitive">True</property>
661 <property name="adjustment">expiration_year_adjustment</property>
662 <property name="climb_rate">1</property>
663 <property name="numeric">True</property>
664 </object>
665 <packing>
666 <property name="expand">False</property>
667 <property name="fill">False</property>
668 <property name="position">1</property>
669 </packing>
670 </child>
671 </object>
672 <packing>
673 <property name="expand">False</property>
674 <property name="fill">False</property>
675 <property name="position">3</property>
676 </packing>
677 </child>
678 <child>
679 <object class="GtkHBox" id="GNUNET_GTK_edit_publication_index_hbox">
680 <property name="visible">True</property>
681 <property name="can_focus">False</property>
682 <child>
683 <object class="GtkLabel" id="GNUNET_GTK_edit_publication_index_label">
684 <property name="visible">True</property>
685 <property name="can_focus">False</property>
686 <property name="xalign">1</property>
687 <property name="label" translatable="yes">_Index file:</property>
688 <property name="use_underline">True</property>
689 <property name="mnemonic_widget">GNUNET_GTK_edit_publication_index_checkbutton</property>
690 </object>
691 <packing>
692 <property name="expand">False</property>
693 <property name="fill">False</property>
694 <property name="padding">5</property>
695 <property name="position">0</property>
696 </packing>
697 </child>
698 <child>
699 <object class="GtkCheckButton" id="GNUNET_GTK_edit_publication_index_checkbutton">
700 <property name="use_action_appearance">False</property>
701 <property name="visible">True</property>
702 <property name="can_focus">True</property>
703 <property name="receives_default">False</property>
704 <property name="draw_indicator">True</property>
705 </object>
706 <packing>
707 <property name="expand">False</property>
708 <property name="fill">False</property>
709 <property name="position">1</property>
710 </packing>
711 </child>
712 </object>
713 <packing>
714 <property name="expand">True</property>
715 <property name="fill">True</property>
716 <property name="position">4</property>
717 </packing>
718 </child>
719 </object>
720 </child>
721 </object>
722 </child>
723 <child type="label">
724 <object class="GtkLabel" id="label2">
725 <property name="visible">True</property>
726 <property name="can_focus">False</property>
727 <property name="label" translatable="yes">Publication options:</property>
728 <property name="use_markup">True</property>
729 </object>
730 </child>
731 </object>
732 <packing>
733 <property name="expand">False</property>
734 <property name="fill">False</property>
735 <property name="position">1</property>
736 </packing>
737 </child>
738 </object>
739 <packing>
740 <property name="resize">True</property>
741 <property name="shrink">False</property>
742 </packing>
743 </child>
744 </object>
745 <packing>
746 <property name="expand">True</property>
747 <property name="fill">True</property>
748 <property name="position">0</property>
749 </packing>
750 </child>
751 <child>
752 <object class="GtkHBox" id="GNUNET_GTK_edit_publication_buttons_hbox">
753 <property name="visible">True</property>
754 <property name="can_focus">False</property>
755 <child>
756 <object class="GtkButton" id="GNUNET_GTK_edit_publication_confirm_button">
757 <property name="label">gtk-ok</property>
758 <property name="use_action_appearance">False</property>
759 <property name="visible">True</property>
760 <property name="sensitive">False</property>
761 <property name="can_focus">True</property>
762 <property name="can_default">True</property>
763 <property name="has_default">True</property>
764 <property name="receives_default">True</property>
765 <property name="use_stock">True</property>
766 <signal name="clicked" handler="GNUNET_GTK_edit_publication_confirm_button_clicked_cb" swapped="no"/>
767 </object>
768 <packing>
769 <property name="expand">False</property>
770 <property name="fill">False</property>
771 <property name="padding">4</property>
772 <property name="pack_type">end</property>
773 <property name="position">0</property>
774 </packing>
775 </child>
776 <child>
777 <object class="GtkButton" id="GNUNET_GTK_edit_publication_cancel_button">
778 <property name="label">gtk-cancel</property>
779 <property name="use_action_appearance">False</property>
780 <property name="visible">True</property>
781 <property name="can_focus">True</property>
782 <property name="receives_default">True</property>
783 <property name="use_stock">True</property>
784 <signal name="clicked" handler="GNUNET_GTK_edit_publication_cancel_button_clicked_cb" swapped="no"/>
785 </object>
786 <packing>
787 <property name="expand">False</property>
788 <property name="fill">False</property>
789 <property name="padding">4</property>
790 <property name="pack_type">end</property>
791 <property name="position">1</property>
792 </packing>
793 </child>
794 </object>
795 <packing>
796 <property name="expand">False</property>
797 <property name="fill">False</property>
798 <property name="padding">1</property>
799 <property name="pack_type">end</property>
800 <property name="position">1</property>
801 </packing>
802 </child>
803 </object>
804 </child>
805 </object>
806 <object class="GtkTreeStore" id="GNUNET_GTK_file_sharing_publishing_tree_store">
807 <columns>
808 <!-- column-name filesize -->
809 <column type="gchararray"/>
810 <!-- column-name do_index -->
811 <column type="gboolean"/>
812 <!-- column-name filename -->
813 <column type="gchararray"/>
814 <!-- column-name anonymity_level -->
815 <column type="guint"/>
816 <!-- column-name priority -->
817 <column type="guint"/>
818 <!-- column-name file_information_struct -->
819 <column type="gpointer"/>
820 </columns>
821 </object>
5 <object class="GtkWindow" id="GNUNET_GTK_main_window"> 822 <object class="GtkWindow" id="GNUNET_GTK_main_window">
6 <property name="can_focus">False</property> 823 <property name="can_focus">False</property>
7 <property name="title" translatable="yes">gnunet-fs-gtk</property> 824 <property name="title" translatable="yes">gnunet-fs-gtk</property>
@@ -41,7 +858,6 @@
41 <property name="use_underline">True</property> 858 <property name="use_underline">True</property>
42 <child type="submenu"> 859 <child type="submenu">
43 <object class="GtkMenu" id="GNUNET_GTK_main_menu_file_sharing_box"> 860 <object class="GtkMenu" id="GNUNET_GTK_main_menu_file_sharing_box">
44 <property name="visible">True</property>
45 <property name="can_focus">False</property> 861 <property name="can_focus">False</property>
46 <child> 862 <child>
47 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_create_pseudonym"> 863 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_create_pseudonym">
@@ -52,7 +868,7 @@
52 <property name="tooltip_text" translatable="yes">Create a pseudonym for publishing content. Note that you can also publish content anonymously (without using a pseudonym).</property> 868 <property name="tooltip_text" translatable="yes">Create a pseudonym for publishing content. Note that you can also publish content anonymously (without using a pseudonym).</property>
53 <property name="accel_path">&lt;gnunet-fs-gtk&gt;/File sharing/Create pseudonym</property> 869 <property name="accel_path">&lt;gnunet-fs-gtk&gt;/File sharing/Create pseudonym</property>
54 <property name="use_underline">True</property> 870 <property name="use_underline">True</property>
55 <property name="image">image3</property> 871 <property name="image">new_stock_imag</property>
56 <property name="use_stock">False</property> 872 <property name="use_stock">False</property>
57 <accelerator key="n" signal="activate" modifiers="GDK_CONTROL_MASK"/> 873 <accelerator key="n" signal="activate" modifiers="GDK_CONTROL_MASK"/>
58 <signal name="activate" handler="GNUNET_GTK_main_menu_create_pseudonym_activate_cb" swapped="no"/> 874 <signal name="activate" handler="GNUNET_GTK_main_menu_create_pseudonym_activate_cb" swapped="no"/>
@@ -65,7 +881,7 @@
65 <property name="visible">True</property> 881 <property name="visible">True</property>
66 <property name="can_focus">False</property> 882 <property name="can_focus">False</property>
67 <property name="use_underline">True</property> 883 <property name="use_underline">True</property>
68 <property name="image">image6</property> 884 <property name="image">index_stock_image</property>
69 <property name="use_stock">False</property> 885 <property name="use_stock">False</property>
70 <signal name="activate" handler="GNUNET_GTK_main_menu_file_advertise_pseudonym_activate_cb" swapped="no"/> 886 <signal name="activate" handler="GNUNET_GTK_main_menu_file_advertise_pseudonym_activate_cb" swapped="no"/>
71 </object> 887 </object>
@@ -79,7 +895,7 @@
79 <property name="tooltip_text" translatable="yes">Publish files or directories on GNUnet</property> 895 <property name="tooltip_text" translatable="yes">Publish files or directories on GNUnet</property>
80 <property name="accel_path">&lt;gnunet-fs-gtk&gt;/File sharing/Publish</property> 896 <property name="accel_path">&lt;gnunet-fs-gtk&gt;/File sharing/Publish</property>
81 <property name="use_underline">True</property> 897 <property name="use_underline">True</property>
82 <property name="image">image2</property> 898 <property name="image">up_stock_image</property>
83 <property name="use_stock">False</property> 899 <property name="use_stock">False</property>
84 <accelerator key="a" signal="activate" modifiers="GDK_CONTROL_MASK"/> 900 <accelerator key="a" signal="activate" modifiers="GDK_CONTROL_MASK"/>
85 <signal name="activate" handler="GNUNET_GTK_main_menu_file_publish_activate_cb" swapped="no"/> 901 <signal name="activate" handler="GNUNET_GTK_main_menu_file_publish_activate_cb" swapped="no"/>
@@ -88,7 +904,6 @@
88 <child> 904 <child>
89 <object class="GtkSeparatorMenuItem" id="GNUNET_GTK_main_menu_file_sep1"> 905 <object class="GtkSeparatorMenuItem" id="GNUNET_GTK_main_menu_file_sep1">
90 <property name="use_action_appearance">False</property> 906 <property name="use_action_appearance">False</property>
91 <property name="visible">True</property>
92 <property name="can_focus">False</property> 907 <property name="can_focus">False</property>
93 </object> 908 </object>
94 </child> 909 </child>
@@ -96,12 +911,10 @@
96 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_search"> 911 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_search">
97 <property name="label" translatable="yes">_Search</property> 912 <property name="label" translatable="yes">_Search</property>
98 <property name="use_action_appearance">False</property> 913 <property name="use_action_appearance">False</property>
99 <property name="visible">True</property>
100 <property name="can_focus">False</property> 914 <property name="can_focus">False</property>
101 <property name="tooltip_text" translatable="yes">Search GNUnet for files</property> 915 <property name="tooltip_text" translatable="yes">Search GNUnet for files</property>
102 <property name="accel_path">&lt;gnunet-fs-gtk&gt;/File sharing/Search</property> 916 <property name="accel_path">&lt;gnunet-fs-gtk&gt;/File sharing/Search</property>
103 <property name="use_underline">True</property> 917 <property name="use_underline">True</property>
104 <property name="image">image4</property>
105 <property name="use_stock">False</property> 918 <property name="use_stock">False</property>
106 <accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/> 919 <accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/>
107 <signal name="activate" handler="GNUNET_GTK_main_menu_file_search_activate_cb" swapped="no"/> 920 <signal name="activate" handler="GNUNET_GTK_main_menu_file_search_activate_cb" swapped="no"/>
@@ -123,7 +936,7 @@
123 <property name="tooltip_text" translatable="yes">Download a file or directory with a known URI.</property> 936 <property name="tooltip_text" translatable="yes">Download a file or directory with a known URI.</property>
124 <property name="accel_path">&lt;gnunet-fs-gtk&gt;/File sharing/Download</property> 937 <property name="accel_path">&lt;gnunet-fs-gtk&gt;/File sharing/Download</property>
125 <property name="use_underline">True</property> 938 <property name="use_underline">True</property>
126 <property name="image">image5</property> 939 <property name="image">down_stock_image</property>
127 <property name="use_stock">False</property> 940 <property name="use_stock">False</property>
128 <accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/> 941 <accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/>
129 <signal name="activate" handler="GNUNET_GTK_main_menu_file_download_uri_activate_cb" swapped="no"/> 942 <signal name="activate" handler="GNUNET_GTK_main_menu_file_download_uri_activate_cb" swapped="no"/>
@@ -138,7 +951,7 @@
138 <property name="tooltip_text" translatable="yes">Use this option to browse a GNUnet directory file that has been previously downloaded.</property> 951 <property name="tooltip_text" translatable="yes">Use this option to browse a GNUnet directory file that has been previously downloaded.</property>
139 <property name="accel_path">&lt;gnunet-fs-gtk&gt;/File sharing/Open directory</property> 952 <property name="accel_path">&lt;gnunet-fs-gtk&gt;/File sharing/Open directory</property>
140 <property name="use_underline">True</property> 953 <property name="use_underline">True</property>
141 <property name="image">image1</property> 954 <property name="image">open_stock_image</property>
142 <property name="use_stock">False</property> 955 <property name="use_stock">False</property>
143 <accelerator key="F3" signal="activate"/> 956 <accelerator key="F3" signal="activate"/>
144 <signal name="activate" handler="GNUNET_GTK_main_menu_file_open_gnunet_directory_activate_cb" swapped="no"/> 957 <signal name="activate" handler="GNUNET_GTK_main_menu_file_open_gnunet_directory_activate_cb" swapped="no"/>
@@ -387,6 +1200,7 @@
387 <property name="visible">True</property> 1200 <property name="visible">True</property>
388 <property name="can_focus">True</property> 1201 <property name="can_focus">True</property>
389 <property name="receives_default">True</property> 1202 <property name="receives_default">True</property>
1203 <property name="image">find_stock_image</property>
390 <signal name="clicked" handler="main_window_search_button_clicked_cb" swapped="no"/> 1204 <signal name="clicked" handler="main_window_search_button_clicked_cb" swapped="no"/>
391 </object> 1205 </object>
392 </child> 1206 </child>
@@ -403,8 +1217,7 @@
403 <property name="can_focus">True</property> 1217 <property name="can_focus">True</property>
404 <property name="invisible_char">●</property> 1218 <property name="invisible_char">●</property>
405 <property name="invisible_char_set">True</property> 1219 <property name="invisible_char_set">True</property>
406 <property name="primary_icon_stock">gtk-find</property> 1220 <property name="primary_icon_activatable">False</property>
407 <property name="primary_icon_activatable">True</property>
408 <property name="secondary_icon_activatable">False</property> 1221 <property name="secondary_icon_activatable">False</property>
409 <property name="primary_icon_sensitive">True</property> 1222 <property name="primary_icon_sensitive">True</property>
410 <property name="secondary_icon_sensitive">True</property> 1223 <property name="secondary_icon_sensitive">True</property>
@@ -665,6 +1478,407 @@
665 </object> 1478 </object>
666 </child> 1479 </child>
667 </object> 1480 </object>
1481 <object class="GtkWindow" id="GNUNET_GTK_master_publish_dialog">
1482 <property name="height_request">500</property>
1483 <property name="can_focus">False</property>
1484 <property name="title" translatable="yes">Publish content on GNUnet</property>
1485 <property name="window_position">center-on-parent</property>
1486 <property name="destroy_with_parent">True</property>
1487 <property name="deletable">False</property>
1488 <property name="transient_for">GNUNET_GTK_main_window</property>
1489 <signal name="realize" handler="GNUNET_GTK_master_publish_dialog_realize_cb" swapped="no"/>
1490 <signal name="delete-event" handler="GNUNET_GTK_master_publish_dialog_delete_event_cb" swapped="no"/>
1491 <child>
1492 <object class="GtkVBox" id="GNUNET_GTK_master_publish_dialog_vbox">
1493 <property name="visible">True</property>
1494 <property name="can_focus">False</property>
1495 <property name="border_width">4</property>
1496 <property name="spacing">7</property>
1497 <child>
1498 <object class="GtkScrolledWindow" id="GNUNET_GTK_master_publish_dialog_file_information_scrolled_window">
1499 <property name="visible">True</property>
1500 <property name="can_focus">True</property>
1501 <property name="hadjustment">adjustment5</property>
1502 <property name="vadjustment">adjustment6</property>
1503 <property name="hscrollbar_policy">automatic</property>
1504 <property name="vscrollbar_policy">automatic</property>
1505 <property name="shadow_type">in</property>
1506 <child>
1507 <object class="GtkTreeView" id="GNUNET_GTK_master_publish_dialog_file_information_tree_view">
1508 <property name="height_request">100</property>
1509 <property name="visible">True</property>
1510 <property name="can_focus">True</property>
1511 <property name="model">GNUNET_GTK_file_sharing_publishing_tree_store</property>
1512 <property name="hadjustment">adjustment5</property>
1513 <property name="vadjustment">adjustment6</property>
1514 <property name="enable_tree_lines">True</property>
1515 <child>
1516 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_file_information_filesize_column">
1517 <property name="sizing">autosize</property>
1518 <property name="title" translatable="yes">Size</property>
1519 <child>
1520 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_file_information_filesize_renderer"/>
1521 <attributes>
1522 <attribute name="text">0</attribute>
1523 </attributes>
1524 </child>
1525 </object>
1526 </child>
1527 <child>
1528 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_file_information_filename_column">
1529 <property name="resizable">True</property>
1530 <property name="sizing">autosize</property>
1531 <property name="title" translatable="yes">Filename</property>
1532 <property name="expand">True</property>
1533 <property name="clickable">True</property>
1534 <property name="reorderable">True</property>
1535 <property name="sort_indicator">True</property>
1536 <child>
1537 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_file_information_filename_renderer"/>
1538 <attributes>
1539 <attribute name="text">2</attribute>
1540 </attributes>
1541 </child>
1542 </object>
1543 </child>
1544 </object>
1545 </child>
1546 </object>
1547 <packing>
1548 <property name="expand">True</property>
1549 <property name="fill">True</property>
1550 <property name="position">0</property>
1551 </packing>
1552 </child>
1553 <child>
1554 <object class="GtkHBox" id="GNUNET_GTK_master_dialog_modification_button_hbox">
1555 <property name="visible">True</property>
1556 <property name="can_focus">False</property>
1557 <child>
1558 <object class="GtkTable" id="GNUNET_GTK_master_publish_dialog_action_table">
1559 <property name="visible">True</property>
1560 <property name="can_focus">False</property>
1561 <property name="n_rows">2</property>
1562 <property name="n_columns">3</property>
1563 <child>
1564 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_add_button">
1565 <property name="label" translatable="yes">Add _File</property>
1566 <property name="use_action_appearance">False</property>
1567 <property name="visible">True</property>
1568 <property name="can_focus">True</property>
1569 <property name="receives_default">True</property>
1570 <property name="use_underline">True</property>
1571 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_add_button_clicked_cb" swapped="no"/>
1572 </object>
1573 </child>
1574 <child>
1575 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_new_button">
1576 <property name="label" translatable="yes">_Create empty directory</property>
1577 <property name="use_action_appearance">False</property>
1578 <property name="visible">True</property>
1579 <property name="can_focus">True</property>
1580 <property name="receives_default">True</property>
1581 <property name="image">new_stock_image</property>
1582 <property name="use_underline">True</property>
1583 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_new_button_clicked_cb" swapped="no"/>
1584 </object>
1585 <packing>
1586 <property name="left_attach">1</property>
1587 <property name="right_attach">3</property>
1588 </packing>
1589 </child>
1590 <child>
1591 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_open_button">
1592 <property name="label" translatable="yes">Add _Directory</property>
1593 <property name="use_action_appearance">False</property>
1594 <property name="visible">True</property>
1595 <property name="can_focus">True</property>
1596 <property name="receives_default">True</property>
1597 <property name="use_underline">True</property>
1598 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_open_button_clicked_cb" swapped="no"/>
1599 </object>
1600 <packing>
1601 <property name="top_attach">1</property>
1602 <property name="bottom_attach">2</property>
1603 </packing>
1604 </child>
1605 <child>
1606 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_edit_button">
1607 <property name="label">gtk-edit</property>
1608 <property name="use_action_appearance">False</property>
1609 <property name="visible">True</property>
1610 <property name="sensitive">False</property>
1611 <property name="can_focus">True</property>
1612 <property name="receives_default">True</property>
1613 <property name="use_stock">True</property>
1614 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb" swapped="no"/>
1615 </object>
1616 <packing>
1617 <property name="left_attach">1</property>
1618 <property name="right_attach">2</property>
1619 <property name="top_attach">1</property>
1620 <property name="bottom_attach">2</property>
1621 </packing>
1622 </child>
1623 <child>
1624 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_delete_button">
1625 <property name="label">gtk-delete</property>
1626 <property name="use_action_appearance">False</property>
1627 <property name="visible">True</property>
1628 <property name="sensitive">False</property>
1629 <property name="can_focus">True</property>
1630 <property name="receives_default">True</property>
1631 <property name="use_stock">True</property>
1632 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb" swapped="no"/>
1633 </object>
1634 <packing>
1635 <property name="left_attach">2</property>
1636 <property name="right_attach">3</property>
1637 <property name="top_attach">1</property>
1638 <property name="bottom_attach">2</property>
1639 </packing>
1640 </child>
1641 </object>
1642 <packing>
1643 <property name="expand">False</property>
1644 <property name="fill">True</property>
1645 <property name="padding">25</property>
1646 <property name="position">0</property>
1647 </packing>
1648 </child>
1649 <child>
1650 <object class="GtkTable" id="GNUNET_GTK_master_publish_dialog_arrow_table">
1651 <property name="visible">True</property>
1652 <property name="can_focus">False</property>
1653 <property name="n_rows">2</property>
1654 <property name="n_columns">3</property>
1655 <property name="homogeneous">True</property>
1656 <child>
1657 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_up_button">
1658 <property name="label">gtk-go-up</property>
1659 <property name="use_action_appearance">False</property>
1660 <property name="visible">True</property>
1661 <property name="sensitive">False</property>
1662 <property name="can_focus">True</property>
1663 <property name="receives_default">True</property>
1664 <property name="use_stock">True</property>
1665 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_up_button_clicked_cb" swapped="no"/>
1666 </object>
1667 <packing>
1668 <property name="left_attach">1</property>
1669 <property name="right_attach">2</property>
1670 </packing>
1671 </child>
1672 <child>
1673 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_left_button">
1674 <property name="label" translatable="yes">_Left</property>
1675 <property name="use_action_appearance">False</property>
1676 <property name="visible">True</property>
1677 <property name="sensitive">False</property>
1678 <property name="can_focus">True</property>
1679 <property name="receives_default">True</property>
1680 <property name="image">left_stock_image</property>
1681 <property name="use_underline">True</property>
1682 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_left_button_clicked_cb" swapped="no"/>
1683 </object>
1684 <packing>
1685 <property name="top_attach">1</property>
1686 <property name="bottom_attach">2</property>
1687 </packing>
1688 </child>
1689 <child>
1690 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_down_button">
1691 <property name="label">gtk-go-down</property>
1692 <property name="use_action_appearance">False</property>
1693 <property name="visible">True</property>
1694 <property name="sensitive">False</property>
1695 <property name="can_focus">True</property>
1696 <property name="receives_default">True</property>
1697 <property name="use_stock">True</property>
1698 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_down_button_clicked_cb" swapped="no"/>
1699 </object>
1700 <packing>
1701 <property name="left_attach">1</property>
1702 <property name="right_attach">2</property>
1703 <property name="top_attach">1</property>
1704 <property name="bottom_attach">2</property>
1705 </packing>
1706 </child>
1707 <child>
1708 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_right_button">
1709 <property name="label" translatable="yes">_Right</property>
1710 <property name="use_action_appearance">False</property>
1711 <property name="visible">True</property>
1712 <property name="sensitive">False</property>
1713 <property name="can_focus">True</property>
1714 <property name="receives_default">True</property>
1715 <property name="image">right_stock_image</property>
1716 <property name="use_underline">True</property>
1717 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_right_button_clicked_cb" swapped="no"/>
1718 </object>
1719 <packing>
1720 <property name="left_attach">2</property>
1721 <property name="right_attach">3</property>
1722 <property name="top_attach">1</property>
1723 <property name="bottom_attach">2</property>
1724 </packing>
1725 </child>
1726 <child>
1727 <placeholder/>
1728 </child>
1729 <child>
1730 <placeholder/>
1731 </child>
1732 </object>
1733 <packing>
1734 <property name="expand">False</property>
1735 <property name="fill">True</property>
1736 <property name="padding">25</property>
1737 <property name="position">1</property>
1738 </packing>
1739 </child>
1740 </object>
1741 <packing>
1742 <property name="expand">False</property>
1743 <property name="fill">True</property>
1744 <property name="position">1</property>
1745 </packing>
1746 </child>
1747 <child>
1748 <object class="GtkScrolledWindow" id="GNUNET_GTK_master_publish_dialog_pseudonym_scrolled_window">
1749 <property name="visible">True</property>
1750 <property name="can_focus">True</property>
1751 <property name="hadjustment">adjustment7</property>
1752 <property name="vadjustment">adjustment8</property>
1753 <property name="hscrollbar_policy">automatic</property>
1754 <property name="vscrollbar_policy">automatic</property>
1755 <property name="shadow_type">in</property>
1756 <child>
1757 <object class="GtkTreeView" id="GNUNET_GTK_master_publish_dialog_pseudonym_tree_view">
1758 <property name="visible">True</property>
1759 <property name="can_focus">True</property>
1760 <property name="model">GNUNET_GTK_pseudonym_tree_store</property>
1761 <property name="hadjustment">adjustment7</property>
1762 <property name="vadjustment">adjustment8</property>
1763 <property name="reorderable">True</property>
1764 <property name="rubber_banding">True</property>
1765 <property name="enable_grid_lines">both</property>
1766 <child>
1767 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_name_column">
1768 <property name="resizable">True</property>
1769 <property name="title" translatable="yes">Pseudonym</property>
1770 <property name="clickable">True</property>
1771 <property name="reorderable">True</property>
1772 <property name="sort_indicator">True</property>
1773 <child>
1774 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_name_renderer"/>
1775 <attributes>
1776 <attribute name="text">0</attribute>
1777 </attributes>
1778 </child>
1779 </object>
1780 </child>
1781 <child>
1782 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_identifier_column">
1783 <property name="resizable">True</property>
1784 <property name="sizing">autosize</property>
1785 <property name="title" translatable="yes">Current identifier</property>
1786 <property name="clickable">True</property>
1787 <child>
1788 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_identifier_renderer"/>
1789 <attributes>
1790 <attribute name="editable">8</attribute>
1791 <attribute name="text">2</attribute>
1792 </attributes>
1793 </child>
1794 </object>
1795 </child>
1796 <child>
1797 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_updates_column">
1798 <property name="resizable">True</property>
1799 <property name="sizing">autosize</property>
1800 <property name="fixed_width">5</property>
1801 <property name="title" translatable="yes">Update identifier</property>
1802 <child>
1803 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_updates_renderer"/>
1804 <attributes>
1805 <attribute name="editable">7</attribute>
1806 <attribute name="text">5</attribute>
1807 </attributes>
1808 </child>
1809 </object>
1810 </child>
1811 <child>
1812 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_description_column">
1813 <property name="title" translatable="yes">Description (of existing content)</property>
1814 <child>
1815 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_description_renderer">
1816 <property name="wrap_mode">word</property>
1817 </object>
1818 <attributes>
1819 <attribute name="text">6</attribute>
1820 </attributes>
1821 </child>
1822 </object>
1823 </child>
1824 </object>
1825 </child>
1826 </object>
1827 <packing>
1828 <property name="expand">True</property>
1829 <property name="fill">True</property>
1830 <property name="position">2</property>
1831 </packing>
1832 </child>
1833 <child>
1834 <object class="GtkHBox" id="GNUNET_GTK_master_publish_dialog_master_buttons_hbox">
1835 <property name="visible">True</property>
1836 <property name="can_focus">False</property>
1837 <property name="spacing">2</property>
1838 <child>
1839 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_execute_button">
1840 <property name="label" translatable="yes">_Execute</property>
1841 <property name="use_action_appearance">False</property>
1842 <property name="visible">True</property>
1843 <property name="can_focus">True</property>
1844 <property name="receives_default">True</property>
1845 <property name="use_underline">True</property>
1846 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_execute_button_clicked_cb" swapped="no"/>
1847 </object>
1848 <packing>
1849 <property name="expand">False</property>
1850 <property name="fill">False</property>
1851 <property name="pack_type">end</property>
1852 <property name="position">0</property>
1853 </packing>
1854 </child>
1855 <child>
1856 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_cancel_button">
1857 <property name="label" translatable="yes">_Cancel</property>
1858 <property name="use_action_appearance">False</property>
1859 <property name="visible">True</property>
1860 <property name="can_focus">True</property>
1861 <property name="receives_default">True</property>
1862 <property name="use_underline">True</property>
1863 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_cancel_button_clicked_cb" swapped="no"/>
1864 </object>
1865 <packing>
1866 <property name="expand">False</property>
1867 <property name="fill">False</property>
1868 <property name="pack_type">end</property>
1869 <property name="position">1</property>
1870 </packing>
1871 </child>
1872 </object>
1873 <packing>
1874 <property name="expand">False</property>
1875 <property name="fill">False</property>
1876 <property name="position">3</property>
1877 </packing>
1878 </child>
1879 </object>
1880 </child>
1881 </object>
668 <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store"> 1882 <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store">
669 <columns> 1883 <columns>
670 <!-- column-name extractor_meta_type --> 1884 <!-- column-name extractor_meta_type -->
@@ -706,7 +1920,6 @@
706 <property name="can_focus">False</property> 1920 <property name="can_focus">False</property>
707 <property name="label" translatable="yes">_URI:</property> 1921 <property name="label" translatable="yes">_URI:</property>
708 <property name="use_underline">True</property> 1922 <property name="use_underline">True</property>
709 <property name="selectable">True</property>
710 <property name="mnemonic_widget">GNUNET_GTK_open_url_dialog_url_textview</property> 1923 <property name="mnemonic_widget">GNUNET_GTK_open_url_dialog_url_textview</property>
711 </object> 1924 </object>
712 <packing> 1925 <packing>
@@ -756,7 +1969,6 @@
756 <property name="can_focus">False</property> 1969 <property name="can_focus">False</property>
757 <property name="label" translatable="yes">_Anonymity:</property> 1970 <property name="label" translatable="yes">_Anonymity:</property>
758 <property name="use_underline">True</property> 1971 <property name="use_underline">True</property>
759 <property name="selectable">True</property>
760 <property name="mnemonic_widget">GNUNET_GTK_open_url_dialog_anonymity_combobox</property> 1972 <property name="mnemonic_widget">GNUNET_GTK_open_url_dialog_anonymity_combobox</property>
761 </object> 1973 </object>
762 <packing> 1974 <packing>
@@ -819,7 +2031,7 @@
819 <property name="sensitive">False</property> 2031 <property name="sensitive">False</property>
820 <property name="can_focus">True</property> 2032 <property name="can_focus">True</property>
821 <property name="receives_default">True</property> 2033 <property name="receives_default">True</property>
822 <property name="image">execute_stock_image2</property> 2034 <property name="image">execute_stock_image</property>
823 <property name="use_underline">True</property> 2035 <property name="use_underline">True</property>
824 <signal name="clicked" handler="GNUNET_GTK_open_url_dialog_execute_button_clicked_cb" swapped="no"/> 2036 <signal name="clicked" handler="GNUNET_GTK_open_url_dialog_execute_button_clicked_cb" swapped="no"/>
825 </object> 2037 </object>
@@ -874,97 +2086,766 @@
874 <column type="guint64"/> 2086 <column type="guint64"/>
875 </columns> 2087 </columns>
876 </object> 2088 </object>
877 <object class="GtkAdjustment" id="adjustment1"> 2089 <object class="GtkTreeStore" id="GNUNET_GTK_pseudonym_tree_store">
878 <property name="upper">100</property> 2090 <columns>
879 <property name="step_increment">1</property> 2091 <!-- column-name local_name -->
880 <property name="page_increment">10</property> 2092 <column type="gchararray"/>
881 <property name="page_size">10</property> 2093 <!-- column-name namespace_handle -->
2094 <column type="gpointer"/>
2095 <!-- column-name last_id -->
2096 <column type="gchararray"/>
2097 <!-- column-name last_uri -->
2098 <column type="gchararray"/>
2099 <!-- column-name last_meta -->
2100 <column type="gpointer"/>
2101 <!-- column-name next_id -->
2102 <column type="gchararray"/>
2103 <!-- column-name last_description_from_meta -->
2104 <column type="gchararray"/>
2105 <!-- column-name next_id_editable -->
2106 <column type="gboolean"/>
2107 <!-- column-name current_id_editable -->
2108 <column type="gboolean"/>
2109 </columns>
882 </object> 2110 </object>
883 <object class="GtkAdjustment" id="adjustment2"> 2111 <object class="GtkListStore" id="GNUNET_GTK_publication_keywords_liststore">
884 <property name="upper">100</property> 2112 <columns>
885 <property name="step_increment">1</property> 2113 <!-- column-name Keyword -->
886 <property name="page_increment">10</property> 2114 <column type="gchararray"/>
887 <property name="page_size">10</property> 2115 <!-- column-name Added -->
2116 <column type="gboolean"/>
2117 </columns>
2118 </object>
2119 <object class="GtkListStore" id="GNUNET_GTK_publication_metadata_liststore">
2120 <columns>
2121 <!-- column-name Type -->
2122 <column type="gint"/>
2123 <!-- column-name Format -->
2124 <column type="gint"/>
2125 <!-- column-name Type1 -->
2126 <column type="gchararray"/>
2127 <!-- column-name Value -->
2128 <column type="gchararray"/>
2129 <!-- column-name Description -->
2130 <column type="gchararray"/>
2131 </columns>
2132 </object>
2133 <object class="GtkListStore" id="GNUNET_GTK_publication_metadata_types_liststore">
2134 <columns>
2135 <!-- column-name Type -->
2136 <column type="gint"/>
2137 <!-- column-name Format -->
2138 <column type="gint"/>
2139 <!-- column-name Type1 -->
2140 <column type="gchararray"/>
2141 <!-- column-name Description -->
2142 <column type="gchararray"/>
2143 </columns>
2144 </object>
2145 <object class="GtkListStore" id="GNUNET_GTK_publication_types_liststore">
2146 <columns>
2147 <!-- column-name Type -->
2148 <column type="gint"/>
2149 <!-- column-name Type1 -->
2150 <column type="gchararray"/>
2151 </columns>
2152 <data>
2153 <row>
2154 <col id="0">-1</col>
2155 <col id="1" translatable="yes">Generic</col>
2156 </row>
2157 <row>
2158 <col id="0">1</col>
2159 <col id="1" translatable="yes">Text</col>
2160 </row>
2161 <row>
2162 <col id="0">2</col>
2163 <col id="1" translatable="yes">Music</col>
2164 </row>
2165 <row>
2166 <col id="0">3</col>
2167 <col id="1" translatable="yes">Video</col>
2168 </row>
2169 <row>
2170 <col id="0">4</col>
2171 <col id="1" translatable="yes">Image</col>
2172 </row>
2173 <row>
2174 <col id="0">5</col>
2175 <col id="1" translatable="yes">Namespace</col>
2176 </row>
2177 </data>
2178 </object>
2179 <object class="GtkFileChooserDialog" id="GNUNET_GTK_publish_directory_dialog">
2180 <property name="can_focus">False</property>
2181 <property name="can_default">True</property>
2182 <property name="events">GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK</property>
2183 <property name="border_width">5</property>
2184 <property name="modal">True</property>
2185 <property name="destroy_with_parent">True</property>
2186 <property name="type_hint">dialog</property>
2187 <property name="skip_taskbar_hint">True</property>
2188 <property name="skip_pager_hint">True</property>
2189 <property name="transient_for">GNUNET_GTK_main_window</property>
2190 <property name="action">select-folder</property>
2191 <property name="create_folders">False</property>
2192 <property name="select_multiple">True</property>
2193 <signal name="response" handler="GNUNET_GTK_publish_directory_dialog_response_cb" swapped="no"/>
2194 <child internal-child="vbox">
2195 <object class="GtkVBox" id="dialog-vbox1">
2196 <property name="visible">True</property>
2197 <property name="can_focus">False</property>
2198 <property name="spacing">2</property>
2199 <child internal-child="action_area">
2200 <object class="GtkHButtonBox" id="dialog-action_area6">
2201 <property name="visible">True</property>
2202 <property name="can_focus">False</property>
2203 <property name="layout_style">end</property>
2204 <child>
2205 <object class="GtkButton" id="GNUNET_GTK_publish_dialog_cancel_button">
2206 <property name="label">gtk-cancel</property>
2207 <property name="use_action_appearance">False</property>
2208 <property name="visible">True</property>
2209 <property name="can_focus">True</property>
2210 <property name="receives_default">True</property>
2211 <property name="use_stock">True</property>
2212 </object>
2213 <packing>
2214 <property name="expand">False</property>
2215 <property name="fill">False</property>
2216 <property name="position">0</property>
2217 </packing>
2218 </child>
2219 <child>
2220 <object class="GtkButton" id="GNUNET_GTK_publish_directory_dialog_ok_button">
2221 <property name="label">gtk-ok</property>
2222 <property name="use_action_appearance">False</property>
2223 <property name="visible">True</property>
2224 <property name="can_focus">True</property>
2225 <property name="can_default">True</property>
2226 <property name="receives_default">True</property>
2227 <property name="use_stock">True</property>
2228 </object>
2229 <packing>
2230 <property name="expand">False</property>
2231 <property name="fill">False</property>
2232 <property name="position">1</property>
2233 </packing>
2234 </child>
2235 </object>
2236 <packing>
2237 <property name="expand">False</property>
2238 <property name="fill">True</property>
2239 <property name="pack_type">end</property>
2240 <property name="position">0</property>
2241 </packing>
2242 </child>
2243 <child>
2244 <object class="GtkVBox" id="vbox3">
2245 <property name="visible">True</property>
2246 <property name="can_focus">False</property>
2247 <child>
2248 <object class="GtkHBox" id="hbox6">
2249 <property name="visible">True</property>
2250 <property name="can_focus">False</property>
2251 <child>
2252 <object class="GtkCheckButton" id="GNUNET_GTK_publish_directory_dialog_do_index_checkbutton">
2253 <property name="label" translatable="yes">Index files</property>
2254 <property name="use_action_appearance">False</property>
2255 <property name="visible">True</property>
2256 <property name="can_focus">True</property>
2257 <property name="receives_default">False</property>
2258 <property name="use_underline">True</property>
2259 <property name="active">True</property>
2260 <property name="draw_indicator">True</property>
2261 </object>
2262 <packing>
2263 <property name="expand">False</property>
2264 <property name="fill">False</property>
2265 <property name="padding">20</property>
2266 <property name="position">0</property>
2267 </packing>
2268 </child>
2269 <child>
2270 <placeholder/>
2271 </child>
2272 <child>
2273 <object class="GtkLabel" id="GNUNET_GTK_publish_directory_dialog_priority_label">
2274 <property name="visible">True</property>
2275 <property name="can_focus">False</property>
2276 <property name="label" translatable="yes">Priority:</property>
2277 </object>
2278 <packing>
2279 <property name="expand">False</property>
2280 <property name="fill">True</property>
2281 <property name="padding">13</property>
2282 <property name="position">2</property>
2283 </packing>
2284 </child>
2285 <child>
2286 <object class="GtkSpinButton" id="GNUNET_GTK_publish_directory_dialog_priority_spin_button">
2287 <property name="visible">True</property>
2288 <property name="can_focus">True</property>
2289 <property name="invisible_char">•</property>
2290 <property name="invisible_char_set">True</property>
2291 <property name="primary_icon_activatable">False</property>
2292 <property name="secondary_icon_activatable">False</property>
2293 <property name="primary_icon_sensitive">True</property>
2294 <property name="secondary_icon_sensitive">True</property>
2295 <property name="adjustment">priority_adjustment</property>
2296 <property name="numeric">True</property>
2297 </object>
2298 <packing>
2299 <property name="expand">False</property>
2300 <property name="fill">True</property>
2301 <property name="padding">20</property>
2302 <property name="position">3</property>
2303 </packing>
2304 </child>
2305 </object>
2306 <packing>
2307 <property name="expand">False</property>
2308 <property name="fill">False</property>
2309 <property name="position">0</property>
2310 </packing>
2311 </child>
2312 <child>
2313 <object class="GtkHBox" id="hbox7">
2314 <property name="visible">True</property>
2315 <property name="can_focus">False</property>
2316 <child>
2317 <object class="GtkLabel" id="GNUNET_GTK_publish_directory_dialog_expiration_label">
2318 <property name="visible">True</property>
2319 <property name="can_focus">False</property>
2320 <property name="label" translatable="yes">Expiration year:</property>
2321 </object>
2322 <packing>
2323 <property name="expand">False</property>
2324 <property name="fill">False</property>
2325 <property name="padding">20</property>
2326 <property name="position">0</property>
2327 </packing>
2328 </child>
2329 <child>
2330 <object class="GtkSpinButton" id="GNUNET_GTK_publish_directory_dialog_expiration_year_spin_button">
2331 <property name="visible">True</property>
2332 <property name="can_focus">True</property>
2333 <property name="invisible_char">•</property>
2334 <property name="invisible_char_set">True</property>
2335 <property name="primary_icon_activatable">False</property>
2336 <property name="secondary_icon_activatable">False</property>
2337 <property name="primary_icon_sensitive">True</property>
2338 <property name="secondary_icon_sensitive">True</property>
2339 <property name="adjustment">expiration_year_adjustment</property>
2340 </object>
2341 <packing>
2342 <property name="expand">False</property>
2343 <property name="fill">False</property>
2344 <property name="position">1</property>
2345 </packing>
2346 </child>
2347 <child>
2348 <object class="GtkLabel" id="GNUNET_GTK_publish_directory_dialog_anonymity_label">
2349 <property name="visible">True</property>
2350 <property name="can_focus">False</property>
2351 <property name="label" translatable="yes">Anonymity:</property>
2352 </object>
2353 <packing>
2354 <property name="expand">False</property>
2355 <property name="fill">True</property>
2356 <property name="padding">5</property>
2357 <property name="position">2</property>
2358 </packing>
2359 </child>
2360 <child>
2361 <object class="GtkAlignment" id="GNUNET_GTK_publish_directory_dialog_anonymity_combobox_alignment">
2362 <property name="visible">True</property>
2363 <property name="can_focus">False</property>
2364 <property name="yscale">0</property>
2365 <child>
2366 <object class="GtkComboBox" id="GNUNET_GTK_publish_directory_dialog_anonymity_combobox">
2367 <property name="visible">True</property>
2368 <property name="can_focus">False</property>
2369 <property name="model">main_window_search_anonymity_liststore</property>
2370 <property name="active">1</property>
2371 <child>
2372 <object class="GtkCellRendererText" id="GNUNET_GTK_publish_directory_dialog_anonymity_combobox_renderer"/>
2373 <attributes>
2374 <attribute name="foreground">2</attribute>
2375 <attribute name="text">0</attribute>
2376 </attributes>
2377 </child>
2378 <child>
2379 <object class="GtkCellRendererText" id="GNUNET_GTK_publish_directory_dialog_anonymity_combobox_renerer_level"/>
2380 <attributes>
2381 <attribute name="text">1</attribute>
2382 </attributes>
2383 </child>
2384 </object>
2385 </child>
2386 </object>
2387 <packing>
2388 <property name="expand">False</property>
2389 <property name="fill">False</property>
2390 <property name="position">3</property>
2391 </packing>
2392 </child>
2393 </object>
2394 <packing>
2395 <property name="expand">False</property>
2396 <property name="fill">True</property>
2397 <property name="position">1</property>
2398 </packing>
2399 </child>
2400 </object>
2401 <packing>
2402 <property name="expand">True</property>
2403 <property name="fill">True</property>
2404 <property name="position">2</property>
2405 </packing>
2406 </child>
2407 </object>
2408 </child>
2409 <action-widgets>
2410 <action-widget response="-6">GNUNET_GTK_publish_dialog_cancel_button</action-widget>
2411 <action-widget response="-5">GNUNET_GTK_publish_directory_dialog_ok_button</action-widget>
2412 </action-widgets>
2413 </object>
2414 <object class="GtkFileChooserDialog" id="GNUNET_GTK_publish_file_dialog">
2415 <property name="can_focus">False</property>
2416 <property name="can_default">True</property>
2417 <property name="border_width">5</property>
2418 <property name="title" translatable="yes">Publish file...</property>
2419 <property name="modal">True</property>
2420 <property name="destroy_with_parent">True</property>
2421 <property name="type_hint">normal</property>
2422 <property name="skip_taskbar_hint">True</property>
2423 <property name="skip_pager_hint">True</property>
2424 <property name="transient_for">GNUNET_GTK_main_window</property>
2425 <property name="create_folders">False</property>
2426 <property name="select_multiple">True</property>
2427 <signal name="delete-event" handler="gtk_widget_hide_on_delete" swapped="no"/>
2428 <signal name="response" handler="GNUNET_GTK_publish_file_dialog_response_cb" swapped="no"/>
2429 <child internal-child="vbox">
2430 <object class="GtkVBox" id="dialog-vbox5">
2431 <property name="visible">True</property>
2432 <property name="can_focus">False</property>
2433 <property name="spacing">2</property>
2434 <child internal-child="action_area">
2435 <object class="GtkHButtonBox" id="dialog-action_area5">
2436 <property name="visible">True</property>
2437 <property name="can_focus">False</property>
2438 <property name="layout_style">end</property>
2439 <child>
2440 <object class="GtkButton" id="GNUNET_GTK_publish_file_dialog_cancel_button">
2441 <property name="label">gtk-cancel</property>
2442 <property name="use_action_appearance">False</property>
2443 <property name="visible">True</property>
2444 <property name="can_focus">True</property>
2445 <property name="receives_default">True</property>
2446 <property name="use_stock">True</property>
2447 </object>
2448 <packing>
2449 <property name="expand">False</property>
2450 <property name="fill">False</property>
2451 <property name="position">0</property>
2452 </packing>
2453 </child>
2454 <child>
2455 <object class="GtkButton" id="GNUNET_GTK_publish_file_dialog_ok_button">
2456 <property name="label">gtk-ok</property>
2457 <property name="use_action_appearance">False</property>
2458 <property name="visible">True</property>
2459 <property name="can_focus">True</property>
2460 <property name="can_default">True</property>
2461 <property name="receives_default">True</property>
2462 <property name="use_stock">True</property>
2463 </object>
2464 <packing>
2465 <property name="expand">False</property>
2466 <property name="fill">False</property>
2467 <property name="position">1</property>
2468 </packing>
2469 </child>
2470 </object>
2471 <packing>
2472 <property name="expand">False</property>
2473 <property name="fill">True</property>
2474 <property name="pack_type">end</property>
2475 <property name="position">0</property>
2476 </packing>
2477 </child>
2478 <child>
2479 <object class="GtkVBox" id="vbox1">
2480 <property name="visible">True</property>
2481 <property name="can_focus">False</property>
2482 <child>
2483 <object class="GtkHBox" id="hbox2">
2484 <property name="visible">True</property>
2485 <property name="can_focus">False</property>
2486 <child>
2487 <object class="GtkCheckButton" id="GNUNET_GTK_publish_file_dialog_do_index_checkbutton">
2488 <property name="label" translatable="yes">Index file</property>
2489 <property name="use_action_appearance">False</property>
2490 <property name="visible">True</property>
2491 <property name="can_focus">True</property>
2492 <property name="receives_default">False</property>
2493 <property name="use_underline">True</property>
2494 <property name="active">True</property>
2495 <property name="draw_indicator">True</property>
2496 </object>
2497 <packing>
2498 <property name="expand">False</property>
2499 <property name="fill">False</property>
2500 <property name="padding">20</property>
2501 <property name="position">0</property>
2502 </packing>
2503 </child>
2504 <child>
2505 <placeholder/>
2506 </child>
2507 <child>
2508 <object class="GtkLabel" id="GNUNET_GTK_publish_file_dialog_priority_label">
2509 <property name="visible">True</property>
2510 <property name="can_focus">False</property>
2511 <property name="label" translatable="yes">Priority:</property>
2512 </object>
2513 <packing>
2514 <property name="expand">False</property>
2515 <property name="fill">True</property>
2516 <property name="padding">13</property>
2517 <property name="position">2</property>
2518 </packing>
2519 </child>
2520 <child>
2521 <object class="GtkSpinButton" id="GNUNET_GTK_publish_file_dialog_priority_spin_button">
2522 <property name="visible">True</property>
2523 <property name="can_focus">True</property>
2524 <property name="invisible_char">•</property>
2525 <property name="invisible_char_set">True</property>
2526 <property name="primary_icon_activatable">False</property>
2527 <property name="secondary_icon_activatable">False</property>
2528 <property name="primary_icon_sensitive">True</property>
2529 <property name="secondary_icon_sensitive">True</property>
2530 <property name="adjustment">priority_adjustment</property>
2531 <property name="numeric">True</property>
2532 </object>
2533 <packing>
2534 <property name="expand">False</property>
2535 <property name="fill">True</property>
2536 <property name="padding">20</property>
2537 <property name="position">3</property>
2538 </packing>
2539 </child>
2540 </object>
2541 <packing>
2542 <property name="expand">False</property>
2543 <property name="fill">False</property>
2544 <property name="position">0</property>
2545 </packing>
2546 </child>
2547 <child>
2548 <object class="GtkHBox" id="hbox5">
2549 <property name="visible">True</property>
2550 <property name="can_focus">False</property>
2551 <child>
2552 <object class="GtkLabel" id="GNUNET_GTK_publish_file_dialog_expiration_label">
2553 <property name="visible">True</property>
2554 <property name="can_focus">False</property>
2555 <property name="label" translatable="yes">Expiration year:</property>
2556 </object>
2557 <packing>
2558 <property name="expand">False</property>
2559 <property name="fill">False</property>
2560 <property name="padding">20</property>
2561 <property name="position">0</property>
2562 </packing>
2563 </child>
2564 <child>
2565 <object class="GtkSpinButton" id="GNUNET_GTK_publish_file_dialog_expiration_year_spin_button">
2566 <property name="visible">True</property>
2567 <property name="can_focus">True</property>
2568 <property name="invisible_char">•</property>
2569 <property name="invisible_char_set">True</property>
2570 <property name="primary_icon_activatable">False</property>
2571 <property name="secondary_icon_activatable">False</property>
2572 <property name="primary_icon_sensitive">True</property>
2573 <property name="secondary_icon_sensitive">True</property>
2574 <property name="adjustment">expiration_year_adjustment</property>
2575 <property name="numeric">True</property>
2576 </object>
2577 <packing>
2578 <property name="expand">False</property>
2579 <property name="fill">False</property>
2580 <property name="position">1</property>
2581 </packing>
2582 </child>
2583 <child>
2584 <object class="GtkLabel" id="GNUNET_GTK_publish_file_dialog_anonymity_label">
2585 <property name="visible">True</property>
2586 <property name="can_focus">False</property>
2587 <property name="label" translatable="yes">Anonymity:</property>
2588 </object>
2589 <packing>
2590 <property name="expand">False</property>
2591 <property name="fill">True</property>
2592 <property name="padding">5</property>
2593 <property name="position">2</property>
2594 </packing>
2595 </child>
2596 <child>
2597 <object class="GtkAlignment" id="GNUNET_GTK_publish_file_dialog_anonymity_combobox_alignment">
2598 <property name="visible">True</property>
2599 <property name="can_focus">False</property>
2600 <property name="yscale">0</property>
2601 <child>
2602 <object class="GtkComboBox" id="GNUNET_GTK_publish_file_dialog_anonymity_combobox">
2603 <property name="visible">True</property>
2604 <property name="can_focus">False</property>
2605 <property name="model">main_window_search_anonymity_liststore</property>
2606 <property name="active">1</property>
2607 <child>
2608 <object class="GtkCellRendererText" id="GNUNET_GTK_publish_file_dialog_anonymity_combobox_renderer"/>
2609 <attributes>
2610 <attribute name="foreground">2</attribute>
2611 <attribute name="text">0</attribute>
2612 </attributes>
2613 </child>
2614 <child>
2615 <object class="GtkCellRendererText" id="GNUNET_GTK_publish_file_dialog_anonymity_combobox_renerer_level"/>
2616 <attributes>
2617 <attribute name="text">1</attribute>
2618 </attributes>
2619 </child>
2620 </object>
2621 </child>
2622 </object>
2623 <packing>
2624 <property name="expand">False</property>
2625 <property name="fill">False</property>
2626 <property name="position">3</property>
2627 </packing>
2628 </child>
2629 </object>
2630 <packing>
2631 <property name="expand">False</property>
2632 <property name="fill">True</property>
2633 <property name="position">1</property>
2634 </packing>
2635 </child>
2636 </object>
2637 <packing>
2638 <property name="expand">False</property>
2639 <property name="fill">False</property>
2640 <property name="position">2</property>
2641 </packing>
2642 </child>
2643 </object>
2644 </child>
2645 <action-widgets>
2646 <action-widget response="-6">GNUNET_GTK_publish_file_dialog_cancel_button</action-widget>
2647 <action-widget response="-5">GNUNET_GTK_publish_file_dialog_ok_button</action-widget>
2648 </action-widgets>
2649 </object>
2650 <object class="GtkListStore" id="GNUNET_GTK_publish_file_dialog_expiration_list_store">
2651 <columns>
2652 <!-- column-name human_readable_time -->
2653 <column type="gchararray"/>
2654 <!-- column-name time_in_ms -->
2655 <column type="guint64"/>
2656 </columns>
2657 </object>
2658 <object class="GtkListStore" id="GNUNET_GTK_select_pseudonym_liststore">
2659 <columns>
2660 <!-- column-name namespace_name -->
2661 <column type="gchararray"/>
2662 <!-- column-name namespace_handle -->
2663 <column type="gpointer"/>
2664 </columns>
888 </object> 2665 </object>
889 <object class="GtkAdjustment" id="adjustment3"> 2666 <object class="GtkAdjustment" id="adjustment3">
890 <property name="upper">100</property> 2667 <property name="upper">100</property>
891 <property name="step_increment">1</property> 2668 <property name="step_increment">1</property>
892 <property name="page_increment">10</property> 2669 <property name="page_increment">10</property>
893 <property name="page_size">10</property>
894 </object> 2670 </object>
895 <object class="GtkAdjustment" id="adjustment4"> 2671 <object class="GtkAdjustment" id="adjustment4">
896 <property name="upper">100</property> 2672 <property name="upper">100</property>
897 <property name="step_increment">1</property> 2673 <property name="step_increment">1</property>
898 <property name="page_increment">10</property> 2674 <property name="page_increment">10</property>
899 <property name="page_size">10</property>
900 </object> 2675 </object>
901 <object class="GtkImage" id="execute_stock_image"> 2676 <object class="GtkDialog" id="GNUNET_GTK_select_pseudonym_dialog">
902 <property name="visible">True</property>
903 <property name="can_focus">False</property> 2677 <property name="can_focus">False</property>
904 <property name="stock">gtk-execute</property> 2678 <property name="border_width">5</property>
2679 <property name="title" translatable="yes">Select pseudonym...</property>
2680 <property name="modal">True</property>
2681 <property name="default_width">400</property>
2682 <property name="default_height">300</property>
2683 <property name="destroy_with_parent">True</property>
2684 <property name="type_hint">normal</property>
2685 <signal name="realize" handler="GNUNET_GTK_select_pseudonym_dialog_realize_cb" swapped="no"/>
2686 <signal name="response" handler="GNUNET_GTK_select_pseudonym_dialog_response_cb" swapped="no"/>
2687 <child internal-child="vbox">
2688 <object class="GtkVBox" id="dialog-vbox3">
2689 <property name="visible">True</property>
2690 <property name="can_focus">False</property>
2691 <property name="spacing">2</property>
2692 <child internal-child="action_area">
2693 <object class="GtkHButtonBox" id="dialog-action_area3">
2694 <property name="visible">True</property>
2695 <property name="can_focus">False</property>
2696 <property name="layout_style">end</property>
2697 <child>
2698 <object class="GtkButton" id="GNUNET_GTK_select_pseudonym_cancel_button">
2699 <property name="label">gtk-cancel</property>
2700 <property name="use_action_appearance">False</property>
2701 <property name="visible">True</property>
2702 <property name="can_focus">True</property>
2703 <property name="receives_default">True</property>
2704 <property name="use_stock">True</property>
2705 </object>
2706 <packing>
2707 <property name="expand">False</property>
2708 <property name="fill">False</property>
2709 <property name="position">0</property>
2710 </packing>
2711 </child>
2712 <child>
2713 <object class="GtkButton" id="GNUNET_GTK_select_pseudonym_ok_button">
2714 <property name="label">gtk-ok</property>
2715 <property name="use_action_appearance">False</property>
2716 <property name="visible">True</property>
2717 <property name="sensitive">False</property>
2718 <property name="can_focus">True</property>
2719 <property name="receives_default">True</property>
2720 <property name="use_stock">True</property>
2721 </object>
2722 <packing>
2723 <property name="expand">False</property>
2724 <property name="fill">False</property>
2725 <property name="position">1</property>
2726 </packing>
2727 </child>
2728 </object>
2729 <packing>
2730 <property name="expand">False</property>
2731 <property name="fill">True</property>
2732 <property name="pack_type">end</property>
2733 <property name="position">0</property>
2734 </packing>
2735 </child>
2736 <child>
2737 <object class="GtkScrolledWindow" id="GNUNET_GTK_select_pseudonym_scrolledwindow">
2738 <property name="visible">True</property>
2739 <property name="can_focus">True</property>
2740 <property name="hadjustment">adjustment3</property>
2741 <property name="vadjustment">adjustment4</property>
2742 <property name="hscrollbar_policy">automatic</property>
2743 <property name="vscrollbar_policy">automatic</property>
2744 <property name="shadow_type">in</property>
2745 <child>
2746 <object class="GtkTreeView" id="GNUNET_GTK_select_pseudonym_tree_view">
2747 <property name="visible">True</property>
2748 <property name="can_focus">True</property>
2749 <property name="model">GNUNET_GTK_select_pseudonym_liststore</property>
2750 <property name="hadjustment">adjustment3</property>
2751 <property name="vadjustment">adjustment4</property>
2752 <property name="search_column">0</property>
2753 <child>
2754 <object class="GtkTreeViewColumn" id="GNUNET_GTK_select_pseudonym_tree_view_column">
2755 <property name="title" translatable="yes">Name</property>
2756 <property name="expand">True</property>
2757 <property name="clickable">True</property>
2758 <property name="reorderable">True</property>
2759 <property name="sort_indicator">True</property>
2760 <property name="sort_column_id">0</property>
2761 <child>
2762 <object class="GtkCellRendererText" id="GNUNET_GTK_select_pseudonym_name_renderer"/>
2763 <attributes>
2764 <attribute name="text">0</attribute>
2765 </attributes>
2766 </child>
2767 </object>
2768 </child>
2769 </object>
2770 </child>
2771 </object>
2772 <packing>
2773 <property name="expand">True</property>
2774 <property name="fill">True</property>
2775 <property name="position">1</property>
2776 </packing>
2777 </child>
2778 <child>
2779 <placeholder/>
2780 </child>
2781 </object>
2782 </child>
2783 <action-widgets>
2784 <action-widget response="-6">GNUNET_GTK_select_pseudonym_cancel_button</action-widget>
2785 <action-widget response="-5">GNUNET_GTK_select_pseudonym_ok_button</action-widget>
2786 </action-widgets>
905 </object> 2787 </object>
906 <object class="GtkImage" id="execute_stock_image1"> 2788 <object class="GtkImage" id="add_stock_image">
907 <property name="visible">True</property> 2789 <property name="visible">True</property>
908 <property name="can_focus">False</property> 2790 <property name="can_focus">False</property>
909 <property name="stock">gtk-execute</property> 2791 <property name="stock">gtk-add</property>
910 </object> 2792 </object>
911 <object class="GtkImage" id="execute_stock_image2"> 2793 <object class="GtkAdjustment" id="adjustment1">
912 <property name="visible">True</property> 2794 <property name="upper">100</property>
913 <property name="can_focus">False</property> 2795 <property name="step_increment">1</property>
914 <property name="stock">gtk-execute</property> 2796 <property name="page_increment">10</property>
2797 <property name="page_size">10</property>
915 </object> 2798 </object>
916 <object class="GtkImage" id="image1"> 2799 <object class="GtkAdjustment" id="adjustment2">
917 <property name="visible">True</property> 2800 <property name="upper">100</property>
918 <property name="can_focus">False</property> 2801 <property name="step_increment">1</property>
919 <property name="stock">gtk-open</property> 2802 <property name="page_increment">10</property>
2803 <property name="page_size">10</property>
920 </object> 2804 </object>
921 <object class="GtkImage" id="image2"> 2805 <object class="GtkAdjustment" id="adjustment5">
922 <property name="visible">True</property> 2806 <property name="upper">100</property>
923 <property name="can_focus">False</property> 2807 <property name="step_increment">1</property>
924 <property name="stock">gtk-go-up</property> 2808 <property name="page_increment">10</property>
925 </object> 2809 </object>
926 <object class="GtkImage" id="image3"> 2810 <object class="GtkAdjustment" id="adjustment6">
927 <property name="visible">True</property> 2811 <property name="upper">100</property>
928 <property name="can_focus">False</property> 2812 <property name="step_increment">1</property>
929 <property name="stock">gtk-new</property> 2813 <property name="page_increment">10</property>
930 </object> 2814 </object>
931 <object class="GtkImage" id="image4"> 2815 <object class="GtkAdjustment" id="adjustment7">
932 <property name="visible">True</property> 2816 <property name="upper">100</property>
933 <property name="can_focus">False</property> 2817 <property name="step_increment">1</property>
934 <property name="stock">gtk-find</property> 2818 <property name="page_increment">10</property>
2819 </object>
2820 <object class="GtkAdjustment" id="adjustment8">
2821 <property name="upper">100</property>
2822 <property name="step_increment">1</property>
2823 <property name="page_increment">10</property>
935 </object> 2824 </object>
936 <object class="GtkImage" id="image5"> 2825 <object class="GtkImage" id="down_stock_image">
937 <property name="visible">True</property> 2826 <property name="visible">True</property>
938 <property name="can_focus">False</property> 2827 <property name="can_focus">False</property>
939 <property name="stock">gtk-go-down</property> 2828 <property name="stock">gtk-go-down</property>
940 </object> 2829 </object>
941 <object class="GtkImage" id="image6"> 2830 <object class="GtkImage" id="execute_stock_image">
942 <property name="visible">True</property> 2831 <property name="visible">True</property>
943 <property name="can_focus">False</property> 2832 <property name="can_focus">False</property>
944 <property name="stock">gtk-index</property> 2833 <property name="stock">gtk-execute</property>
945 </object> 2834 </object>
946 <object class="GtkImage" id="image7"> 2835 <object class="GtkImage" id="find_stock_image">
947 <property name="visible">True</property> 2836 <property name="visible">True</property>
948 <property name="can_focus">False</property> 2837 <property name="can_focus">False</property>
949 <property name="stock">gtk-index</property> 2838 <property name="stock">gtk-find</property>
950 </object> 2839 </object>
951 <object class="GtkImage" id="image8"> 2840 <object class="GtkImage" id="index_stock_image">
952 <property name="visible">True</property> 2841 <property name="visible">True</property>
953 <property name="can_focus">False</property> 2842 <property name="can_focus">False</property>
954 <property name="stock">gtk-index</property> 2843 <property name="stock">gtk-index</property>
955 </object> 2844 </object>
956 <object class="GtkImage" id="image9"> 2845 <object class="GtkImage" id="left_stock_image">
957 <property name="visible">True</property> 2846 <property name="visible">True</property>
958 <property name="can_focus">False</property> 2847 <property name="can_focus">False</property>
959 <property name="stock">gtk-index</property> 2848 <property name="stock">gtk-go-back</property>
960 </object>
961 <object class="GtkSizeGroup" id="enties_and_comboboxes_sizegroup">
962 <property name="mode">vertical</property>
963 <widgets>
964 <widget name="main_window_search_entry"/>
965 <widget name="main_window_search_anonymity_combobox"/>
966 <widget name="main_window_search_mime_combobox"/>
967 </widgets>
968 </object> 2849 </object>
969 <object class="GtkListStore" id="main_window_search_anonymity_liststore"> 2850 <object class="GtkListStore" id="main_window_search_anonymity_liststore">
970 <columns> 2851 <columns>
@@ -1067,6 +2948,7 @@
1067 <property name="can_focus">False</property> 2948 <property name="can_focus">False</property>
1068 <property name="events">GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property> 2949 <property name="events">GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property>
1069 <property name="resizable">False</property> 2950 <property name="resizable">False</property>
2951 <property name="destroy_with_parent">True</property>
1070 <property name="type_hint">dropdown-menu</property> 2952 <property name="type_hint">dropdown-menu</property>
1071 <property name="skip_taskbar_hint">True</property> 2953 <property name="skip_taskbar_hint">True</property>
1072 <property name="skip_pager_hint">True</property> 2954 <property name="skip_pager_hint">True</property>
@@ -1117,4 +2999,78 @@
1117 </object> 2999 </object>
1118 </child> 3000 </child>
1119 </object> 3001 </object>
3002 <object class="GtkImage" id="new_stock_imag">
3003 <property name="visible">True</property>
3004 <property name="can_focus">False</property>
3005 <property name="stock">gtk-new</property>
3006 </object>
3007 <object class="GtkImage" id="new_stock_image">
3008 <property name="visible">True</property>
3009 <property name="can_focus">False</property>
3010 <property name="stock">gtk-new</property>
3011 </object>
3012 <object class="GtkImage" id="open_stock_image">
3013 <property name="visible">True</property>
3014 <property name="can_focus">False</property>
3015 <property name="stock">gtk-open</property>
3016 </object>
3017 <object class="GtkAdjustment" id="priority_adjustment">
3018 <property name="upper">10000000</property>
3019 <property name="value">1000</property>
3020 <property name="step_increment">1</property>
3021 <property name="page_increment">10</property>
3022 </object>
3023 <object class="GtkImage" id="right_stock_image">
3024 <property name="visible">True</property>
3025 <property name="can_focus">False</property>
3026 <property name="stock">gtk-go-forward</property>
3027 </object>
3028 <object class="GtkImage" id="up_stock_image">
3029 <property name="visible">True</property>
3030 <property name="can_focus">False</property>
3031 <property name="stock">gtk-go-up</property>
3032 </object>
3033 <object class="GtkSizeGroup" id="edit_publication_options_input_widgets_sizegroup">
3034 <widgets>
3035 <widget name="GNUNET_GTK_edit_publication_anonymity_combobox_alignment"/>
3036 <widget name="GNUNET_GTK_edit_publication_priority_spin_button"/>
3037 <widget name="GNUNET_GTK_edit_publication_root_entry"/>
3038 <widget name="GNUNET_GTK_edit_publication_expiration_year_spin_button"/>
3039 <widget name="GNUNET_GTK_edit_publication_index_checkbutton"/>
3040 </widgets>
3041 </object>
3042 <object class="GtkSizeGroup" id="edit_publication_options_labels_sizegroup">
3043 <widgets>
3044 <widget name="GNUNET_GTK_edit_publication_anonymity_label"/>
3045 <widget name="GNUNET_GTK_edit_publication_priority_label"/>
3046 <widget name="GNUNET_GTK_edit_publication_root_label"/>
3047 <widget name="GNUNET_GTK_edit_publication_expiration_label"/>
3048 <widget name="GNUNET_GTK_edit_publication_index_label"/>
3049 </widgets>
3050 </object>
3051 <object class="GtkSizeGroup" id="enties_and_comboboxes_sizegroup">
3052 <property name="mode">vertical</property>
3053 <widgets>
3054 <widget name="main_window_search_entry"/>
3055 <widget name="main_window_search_anonymity_combobox"/>
3056 <widget name="main_window_search_mime_combobox"/>
3057 </widgets>
3058 </object>
3059 <object class="GtkAdjustment" id="expiration_year_adjustment">
3060 <property name="upper">9999</property>
3061 <property name="step_increment">1</property>
3062 <property name="page_increment">10</property>
3063 </object>
3064 <object class="GtkSizeGroup" id="sizegroup4">
3065 <widgets>
3066 <widget name="GNUNET_GTK_master_publish_dialog_cancel_button"/>
3067 <widget name="GNUNET_GTK_master_publish_dialog_execute_button"/>
3068 </widgets>
3069 </object>
3070 <object class="GtkSizeGroup" id="sizegroup5">
3071 <widgets>
3072 <widget name="GNUNET_GTK_edit_publication_confirm_button"/>
3073 <widget name="GNUNET_GTK_edit_publication_cancel_button"/>
3074 </widgets>
3075 </object>
1120</interface> 3076</interface>
diff --git a/contrib/gnunet_fs_gtk_open_directory_dialog.glade b/contrib/gnunet_fs_gtk_open_directory_dialog.glade
index d55c0b00..a807742a 100644
--- a/contrib/gnunet_fs_gtk_open_directory_dialog.glade
+++ b/contrib/gnunet_fs_gtk_open_directory_dialog.glade
@@ -4,30 +4,30 @@
4 <!-- interface-naming-policy project-wide --> 4 <!-- interface-naming-policy project-wide -->
5 <object class="GtkFileFilter" id="gnunet_directory_filter"/> 5 <object class="GtkFileFilter" id="gnunet_directory_filter"/>
6 <object class="GtkFileChooserDialog" id="GNUNET_GTK_open_directory_dialog"> 6 <object class="GtkFileChooserDialog" id="GNUNET_GTK_open_directory_dialog">
7 <property name="can_focus">False</property>
7 <property name="can_default">True</property> 8 <property name="can_default">True</property>
8 <property name="border_width">5</property> 9 <property name="border_width">5</property>
9 <property name="type_hint">normal</property> 10 <property name="type_hint">normal</property>
10 <property name="has_separator">False</property>
11 <property name="filter">gnunet_directory_filter</property>
12 <property name="create_folders">False</property> 11 <property name="create_folders">False</property>
12 <property name="filter">gnunet_directory_filter</property>
13 <signal name="response" handler="GNUNET_GTK_open_directory_dialog_response_cb" swapped="no"/>
13 <child internal-child="vbox"> 14 <child internal-child="vbox">
14 <object class="GtkVBox" id="dialog-vbox3"> 15 <object class="GtkVBox" id="dialog-vbox3">
15 <property name="visible">True</property> 16 <property name="visible">True</property>
17 <property name="can_focus">False</property>
16 <property name="spacing">2</property> 18 <property name="spacing">2</property>
17 <child>
18 <placeholder/>
19 </child>
20 <child internal-child="action_area"> 19 <child internal-child="action_area">
21 <object class="GtkHButtonBox" id="dialog-action_area4"> 20 <object class="GtkHButtonBox" id="dialog-action_area4">
22 <property name="visible">True</property> 21 <property name="visible">True</property>
22 <property name="can_focus">False</property>
23 <property name="layout_style">end</property> 23 <property name="layout_style">end</property>
24 <child> 24 <child>
25 <object class="GtkButton" id="GNUNET_GTK_open_directory_dialog_cancel_button"> 25 <object class="GtkButton" id="GNUNET_GTK_open_directory_dialog_cancel_button">
26 <property name="label">gtk-cancel</property> 26 <property name="label">gtk-cancel</property>
27 <property name="use_action_appearance">False</property>
27 <property name="visible">True</property> 28 <property name="visible">True</property>
28 <property name="can_focus">True</property> 29 <property name="can_focus">True</property>
29 <property name="receives_default">True</property> 30 <property name="receives_default">True</property>
30 <property name="use_action_appearance">False</property>
31 <property name="use_stock">True</property> 31 <property name="use_stock">True</property>
32 </object> 32 </object>
33 <packing> 33 <packing>
@@ -39,11 +39,11 @@
39 <child> 39 <child>
40 <object class="GtkButton" id="GNUNET_GTK_open_directory_dialog_ok_button"> 40 <object class="GtkButton" id="GNUNET_GTK_open_directory_dialog_ok_button">
41 <property name="label">gtk-ok</property> 41 <property name="label">gtk-ok</property>
42 <property name="use_action_appearance">False</property>
42 <property name="visible">True</property> 43 <property name="visible">True</property>
43 <property name="can_focus">True</property> 44 <property name="can_focus">True</property>
44 <property name="can_default">True</property> 45 <property name="can_default">True</property>
45 <property name="receives_default">True</property> 46 <property name="receives_default">True</property>
46 <property name="use_action_appearance">False</property>
47 <property name="use_stock">True</property> 47 <property name="use_stock">True</property>
48 </object> 48 </object>
49 <packing> 49 <packing>
@@ -55,10 +55,14 @@
55 </object> 55 </object>
56 <packing> 56 <packing>
57 <property name="expand">False</property> 57 <property name="expand">False</property>
58 <property name="fill">True</property>
58 <property name="pack_type">end</property> 59 <property name="pack_type">end</property>
59 <property name="position">0</property> 60 <property name="position">0</property>
60 </packing> 61 </packing>
61 </child> 62 </child>
63 <child>
64 <placeholder/>
65 </child>
62 </object> 66 </object>
63 </child> 67 </child>
64 <action-widgets> 68 <action-widgets>
diff --git a/contrib/gnunet_fs_gtk_select_pseudonym_dialog.glade b/contrib/gnunet_fs_gtk_select_pseudonym_dialog.glade
index ea50fa41..418231de 100644
--- a/contrib/gnunet_fs_gtk_select_pseudonym_dialog.glade
+++ b/contrib/gnunet_fs_gtk_select_pseudonym_dialog.glade
@@ -2,28 +2,81 @@
2<interface> 2<interface>
3 <requires lib="gtk+" version="2.20"/> 3 <requires lib="gtk+" version="2.20"/>
4 <!-- interface-naming-policy project-wide --> 4 <!-- interface-naming-policy project-wide -->
5 <object class="GtkAdjustment" id="adjustment2"> 5 <object class="GtkListStore" id="GNUNET_GTK_select_pseudonym_liststore">
6 <columns>
7 <!-- column-name namespace_name -->
8 <column type="gchararray"/>
9 <!-- column-name namespace_handle -->
10 <column type="gpointer"/>
11 </columns>
12 </object>
13 <object class="GtkAdjustment" id="adjustment1">
6 <property name="upper">100</property> 14 <property name="upper">100</property>
7 <property name="step_increment">1</property> 15 <property name="step_increment">1</property>
8 <property name="page_increment">10</property> 16 <property name="page_increment">10</property>
9 <property name="page_size">10</property> 17 <property name="page_size">10</property>
10 </object> 18 </object>
11 <object class="GtkAdjustment" id="adjustment1"> 19 <object class="GtkAdjustment" id="adjustment2">
12 <property name="upper">100</property> 20 <property name="upper">100</property>
13 <property name="step_increment">1</property> 21 <property name="step_increment">1</property>
14 <property name="page_increment">10</property> 22 <property name="page_increment">10</property>
15 <property name="page_size">10</property> 23 <property name="page_size">10</property>
16 </object> 24 </object>
17 <object class="GtkDialog" id="GNUNET_GTK_select_pseudonym_dialog"> 25 <object class="GtkDialog" id="GNUNET_GTK_select_pseudonym_dialog">
26 <property name="can_focus">False</property>
18 <property name="border_width">5</property> 27 <property name="border_width">5</property>
19 <property name="title" translatable="yes">Select pseudonym...</property> 28 <property name="title" translatable="yes">Select pseudonym...</property>
20 <property name="modal">True</property> 29 <property name="modal">True</property>
21 <property name="type_hint">normal</property> 30 <property name="type_hint">normal</property>
22 <property name="has_separator">False</property>
23 <child internal-child="vbox"> 31 <child internal-child="vbox">
24 <object class="GtkVBox" id="GNUNET_GTK_select_pseudonym_dialog_vbox"> 32 <object class="GtkVBox" id="GNUNET_GTK_select_pseudonym_dialog_vbox">
25 <property name="visible">True</property> 33 <property name="visible">True</property>
34 <property name="can_focus">False</property>
26 <property name="spacing">2</property> 35 <property name="spacing">2</property>
36 <child internal-child="action_area">
37 <object class="GtkHButtonBox" id="GNUNET_GTK_select_pseudonym_dialog_action_area">
38 <property name="visible">True</property>
39 <property name="can_focus">False</property>
40 <property name="layout_style">end</property>
41 <child>
42 <object class="GtkButton" id="GNUNET_GTK_select_pseudonym_cancel_button">
43 <property name="label">gtk-cancel</property>
44 <property name="use_action_appearance">False</property>
45 <property name="visible">True</property>
46 <property name="can_focus">True</property>
47 <property name="receives_default">True</property>
48 <property name="use_stock">True</property>
49 </object>
50 <packing>
51 <property name="expand">False</property>
52 <property name="fill">False</property>
53 <property name="position">0</property>
54 </packing>
55 </child>
56 <child>
57 <object class="GtkButton" id="GNUNET_GTK_select_pseudonym_ok_button">
58 <property name="label">gtk-ok</property>
59 <property name="use_action_appearance">False</property>
60 <property name="visible">True</property>
61 <property name="sensitive">False</property>
62 <property name="can_focus">True</property>
63 <property name="receives_default">True</property>
64 <property name="use_stock">True</property>
65 </object>
66 <packing>
67 <property name="expand">False</property>
68 <property name="fill">False</property>
69 <property name="position">1</property>
70 </packing>
71 </child>
72 </object>
73 <packing>
74 <property name="expand">False</property>
75 <property name="fill">True</property>
76 <property name="pack_type">end</property>
77 <property name="position">0</property>
78 </packing>
79 </child>
27 <child> 80 <child>
28 <object class="GtkScrolledWindow" id="GNUNET_GTK_select_pseudonym_scrolledwindow"> 81 <object class="GtkScrolledWindow" id="GNUNET_GTK_select_pseudonym_scrolledwindow">
29 <property name="visible">True</property> 82 <property name="visible">True</property>
@@ -59,54 +112,14 @@
59 </child> 112 </child>
60 </object> 113 </object>
61 <packing> 114 <packing>
115 <property name="expand">True</property>
116 <property name="fill">True</property>
62 <property name="position">1</property> 117 <property name="position">1</property>
63 </packing> 118 </packing>
64 </child> 119 </child>
65 <child> 120 <child>
66 <placeholder/> 121 <placeholder/>
67 </child> 122 </child>
68 <child internal-child="action_area">
69 <object class="GtkHButtonBox" id="GNUNET_GTK_select_pseudonym_dialog_action_area">
70 <property name="visible">True</property>
71 <property name="layout_style">end</property>
72 <child>
73 <object class="GtkButton" id="GNUNET_GTK_select_pseudonym_cancel_button">
74 <property name="label">gtk-cancel</property>
75 <property name="visible">True</property>
76 <property name="can_focus">True</property>
77 <property name="receives_default">True</property>
78 <property name="use_action_appearance">False</property>
79 <property name="use_stock">True</property>
80 </object>
81 <packing>
82 <property name="expand">False</property>
83 <property name="fill">False</property>
84 <property name="position">0</property>
85 </packing>
86 </child>
87 <child>
88 <object class="GtkButton" id="GNUNET_GTK_select_pseudonym_ok_button">
89 <property name="label">gtk-ok</property>
90 <property name="visible">True</property>
91 <property name="sensitive">False</property>
92 <property name="can_focus">True</property>
93 <property name="receives_default">True</property>
94 <property name="use_action_appearance">False</property>
95 <property name="use_stock">True</property>
96 </object>
97 <packing>
98 <property name="expand">False</property>
99 <property name="fill">False</property>
100 <property name="position">1</property>
101 </packing>
102 </child>
103 </object>
104 <packing>
105 <property name="expand">False</property>
106 <property name="pack_type">end</property>
107 <property name="position">0</property>
108 </packing>
109 </child>
110 </object> 123 </object>
111 </child> 124 </child>
112 <action-widgets> 125 <action-widgets>
@@ -114,12 +127,4 @@
114 <action-widget response="-5">GNUNET_GTK_select_pseudonym_ok_button</action-widget> 127 <action-widget response="-5">GNUNET_GTK_select_pseudonym_ok_button</action-widget>
115 </action-widgets> 128 </action-widgets>
116 </object> 129 </object>
117 <object class="GtkListStore" id="GNUNET_GTK_select_pseudonym_liststore">
118 <columns>
119 <!-- column-name namespace_name -->
120 <column type="gchararray"/>
121 <!-- column-name namespace_handle -->
122 <column type="gpointer"/>
123 </columns>
124 </object>
125</interface> 130</interface>
diff --git a/src/fs/gnunet-fs-gtk-download.c b/src/fs/gnunet-fs-gtk-download.c
index d9451e1c..1a7ff302 100644
--- a/src/fs/gnunet-fs-gtk-download.c
+++ b/src/fs/gnunet-fs-gtk-download.c
@@ -203,7 +203,7 @@ GNUNET_FS_GTK_open_download_as_dialog (struct DownloadContext *dc)
203 dlc->response = 0; 203 dlc->response = 0;
204 dlc->dc = dc; 204 dlc->dc = dc;
205 g_object_set_data (G_OBJECT (ad), "dialog-context", dlc); 205 g_object_set_data (G_OBJECT (ad), "dialog-context", dlc);
206 gtk_widget_show_all (ad); 206 gtk_window_present (GTK_WINDOW (ad));
207} 207}
208 208
209/* end of gnunet-fs-gtk-download.c */ 209/* end of gnunet-fs-gtk-download.c */
diff --git a/src/fs/gnunet-fs-gtk-edit_publish_dialog.c b/src/fs/gnunet-fs-gtk-edit_publish_dialog.c
index 2465e6ac..37fe1a2a 100644
--- a/src/fs/gnunet-fs-gtk-edit_publish_dialog.c
+++ b/src/fs/gnunet-fs-gtk-edit_publish_dialog.c
@@ -24,87 +24,26 @@
24 */ 24 */
25#include "gnunet-fs-gtk-common.h" 25#include "gnunet-fs-gtk-common.h"
26#include "gnunet-fs-gtk-edit_publish_dialog.h" 26#include "gnunet-fs-gtk-edit_publish_dialog.h"
27#include "gnunet-fs-gtk.h"
27#include <gnunet/gnunet_util_lib.h> 28#include <gnunet/gnunet_util_lib.h>
29#include <gdk/gdkkeysyms.h>
28 30
29/** 31#define PUBSTATE "edit-publication-state"
30 * Builder for the current dialog.
31 */
32static GtkBuilder *builder;
33
34/**
35 * Are we editing metadata for a directory?
36 */
37static int is_directory;
38
39/**
40 * Set to YES if the preview was changed.
41 */
42static int preview_changed;
43
44void
45GNUNET_GTK_edit_file_information_keyword_list_normalize_button_clicked_cb ()
46{
47 GNUNET_break (0);
48}
49
50void
51GNUNET_GTK_edit_file_information_keyword_list_del_button_clicked_cb ()
52{
53 GtkTreeView *tv;
54 GtkTreeSelection *sel;
55 GtkTreeModel *tm;
56 GtkTreeIter iter;
57
58 tv = GTK_TREE_VIEW (gtk_builder_get_object
59 (builder,
60 "GNUNET_GTK_edit_file_information_keyword_list_tree_view"));
61 sel = gtk_tree_view_get_selection (tv);
62 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
63 {
64 GNUNET_break (0);
65 return;
66 }
67 gtk_list_store_remove (GTK_LIST_STORE (tm), &iter);
68}
69
70void
71GNUNET_GTK_edit_file_information_keyword_list_add_button_clicked_cb ()
72{
73 const char *keyword;
74 GtkEntry *entry;
75 GtkListStore *ls;
76 GtkTreeIter iter;
77
78 ls = GTK_LIST_STORE (gtk_builder_get_object
79 (builder, "GNUNET_GTK_keyword_list_store"));
80 entry =
81 GTK_ENTRY (gtk_builder_get_object
82 (builder, "GNUNET_GTK_edit_file_information_keyword_entry"));
83 keyword = gtk_entry_get_text (entry);
84 if (strlen (keyword) > 0)
85 gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, keyword, -1);
86 gtk_entry_set_text (entry, "");
87}
88 32
89 33struct edit_publication_state
90void
91GNUNET_GTK_edit_file_information_keyword_entry_changed_cb ()
92{ 34{
93 const char *keyword; 35 int *do_index;
94 GtkEntry *entry; 36 char **short_fn;
95 GtkWidget *button; 37 guint *anonymity_level;
96 38 guint *priority;
97 button = 39 struct GNUNET_FS_FileInformation *fip;
98 GTK_WIDGET (gtk_builder_get_object 40 gint preview_changed;
99 (builder, 41 gboolean allow_no_keywords;
100 "GNUNET_GTK_edit_file_information_keyword_list_add_button")); 42 gboolean is_directory;
101 entry = 43 GNUNET_FS_GTK_edit_publish_dialog_cb cb;
102 GTK_ENTRY (gtk_builder_get_object 44 gchar *root;
103 (builder, "GNUNET_GTK_edit_file_information_keyword_entry")); 45 gpointer cls;
104 keyword = gtk_entry_get_text (entry); 46};
105 gtk_widget_set_sensitive (button, (strlen (keyword) > 0) ? TRUE : FALSE);
106}
107
108 47
109static void 48static void
110metadata_selection_changed_cb (GtkTreeSelection * ts, gpointer user_data) 49metadata_selection_changed_cb (GtkTreeSelection * ts, gpointer user_data)
@@ -112,165 +51,222 @@ metadata_selection_changed_cb (GtkTreeSelection * ts, gpointer user_data)
112 GtkTreeView *tv; 51 GtkTreeView *tv;
113 GtkTreeSelection *sel; 52 GtkTreeSelection *sel;
114 GtkWidget *button; 53 GtkWidget *button;
54 GtkBuilder *builder;
55
56 builder = GTK_BUILDER (user_data);
115 57
116 tv = GTK_TREE_VIEW (gtk_builder_get_object 58 tv = GTK_TREE_VIEW (gtk_builder_get_object
117 (builder, 59 (builder,
118 "GNUNET_GTK_edit_file_information_metadata_tree_view")); 60 "GNUNET_GTK_edit_publication_metadata_tree_view"));
119 sel = gtk_tree_view_get_selection (tv); 61 sel = gtk_tree_view_get_selection (tv);
120 button = 62 button =
121 GTK_WIDGET (gtk_builder_get_object 63 GTK_WIDGET (gtk_builder_get_object
122 (builder, 64 (builder,
123 "GNUNET_GTK_edit_file_information_metadata_delete_button")); 65 "GNUNET_GTK_edit_publication_delete_button"));
124 gtk_widget_set_sensitive (button, 66 gtk_widget_set_sensitive (button,
125 gtk_tree_selection_get_selected (sel, NULL, NULL)); 67 gtk_tree_selection_get_selected (sel, NULL, NULL));
126} 68}
127 69
128
129static void 70static void
130keyword_selection_changed_cb (GtkTreeSelection * ts, gpointer user_data) 71keywords_selection_changed_cb (GtkTreeSelection * ts, gpointer user_data)
131{ 72{
132 GtkTreeView *tv; 73 GtkTreeView *tv;
133 GtkTreeSelection *sel; 74 GtkTreeSelection *sel;
134 GtkWidget *button; 75 GtkWidget *button;
76 GtkBuilder *builder;
77
78 builder = GTK_BUILDER (user_data);
79
135 80
136 tv = GTK_TREE_VIEW (gtk_builder_get_object 81 tv = GTK_TREE_VIEW (gtk_builder_get_object
137 (builder, 82 (builder,
138 "GNUNET_GTK_edit_file_information_keyword_list_tree_view")); 83 "GNUNET_GTK_edit_publication_keyword_list_tree_view"));
139 sel = gtk_tree_view_get_selection (tv); 84 sel = gtk_tree_view_get_selection (tv);
140 button = 85 button =
141 GTK_WIDGET (gtk_builder_get_object 86 GTK_WIDGET (gtk_builder_get_object
142 (builder, 87 (builder,
143 "GNUNET_GTK_edit_file_information_keyword_list_del_button")); 88 "GNUNET_GTK_edit_publication_keyword_list_del_button"));
144 89
145 gtk_widget_set_sensitive (button, 90 gtk_widget_set_sensitive (button,
146 gtk_tree_selection_get_selected (sel, NULL, NULL)); 91 gtk_tree_selection_get_selected (sel, NULL, NULL));
147 button = 92 button =
148 GTK_WIDGET (gtk_builder_get_object 93 GTK_WIDGET (gtk_builder_get_object
149 (builder, 94 (builder,
150 "GNUNET_GTK_edit_file_information_keyword_list_normalize_button")); 95 "GNUNET_GTK_edit_publication_keyword_list_normalize_button"));
151 gtk_widget_set_sensitive (button, 96 gtk_widget_set_sensitive (button,
152 gtk_tree_selection_get_selected (sel, NULL, NULL)); 97 gtk_tree_selection_get_selected (sel, NULL, NULL));
153} 98}
154 99
155 100
156void 101void
157GNUNET_GTK_edit_file_information_metadata_value_entry_changed_cb () 102GNUNET_GTK_edit_publication_window_realize_cb (GtkWidget *widget,
103 gpointer user_data)
158{ 104{
105 GtkBuilder *builder;
106 GtkListStore *metatypes_list;
107 GtkTreeIter iter;
159 GtkTreeView *tv; 108 GtkTreeView *tv;
160 GtkTreeSelection *sel; 109 GtkTreeSelection *sel;
161 const char *value; 110 guint type;
162 GtkEntry *entry; 111 guint max_type;
163 GtkWidget *button;
164 112
165 entry = 113 builder = GTK_BUILDER (user_data);
166 GTK_ENTRY (gtk_builder_get_object 114 metatypes_list = GTK_LIST_STORE (gtk_builder_get_object (builder,
167 (builder, 115 "GNUNET_GTK_publication_metadata_types_liststore"));
168 "GNUNET_GTK_edit_file_information_metadata_value_entry")); 116
169 value = gtk_entry_get_text (entry); 117 tv = GTK_TREE_VIEW (gtk_builder_get_object (builder,
170 tv = GTK_TREE_VIEW (gtk_builder_get_object 118 "GNUNET_GTK_edit_publication_metadata_tree_view"));
171 (builder,
172 "GNUNET_GTK_edit_file_information_metadata_type_tree_view"));
173 sel = gtk_tree_view_get_selection (tv); 119 sel = gtk_tree_view_get_selection (tv);
174 button = 120 g_signal_connect (G_OBJECT (sel), "changed",
175 GTK_WIDGET (gtk_builder_get_object 121 G_CALLBACK (metadata_selection_changed_cb), builder);
176 (builder,
177 "GNUNET_GTK_edit_file_information_metadata_add_button"));
178 gtk_widget_set_sensitive (button,
179 (strlen (value) >
180 0) ? gtk_tree_selection_get_selected (sel, NULL,
181 NULL) :
182 FALSE);
183}
184 122
123 tv = GTK_TREE_VIEW (gtk_builder_get_object (builder,
124 "GNUNET_GTK_edit_publication_keyword_list_tree_view"));
125 sel = gtk_tree_view_get_selection (tv);
126 g_signal_connect (G_OBJECT (sel), "changed",
127 G_CALLBACK (keywords_selection_changed_cb), builder);
185 128
186void 129 max_type = EXTRACTOR_metatype_get_max ();
187GNUNET_GTK_edit_file_information_keyword_entry_activate_cb () 130 for (type = 1; type < max_type - 1; type++)
188{ 131 gtk_list_store_insert_with_values (metatypes_list, &iter, G_MAXINT,
189 GNUNET_GTK_edit_file_information_keyword_list_add_button_clicked_cb (); 132 0, type,
133 1, EXTRACTOR_METAFORMAT_UTF8,
134 2, EXTRACTOR_metatype_to_string (type),
135 3, EXTRACTOR_metatype_to_description (type), -1);
190} 136}
191 137
192
193void 138void
194GNUNET_GTK_edit_file_information_metadata_preview_file_chooser_button_file_set_cb 139GNUNET_GTK_edit_publication_add_button_clicked_cb (GtkButton *button,
195 (GtkFileChooserButton * widget, gpointer user_data) 140 gpointer user_data)
196{ 141{
197 gchar *fn; 142 GtkBuilder *builder;
198 GtkImage *image; 143 GtkTreeView *meta_tree;
144 GtkListStore *meta_list;
145 GtkTreeIter iter;
199 146
200 fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); 147 builder = GTK_BUILDER (user_data);
201 image = 148 meta_tree = GTK_TREE_VIEW (gtk_builder_get_object (builder,
202 GTK_IMAGE (gtk_builder_get_object 149 "GNUNET_GTK_edit_publication_metadata_tree_view"));
203 (builder, 150 meta_list = GTK_LIST_STORE (gtk_tree_view_get_model (meta_tree));
204 "GNUNET_GTK_edit_file_information_metadata_preview_image")); 151
205 gtk_image_set_from_file (image, fn); 152 gtk_list_store_insert (meta_list, &iter, 0);
206 preview_changed = GNUNET_YES; 153 /* type == -1 means "not set" */
154 gtk_list_store_set (meta_list, &iter, 0, -1, 1, EXTRACTOR_METAFORMAT_UTF8,
155 2, _("Select a type"), 3, _("Specify a value"), 4, NULL, -1);
207} 156}
208 157
158gboolean
159GNUNET_GTK_edit_publication_keyword_entry_key_press_event_cb (GtkWidget *widget,
160 GdkEventKey *event, gpointer user_data)
161{
162 GtkBuilder *builder;
163 GtkButton *add_button;
164 builder = GTK_BUILDER (user_data);
165
166 if (event->keyval == GDK_KEY_Return)
167 {
168 add_button = GTK_BUTTON (gtk_builder_get_object (builder,
169 "GNUNET_GTK_edit_publication_add_button"));
170 GNUNET_GTK_edit_publication_add_button_clicked_cb (add_button, user_data);
171 return TRUE;
172 }
173 return FALSE;
174}
209 175
210void 176void
211GNUNET_GTK_edit_file_information_metadata_delete_button_clicked_cb () 177GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_edited_cb (
178 GtkCellRendererText *renderer, gchar *path, gchar *new_text,
179 gpointer user_data)
212{ 180{
213 GtkTreeView *tv; 181 GtkBuilder *builder;
214 GtkTreeSelection *sel; 182 GtkTreeView *meta_tree;
215 GtkTreeModel *tm; 183 GtkListStore *meta_list;
184 GtkCellRendererCombo *combo;
185 GtkTreeModel *combo_model;
216 GtkTreeIter iter; 186 GtkTreeIter iter;
187 gint type_id;
188 gchar *description = NULL;
189 GtkTreeIter *pass_data = NULL;
190
191 builder = GTK_BUILDER (user_data);
192 meta_tree = GTK_TREE_VIEW (gtk_builder_get_object (builder,
193 "GNUNET_GTK_edit_publication_metadata_tree_view"));
194 meta_list = GTK_LIST_STORE (gtk_tree_view_get_model (meta_tree));
195 if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (meta_list), &iter, path))
196 return;
217 197
218 tv = GTK_TREE_VIEW (gtk_builder_get_object 198 combo = GTK_CELL_RENDERER_COMBO (gtk_builder_get_object (builder,
219 (builder, 199 "GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer"));
220 "GNUNET_GTK_edit_file_information_metadata_tree_view")); 200
221 sel = gtk_tree_view_get_selection (tv); 201 pass_data = g_object_get_data (G_OBJECT (combo), "selected-type");
222 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter)) 202 if (!pass_data)
223 {
224 GNUNET_break (0);
225 return; 203 return;
226 } 204 g_object_get (combo, "model", &combo_model, NULL);
227 gtk_list_store_remove (GTK_LIST_STORE (tm), &iter); 205 gtk_tree_model_get (combo_model, pass_data, 0, &type_id, 2, &description, -1);
206 g_free (combo_model);
207 g_free (pass_data);
208 g_object_set_data (G_OBJECT (combo), "selected-type", NULL);
209
210 gtk_list_store_set (meta_list, &iter, 0, type_id, 1,
211 EXTRACTOR_METAFORMAT_UTF8, 2, new_text, 4, description, -1);
212 g_free (description);
228} 213}
229 214
215void
216GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_changed_cb (
217 GtkCellRendererCombo *combo, gchar *path_string, GtkTreeIter *new_iter,
218 gpointer user_data)
219{
220 GtkTreeIter *pass_data;
221
222 pass_data = g_object_get_data (G_OBJECT (combo), "selected-type");
223 if (pass_data)
224 g_free (pass_data);
225 pass_data = g_new0 (GtkTreeIter, 1);
226 *pass_data = *new_iter;
227 g_object_set_data (G_OBJECT (combo), "selected-type", pass_data);
228}
230 229
231void 230void
232GNUNET_GTK_edit_file_information_metadata_add_button_clicked_cb () 231GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer_edited_cb (
232 GtkCellRendererText *renderer, gchar *path, gchar *new_text,
233 gpointer user_data)
233{ 234{
234 const char *value; 235 GtkBuilder *builder;
236 GtkTreeView *meta_tree;
237 GtkListStore *meta_list;
238 GtkTreeIter iter;
239 gint metatype;
235 char *avalue; 240 char *avalue;
236 const char *ivalue; 241 const char *ivalue;
237 GtkEntry *entry;
238 GtkListStore *ls;
239 GtkTreeModel *tm;
240 GtkTreeView *tv;
241 GtkTreeSelection *sel;
242 GtkTreeIter iter;
243 guint type;
244 size_t slen; 242 size_t slen;
245 char *pos; 243 char *pos;
246 244
247 entry = 245 GObject *pubwindow;
248 GTK_ENTRY (gtk_builder_get_object 246 struct edit_publication_state *state = NULL;
249 (builder, 247
250 "GNUNET_GTK_edit_file_information_metadata_value_entry")); 248 builder = GTK_BUILDER (user_data);
251 value = gtk_entry_get_text (entry); 249 meta_tree = GTK_TREE_VIEW (gtk_builder_get_object (builder,
252 if ((value == NULL) || (strlen (value) == 0)) 250 "GNUNET_GTK_edit_publication_metadata_tree_view"));
253 { 251 meta_list = GTK_LIST_STORE (gtk_tree_view_get_model (meta_tree));
254 GNUNET_break (0); 252 if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (meta_list), &iter, path))
255 return; 253 return;
256 } 254
257 tv = GTK_TREE_VIEW (gtk_builder_get_object 255 pubwindow = gtk_builder_get_object (builder,
258 (builder, 256 "GNUNET_GTK_edit_publication_window");
259 "GNUNET_GTK_edit_file_information_metadata_type_tree_view")); 257 state = g_object_get_data (pubwindow, PUBSTATE);
260 tm = gtk_tree_view_get_model (tv); 258 if (!state)
261 sel = gtk_tree_view_get_selection (tv);
262 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
263 { 259 {
264 GNUNET_break (0); 260 GNUNET_break (0);
265 return; 261 return;
266 } 262 }
267 gtk_tree_model_get (tm, &iter, 1, &type, -1); 263
268 ls = GTK_LIST_STORE (gtk_builder_get_object 264 gtk_tree_model_get (GTK_TREE_MODEL (meta_list), &iter, 0, &metatype, -1);
269 (builder, "GNUNET_GTK_meta_data_list_store")); 265 if (metatype == EXTRACTOR_METATYPE_FILENAME
270 if ((type == EXTRACTOR_METATYPE_FILENAME) && 266 && new_text[strlen (new_text) - 1] != '/'
271 (value[strlen (value) - 1] != '/') && (is_directory)) 267 && state->is_directory)
272 { 268 {
273 GNUNET_asprintf (&avalue, "%s/", value); 269 GNUNET_asprintf (&avalue, "%s/", new_text);
274 /* if user typed '\' instead of '/', change it! */ 270 /* if user typed '\' instead of '/', change it! */
275 slen = strlen (avalue); 271 slen = strlen (avalue);
276 while ((slen > 1) && (avalue[slen - 2] == '\\')) 272 while ((slen > 1) && (avalue[slen - 2] == '\\'))
@@ -281,7 +277,7 @@ GNUNET_GTK_edit_file_information_metadata_add_button_clicked_cb ()
281 } 277 }
282 while (NULL != (pos = strstr (avalue, "\\"))) 278 while (NULL != (pos = strstr (avalue, "\\")))
283 *pos = '/'; 279 *pos = '/';
284 /* remove '../' everywhere */ 280 // remove '../' everywhere
285 while (NULL != (pos = strstr (avalue, "../"))) 281 while (NULL != (pos = strstr (avalue, "../")))
286 { 282 {
287 pos[0] = '_'; 283 pos[0] = '_';
@@ -292,158 +288,260 @@ GNUNET_GTK_edit_file_information_metadata_add_button_clicked_cb ()
292 } 288 }
293 else 289 else
294 { 290 {
295 ivalue = value; 291 ivalue = new_text;
296 avalue = NULL; 292 avalue = NULL;
297 } 293 }
298 294
299 gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, type, 1, 295 gtk_list_store_set (meta_list, &iter, 3, ivalue, -1);
300 (guint) EXTRACTOR_METAFORMAT_UTF8, 2,
301 EXTRACTOR_metatype_to_string (type), 3,
302 ivalue, -1);
303 GNUNET_free_non_null (avalue); 296 GNUNET_free_non_null (avalue);
304 gtk_entry_set_text (GTK_ENTRY (entry), "");
305} 297}
306 298
299void
300GNUNET_GTK_edit_publication_delete_button_clicked_cb (GtkButton *button,
301 gpointer user_data)
302{
303 GtkTreeView *tv;
304 GtkTreeSelection *sel;
305 GtkTreeModel *tm;
306 GtkTreeIter iter;
307 GtkBuilder *builder = GTK_BUILDER (user_data);
307 308
308/** 309 tv = GTK_TREE_VIEW (gtk_builder_get_object
309 * Add each of the keywords to the keyword list store. 310 (builder,
310 * 311 "GNUNET_GTK_edit_publication_metadata_tree_view"));
311 * @param cls closure 312 sel = gtk_tree_view_get_selection (tv);
312 * @param keyword the keyword 313 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
313 * @param is_mandatory is the keyword mandatory (in a search) 314 {
314 * @return GNUNET_OK to continue to iterate 315 GNUNET_break (0);
315 */ 316 return;
316static int 317 }
317add_keyword (void *cls, const char *keyword, int is_mandatory) 318 if (gtk_list_store_remove (GTK_LIST_STORE (tm), &iter))
319 gtk_tree_selection_select_iter (sel, &iter);
320}
321
322void
323GNUNET_GTK_edit_publication_keyword_list_add_button_clicked_cb (
324 GtkButton *button, gpointer user_data)
318{ 325{
326 const char *keyword;
327 GtkEntry *entry;
319 GtkListStore *ls; 328 GtkListStore *ls;
320 GtkTreeIter iter; 329 GtkTreeIter iter;
330 GtkBuilder *builder;
331 GtkWidget *ok;
332
333 builder = GTK_BUILDER (user_data);
321 334
322 ls = GTK_LIST_STORE (gtk_builder_get_object 335 ls = GTK_LIST_STORE (gtk_builder_get_object
323 (builder, "GNUNET_GTK_keyword_list_store")); 336 (builder, "GNUNET_GTK_publication_keywords_liststore"));
324 gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, keyword, -1); 337 entry =
325 return GNUNET_OK; 338 GTK_ENTRY (gtk_builder_get_object
339 (builder, "GNUNET_GTK_edit_publication_keyword_entry"));
340 keyword = gtk_entry_get_text (entry);
341 if (strlen (keyword) > 0)
342 {
343 gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, keyword, 1, TRUE, -1);
344 ok = GTK_WIDGET (gtk_builder_get_object (builder,
345 "GNUNET_GTK_edit_publication_confirm_button"));
346 gtk_widget_set_sensitive (ok, TRUE);
347 }
348 gtk_entry_set_text (entry, "");
326} 349}
327 350
351gboolean
352gtk_tree_model_get_item_count_cb (GtkTreeModel *model, GtkTreePath *path,
353 GtkTreeIter *iter, gpointer data)
354{
355 gint *counter = (gint *) data;
356 *counter += 1;
357 return FALSE;
358}
328 359
329/** 360void
330 * Add the given meta data to the model (or make it the preview 361GNUNET_GTK_edit_publication_keyword_entry_changed_cb (GtkEditable *editable,
331 * image if it is an image). 362 gpointer user_data)
332 *
333 * @param cls closure, NULL
334 * @param plugin_name name of the plugin that produced this value;
335 * special values can be used (i.e. '<zlib>' for zlib being
336 * used in the main libextractor library and yielding
337 * meta data).
338 * @param type libextractor-type describing the meta data
339 * @param format basic format information about data
340 * @param data_mime_type mime-type of data (not of the original file);
341 * can be NULL (if mime-type is not known)
342 * @param data actual meta-data found
343 * @param data_len number of bytes in data
344 * @return 0 to continue extracting
345 */
346static int
347add_meta_item (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type,
348 enum EXTRACTOR_MetaFormat format, const char *data_mime_type,
349 const char *data, size_t data_len)
350{ 363{
351 GtkListStore *ls; 364 const char *keyword;
365 GtkEntry *entry;
366 GtkWidget *button;
367 GtkBuilder *builder;
368
369 builder = GTK_BUILDER (user_data);
370
371 button =
372 GTK_WIDGET (gtk_builder_get_object
373 (builder,
374 "GNUNET_GTK_edit_publication_keyword_list_add_button"));
375 entry =
376 GTK_ENTRY (gtk_builder_get_object
377 (builder, "GNUNET_GTK_edit_publication_keyword_entry"));
378 keyword = gtk_entry_get_text (entry);
379 gtk_widget_set_sensitive (button, (strlen (keyword) > 0) ? TRUE : FALSE);
380}
381
382
383gint
384gtk_tree_model_get_item_count (GtkTreeModel *model)
385{
386 gint c = 0;
387 gtk_tree_model_foreach (model, &gtk_tree_model_get_item_count_cb, &c);
388 return c;
389}
390
391gboolean
392gtk_tree_model_has_items_cb (GtkTreeModel *model, GtkTreePath *path,
393 GtkTreeIter *iter, gpointer data)
394{
395 gboolean *val = (gboolean *) data;
396 *val = TRUE;
397 return TRUE;
398}
399
400gboolean
401gtk_tree_model_has_items (GtkTreeModel *model)
402{
403 gboolean b = FALSE;
404 gtk_tree_model_foreach (model, &gtk_tree_model_has_items_cb, &b);
405 return b;
406}
407
408void
409GNUNET_GTK_edit_publication_keyword_list_del_button_clicked_cb (
410 GtkButton *button, gpointer user_data)
411{
412 GtkTreeView *tv;
413 GtkTreeSelection *sel;
414 GtkTreeModel *tm;
352 GtkTreeIter iter; 415 GtkTreeIter iter;
416 GtkBuilder *builder;
417 GtkWidget *ok;
418 GObject *pubwindow;
419 struct edit_publication_state *state = NULL;
420 builder = GTK_BUILDER (user_data);
353 421
354 switch (format) 422 tv = GTK_TREE_VIEW (gtk_builder_get_object
423 (builder,
424 "GNUNET_GTK_edit_publication_keyword_list_tree_view"));
425
426 sel = gtk_tree_view_get_selection (tv);
427 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
355 { 428 {
356 case EXTRACTOR_METAFORMAT_UTF8:
357 case EXTRACTOR_METAFORMAT_C_STRING:
358 ls = GTK_LIST_STORE (gtk_builder_get_object
359 (builder, "GNUNET_GTK_meta_data_list_store"));
360 gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, (guint) type, 1,
361 (guint) format, 2,
362 EXTRACTOR_metatype_to_string (type), 3,
363 data, -1);
364 break;
365 case EXTRACTOR_METAFORMAT_UNKNOWN:
366 break;
367 case EXTRACTOR_METAFORMAT_BINARY:
368 break;
369 default:
370 GNUNET_break (0); 429 GNUNET_break (0);
430 return;
371 } 431 }
372 return 0; 432 if (gtk_list_store_remove (GTK_LIST_STORE (tm), &iter))
433 gtk_tree_selection_select_iter (sel, &iter);
434
435 ok = GTK_WIDGET (gtk_builder_get_object (builder,
436 "GNUNET_GTK_edit_publication_confirm_button"));
437
438 pubwindow = gtk_builder_get_object (builder,
439 "GNUNET_GTK_edit_publication_window");
440 state = g_object_get_data (pubwindow, PUBSTATE);
441 if (!state)
442 {
443 GNUNET_break (0);
444 return;
445 }
446
447 if (!state->allow_no_keywords && !gtk_tree_model_has_items (tm))
448 gtk_widget_set_sensitive (ok, FALSE);
373} 449}
374 450
451void
452GNUNET_GTK_edit_publication_keyword_list_normalize_button_clicked_cb (
453 GtkButton *button, gpointer user_data)
454{
455 GtkTreeView *tv;
456 GtkTreeSelection *sel;
457 GtkTreeModel *tm;
458 GtkTreeIter iter, inserted;
459 gchar *value;
460 struct GNUNET_FS_Uri *uri;
461 struct GNUNET_FS_Uri *nuri;
462 char *nvalue;
463 char *emsg;
464 GtkBuilder *builder;
465 builder = GTK_BUILDER (user_data);
375 466
376/** 467 tv = GTK_TREE_VIEW (gtk_builder_get_object
377 * Function called to extract the information from FI. 468 (builder,
378 * 469 "GNUNET_GTK_edit_publication_keyword_list_tree_view"));
379 * @param cls closure 470 sel = gtk_tree_view_get_selection (tv);
380 * @param fi the entry in the publish-structure 471 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
381 * @param length length of the file or directory 472 return;
382 * @param meta metadata for the file or directory (can be modified) 473 gtk_tree_model_get (tm, &iter, 0, &value, -1);
383 * @param uri pointer to the keywords that will be used for this entry (can be modified) 474 emsg = NULL;
384 * @param bo block options 475 uri = GNUNET_FS_uri_ksk_create (value, &emsg);
385 * @param do_index should we index (can be modified) 476 if (uri == NULL)
386 * @param client_info pointer to client context set upon creation (can be modified) 477 {
387 * @return GNUNET_SYSERR (aborts after first call) 478 GNUNET_break (0);
388 */ 479 GNUNET_free (emsg);
389static int 480 g_free (value);
390file_information_extract (void *cls, struct GNUNET_FS_FileInformation *fi, 481 return;
391 uint64_t length, 482 }
392 struct GNUNET_CONTAINER_MetaData *meta, 483 nuri = GNUNET_FS_uri_ksk_canonicalize (uri);
393 struct GNUNET_FS_Uri **uri, 484 nvalue = GNUNET_FS_uri_ksk_to_string_fancy (nuri);
394 struct GNUNET_FS_BlockOptions *bo, int *do_index, 485
395 void **client_info) 486 if (strcmp (value, nvalue) != 0)
487 {
488 gtk_list_store_insert_after (GTK_LIST_STORE (tm), &inserted, &iter);
489 gtk_list_store_set (GTK_LIST_STORE (tm), &inserted, 0, nvalue, -1);
490 }
491 GNUNET_FS_uri_destroy (nuri);
492 GNUNET_FS_uri_destroy (uri);
493 GNUNET_free (nvalue);
494 g_free (value);
495}
496
497void
498GNUNET_GTK_edit_publication_normalization_checkbox_toggled_cb (
499 GtkToggleButton *button, gpointer user_data)
396{ 500{
397 GtkImage *img; 501 GtkBuilder *builder;
398 GdkPixbuf *pixbuf; 502 GtkToggleButton *norm_button;
399 struct tm *t; 503 builder = GTK_BUILDER (user_data);
400 int year; 504 norm_button = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder,
401 time_t tp; 505 "GNUNET_GTK_edit_publication_keyword_list_normalize_button"));
506 gtk_widget_set_sensitive (GTK_WIDGET (norm_button),
507 !gtk_toggle_button_get_active (norm_button));
508}
402 509
403 if (NULL != *uri) 510void
404 GNUNET_FS_uri_ksk_get_keywords (*uri, &add_keyword, NULL); 511GNUNET_GTK_edit_publication_metadata_preview_file_chooser_button_file_set_cb (
405 if (NULL != meta) 512 GtkFileChooserButton *widget, gpointer user_data)
513{
514 gchar *fn;
515 GtkImage *image;
516 GObject *pubwindow;
517 GtkBuilder *builder = GTK_BUILDER (user_data);
518 struct edit_publication_state *state = NULL;
519
520 pubwindow = gtk_builder_get_object (builder,
521 "GNUNET_GTK_edit_publication_window");
522 state = g_object_get_data (pubwindow, PUBSTATE);
523 if (!state)
406 { 524 {
407 GNUNET_CONTAINER_meta_data_iterate (meta, &add_meta_item, NULL); 525 GNUNET_break (0);
408 pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta); 526 return;
409 if (pixbuf != NULL)
410 {
411 img =
412 GTK_IMAGE (gtk_builder_get_object
413 (builder,
414 "GNUNET_GTK_edit_file_information_metadata_preview_image"));
415 gtk_image_set_from_pixbuf (img, pixbuf);
416 }
417 } 527 }
418 tp = bo->expiration_time.abs_value / 1000; /* ms to seconds */ 528
419 t = gmtime (&tp); 529 fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
420 if (t == NULL) 530 image =
421 year = 0; 531 GTK_IMAGE (gtk_builder_get_object
422 else 532 (builder,
423 year = t->tm_year + 1900; 533 "GNUNET_GTK_edit_publication_metadata_preview_image"));
424 gtk_spin_button_set_value (GTK_SPIN_BUTTON 534 gtk_image_set_from_file (image, fn);
425 (gtk_builder_get_object 535 state->preview_changed = GNUNET_YES;
426 (builder,
427 "GNUNET_GTK_edit_file_information_expiration_year_spin_button")),
428 year);
429 gtk_spin_button_set_value (GTK_SPIN_BUTTON
430 (gtk_builder_get_object
431 (builder,
432 "GNUNET_GTK_edit_file_information_anonymity_spin_button")),
433 bo->anonymity_level);
434 gtk_spin_button_set_value (GTK_SPIN_BUTTON
435 (gtk_builder_get_object
436 (builder,
437 "GNUNET_GTK_edit_file_information_priority_spin_button")),
438 bo->content_priority);
439 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
440 (gtk_builder_get_object
441 (builder,
442 "GNUNET_GTK_edit_file_information_index_check_button")),
443 *do_index);
444 return GNUNET_SYSERR; /* only visit top-level item */
445} 536}
446 537
538struct fiu_context
539{
540 GtkBuilder *builder;
541 char **short_fn;
542 gchar *root;
543 struct GNUNET_CONTAINER_MetaData *md;
544};
447 545
448/** 546/**
449 * Copy binary meta data from to the new container and also 547 * Copy binary meta data from to the new container and also
@@ -469,7 +567,9 @@ preserve_meta_items (void *cls, const char *plugin_name,
469 const char *data_mime_type, const char *data, 567 const char *data_mime_type, const char *data,
470 size_t data_len) 568 size_t data_len)
471{ 569{
472 struct GNUNET_CONTAINER_MetaData *md = cls; 570 struct fiu_context *context = (struct fiu_context *) cls;
571 GtkBuilder *builder = context->builder;
572 struct GNUNET_CONTAINER_MetaData *md = context->md;
473 GtkTreeModel *tm; 573 GtkTreeModel *tm;
474 GtkTreeIter iter; 574 GtkTreeIter iter;
475 gchar *value; 575 gchar *value;
@@ -477,13 +577,25 @@ preserve_meta_items (void *cls, const char *plugin_name,
477 guint nformat; 577 guint nformat;
478 int keep; 578 int keep;
479 579
580 GObject *pubwindow;
581 struct edit_publication_state *state = NULL;
582
583 pubwindow = gtk_builder_get_object (builder,
584 "GNUNET_GTK_edit_publication_window");
585 state = g_object_get_data (pubwindow, PUBSTATE);
586 if (!state)
587 {
588 GNUNET_break (0);
589 return 0;
590 }
591
480 keep = GNUNET_NO; 592 keep = GNUNET_NO;
481 switch (format) 593 switch (format)
482 { 594 {
483 case EXTRACTOR_METAFORMAT_UTF8: 595 case EXTRACTOR_METAFORMAT_UTF8:
484 case EXTRACTOR_METAFORMAT_C_STRING: 596 case EXTRACTOR_METAFORMAT_C_STRING:
485 tm = GTK_TREE_MODEL (gtk_builder_get_object 597 tm = GTK_TREE_MODEL (gtk_builder_get_object
486 (builder, "GNUNET_GTK_meta_data_list_store")); 598 (builder, "GNUNET_GTK_publication_metadata_liststore"));
487 if (TRUE == gtk_tree_model_get_iter_first (tm, &iter)) 599 if (TRUE == gtk_tree_model_get_iter_first (tm, &iter))
488 { 600 {
489 do 601 do
@@ -505,7 +617,7 @@ preserve_meta_items (void *cls, const char *plugin_name,
505 case EXTRACTOR_METAFORMAT_UNKNOWN: 617 case EXTRACTOR_METAFORMAT_UNKNOWN:
506 break; 618 break;
507 case EXTRACTOR_METAFORMAT_BINARY: 619 case EXTRACTOR_METAFORMAT_BINARY:
508 if (preview_changed == GNUNET_NO) 620 if (state->preview_changed == GNUNET_NO)
509 keep = GNUNET_YES; 621 keep = GNUNET_YES;
510 break; 622 break;
511 default: 623 default:
@@ -542,7 +654,9 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi,
542 struct GNUNET_FS_BlockOptions *bo, int *do_index, 654 struct GNUNET_FS_BlockOptions *bo, int *do_index,
543 void **client_info) 655 void **client_info)
544{ 656{
545 char **short_fn = cls; 657 struct fiu_context *context = (struct fiu_context *) cls;
658 char **short_fn = context->short_fn;
659 GtkBuilder *builder = context->builder;
546 struct GNUNET_CONTAINER_MetaData *nm; 660 struct GNUNET_CONTAINER_MetaData *nm;
547 GtkTreeModel *tm; 661 GtkTreeModel *tm;
548 GtkTreeIter iter; 662 GtkTreeIter iter;
@@ -558,26 +672,49 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi,
558 const char *mime; 672 const char *mime;
559 GFile *f; 673 GFile *f;
560 GFileInfo *finfo; 674 GFileInfo *finfo;
675 gboolean auto_normalize = FALSE;
561 676
562 bo->anonymity_level = 677 GObject *pubwindow;
563 gtk_spin_button_get_value (GTK_SPIN_BUTTON 678 struct edit_publication_state *state = NULL;
564 (gtk_builder_get_object 679
565 (builder, 680 pubwindow = gtk_builder_get_object (builder,
566 "GNUNET_GTK_edit_file_information_anonymity_spin_button"))); 681 "GNUNET_GTK_edit_publication_window");
682 state = g_object_get_data (pubwindow, PUBSTATE);
683 if (!state)
684 {
685 GNUNET_break (0);
686 return GNUNET_SYSERR;
687 }
688
689 if (!GNUNET_GTK_get_selected_anonymity_level (builder,
690 "GNUNET_GTK_edit_publication_anonymity_combobox", &bo->anonymity_level))
691 return GNUNET_SYSERR;
567 bo->content_priority = 692 bo->content_priority =
568 gtk_spin_button_get_value (GTK_SPIN_BUTTON 693 gtk_spin_button_get_value (GTK_SPIN_BUTTON
569 (gtk_builder_get_object 694 (gtk_builder_get_object
570 (builder, 695 (builder,
571 "GNUNET_GTK_edit_file_information_priority_spin_button"))); 696 "GNUNET_GTK_edit_publication_priority_spin_button")));
572 *do_index = 697 *do_index =
573 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 698 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
574 (gtk_builder_get_object 699 (gtk_builder_get_object
575 (builder, 700 (builder,
576 "GNUNET_GTK_edit_file_information_index_check_button"))); 701 "GNUNET_GTK_edit_publication_index_checkbutton")));
702 auto_normalize = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
703 (gtk_builder_get_object
704 (builder,
705 "GNUNET_GTK_edit_publication_normalization_checkbox")));
577 sb = GTK_SPIN_BUTTON (gtk_builder_get_object 706 sb = GTK_SPIN_BUTTON (gtk_builder_get_object
578 (builder, 707 (builder,
579 "GNUNET_GTK_edit_file_information_expiration_year_spin_button")); 708 "GNUNET_GTK_edit_publication_expiration_year_spin_button"));
580 bo->expiration_time = GNUNET_FS_GTK_get_expiration_time (sb); 709 bo->expiration_time = GNUNET_FS_GTK_get_expiration_time (sb);
710
711 g_free (context->root);
712 context->root =
713 g_strdup (gtk_entry_get_text (GTK_ENTRY
714 (gtk_builder_get_object
715 (builder,
716 "GNUNET_GTK_edit_publication_root_entry"))));
717
581 /* update URI */ 718 /* update URI */
582 if (NULL != (*uri)) 719 if (NULL != (*uri))
583 GNUNET_FS_uri_destroy (*uri); 720 GNUNET_FS_uri_destroy (*uri);
@@ -586,7 +723,7 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi,
586 mrg = NULL; 723 mrg = NULL;
587 724
588 tm = GTK_TREE_MODEL (gtk_builder_get_object 725 tm = GTK_TREE_MODEL (gtk_builder_get_object
589 (builder, "GNUNET_GTK_keyword_list_store")); 726 (builder, "GNUNET_GTK_publication_keywords_liststore"));
590 if (TRUE == gtk_tree_model_get_iter_first (tm, &iter)) 727 if (TRUE == gtk_tree_model_get_iter_first (tm, &iter))
591 { 728 {
592 do 729 do
@@ -598,6 +735,24 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi,
598 if (NULL != *uri) 735 if (NULL != *uri)
599 GNUNET_FS_uri_destroy (*uri); 736 GNUNET_FS_uri_destroy (*uri);
600 *uri = mrg; 737 *uri = mrg;
738 if (auto_normalize)
739 {
740 char *emsg = NULL;
741 struct GNUNET_FS_Uri *nuri;
742
743 nuri = GNUNET_FS_uri_ksk_create (value, &emsg);
744 if (nuri == NULL)
745 GNUNET_free_non_null (emsg);
746 else
747 {
748 nxt = GNUNET_FS_uri_ksk_canonicalize (nuri);
749 mrg = GNUNET_FS_uri_ksk_merge (nxt, *uri);
750 GNUNET_FS_uri_destroy (nxt);
751 if (NULL != *uri)
752 GNUNET_FS_uri_destroy (*uri);
753 *uri = mrg;
754 }
755 }
601 g_free (value); 756 g_free (value);
602 } 757 }
603 while (TRUE == gtk_tree_model_iter_next (tm, &iter)); 758 while (TRUE == gtk_tree_model_iter_next (tm, &iter));
@@ -605,30 +760,31 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi,
605 760
606 /* update meta */ 761 /* update meta */
607 nm = GNUNET_CONTAINER_meta_data_create (); 762 nm = GNUNET_CONTAINER_meta_data_create ();
608 GNUNET_CONTAINER_meta_data_iterate (meta, &preserve_meta_items, nm); 763 context->md = nm;
764 GNUNET_CONTAINER_meta_data_iterate (meta, &preserve_meta_items, context);
609 765
610 GNUNET_CONTAINER_meta_data_clear (meta); 766 GNUNET_CONTAINER_meta_data_clear (meta);
611 tm = GTK_TREE_MODEL (gtk_builder_get_object 767 tm = GTK_TREE_MODEL (gtk_builder_get_object
612 (builder, "GNUNET_GTK_meta_data_list_store")); 768 (builder, "GNUNET_GTK_publication_metadata_liststore"));
613 if (TRUE == gtk_tree_model_get_iter_first (tm, &iter)) 769 if (TRUE == gtk_tree_model_get_iter_first (tm, &iter))
614 { 770 {
615 do 771 do
616 { 772 {
617 gtk_tree_model_get (tm, &iter, 0, &ntype, 1, &nformat, 3, &value, -1); 773 gtk_tree_model_get (tm, &iter, 0, &ntype, 1, &nformat, 3, &value, -1);
618 GNUNET_CONTAINER_meta_data_insert (nm, "<user>", ntype, nformat, 774 if (ntype >= 0)
619 "text/plain", value, 775 GNUNET_CONTAINER_meta_data_insert (nm, "<user>", ntype, nformat,
620 strlen (value) + 1); 776 "text/plain", value, strlen (value) + 1);
621 g_free (value); 777 g_free (value);
622 } 778 }
623 while (TRUE == gtk_tree_model_iter_next (tm, &iter)); 779 while (TRUE == gtk_tree_model_iter_next (tm, &iter));
624 } 780 }
625 GNUNET_CONTAINER_meta_data_merge (meta, nm); 781 GNUNET_CONTAINER_meta_data_merge (meta, nm);
626 if (preview_changed == GNUNET_YES) 782 if (state->preview_changed == GNUNET_YES)
627 { 783 {
628 fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER 784 fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER
629 (gtk_builder_get_object 785 (gtk_builder_get_object
630 (builder, 786 (builder,
631 "GNUNET_GTK_edit_file_information_metadata_preview_file_chooser_button"))); 787 "GNUNET_GTK_edit_publication_metadata_preview_file_chooser_button")));
632 f = g_file_new_for_path (fn); 788 f = g_file_new_for_path (fn);
633 finfo = 789 finfo =
634 g_file_query_info (f, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, 0, NULL, 790 g_file_query_info (f, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, 0, NULL,
@@ -663,32 +819,190 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi,
663 return GNUNET_SYSERR; /* only visit top-level item */ 819 return GNUNET_SYSERR; /* only visit top-level item */
664} 820}
665 821
822void
823GNUNET_GTK_edit_publication_cancel_button_clicked_cb (
824 GtkButton *button, gpointer user_data)
825{
826 GtkBuilder *builder;
827 GObject *pubwindow;
828 struct edit_publication_state *state = NULL;
829
830 builder = GTK_BUILDER (user_data);
831
832 pubwindow = gtk_builder_get_object (builder,
833 "GNUNET_GTK_edit_publication_window");
834 state = g_object_get_data (pubwindow, PUBSTATE);
835 if (!state)
836 {
837 GNUNET_break (0);
838 return;
839 }
840
841 state->cb (state->cls, state->do_index, state->short_fn,
842 state->anonymity_level, state->priority, NULL, state->fip, GTK_RESPONSE_CANCEL);
843 g_free (state);
844 g_object_set_data (pubwindow, PUBSTATE, NULL);
845 gtk_widget_hide (GTK_WIDGET (pubwindow));
846}
847
848void
849GNUNET_GTK_edit_publication_confirm_button_clicked_cb (
850 GtkButton *button, gpointer user_data)
851{
852 GtkBuilder *builder;
853 GObject *pubwindow;
854 struct edit_publication_state *state = NULL;
855 struct fiu_context ctx;
856
857 builder = GTK_BUILDER (user_data);
858
859 pubwindow = gtk_builder_get_object (builder,
860 "GNUNET_GTK_edit_publication_window");
861 state = g_object_get_data (pubwindow, PUBSTATE);
862 if (!state)
863 {
864 GNUNET_break (0);
865 return;
866 }
867
868 ctx.builder = builder;
869 ctx.short_fn = state->short_fn;
870 ctx.root = NULL;
871 ctx.md = NULL;
872
873 GNUNET_FS_file_information_inspect (state->fip, &file_information_update, &ctx);
874 if (!GNUNET_GTK_get_selected_anonymity_level (builder,
875 "GNUNET_GTK_edit_publication_anonymity_combobox", state->anonymity_level))
876 *state->priority =
877 gtk_spin_button_get_value (GTK_SPIN_BUTTON
878 (gtk_builder_get_object
879 (builder,
880 "GNUNET_GTK_edit_publication_priority_spin_button")));
881 *state->do_index =
882 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
883 (gtk_builder_get_object
884 (builder,
885 "GNUNET_GTK_edit_publication_index_checkbutton")));
886
887
888 state->cb (state->cls, state->do_index, state->short_fn,
889 state->anonymity_level, state->priority, ctx.root, state->fip,
890 GTK_RESPONSE_OK);
891 g_free (state);
892 g_object_set_data (pubwindow, PUBSTATE, NULL);
893 gtk_widget_hide (GTK_WIDGET (pubwindow));
894}
666 895
667/** 896/**
668 * Open the dialog to edit file information data. 897 * Add each of the keywords to the keyword list store.
898 *
899 * @param cls closure
900 * @param keyword the keyword
901 * @param is_mandatory is the keyword mandatory (in a search)
902 * @return GNUNET_OK to continue to iterate
669 */ 903 */
670void 904static int
671GNUNET_FS_GTK_edit_publish_dialog (int *do_index, char **short_fn, 905add_keyword (void *cls, const char *keyword, int is_mandatory)
672 guint * anonymity_level, guint * priority,
673 struct GNUNET_FS_FileInformation *fip)
674{ 906{
675 GtkWidget *ad;
676 GtkListStore *ls; 907 GtkListStore *ls;
677 GtkTreeIter iter; 908 GtkTreeIter iter;
678 guint type;
679 guint max_type;
680 GtkTreeView *tv;
681 GtkTreeSelection *sel;
682 909
683 GNUNET_assert (builder == NULL); 910 ls = GTK_LIST_STORE (cls);
684 builder = 911 gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, keyword, 1, FALSE, -1);
685 GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_publish_edit_dialog.glade"); 912 return GNUNET_OK;
686 if (builder == NULL) 913}
914
915/**
916 * Function called to extract the information from FI.
917 *
918 * @param cls closure
919 * @param fi the entry in the publish-structure
920 * @param length length of the file or directory
921 * @param meta metadata for the file or directory (can be modified)
922 * @param uri pointer to the keywords that will be used for this entry (can be modified)
923 * @param bo block options
924 * @param do_index should we index (can be modified)
925 * @param client_info pointer to client context set upon creation (can be modified)
926 * @return GNUNET_SYSERR (aborts after first call)
927 */
928static int
929file_information_extract (void *cls, struct GNUNET_FS_FileInformation *fi,
930 uint64_t length,
931 struct GNUNET_CONTAINER_MetaData *meta,
932 struct GNUNET_FS_Uri **uri,
933 struct GNUNET_FS_BlockOptions *bo, int *do_index,
934 void **client_info)
935{
936 GtkBuilder *builder = GTK_BUILDER (cls);
937 GtkImage *img;
938 GdkPixbuf *pixbuf;
939 struct tm *t;
940 int year;
941 time_t tp;
942 GtkListStore *ls;
943
944 ls = GTK_LIST_STORE (gtk_builder_get_object
945 (builder, "GNUNET_GTK_publication_keywords_liststore"));
946
947 if (NULL != *uri)
948 GNUNET_FS_uri_ksk_get_keywords (*uri, &add_keyword, ls);
949 if (NULL != meta)
687 { 950 {
688 GNUNET_break (0); 951 ls = GTK_LIST_STORE (gtk_builder_get_object (builder,
689 return; 952 "GNUNET_GTK_publication_metadata_liststore"));
953 GNUNET_CONTAINER_meta_data_iterate (meta, &GNUNET_FS_GTK_add_meta_data_to_list_store, ls);
954 pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta);
955 if (pixbuf != NULL)
956 {
957 img =
958 GTK_IMAGE (gtk_builder_get_object
959 (builder,
960 "GNUNET_GTK_publication_metadata_preview_image"));
961 gtk_image_set_from_pixbuf (img, pixbuf);
962 }
690 } 963 }
691 preview_changed = GNUNET_NO; 964 tp = bo->expiration_time.abs_value / 1000; /* ms to seconds */
965 t = gmtime (&tp);
966 if (t == NULL)
967 year = 0;
968 else
969 year = t->tm_year + 1900;
970 gtk_spin_button_set_value (GTK_SPIN_BUTTON
971 (gtk_builder_get_object
972 (builder,
973 "GNUNET_GTK_edit_publication_expiration_year_spin_button")),
974 year);
975 GNUNET_GTK_select_anonymity_level (builder,
976 "GNUNET_GTK_edit_publication_anonymity_combobox", bo->anonymity_level);
977 gtk_spin_button_set_value (GTK_SPIN_BUTTON
978 (gtk_builder_get_object
979 (builder,
980 "GNUNET_GTK_edit_publication_priority_spin_button")),
981 bo->content_priority);
982 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
983 (gtk_builder_get_object
984 (builder,
985 "GNUNET_GTK_edit_publication_index_checkbutton")),
986 *do_index);
987 return GNUNET_SYSERR; /* only visit top-level item */
988}
989
990
991/**
992 * Open the dialog to edit file information data.
993 */
994void
995GNUNET_FS_GTK_edit_publish_dialog (GtkBuilder *builder, GtkWindow *parent, int *do_index,
996 char **short_fn, guint *anonymity_level, guint *priority,
997 struct GNUNET_FS_FileInformation *fip, gboolean allow_no_keywords,
998 GNUNET_FS_GTK_edit_publish_dialog_cb cb, gpointer cls)
999{
1000 GtkWidget *dialog;
1001 GObject *pubwindow;
1002 GtkEntry *entry;
1003 GtkWidget *ok;
1004 struct edit_publication_state *state;
1005
692 GNUNET_FS_GTK_setup_expiration_year_adjustment (builder); 1006 GNUNET_FS_GTK_setup_expiration_year_adjustment (builder);
693 if (GNUNET_FS_file_information_is_directory (fip)) 1007 if (GNUNET_FS_file_information_is_directory (fip))
694 { 1008 {
@@ -696,80 +1010,60 @@ GNUNET_FS_GTK_edit_publish_dialog (int *do_index, char **short_fn,
696 gtk_widget_hide (GTK_WIDGET 1010 gtk_widget_hide (GTK_WIDGET
697 (gtk_builder_get_object 1011 (gtk_builder_get_object
698 (builder, 1012 (builder,
699 "GNUNET_GTK_edit_file_information_index_check_button"))); 1013 "GNUNET_GTK_edit_publication_index_checkbutton")));
700 gtk_widget_hide (GTK_WIDGET 1014 gtk_widget_hide (GTK_WIDGET
701 (gtk_builder_get_object 1015 (gtk_builder_get_object
702 (builder, 1016 (builder,
703 "GNUNET_GTK_edit_file_information_index_label"))); 1017 "GNUNET_GTK_edit_publication_index_label")));
704
705 } 1018 }
706 1019 if (allow_no_keywords)
707 ad = GTK_WIDGET (gtk_builder_get_object
708 (builder, "GNUNET_GTK_edit_file_information_dialog"));
709 ls = GTK_LIST_STORE (gtk_builder_get_object
710 (builder, "GNUNET_GTK_metatype_list_store"));
711 max_type = EXTRACTOR_metatype_get_max ();
712 type = 1;
713 while (type < max_type - 1)
714 { 1020 {
715 gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, 1021 gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder,
716 EXTRACTOR_metatype_to_string (type), 1, 1022 "GNUNET_GTK_edit_publication_root_entry")));
717 type, 2, 1023 gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder,
718 EXTRACTOR_metatype_to_description (type), 1024 "GNUNET_GTK_edit_publication_root_label")));
719 -1);
720 type++;
721 } 1025 }
1026 gtk_list_store_clear (GTK_LIST_STORE (gtk_builder_get_object (
1027 builder, "GNUNET_GTK_publication_keywords_liststore")));
1028 gtk_list_store_clear (GTK_LIST_STORE (gtk_builder_get_object (
1029 builder, "GNUNET_GTK_publication_metadata_liststore")));
1030
1031 GNUNET_FS_file_information_inspect (fip, &file_information_extract, builder);
1032
1033 dialog = GTK_WIDGET (gtk_builder_get_object (builder,
1034 "GNUNET_GTK_edit_publication_window"));
1035
1036 gtk_window_set_title (GTK_WINDOW (dialog), *short_fn);
1037
1038 state = g_new0 (struct edit_publication_state, 1);
1039 state->do_index = do_index;
1040 state->short_fn = short_fn;
1041 state->root = NULL;
1042 state->anonymity_level = anonymity_level;
1043 state->priority = priority;
1044 state->fip = fip;
1045 state->preview_changed = GNUNET_NO;
1046 state->allow_no_keywords = allow_no_keywords;
1047 state->is_directory = GNUNET_FS_file_information_is_directory (fip);
1048 state->cb = cb;
1049 state->cls = cls;
722 1050
723 GNUNET_FS_file_information_inspect (fip, &file_information_extract, NULL); 1051 entry =
724 tv = GTK_TREE_VIEW (gtk_builder_get_object 1052 GTK_ENTRY (gtk_builder_get_object
725 (builder, 1053 (builder, "GNUNET_GTK_edit_publication_keyword_entry"));
726 "GNUNET_GTK_edit_file_information_metadata_type_tree_view")); 1054 gtk_entry_set_text (entry, "");
727 sel = gtk_tree_view_get_selection (tv);
728 g_signal_connect (G_OBJECT (sel), "changed",
729 G_CALLBACK
730 (GNUNET_GTK_edit_file_information_metadata_value_entry_changed_cb),
731 NULL);
732 1055
733 tv = GTK_TREE_VIEW (gtk_builder_get_object 1056 pubwindow = gtk_builder_get_object (builder,
734 (builder, 1057 "GNUNET_GTK_edit_publication_window");
735 "GNUNET_GTK_edit_file_information_metadata_tree_view")); 1058 g_object_set_data (pubwindow, PUBSTATE, state);
736 sel = gtk_tree_view_get_selection (tv);
737 g_signal_connect (G_OBJECT (sel), "changed",
738 G_CALLBACK (metadata_selection_changed_cb), NULL);
739 1059
740 tv = GTK_TREE_VIEW (gtk_builder_get_object 1060 ok = GTK_WIDGET (gtk_builder_get_object (builder,
741 (builder, 1061 "GNUNET_GTK_edit_publication_confirm_button"));
742 "GNUNET_GTK_edit_file_information_keyword_list_tree_view")); 1062 gtk_widget_set_sensitive (ok, allow_no_keywords ? TRUE : FALSE);
743 sel = gtk_tree_view_get_selection (tv); 1063
744 g_signal_connect (G_OBJECT (sel), "changed", 1064 gtk_window_set_transient_for (GTK_WINDOW (pubwindow), parent);
745 G_CALLBACK (keyword_selection_changed_cb), NULL); 1065
746 gtk_window_set_title (GTK_WINDOW (ad), *short_fn); 1066 gtk_window_present (GTK_WINDOW (dialog));
747 if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad)))
748 {
749 gtk_widget_destroy (ad);
750 g_object_unref (G_OBJECT (builder));
751 builder = NULL;
752 return;
753 }
754 GNUNET_FS_file_information_inspect (fip, &file_information_update, short_fn);
755 *anonymity_level =
756 gtk_spin_button_get_value (GTK_SPIN_BUTTON
757 (gtk_builder_get_object
758 (builder,
759 "GNUNET_GTK_edit_file_information_anonymity_spin_button")));
760 *priority =
761 gtk_spin_button_get_value (GTK_SPIN_BUTTON
762 (gtk_builder_get_object
763 (builder,
764 "GNUNET_GTK_edit_file_information_priority_spin_button")));
765 *do_index =
766 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
767 (gtk_builder_get_object
768 (builder,
769 "GNUNET_GTK_edit_file_information_index_check_button")));
770 gtk_widget_destroy (ad);
771 g_object_unref (G_OBJECT (builder));
772 builder = NULL;
773} 1067}
774 1068
775/* end of gnunet-fs-gtk-edit_publish_dialog.c */ 1069/* end of gnunet-fs-gtk-edit_publish_dialog.c */
diff --git a/src/fs/gnunet-fs-gtk-edit_publish_dialog.h b/src/fs/gnunet-fs-gtk-edit_publish_dialog.h
index 63635212..5473cb42 100644
--- a/src/fs/gnunet-fs-gtk-edit_publish_dialog.h
+++ b/src/fs/gnunet-fs-gtk-edit_publish_dialog.h
@@ -30,10 +30,20 @@
30#include <gnunet/gnunet_fs_service.h> 30#include <gnunet/gnunet_fs_service.h>
31 31
32 32
33typedef void
34(*GNUNET_FS_GTK_edit_publish_dialog_cb) (gpointer cls, int *do_index, char **short_fn,
35 guint * anonymity_level, guint * priority, gchar *root,
36 struct GNUNET_FS_FileInformation *fip, gint ret);
37
38
39/**
40 * Open the dialog to edit file information data.
41 */
33void 42void
34GNUNET_FS_GTK_edit_publish_dialog (int *do_index, char **short_fn, 43GNUNET_FS_GTK_edit_publish_dialog (GtkBuilder *builder, GtkWindow *parent, int *do_index,
35 guint * anonymity_level, guint * priority, 44 char **short_fn, guint * anonymity_level, guint * priority,
36 struct GNUNET_FS_FileInformation *fip); 45 struct GNUNET_FS_FileInformation *fip, gboolean allow_no_keywords,
46 GNUNET_FS_GTK_edit_publish_dialog_cb cb, gpointer cls);
37 47
38#endif 48#endif
39/* end of gnunet-fs-gtk-edit_publish_dialog.h */ 49/* end of gnunet-fs-gtk-edit_publish_dialog.h */
diff --git a/src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c b/src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c
index bb3265e0..9b76f2ab 100644
--- a/src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c
+++ b/src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c
@@ -24,343 +24,7 @@
24 */ 24 */
25#include "gnunet-fs-gtk-common.h" 25#include "gnunet-fs-gtk-common.h"
26#include "gnunet-fs-gtk.h" 26#include "gnunet-fs-gtk.h"
27 27#include "gnunet-fs-gtk-edit_publish_dialog.h"
28static GtkBuilder *builder;
29
30
31/**
32 * Canonicalize spelling of currently selected keyword.
33 */
34void
35GNUNET_GTK_advertise_pseudonym_keyword_list_normalize_button_clicked_cb ()
36{
37 GtkTreeView *tv;
38 GtkTreeSelection *sel;
39 GtkTreeModel *tm;
40 GtkTreeIter iter;
41 gchar *value;
42 struct GNUNET_FS_Uri *uri;
43 struct GNUNET_FS_Uri *nuri;
44 char *nvalue;
45 char *emsg;
46
47 tv = GTK_TREE_VIEW (gtk_builder_get_object
48 (builder,
49 "GNUNET_GTK_advertise_pseudonym_keyword_list_tree_view"));
50 sel = gtk_tree_view_get_selection (tv);
51 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
52 {
53 GNUNET_break (0);
54 return;
55 }
56 gtk_tree_model_get (tm, &iter, 0, &value, -1);
57 emsg = NULL;
58 uri = GNUNET_FS_uri_ksk_create (value, &emsg);
59 if (uri == NULL)
60 {
61 GNUNET_break (0);
62 GNUNET_free (emsg);
63 g_free (value);
64 return;
65 }
66 nuri = GNUNET_FS_uri_ksk_canonicalize (uri);
67 nvalue = GNUNET_FS_uri_ksk_to_string_fancy (nuri);
68 gtk_list_store_set (GTK_LIST_STORE (tm), &iter, 0, nvalue, -1);
69 GNUNET_FS_uri_destroy (nuri);
70 GNUNET_FS_uri_destroy (uri);
71 GNUNET_free (nvalue);
72 g_free (value);
73}
74
75
76/**
77 * Remove the currently selected keyword from the list.
78 */
79void
80GNUNET_GTK_advertise_pseudonym_keyword_list_del_button_clicked_cb ()
81{
82 GtkTreeView *tv;
83 GtkTreeSelection *sel;
84 GtkTreeModel *tm;
85 GtkTreeIter iter;
86 GtkWidget *w;
87
88 tv = GTK_TREE_VIEW (gtk_builder_get_object
89 (builder,
90 "GNUNET_GTK_advertise_pseudonym_keyword_list_tree_view"));
91 sel = gtk_tree_view_get_selection (tv);
92 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
93 {
94 GNUNET_break (0);
95 return;
96 }
97 gtk_list_store_remove (GTK_LIST_STORE (tm), &iter);
98 if (TRUE != gtk_tree_model_get_iter_first (tm, &iter))
99 {
100 /* keyword list now empty, disable 'Ok' button! */
101 w = GTK_WIDGET (gtk_builder_get_object (builder,
102 "GNUNET_GTK_advertise_pseudonym_confirm_button"));
103 gtk_widget_set_sensitive (w, FALSE);
104 }
105}
106
107
108/**
109 * Add keyword from entry line to keyword list.
110 */
111void
112GNUNET_GTK_advertise_pseudonym_keyword_list_add_button_clicked_cb ()
113{
114 const char *keyword;
115 GtkEntry *entry;
116 GtkListStore *ls;
117 GtkTreeIter iter;
118 GtkWidget *w;
119
120 ls = GTK_LIST_STORE (gtk_builder_get_object
121 (builder, "GNUNET_GTK_keyword_list_store"));
122 entry =
123 GTK_ENTRY (gtk_builder_get_object
124 (builder, "GNUNET_GTK_advertise_pseudonym_keyword_entry"));
125 keyword = gtk_entry_get_text (entry);
126 if (strlen (keyword) > 0)
127 {
128 gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, keyword, -1);
129 /* enable OK button */
130 w = GTK_WIDGET (gtk_builder_get_object (builder, "GNUNET_GTK_advertise_pseudonym_confirm_button"));
131 gtk_widget_set_sensitive (w, TRUE);
132 }
133 gtk_entry_set_text (entry, "");
134}
135
136
137/**
138 * Update sensitivity of keyword add button.
139 */
140void
141GNUNET_GTK_advertise_pseudonym_keyword_entry_changed_cb ()
142{
143 const char *keyword;
144 GtkEntry *entry;
145 GtkWidget *button;
146
147 button =
148 GTK_WIDGET (gtk_builder_get_object
149 (builder,
150 "GNUNET_GTK_advertise_pseudonym_keyword_list_add_button"));
151 entry =
152 GTK_ENTRY (gtk_builder_get_object
153 (builder, "GNUNET_GTK_advertise_pseudonym_keyword_entry"));
154 keyword = gtk_entry_get_text (entry);
155 gtk_widget_set_sensitive (button, (strlen (keyword) > 0) ? TRUE : FALSE);
156}
157
158/**
159 * Update sensitivity of metadata delete button.
160 */
161static void
162metadata_selection_changed_cb (GtkTreeSelection * ts, gpointer user_data)
163{
164 GtkTreeView *tv;
165 GtkTreeSelection *sel;
166 GtkWidget *button;
167
168 tv = GTK_TREE_VIEW (gtk_builder_get_object
169 (builder,
170 "GNUNET_GTK_advertise_pseudonym_metadata_tree_view"));
171 sel = gtk_tree_view_get_selection (tv);
172 button =
173 GTK_WIDGET (gtk_builder_get_object
174 (builder,
175 "GNUNET_GTK_advertise_pseudonym_metadata_delete_button"));
176 gtk_widget_set_sensitive (button,
177 gtk_tree_selection_get_selected (sel, NULL, NULL));
178}
179
180
181/**
182 * Update sensitivity of keyword delete and normalize button.
183 */
184static void
185keyword_selection_changed_cb (GtkTreeSelection * ts, gpointer user_data)
186{
187 GtkTreeView *tv;
188 GtkTreeSelection *sel;
189 GtkWidget *button;
190
191 tv = GTK_TREE_VIEW (gtk_builder_get_object
192 (builder,
193 "GNUNET_GTK_advertise_pseudonym_keyword_list_tree_view"));
194 sel = gtk_tree_view_get_selection (tv);
195 button =
196 GTK_WIDGET (gtk_builder_get_object
197 (builder,
198 "GNUNET_GTK_advertise_pseudonym_keyword_list_del_button"));
199
200 gtk_widget_set_sensitive (button,
201 gtk_tree_selection_get_selected (sel, NULL, NULL));
202 button =
203 GTK_WIDGET (gtk_builder_get_object
204 (builder,
205 "GNUNET_GTK_advertise_pseudonym_keyword_list_normalize_button"));
206 gtk_widget_set_sensitive (button,
207 gtk_tree_selection_get_selected (sel, NULL, NULL));
208}
209
210
211/**
212 * Update sensitivity of metadata add button.
213 */
214void
215GNUNET_GTK_advertise_pseudonym_metadata_value_entry_changed_cb ()
216{
217 GtkTreeView *tv;
218 GtkTreeSelection *sel;
219 const char *value;
220 GtkEntry *entry;
221 GtkWidget *button;
222
223 entry =
224 GTK_ENTRY (gtk_builder_get_object
225 (builder,
226 "GNUNET_GTK_advertise_pseudonym_metadata_value_entry"));
227 value = gtk_entry_get_text (entry);
228 tv = GTK_TREE_VIEW (gtk_builder_get_object
229 (builder,
230 "GNUNET_GTK_advertise_pseudonym_metadata_type_tree_view"));
231 sel = gtk_tree_view_get_selection (tv);
232 button =
233 GTK_WIDGET (gtk_builder_get_object
234 (builder,
235 "GNUNET_GTK_advertise_pseudonym_metadata_add_button"));
236 gtk_widget_set_sensitive (button,
237 (strlen (value) >
238 0) ? gtk_tree_selection_get_selected (sel, NULL,
239 NULL) :
240 FALSE);
241}
242
243
244/**
245 * Add keyword to keyword list.
246 */
247void
248GNUNET_GTK_advertise_pseudonym_keyword_entry_activate_cb ()
249{
250 GNUNET_GTK_advertise_pseudonym_keyword_list_add_button_clicked_cb ();
251}
252
253
254void
255GNUNET_GTK_advertise_pseudonym_metadata_preview_file_chooser_button_file_set_cb
256 ()
257{
258 GNUNET_break (0);
259}
260
261/**
262 * Delete currently selected item from meta data list.
263 */
264void
265GNUNET_GTK_advertise_pseudonym_metadata_delete_button_clicked_cb ()
266{
267 GtkTreeView *tv;
268 GtkTreeSelection *sel;
269 GtkTreeModel *tm;
270 GtkTreeIter iter;
271
272 tv = GTK_TREE_VIEW (gtk_builder_get_object
273 (builder,
274 "GNUNET_GTK_advertise_pseudonym_metadata_tree_view"));
275 sel = gtk_tree_view_get_selection (tv);
276 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
277 {
278 GNUNET_break (0);
279 return;
280 }
281 gtk_list_store_remove (GTK_LIST_STORE (tm), &iter);
282}
283
284
285/**
286 * Add metadata to metadata list.
287 */
288void
289GNUNET_GTK_advertise_pseudonym_metadata_add_button_clicked_cb ()
290{
291 const char *value;
292 char *avalue;
293 const char *ivalue;
294 GtkEntry *entry;
295 GtkListStore *ls;
296 GtkTreeModel *tm;
297 GtkTreeView *tv;
298 GtkTreeSelection *sel;
299 GtkTreeIter iter;
300 guint type;
301 size_t slen;
302 char *pos;
303
304 entry =
305 GTK_ENTRY (gtk_builder_get_object
306 (builder,
307 "GNUNET_GTK_advertise_pseudonym_metadata_value_entry"));
308 value = gtk_entry_get_text (entry);
309 if ((value == NULL) || (strlen (value) == 0))
310 {
311 GNUNET_break (0);
312 return;
313 }
314 tv = GTK_TREE_VIEW (gtk_builder_get_object
315 (builder,
316 "GNUNET_GTK_advertise_pseudonym_metadata_type_tree_view"));
317 tm = gtk_tree_view_get_model (tv);
318 sel = gtk_tree_view_get_selection (tv);
319 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
320 {
321 GNUNET_break (0);
322 return;
323 }
324 gtk_tree_model_get (tm, &iter, 1, &type, -1);
325 ls = GTK_LIST_STORE (gtk_builder_get_object
326 (builder, "GNUNET_GTK_meta_data_list_store"));
327 if ((type == EXTRACTOR_METATYPE_FILENAME) &&
328 (value[strlen (value) - 1] != '/'))
329 {
330 GNUNET_asprintf (&avalue, "%s/", value);
331 /* if user typed '\' instead of '/', change it! */
332 slen = strlen (avalue);
333 while ((slen > 1) && (avalue[slen - 2] == '\\'))
334 {
335 avalue[slen - 2] = '/';
336 avalue[slen - 1] = '\0';
337 slen--;
338 }
339 while (NULL != (pos = strstr (avalue, "\\")))
340 *pos = '/';
341 /* remove '../' everywhere */
342 while (NULL != (pos = strstr (avalue, "../")))
343 {
344 pos[0] = '_';
345 pos[1] = '_';
346 pos[2] = '_';
347 }
348 ivalue = avalue;
349 }
350 else
351 {
352 ivalue = value;
353 avalue = NULL;
354 }
355
356 gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, type, 1,
357 (guint) EXTRACTOR_METAFORMAT_UTF8, 2,
358 EXTRACTOR_metatype_to_string (type), 3,
359 ivalue, -1);
360 GNUNET_free_non_null (avalue);
361 gtk_entry_set_text (GTK_ENTRY (entry), "");
362}
363
364 28
365/** 29/**
366 * Callback with information about local (!) namespaces. 30 * Callback with information about local (!) namespaces.
@@ -390,6 +54,8 @@ selection_changed_cb (GtkTreeSelection * ts, gpointer user_data)
390{ 54{
391 GtkTreeIter iter; 55 GtkTreeIter iter;
392 GtkWidget *ok_button; 56 GtkWidget *ok_button;
57 GtkBuilder *builder;
58 builder = GTK_BUILDER (user_data);
393 59
394 ok_button = 60 ok_button =
395 GTK_WIDGET (gtk_builder_get_object 61 GTK_WIDGET (gtk_builder_get_object
@@ -400,60 +66,100 @@ selection_changed_cb (GtkTreeSelection * ts, gpointer user_data)
400 gtk_widget_set_sensitive (ok_button, FALSE); 66 gtk_widget_set_sensitive (ok_button, FALSE);
401} 67}
402 68
69struct namespace_data_struct
70{
71 struct GNUNET_FS_Namespace *ns;
72 int do_index;
73 char *short_fn;
74 guint anonymity_level;
75 guint priority;
76 gchar *root;
77};
403 78
404/** 79/**
405 * Advertise pseudonym selected. 80 * Function called on entries in a GNUNET_FS_FileInformation publish-structure.
81 *
82 * @param cls closure
83 * @param fi the entry in the publish-structure
84 * @param length length of the file or directory
85 * @param meta metadata for the file or directory (can be modified)
86 * @param uri pointer to the keywords that will be used for this entry (can be modified)
87 * @param bo block options (can be modified)
88 * @param do_index should we index (can be modified)
89 * @param client_info pointer to client context set upon creation (can be modified)
90 * @return GNUNET_OK to continue, GNUNET_NO to remove
91 * this entry from the directory, GNUNET_SYSERR
92 * to abort the iteration
406 */ 93 */
94int
95advertise_namespace (void *cls, struct GNUNET_FS_FileInformation *fi,
96 uint64_t length, struct GNUNET_CONTAINER_MetaData *meta,
97 struct GNUNET_FS_Uri **uri, struct GNUNET_FS_BlockOptions *bo,
98 int *do_index, void **client_info)
99{
100 struct namespace_data_struct *nds;
101 nds = (struct namespace_data_struct *) cls;
102 GNUNET_FS_namespace_advertise (GNUNET_FS_GTK_get_fs_handle (), *uri,
103 nds->ns, meta, bo, nds->root, NULL, NULL);
104 return GNUNET_SYSERR;
105}
106
407void 107void
408GNUNET_GTK_main_menu_file_advertise_pseudonym_activate_cb (GtkWidget * dummy, 108adv_pseudonym_edit_publish_dialog_cb (gpointer cls, int *do_index, char **short_fn,
409 gpointer data) 109 guint * anonymity_level, guint * priority, gchar *root,
110 struct GNUNET_FS_FileInformation *fip, gint ret)
111{
112 struct namespace_data_struct *nds;
113 nds = (struct namespace_data_struct *) cls;
114
115 if (ret == GTK_RESPONSE_OK)
116 {
117 nds->do_index = *do_index;
118 nds->short_fn = *short_fn;
119 nds->anonymity_level = *anonymity_level;
120 nds->priority = *priority;
121 nds->root = root;
122 GNUNET_FS_file_information_inspect (fip,
123 advertise_namespace, nds);
124 }
125 g_free (nds->root);
126 GNUNET_FS_namespace_delete (nds->ns, GNUNET_NO);
127 g_free (nds);
128 GNUNET_FS_file_information_destroy (fip, NULL, NULL);
129}
130
131void
132GNUNET_GTK_select_pseudonym_dialog_response_cb (GtkDialog *dialog,
133 gint response_id, gpointer user_data)
410{ 134{
135 GtkBuilder *builder;
411 GtkWidget *ad; 136 GtkWidget *ad;
412 struct GNUNET_FS_Namespace *ns;
413 struct GNUNET_FS_Namespace *nso;
414 GtkListStore *ls;
415 GtkTreeView *tv; 137 GtkTreeView *tv;
416 GtkTreeIter iter;
417 GtkTreeSelection *sel; 138 GtkTreeSelection *sel;
418 GtkTreeModel *tm; 139 GtkTreeModel *tm;
419 GtkSpinButton *sb; 140 GtkTreeIter iter;
141 struct GNUNET_FS_Namespace *ns;
142 struct GNUNET_FS_Namespace *nso;
143 GtkWindow *transient;
144 struct namespace_data_struct *nds;
145 struct GNUNET_FS_FileInformation *fip;
146 struct GNUNET_CONTAINER_MetaData *meta;
147 builder = GTK_BUILDER (user_data);
420 struct GNUNET_FS_BlockOptions bo; 148 struct GNUNET_FS_BlockOptions bo;
421 struct GNUNET_FS_Uri *nxt;
422 struct GNUNET_FS_Uri *mrg;
423 struct GNUNET_FS_Uri *uri;
424 struct GNUNET_CONTAINER_MetaData *nm;
425 const char *root;
426 char *value;
427 guint ntype;
428 guint nformat;
429 guint type;
430 guint max_type;
431 149
432 builder =
433 GNUNET_GTK_get_new_builder
434 ("gnunet_fs_gtk_select_pseudonym_dialog.glade");
435 if (builder == NULL)
436 {
437 GNUNET_break (0);
438 return;
439 }
440 ad = GTK_WIDGET (gtk_builder_get_object 150 ad = GTK_WIDGET (gtk_builder_get_object
441 (builder, "GNUNET_GTK_select_pseudonym_dialog")); 151 (builder, "GNUNET_GTK_select_pseudonym_dialog"));
442 ls = GTK_LIST_STORE (gtk_builder_get_object 152
443 (builder, "GNUNET_GTK_select_pseudonym_liststore")); 153 if (response_id != -5)
444 GNUNET_FS_namespace_list (GNUNET_FS_GTK_get_fs_handle (), &add_to_list, ls);
445 tv = GTK_TREE_VIEW (gtk_builder_get_object
446 (builder, "GNUNET_GTK_select_pseudonym_tree_view"));
447 sel = gtk_tree_view_get_selection (tv);
448 g_signal_connect (G_OBJECT (sel), "changed",
449 G_CALLBACK (selection_changed_cb), NULL);
450 if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad)))
451 { 154 {
452 gtk_widget_destroy (ad); 155 gtk_widget_hide (ad);
453 g_object_unref (G_OBJECT (builder));
454 builder = NULL;
455 return; 156 return;
456 } 157 }
158 tv = GTK_TREE_VIEW (gtk_builder_get_object
159 (builder,
160 "GNUNET_GTK_select_pseudonym_tree_view"));
161 sel = gtk_tree_view_get_selection (tv);
162
457 GNUNET_assert (TRUE == gtk_tree_selection_get_selected (sel, &tm, &iter)); 163 GNUNET_assert (TRUE == gtk_tree_selection_get_selected (sel, &tm, &iter));
458 gtk_tree_model_get (tm, &iter, 1, &ns, -1); 164 gtk_tree_model_get (tm, &iter, 1, &ns, -1);
459 /* free all namespaces from list store except "ns" */ 165 /* free all namespaces from list store except "ns" */
@@ -467,129 +173,72 @@ GNUNET_GTK_main_menu_file_advertise_pseudonym_activate_cb (GtkWidget * dummy,
467 } 173 }
468 while (TRUE == gtk_tree_model_iter_next (tm, &iter)); 174 while (TRUE == gtk_tree_model_iter_next (tm, &iter));
469 } 175 }
470 gtk_widget_destroy (ad); 176 transient = gtk_window_get_transient_for (GTK_WINDOW (ad));
471 g_object_unref (G_OBJECT (builder)); 177 gtk_widget_hide (ad);
472 builder = NULL; 178
179 meta = GNUNET_CONTAINER_meta_data_create ();
180
181 nds = g_new0 (struct namespace_data_struct, 1);
182 nds->ns = ns;
183 nds->do_index = FALSE;
184 nds->short_fn = NULL;
185 nds->anonymity_level = 1;
186 nds->priority = 1000;
187 nds->root = NULL;
188 /* This is a bogus fileinfo. It's needed because edit_publish_dialog
189 * was written to work with fileinfo, and return a fileinfo.
190 */
191 memset (&bo, 0, sizeof (bo));
192 fip = GNUNET_FS_file_information_create_empty_directory (NULL, NULL,
193 NULL, meta, &bo);
194 GNUNET_CONTAINER_meta_data_destroy (meta);
195
196 GNUNET_FS_GTK_edit_publish_dialog (builder, transient, &nds->do_index,
197 &nds->short_fn, &nds->anonymity_level, &nds->priority,
198 fip, FALSE, &adv_pseudonym_edit_publish_dialog_cb, nds);
199}
473 200
201void
202GNUNET_GTK_select_pseudonym_dialog_realize_cb (GtkWidget *widget,
203 gpointer user_data)
204{
205 GtkTreeView *tv;
206 GtkTreeSelection *sel;
207 GtkBuilder *builder;
474 208
475 builder = 209 builder = GTK_BUILDER (user_data);
476 GNUNET_GTK_get_new_builder
477 ("gnunet_fs_gtk_advertise_pseudonym_dialog.glade");
478 if (builder == NULL)
479 {
480 GNUNET_break (0);
481 return;
482 }
483 GNUNET_FS_GTK_setup_expiration_year_adjustment (builder);
484 ad = GTK_WIDGET (gtk_builder_get_object
485 (builder, "GNUNET_GTK_advertise_pseudonym_dialog"));
486 ls = GTK_LIST_STORE (gtk_builder_get_object
487 (builder, "GNUNET_GTK_metatype_list_store"));
488 max_type = EXTRACTOR_metatype_get_max ();
489 type = 1;
490 while (type < max_type - 1)
491 {
492 gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0,
493 EXTRACTOR_metatype_to_string (type), 1,
494 type, 2,
495 EXTRACTOR_metatype_to_description (type),
496 -1);
497 type++;
498 }
499 tv = GTK_TREE_VIEW (gtk_builder_get_object
500 (builder,
501 "GNUNET_GTK_advertise_pseudonym_metadata_type_tree_view"));
502 sel = gtk_tree_view_get_selection (tv);
503 g_signal_connect (G_OBJECT (sel), "changed",
504 G_CALLBACK
505 (GNUNET_GTK_advertise_pseudonym_metadata_value_entry_changed_cb),
506 NULL);
507 210
508 tv = GTK_TREE_VIEW (gtk_builder_get_object 211 tv = GTK_TREE_VIEW (gtk_builder_get_object
509 (builder, 212 (builder, "GNUNET_GTK_select_pseudonym_tree_view"));
510 "GNUNET_GTK_advertise_pseudonym_metadata_tree_view"));
511 sel = gtk_tree_view_get_selection (tv); 213 sel = gtk_tree_view_get_selection (tv);
512 g_signal_connect (G_OBJECT (sel), "changed", 214 g_signal_connect (G_OBJECT (sel), "changed",
513 G_CALLBACK (metadata_selection_changed_cb), NULL); 215 G_CALLBACK (selection_changed_cb), user_data);
216}
514 217
515 tv = GTK_TREE_VIEW (gtk_builder_get_object 218/**
516 (builder, 219 * Advertise pseudonym selected.
517 "GNUNET_GTK_advertise_pseudonym_keyword_list_tree_view")); 220 */
518 sel = gtk_tree_view_get_selection (tv); 221void
519 g_signal_connect (G_OBJECT (sel), "changed", 222GNUNET_GTK_main_menu_file_advertise_pseudonym_activate_cb (GtkWidget * dummy,
520 G_CALLBACK (keyword_selection_changed_cb), NULL); 223 gpointer data)
521 if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad))) 224{
522 { 225 GtkWidget *ad;
523 gtk_widget_destroy (ad); 226 GtkListStore *ls;
524 g_object_unref (G_OBJECT (builder)); 227 GtkWidget *toplevel;
525 builder = NULL; 228 GtkBuilder *builder;
526 return; 229
527 } 230 builder = GTK_BUILDER (data);
528 /* get keywords from list store */ 231
529 nxt = NULL; 232 ad = GTK_WIDGET (gtk_builder_get_object
530 mrg = NULL; 233 (builder, "GNUNET_GTK_select_pseudonym_dialog"));
531 uri = NULL; 234 ls = GTK_LIST_STORE (gtk_builder_get_object
532 tm = GTK_TREE_MODEL (gtk_builder_get_object 235 (builder, "GNUNET_GTK_select_pseudonym_liststore"));
533 (builder, "GNUNET_GTK_keyword_list_store")); 236 gtk_list_store_clear (ls);
534 if (TRUE == gtk_tree_model_get_iter_first (tm, &iter)) 237 GNUNET_FS_namespace_list (GNUNET_FS_GTK_get_fs_handle (), &add_to_list, ls);
535 { 238 toplevel = gtk_widget_get_toplevel (dummy);
536 do 239 if (GTK_IS_WINDOW (toplevel))
537 { 240 gtk_window_set_transient_for (GTK_WINDOW (ad), GTK_WINDOW (toplevel));
538 gtk_tree_model_get (tm, &iter, 0, &value, -1); 241 gtk_window_present (GTK_WINDOW (ad));
539 nxt = GNUNET_FS_uri_ksk_create_from_args (1, (const char **) &value);
540 mrg = GNUNET_FS_uri_ksk_merge (nxt, uri);
541 GNUNET_FS_uri_destroy (nxt);
542 if (NULL != uri)
543 GNUNET_FS_uri_destroy (uri);
544 uri = mrg;
545 g_free (value);
546 }
547 while (TRUE == gtk_tree_model_iter_next (tm, &iter));
548 }
549 /* get meta */
550 nm = GNUNET_CONTAINER_meta_data_create ();
551 tm = GTK_TREE_MODEL (gtk_builder_get_object
552 (builder, "GNUNET_GTK_meta_data_list_store"));
553 if (TRUE == gtk_tree_model_get_iter_first (tm, &iter))
554 {
555 do
556 {
557 gtk_tree_model_get (tm, &iter, 0, &ntype, 1, &nformat, 3, &value, -1);
558 GNUNET_CONTAINER_meta_data_insert (nm, "<user>", ntype, nformat,
559 "text/plain", value,
560 strlen (value) + 1);
561 g_free (value);
562 }
563 while (TRUE == gtk_tree_model_iter_next (tm, &iter));
564 }
565 bo.anonymity_level =
566 gtk_spin_button_get_value (GTK_SPIN_BUTTON
567 (gtk_builder_get_object
568 (builder,
569 "GNUNET_GTK_advertise_pseudonym_anonymity_spin_button")));
570 bo.content_priority =
571 gtk_spin_button_get_value (GTK_SPIN_BUTTON
572 (gtk_builder_get_object
573 (builder,
574 "GNUNET_GTK_advertise_pseudonym_priority_spin_button")));
575 sb = GTK_SPIN_BUTTON (gtk_builder_get_object
576 (builder,
577 "GNUNET_GTK_advertise_pseudonym_expiration_year_spin_button"));
578 bo.expiration_time = GNUNET_FS_GTK_get_expiration_time (sb);
579 root =
580 gtk_entry_get_text (GTK_ENTRY
581 (gtk_builder_get_object
582 (builder,
583 "GNUNET_GTK_advertise_pseudonym_root_entry")));
584 GNUNET_FS_namespace_advertise (GNUNET_FS_GTK_get_fs_handle (), uri, ns, nm,
585 &bo, root, NULL, NULL);
586 GNUNET_FS_namespace_delete (ns, GNUNET_NO);
587 GNUNET_CONTAINER_meta_data_destroy (nm);
588 if (NULL != uri)
589 GNUNET_FS_uri_destroy (uri);
590 gtk_widget_destroy (ad);
591 g_object_unref (G_OBJECT (builder));
592 builder = NULL;
593} 242}
594 243
595 244
diff --git a/src/fs/gnunet-fs-gtk-main_window_create_pseudonym.c b/src/fs/gnunet-fs-gtk-main_window_create_pseudonym.c
index 05094a12..e0a8b0e4 100644
--- a/src/fs/gnunet-fs-gtk-main_window_create_pseudonym.c
+++ b/src/fs/gnunet-fs-gtk-main_window_create_pseudonym.c
@@ -26,28 +26,20 @@
26#include "gnunet-fs-gtk-common.h" 26#include "gnunet-fs-gtk-common.h"
27#include "gnunet-fs-gtk.h" 27#include "gnunet-fs-gtk.h"
28 28
29/**
30 */
31void 29void
32GNUNET_GTK_main_menu_create_pseudonym_activate_cb (GtkWidget * dummy, 30GNUNET_GTK_create_namespace_dialog_response_cb (GtkDialog *dialog,
33 gpointer data) 31 gint response_id, gpointer user_data)
34{ 32{
35 GtkWidget *ad;
36 GtkBuilder *builder;
37 const char *name; 33 const char *name;
38 struct GNUNET_FS_Namespace *ns; 34 struct GNUNET_FS_Namespace *ns;
35 GtkWidget *ad;
36 GtkBuilder *builder;
39 37
40 builder = 38 builder = GTK_BUILDER (user_data);
41 GNUNET_GTK_get_new_builder
42 ("gnunet_fs_gtk_create_namespace_dialog.glade");
43 if (builder == NULL)
44 {
45 GNUNET_break (0);
46 return;
47 }
48 ad = GTK_WIDGET (gtk_builder_get_object 39 ad = GTK_WIDGET (gtk_builder_get_object
49 (builder, "GNUNET_GTK_create_namespace_dialog")); 40 (builder, "GNUNET_GTK_create_namespace_dialog"));
50 if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad))) 41
42 if (response_id != -5)
51 { 43 {
52 gtk_widget_destroy (ad); 44 gtk_widget_destroy (ad);
53 g_object_unref (G_OBJECT (builder)); 45 g_object_unref (G_OBJECT (builder));
@@ -65,5 +57,32 @@ GNUNET_GTK_main_menu_create_pseudonym_activate_cb (GtkWidget * dummy,
65 g_object_unref (G_OBJECT (builder)); 57 g_object_unref (G_OBJECT (builder));
66} 58}
67 59
60/**
61 */
62void
63GNUNET_GTK_main_menu_create_pseudonym_activate_cb (GtkWidget * dummy,
64 gpointer data)
65{
66 GtkWidget *ad;
67 GtkWidget *toplevel;
68 GtkBuilder *builder;
69
70 builder =
71 GNUNET_GTK_get_new_builder
72 ("gnunet_fs_gtk_create_namespace_dialog.glade");
73 if (builder == NULL)
74 {
75 GNUNET_break (0);
76 return;
77 }
78 ad = GTK_WIDGET (gtk_builder_get_object
79 (builder, "GNUNET_GTK_create_namespace_dialog"));
80
81 toplevel = gtk_widget_get_toplevel (dummy);
82 if (GTK_IS_WINDOW (toplevel))
83 gtk_window_set_transient_for (GTK_WINDOW (ad), GTK_WINDOW (toplevel));
84 gtk_window_present (GTK_WINDOW (ad));
85}
86
68 87
69/* end of gnunet-fs-gtk-main_window_create_pseudonym.c */ 88/* end of gnunet-fs-gtk-main_window_create_pseudonym.c */
diff --git a/src/fs/gnunet-fs-gtk-main_window_file_publish.c b/src/fs/gnunet-fs-gtk-main_window_file_publish.c
index c4ad5117..72915041 100644
--- a/src/fs/gnunet-fs-gtk-main_window_file_publish.c
+++ b/src/fs/gnunet-fs-gtk-main_window_file_publish.c
@@ -26,16 +26,11 @@
26#include "gnunet-fs-gtk.h" 26#include "gnunet-fs-gtk.h"
27#include "gnunet-fs-gtk-edit_publish_dialog.h" 27#include "gnunet-fs-gtk-edit_publish_dialog.h"
28#include <gnunet/gnunet_util_lib.h> 28#include <gnunet/gnunet_util_lib.h>
29#include <gnunet/gnunet_fs_service.h>
29 30
30#define MARKER_DIR_FILE_SIZE "-" 31#define MARKER_DIR_FILE_SIZE "-"
31 32
32/** 33/**
33 * Builder used for the master publish dialog.
34 */
35static GtkBuilder *master_builder;
36
37
38/**
39 * Check if two GtkTreeIters refer to the same element. 34 * Check if two GtkTreeIters refer to the same element.
40 * 35 *
41 * @param tm tree model of the iterators 36 * @param tm tree model of the iterators
@@ -63,7 +58,7 @@ gtk_tree_iter_equals (GtkTreeModel * tm, GtkTreeIter * i1, GtkTreeIter * i2)
63 * Update selectivity in the master dialog. 58 * Update selectivity in the master dialog.
64 */ 59 */
65static void 60static void
66update_selectivity () 61update_selectivity (gpointer data)
67{ 62{
68 GtkTreeView *tv; 63 GtkTreeView *tv;
69 GtkTreeModel *tm; 64 GtkTreeModel *tm;
@@ -83,12 +78,15 @@ update_selectivity ()
83 struct GNUNET_FS_FileInformation *fip; 78 struct GNUNET_FS_FileInformation *fip;
84 int ns_ok; 79 int ns_ok;
85 gchar *namespace_id; 80 gchar *namespace_id;
81 GtkBuilder *builder;
82
83 builder = GTK_BUILDER (data);
86 84
87 tm = GTK_TREE_MODEL (gtk_builder_get_object 85 tm = GTK_TREE_MODEL (gtk_builder_get_object
88 (master_builder, 86 (builder,
89 "GNUNET_GTK_file_sharing_publishing_tree_store")); 87 "GNUNET_GTK_file_sharing_publishing_tree_store"));
90 tv = GTK_TREE_VIEW (gtk_builder_get_object 88 tv = GTK_TREE_VIEW (gtk_builder_get_object
91 (master_builder, 89 (builder,
92 "GNUNET_GTK_master_publish_dialog_pseudonym_tree_view")); 90 "GNUNET_GTK_master_publish_dialog_pseudonym_tree_view"));
93 sel = gtk_tree_view_get_selection (tv); 91 sel = gtk_tree_view_get_selection (tv);
94 ns_ok = GNUNET_YES; 92 ns_ok = GNUNET_YES;
@@ -102,34 +100,34 @@ update_selectivity ()
102 } 100 }
103 up_button = 101 up_button =
104 GTK_WIDGET (gtk_builder_get_object 102 GTK_WIDGET (gtk_builder_get_object
105 (master_builder, 103 (builder,
106 "GNUNET_GTK_master_publish_dialog_up_button")); 104 "GNUNET_GTK_master_publish_dialog_up_button"));
107 down_button = 105 down_button =
108 GTK_WIDGET (gtk_builder_get_object 106 GTK_WIDGET (gtk_builder_get_object
109 (master_builder, 107 (builder,
110 "GNUNET_GTK_master_publish_dialog_down_button")); 108 "GNUNET_GTK_master_publish_dialog_down_button"));
111 left_button = 109 left_button =
112 GTK_WIDGET (gtk_builder_get_object 110 GTK_WIDGET (gtk_builder_get_object
113 (master_builder, 111 (builder,
114 "GNUNET_GTK_master_publish_dialog_left_button")); 112 "GNUNET_GTK_master_publish_dialog_left_button"));
115 right_button = 113 right_button =
116 GTK_WIDGET (gtk_builder_get_object 114 GTK_WIDGET (gtk_builder_get_object
117 (master_builder, 115 (builder,
118 "GNUNET_GTK_master_publish_dialog_right_button")); 116 "GNUNET_GTK_master_publish_dialog_right_button"));
119 delete_button = 117 delete_button =
120 GTK_WIDGET (gtk_builder_get_object 118 GTK_WIDGET (gtk_builder_get_object
121 (master_builder, 119 (builder,
122 "GNUNET_GTK_master_publish_dialog_delete_button")); 120 "GNUNET_GTK_master_publish_dialog_delete_button"));
123 edit_button = 121 edit_button =
124 GTK_WIDGET (gtk_builder_get_object 122 GTK_WIDGET (gtk_builder_get_object
125 (master_builder, 123 (builder,
126 "GNUNET_GTK_master_publish_dialog_edit_button")); 124 "GNUNET_GTK_master_publish_dialog_edit_button"));
127 execute_button = 125 execute_button =
128 GTK_WIDGET (gtk_builder_get_object 126 GTK_WIDGET (gtk_builder_get_object
129 (master_builder, 127 (builder,
130 "GNUNET_GTK_master_publish_dialog_execute_button")); 128 "GNUNET_GTK_master_publish_dialog_execute_button"));
131 tv = GTK_TREE_VIEW (gtk_builder_get_object 129 tv = GTK_TREE_VIEW (gtk_builder_get_object
132 (master_builder, 130 (builder,
133 "GNUNET_GTK_master_publish_dialog_file_information_tree_view")); 131 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
134 sel = gtk_tree_view_get_selection (tv); 132 sel = gtk_tree_view_get_selection (tv);
135 tm = gtk_tree_view_get_model (tv); 133 tm = gtk_tree_view_get_model (tv);
@@ -208,7 +206,7 @@ update_selectivity ()
208 * @param iter parent entry, or NULL for top-level addition 206 * @param iter parent entry, or NULL for top-level addition
209 */ 207 */
210static void 208static void
211add_file_at_iter (const char *filename, const struct GNUNET_FS_BlockOptions *bo, 209add_file_at_iter (gpointer data, const char *filename, const struct GNUNET_FS_BlockOptions *bo,
212 int do_index, GtkTreeIter * iter) 210 int do_index, GtkTreeIter * iter)
213{ 211{
214 struct GNUNET_FS_FileInformation *fi; 212 struct GNUNET_FS_FileInformation *fi;
@@ -223,6 +221,9 @@ add_file_at_iter (const char *filename, const struct GNUNET_FS_BlockOptions *bo,
223 char *file_size_fancy; 221 char *file_size_fancy;
224 const char *ss; 222 const char *ss;
225 struct stat sbuf; 223 struct stat sbuf;
224 GtkBuilder *builder;
225
226 builder = GTK_BUILDER (data);
226 227
227 if (0 != STAT (filename, &sbuf)) 228 if (0 != STAT (filename, &sbuf))
228 return; 229 return;
@@ -239,7 +240,7 @@ add_file_at_iter (const char *filename, const struct GNUNET_FS_BlockOptions *bo,
239 } 240 }
240 } 241 }
241 ts = GTK_TREE_STORE (gtk_builder_get_object 242 ts = GTK_TREE_STORE (gtk_builder_get_object
242 (master_builder, 243 (builder,
243 "GNUNET_GTK_file_sharing_publishing_tree_store")); 244 "GNUNET_GTK_file_sharing_publishing_tree_store"));
244 245
245 meta = GNUNET_CONTAINER_meta_data_create (); 246 meta = GNUNET_CONTAINER_meta_data_create ();
@@ -273,7 +274,7 @@ add_file_at_iter (const char *filename, const struct GNUNET_FS_BlockOptions *bo,
273 short_fn, 3, (guint) bo->anonymity_level, 4, 274 short_fn, 3, (guint) bo->anonymity_level, 4,
274 (guint) bo->content_priority, 5, fi, -1); 275 (guint) bo->content_priority, 5, fi, -1);
275 GNUNET_free (file_size_fancy); 276 GNUNET_free (file_size_fancy);
276 update_selectivity (); 277 update_selectivity (data);
277} 278}
278 279
279 280
@@ -287,7 +288,7 @@ add_file_at_iter (const char *filename, const struct GNUNET_FS_BlockOptions *bo,
287 * @param pos iterator to set to the location of the new element 288 * @param pos iterator to set to the location of the new element
288 */ 289 */
289static void 290static void
290create_dir_at_iter (const char *name, const struct GNUNET_FS_BlockOptions *bo, 291create_dir_at_iter (gpointer data, const char *name, const struct GNUNET_FS_BlockOptions *bo,
291 GtkTreeIter * iter, GtkTreeIter * pos) 292 GtkTreeIter * iter, GtkTreeIter * pos)
292{ 293{
293 struct GNUNET_FS_FileInformation *fi; 294 struct GNUNET_FS_FileInformation *fi;
@@ -295,9 +296,12 @@ create_dir_at_iter (const char *name, const struct GNUNET_FS_BlockOptions *bo,
295 GtkTreePath *path; 296 GtkTreePath *path;
296 struct GNUNET_CONTAINER_MetaData *meta; 297 struct GNUNET_CONTAINER_MetaData *meta;
297 GtkTreeStore *ts; 298 GtkTreeStore *ts;
299 GtkBuilder *builder;
300
301 builder = GTK_BUILDER (data);
298 302
299 ts = GTK_TREE_STORE (gtk_builder_get_object 303 ts = GTK_TREE_STORE (gtk_builder_get_object
300 (master_builder, 304 (builder,
301 "GNUNET_GTK_file_sharing_publishing_tree_store")); 305 "GNUNET_GTK_file_sharing_publishing_tree_store"));
302 meta = GNUNET_CONTAINER_meta_data_create (); 306 meta = GNUNET_CONTAINER_meta_data_create ();
303 GNUNET_FS_meta_data_make_directory (meta); 307 GNUNET_FS_meta_data_make_directory (meta);
@@ -315,7 +319,7 @@ create_dir_at_iter (const char *name, const struct GNUNET_FS_BlockOptions *bo,
315 gtk_tree_store_set (ts, pos, 0, MARKER_DIR_FILE_SIZE, 1, (gboolean) GNUNET_NO, 319 gtk_tree_store_set (ts, pos, 0, MARKER_DIR_FILE_SIZE, 1, (gboolean) GNUNET_NO,
316 2, name, 3, (guint) bo->anonymity_level, 4, 320 2, name, 3, (guint) bo->anonymity_level, 4,
317 (guint) bo->content_priority, 5, fi, -1); 321 (guint) bo->content_priority, 5, fi, -1);
318 update_selectivity (); 322 update_selectivity (data);
319} 323}
320 324
321 325
@@ -797,11 +801,14 @@ scan_directory (void *cls, const char *filename)
797 * @param do_index should we index? 801 * @param do_index should we index?
798 */ 802 */
799static void 803static void
800add_dir (const char *filename, const struct GNUNET_FS_BlockOptions *bo, 804add_dir (gpointer data, const char *filename, const struct GNUNET_FS_BlockOptions *bo,
801 int do_index) 805 int do_index)
802{ 806{
803 struct stat sbuf; 807 struct stat sbuf;
804 struct AddDirContext scan_ctx; 808 struct AddDirContext scan_ctx;
809 GtkBuilder *builder;
810
811 builder = GTK_BUILDER (data);
805 812
806 if (0 != STAT (filename, &sbuf)) 813 if (0 != STAT (filename, &sbuf))
807 return; 814 return;
@@ -815,7 +822,7 @@ add_dir (const char *filename, const struct GNUNET_FS_BlockOptions *bo,
815 scan_ctx.do_index = do_index; 822 scan_ctx.do_index = do_index;
816 scan_ctx.ts = 823 scan_ctx.ts =
817 GTK_TREE_STORE (gtk_builder_get_object 824 GTK_TREE_STORE (gtk_builder_get_object
818 (master_builder, 825 (builder,
819 "GNUNET_GTK_file_sharing_publishing_tree_store")); 826 "GNUNET_GTK_file_sharing_publishing_tree_store"));
820 scan_directory (&scan_ctx, filename); 827 scan_directory (&scan_ctx, filename);
821} 828}
@@ -827,7 +834,7 @@ add_dir (const char *filename, const struct GNUNET_FS_BlockOptions *bo,
827static void 834static void
828selection_changed_cb (GtkTreeSelection * ts, gpointer user_data) 835selection_changed_cb (GtkTreeSelection * ts, gpointer user_data)
829{ 836{
830 update_selectivity (); 837 update_selectivity (user_data);
831} 838}
832 839
833 840
@@ -847,7 +854,7 @@ remove_old_entry (GtkTreeStore * ts, GtkTreeIter * root)
847 * Move an entry in the tree. 854 * Move an entry in the tree.
848 */ 855 */
849static void 856static void
850move_entry (GtkTreeModel * tm, GtkTreeIter * old, GtkTreeIter * newpos, 857move_entry (gpointer data, GtkTreeModel * tm, GtkTreeIter * old, GtkTreeIter * newpos,
851 int dsel) 858 int dsel)
852{ 859{
853 struct GNUNET_FS_FileInformation *fip; 860 struct GNUNET_FS_FileInformation *fip;
@@ -863,6 +870,9 @@ move_entry (GtkTreeModel * tm, GtkTreeIter * old, GtkTreeIter * newpos,
863 GtkTreeIter cnewpos; 870 GtkTreeIter cnewpos;
864 GtkTreeRowReference *rr; 871 GtkTreeRowReference *rr;
865 GtkTreeRowReference *rr2; 872 GtkTreeRowReference *rr2;
873 GtkBuilder *builder;
874
875 builder = GTK_BUILDER (data);
866 876
867 gtk_tree_model_get (tm, old, 0, &fsf, 1, &do_index, 2, &short_fn, 3, 877 gtk_tree_model_get (tm, old, 0, &fsf, 1, &do_index, 2, &short_fn, 3,
868 &anonymity_level, 4, &priority, 5, &fip, -1); 878 &anonymity_level, 4, &priority, 5, &fip, -1);
@@ -874,7 +884,7 @@ move_entry (GtkTreeModel * tm, GtkTreeIter * old, GtkTreeIter * newpos,
874 if (dsel == GNUNET_YES) 884 if (dsel == GNUNET_YES)
875 { 885 {
876 tv = GTK_TREE_VIEW (gtk_builder_get_object 886 tv = GTK_TREE_VIEW (gtk_builder_get_object
877 (master_builder, 887 (builder,
878 "GNUNET_GTK_master_publish_dialog_file_information_tree_view")); 888 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
879 sel = gtk_tree_view_get_selection (tv); 889 sel = gtk_tree_view_get_selection (tv);
880 path = gtk_tree_model_get_path (tm, newpos); 890 path = gtk_tree_model_get_path (tm, newpos);
@@ -894,7 +904,7 @@ move_entry (GtkTreeModel * tm, GtkTreeIter * old, GtkTreeIter * newpos,
894 gtk_tree_path_free (path); 904 gtk_tree_path_free (path);
895 gtk_tree_store_insert_before (GTK_TREE_STORE (tm), &cnewpos, newpos, 905 gtk_tree_store_insert_before (GTK_TREE_STORE (tm), &cnewpos, newpos,
896 NULL); 906 NULL);
897 move_entry (tm, &child, &cnewpos, GNUNET_NO); 907 move_entry (data, tm, &child, &cnewpos, GNUNET_NO);
898 path = gtk_tree_row_reference_get_path (rr2); 908 path = gtk_tree_row_reference_get_path (rr2);
899 gtk_tree_row_reference_free (rr2); 909 gtk_tree_row_reference_free (rr2);
900 GNUNET_assert (TRUE == gtk_tree_model_get_iter (tm, &child, path)); 910 GNUNET_assert (TRUE == gtk_tree_model_get_iter (tm, &child, path));
@@ -913,7 +923,7 @@ move_entry (GtkTreeModel * tm, GtkTreeIter * old, GtkTreeIter * newpos,
913 gtk_tree_path_free (path); 923 gtk_tree_path_free (path);
914 gtk_tree_selection_select_iter (sel, newpos); 924 gtk_tree_selection_select_iter (sel, newpos);
915 } 925 }
916 update_selectivity (); 926 update_selectivity (data);
917} 927}
918 928
919/** 929/**
@@ -926,9 +936,12 @@ void GNUNET_GTK_master_publish_dialog_pseudonym_updates_renderer_edited_cb
926{ 936{
927 GtkTreeIter iter; 937 GtkTreeIter iter;
928 GtkTreeStore *ts; 938 GtkTreeStore *ts;
939 GtkBuilder *builder;
940
941 builder = GTK_BUILDER (user_data);
929 942
930 ts = GTK_TREE_STORE (gtk_builder_get_object 943 ts = GTK_TREE_STORE (gtk_builder_get_object
931 (master_builder, "GNUNET_GTK_pseudonym_tree_store")); 944 (builder, "GNUNET_GTK_pseudonym_tree_store"));
932 945
933 if (TRUE != 946 if (TRUE !=
934 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ts), &iter, cpath)) 947 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ts), &iter, cpath))
@@ -937,7 +950,7 @@ void GNUNET_GTK_master_publish_dialog_pseudonym_updates_renderer_edited_cb
937 return; 950 return;
938 } 951 }
939 gtk_tree_store_set (ts, &iter, 5, new_text, -1); 952 gtk_tree_store_set (ts, &iter, 5, new_text, -1);
940 update_selectivity (); 953 update_selectivity (user_data);
941} 954}
942 955
943 956
@@ -951,9 +964,12 @@ void GNUNET_GTK_master_publish_dialog_pseudonym_identifier_renderer_edited_cb
951{ 964{
952 GtkTreeIter iter; 965 GtkTreeIter iter;
953 GtkTreeStore *ts; 966 GtkTreeStore *ts;
967 GtkBuilder *builder;
968
969 builder = GTK_BUILDER (user_data);
954 970
955 ts = GTK_TREE_STORE (gtk_builder_get_object 971 ts = GTK_TREE_STORE (gtk_builder_get_object
956 (master_builder, "GNUNET_GTK_pseudonym_tree_store")); 972 (builder, "GNUNET_GTK_pseudonym_tree_store"));
957 973
958 if (TRUE != 974 if (TRUE !=
959 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ts), &iter, cpath)) 975 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ts), &iter, cpath))
@@ -962,7 +978,7 @@ void GNUNET_GTK_master_publish_dialog_pseudonym_identifier_renderer_edited_cb
962 return; 978 return;
963 } 979 }
964 gtk_tree_store_set (ts, &iter, 2, new_text, -1); 980 gtk_tree_store_set (ts, &iter, 2, new_text, -1);
965 update_selectivity (); 981 update_selectivity (user_data);
966} 982}
967 983
968 984
@@ -978,9 +994,12 @@ GNUNET_GTK_master_publish_dialog_right_button_clicked_cb (GtkWidget * dummy,
978 GtkTreeIter pred; 994 GtkTreeIter pred;
979 GtkTreeIter prev; 995 GtkTreeIter prev;
980 GtkTreeIter pos; 996 GtkTreeIter pos;
997 GtkBuilder *builder;
998
999 builder = GTK_BUILDER (data);
981 1000
982 tv = GTK_TREE_VIEW (gtk_builder_get_object 1001 tv = GTK_TREE_VIEW (gtk_builder_get_object
983 (master_builder, 1002 (builder,
984 "GNUNET_GTK_master_publish_dialog_file_information_tree_view")); 1003 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
985 sel = gtk_tree_view_get_selection (tv); 1004 sel = gtk_tree_view_get_selection (tv);
986 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter)) 1005 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
@@ -1010,7 +1029,7 @@ GNUNET_GTK_master_publish_dialog_right_button_clicked_cb (GtkWidget * dummy,
1010 GNUNET_break (0); 1029 GNUNET_break (0);
1011 return; 1030 return;
1012 } 1031 }
1013 move_entry (tm, &iter, &pos, GNUNET_YES); 1032 move_entry (data, tm, &iter, &pos, GNUNET_YES);
1014 remove_old_entry (GTK_TREE_STORE (tm), &iter); 1033 remove_old_entry (GTK_TREE_STORE (tm), &iter);
1015} 1034}
1016 1035
@@ -1025,9 +1044,12 @@ GNUNET_GTK_master_publish_dialog_left_button_clicked_cb (GtkWidget * dummy,
1025 GtkTreeIter iter; 1044 GtkTreeIter iter;
1026 GtkTreeIter parent; 1045 GtkTreeIter parent;
1027 GtkTreeIter pos; 1046 GtkTreeIter pos;
1047 GtkBuilder *builder;
1048
1049 builder = GTK_BUILDER (data);
1028 1050
1029 tv = GTK_TREE_VIEW (gtk_builder_get_object 1051 tv = GTK_TREE_VIEW (gtk_builder_get_object
1030 (master_builder, 1052 (builder,
1031 "GNUNET_GTK_master_publish_dialog_file_information_tree_view")); 1053 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
1032 sel = gtk_tree_view_get_selection (tv); 1054 sel = gtk_tree_view_get_selection (tv);
1033 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter)) 1055 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
@@ -1046,7 +1068,7 @@ GNUNET_GTK_master_publish_dialog_left_button_clicked_cb (GtkWidget * dummy,
1046 GNUNET_break (0); 1068 GNUNET_break (0);
1047 return; 1069 return;
1048 } 1070 }
1049 move_entry (tm, &iter, &pos, GNUNET_YES); 1071 move_entry (data, tm, &iter, &pos, GNUNET_YES);
1050 remove_old_entry (GTK_TREE_STORE (tm), &iter); 1072 remove_old_entry (GTK_TREE_STORE (tm), &iter);
1051} 1073}
1052 1074
@@ -1064,9 +1086,12 @@ GNUNET_GTK_master_publish_dialog_up_button_clicked_cb (GtkWidget * dummy,
1064 GtkTreeIter prev; 1086 GtkTreeIter prev;
1065 GtkTreeIter *pprev; 1087 GtkTreeIter *pprev;
1066 GtkTreeIter pos; 1088 GtkTreeIter pos;
1089 GtkBuilder *builder;
1090
1091 builder = GTK_BUILDER (data);
1067 1092
1068 tv = GTK_TREE_VIEW (gtk_builder_get_object 1093 tv = GTK_TREE_VIEW (gtk_builder_get_object
1069 (master_builder, 1094 (builder,
1070 "GNUNET_GTK_master_publish_dialog_file_information_tree_view")); 1095 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
1071 sel = gtk_tree_view_get_selection (tv); 1096 sel = gtk_tree_view_get_selection (tv);
1072 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter)) 1097 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
@@ -1101,7 +1126,7 @@ GNUNET_GTK_master_publish_dialog_up_button_clicked_cb (GtkWidget * dummy,
1101 GNUNET_break (0); 1126 GNUNET_break (0);
1102 return; 1127 return;
1103 } 1128 }
1104 move_entry (tm, &iter, &pos, GNUNET_YES); 1129 move_entry (data, tm, &iter, &pos, GNUNET_YES);
1105 remove_old_entry (GTK_TREE_STORE (tm), &iter); 1130 remove_old_entry (GTK_TREE_STORE (tm), &iter);
1106} 1131}
1107 1132
@@ -1116,9 +1141,12 @@ GNUNET_GTK_master_publish_dialog_down_button_clicked_cb (GtkWidget * dummy,
1116 GtkTreeIter iter; 1141 GtkTreeIter iter;
1117 GtkTreeIter next; 1142 GtkTreeIter next;
1118 GtkTreeIter pos; 1143 GtkTreeIter pos;
1144 GtkBuilder *builder;
1145
1146 builder = GTK_BUILDER (data);
1119 1147
1120 tv = GTK_TREE_VIEW (gtk_builder_get_object 1148 tv = GTK_TREE_VIEW (gtk_builder_get_object
1121 (master_builder, 1149 (builder,
1122 "GNUNET_GTK_master_publish_dialog_file_information_tree_view")); 1150 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
1123 sel = gtk_tree_view_get_selection (tv); 1151 sel = gtk_tree_view_get_selection (tv);
1124 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter)) 1152 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
@@ -1138,7 +1166,7 @@ GNUNET_GTK_master_publish_dialog_down_button_clicked_cb (GtkWidget * dummy,
1138 GNUNET_break (0); 1166 GNUNET_break (0);
1139 return; 1167 return;
1140 } 1168 }
1141 move_entry (tm, &iter, &pos, GNUNET_YES); 1169 move_entry (data, tm, &iter, &pos, GNUNET_YES);
1142 remove_old_entry (GTK_TREE_STORE (tm), &iter); 1170 remove_old_entry (GTK_TREE_STORE (tm), &iter);
1143} 1171}
1144 1172
@@ -1152,9 +1180,12 @@ GNUNET_GTK_master_publish_dialog_new_button_clicked_cb (GtkWidget * dummy,
1152 GtkTreeIter iter; 1180 GtkTreeIter iter;
1153 GtkTreeIter pos; 1181 GtkTreeIter pos;
1154 struct GNUNET_FS_BlockOptions bo; 1182 struct GNUNET_FS_BlockOptions bo;
1183 GtkBuilder *builder;
1184
1185 builder = GTK_BUILDER (data);
1155 1186
1156 tv = GTK_TREE_VIEW (gtk_builder_get_object 1187 tv = GTK_TREE_VIEW (gtk_builder_get_object
1157 (master_builder, 1188 (builder,
1158 "GNUNET_GTK_master_publish_dialog_file_information_tree_view")); 1189 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
1159 sel = gtk_tree_view_get_selection (tv); 1190 sel = gtk_tree_view_get_selection (tv);
1160 /* FIXME: consider opening a dialog to get 1191 /* FIXME: consider opening a dialog to get
@@ -1169,10 +1200,10 @@ GNUNET_GTK_master_publish_dialog_new_button_clicked_cb (GtkWidget * dummy,
1169 bo.replication_level = 1; 1200 bo.replication_level = 1;
1170 if (TRUE != gtk_tree_selection_get_selected (sel, NULL, &iter)) 1201 if (TRUE != gtk_tree_selection_get_selected (sel, NULL, &iter))
1171 { 1202 {
1172 create_dir_at_iter ("unnamed/", &bo, NULL, &pos); 1203 create_dir_at_iter (data, "unnamed/", &bo, NULL, &pos);
1173 return; 1204 return;
1174 } 1205 }
1175 create_dir_at_iter ("unnamed/", &bo, &iter, &pos); 1206 create_dir_at_iter (data, "unnamed/", &bo, &iter, &pos);
1176} 1207}
1177 1208
1178 1209
@@ -1182,55 +1213,49 @@ GNUNET_GTK_master_publish_dialog_add_button_clicked_cb (GtkWidget * dummy,
1182{ 1213{
1183 GtkWidget *ad; 1214 GtkWidget *ad;
1184 GtkBuilder *builder; 1215 GtkBuilder *builder;
1185 char *filename; 1216 GtkWindow *master_pubdialog;
1186 struct GNUNET_FS_BlockOptions bo; 1217
1187 int do_index; 1218 builder = GTK_BUILDER (data);
1188 GtkSpinButton *sb;
1189 1219
1190 builder =
1191 GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_publish_file_dialog.glade");
1192 if (builder == NULL)
1193 {
1194 GNUNET_break (0);
1195 return;
1196 }
1197 ad = GTK_WIDGET (gtk_builder_get_object 1220 ad = GTK_WIDGET (gtk_builder_get_object
1198 (builder, "GNUNET_GTK_publish_file_dialog")); 1221 (builder, "GNUNET_GTK_publish_file_dialog"));
1199 GNUNET_FS_GTK_setup_expiration_year_adjustment (builder); 1222 GNUNET_FS_GTK_setup_expiration_year_adjustment (builder);
1200 if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad))) 1223
1201 { 1224 master_pubdialog = GTK_WINDOW (gtk_builder_get_object (builder,
1202 gtk_widget_destroy (ad); 1225 "GNUNET_GTK_master_publish_dialog"));
1203 g_object_unref (G_OBJECT (builder)); 1226 gtk_window_set_transient_for (GTK_WINDOW (ad), master_pubdialog);
1204 return; 1227
1205 } 1228 gtk_window_present (GTK_WINDOW (ad));
1206 filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (ad));
1207 sb = GTK_SPIN_BUTTON (gtk_builder_get_object
1208 (builder,
1209 "GNUNET_GTK_publish_file_dialog_expiration_year_spin_button"));
1210 bo.anonymity_level =
1211 gtk_spin_button_get_value (GTK_SPIN_BUTTON
1212 (gtk_builder_get_object
1213 (builder,
1214 "GNUNET_GTK_publish_file_dialog_anonymity_spin_button")));
1215 bo.content_priority =
1216 gtk_spin_button_get_value (GTK_SPIN_BUTTON
1217 (gtk_builder_get_object
1218 (builder,
1219 "GNUNET_GTK_publish_file_dialog_priority_spin_button")));
1220 bo.expiration_time = GNUNET_FS_GTK_get_expiration_time (sb);
1221 bo.replication_level = 1; /* FIXME... */
1222 do_index =
1223 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
1224 (gtk_builder_get_object
1225 (builder,
1226 "GNUNET_GTK_publish_file_dialog_do_index_checkbutton")));
1227 add_file_at_iter (filename, &bo, do_index, NULL);
1228 gtk_widget_destroy (ad);
1229 g_object_unref (G_OBJECT (builder));
1230 g_free (filename);
1231 update_selectivity ();
1232} 1229}
1233 1230
1231struct edit_pub_cb_args
1232{
1233 GtkTreeModel *tm;
1234 GtkTreeIter iter;
1235 /* FIXME: this indirection madness is not really required any longer.
1236 * we only need to pass over *tm and iter, everything else can be
1237 * copied.
1238 */
1239 gchar *short_fn;
1240 struct GNUNET_FS_FileInformation *fip;
1241 int do_index;
1242 guint anonymity_level;
1243 guint priority;
1244};
1245
1246void
1247master_publish_edit_publish_dialog_cb (gpointer cls, int *do_index, char **short_fn,
1248 guint * anonymity_level, guint * priority, gchar *root,
1249 struct GNUNET_FS_FileInformation *fip, gint ret)
1250{
1251 struct edit_pub_cb_args *cbargs = (struct edit_pub_cb_args *) cls;
1252 if (ret == GTK_RESPONSE_OK)
1253 gtk_tree_store_set (GTK_TREE_STORE (cbargs->tm), &cbargs->iter,
1254 1, *do_index, 2, *short_fn, 3, *anonymity_level, 4, *priority, -1);
1255 g_free (root);
1256 g_free (short_fn);
1257 g_free (cbargs);
1258}
1234 1259
1235void 1260void
1236GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb (GtkWidget * dummy, 1261GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb (GtkWidget * dummy,
@@ -1239,29 +1264,36 @@ GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb (GtkWidget * dummy,
1239 GtkTreeView *tv; 1264 GtkTreeView *tv;
1240 GtkTreeModel *tm; 1265 GtkTreeModel *tm;
1241 GtkTreeSelection *sel; 1266 GtkTreeSelection *sel;
1242 GtkTreeIter iter; 1267 struct edit_pub_cb_args *cbargs;
1243 int do_index; 1268 GtkBuilder *builder;
1244 guint anonymity_level; 1269 GtkWindow *master_pubdialog;
1245 guint priority; 1270
1246 gchar *short_fn; 1271 builder = GTK_BUILDER (data);
1247 struct GNUNET_FS_FileInformation *fip;
1248 1272
1249 tv = GTK_TREE_VIEW (gtk_builder_get_object 1273 tv = GTK_TREE_VIEW (gtk_builder_get_object
1250 (master_builder, 1274 (builder,
1251 "GNUNET_GTK_master_publish_dialog_file_information_tree_view")); 1275 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
1276
1277 cbargs = g_new0 (struct edit_pub_cb_args, 1);
1278 cbargs->tm = gtk_tree_view_get_model (tv);
1279
1280 master_pubdialog = GTK_WINDOW (gtk_builder_get_object (builder,
1281 "GNUNET_GTK_master_publish_dialog"));
1252 sel = gtk_tree_view_get_selection (tv); 1282 sel = gtk_tree_view_get_selection (tv);
1253 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter)) 1283 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &cbargs->iter))
1254 { 1284 {
1255 GNUNET_break (0); 1285 GNUNET_break (0);
1286 g_free (cbargs);
1256 return; 1287 return;
1257 } 1288 }
1258 gtk_tree_model_get (tm, &iter, 1, &do_index, 2, &short_fn, 3, 1289
1259 &anonymity_level, 4, &priority, 5, &fip, -1); 1290 gtk_tree_model_get (tm, &cbargs->iter, 1, &cbargs->do_index, 2,
1260 GNUNET_FS_GTK_edit_publish_dialog (&do_index, &short_fn, &anonymity_level, 1291 &cbargs->short_fn, 3, &cbargs->anonymity_level, 4, &cbargs->priority,
1261 &priority, fip); 1292 5, &cbargs->fip, -1);
1262 gtk_tree_store_set (GTK_TREE_STORE (tm), &iter, 1, do_index, 2, short_fn, 3, 1293
1263 anonymity_level, 4, priority, -1); 1294 GNUNET_FS_GTK_edit_publish_dialog (builder, master_pubdialog, &cbargs->do_index,
1264 g_free (short_fn); 1295 &cbargs->short_fn, &cbargs->anonymity_level, &cbargs->priority,
1296 cbargs->fip, TRUE, &master_publish_edit_publish_dialog_cb, cbargs);
1265} 1297}
1266 1298
1267 1299
@@ -1298,9 +1330,12 @@ GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb (GtkWidget * dummy,
1298 GtkTreeSelection *sel; 1330 GtkTreeSelection *sel;
1299 GtkTreeIter iter; 1331 GtkTreeIter iter;
1300 struct GNUNET_FS_FileInformation *fip; 1332 struct GNUNET_FS_FileInformation *fip;
1333 GtkBuilder *builder;
1334
1335 builder = GTK_BUILDER (data);
1301 1336
1302 tv = GTK_TREE_VIEW (gtk_builder_get_object 1337 tv = GTK_TREE_VIEW (gtk_builder_get_object
1303 (master_builder, 1338 (builder,
1304 "GNUNET_GTK_master_publish_dialog_file_information_tree_view")); 1339 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
1305 sel = gtk_tree_view_get_selection (tv); 1340 sel = gtk_tree_view_get_selection (tv);
1306 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter)) 1341 if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
@@ -1311,65 +1346,69 @@ GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb (GtkWidget * dummy,
1311 gtk_tree_model_get (tm, &iter, 5, &fip, -1); 1346 gtk_tree_model_get (tm, &iter, 5, &fip, -1);
1312 GNUNET_FS_file_information_destroy (fip, &free_fi_row_reference, NULL); 1347 GNUNET_FS_file_information_destroy (fip, &free_fi_row_reference, NULL);
1313 gtk_tree_store_remove (GTK_TREE_STORE (tm), &iter); 1348 gtk_tree_store_remove (GTK_TREE_STORE (tm), &iter);
1314 update_selectivity (); 1349 update_selectivity (data);
1315} 1350}
1316 1351
1317
1318void 1352void
1319GNUNET_GTK_master_publish_dialog_open_button_clicked_cb (GtkWidget * dummy, 1353GNUNET_GTK_publish_directory_dialog_response_cb (GtkDialog *dialog,
1320 gpointer data) 1354 gint response_id, gpointer user_data)
1321{ 1355{
1322 GtkWidget *ad;
1323 GtkBuilder *builder;
1324 char *filename; 1356 char *filename;
1325 int do_index; 1357 int do_index;
1326 GtkSpinButton *sb; 1358 GtkSpinButton *sb;
1327 struct GNUNET_FS_BlockOptions bo; 1359 struct GNUNET_FS_BlockOptions bo;
1360 GtkWidget *ad;
1361 GtkBuilder *builder;
1362
1363 builder = GTK_BUILDER (user_data);
1328 1364
1329 builder = 1365 ad = GTK_WIDGET (gtk_builder_get_object (builder,
1330 GNUNET_GTK_get_new_builder 1366 "GNUNET_GTK_publish_directory_dialog"));
1331 ("gnunet_fs_gtk_publish_directory_dialog.glade"); 1367
1332 if (builder == NULL) 1368 if (response_id == -5)
1333 { 1369 {
1334 GNUNET_break (0); 1370 filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (ad));
1335 return; 1371 sb = GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
1372 "GNUNET_GTK_publish_directory_dialog_expiration_year_spin_button"));
1373 if (!GNUNET_GTK_get_selected_anonymity_level (builder,
1374 "GNUNET_GTK_publish_directory_dialog_anonymity_combobox",
1375 &bo.anonymity_level))
1376 bo.anonymity_level = 1;
1377 bo.content_priority = gtk_spin_button_get_value (GTK_SPIN_BUTTON (
1378 gtk_builder_get_object (builder,
1379 "GNUNET_GTK_publish_directory_dialog_priority_spin_button")));
1380 bo.expiration_time = GNUNET_FS_GTK_get_expiration_time (sb);
1381 do_index = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
1382 gtk_builder_get_object (builder,
1383 "GNUNET_GTK_publish_directory_dialog_do_index_checkbutton")));
1384
1385 /* FIXME: open progress dialog here... */
1386 add_dir (user_data, filename, &bo, do_index);
1387 g_free (filename);
1388 update_selectivity (user_data);
1336 } 1389 }
1390 gtk_widget_hide (ad);
1391}
1392
1393
1394void
1395GNUNET_GTK_master_publish_dialog_open_button_clicked_cb (GtkWidget * dummy,
1396 gpointer data)
1397{
1398 GtkWidget *ad;
1399 GtkBuilder *builder;
1400 GtkWindow *master_pubdialog;
1401
1402 builder = GTK_BUILDER (data);
1337 GNUNET_FS_GTK_setup_expiration_year_adjustment (builder); 1403 GNUNET_FS_GTK_setup_expiration_year_adjustment (builder);
1338 ad = GTK_WIDGET (gtk_builder_get_object 1404 ad = GTK_WIDGET (gtk_builder_get_object
1339 (builder, "GNUNET_GTK_publish_directory_dialog")); 1405 (builder, "GNUNET_GTK_publish_directory_dialog"));
1340 if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad))) 1406
1341 { 1407 master_pubdialog = GTK_WINDOW (gtk_builder_get_object (builder,
1342 gtk_widget_destroy (ad); 1408 "GNUNET_GTK_master_publish_dialog"));
1343 g_object_unref (G_OBJECT (builder)); 1409 gtk_window_set_transient_for (GTK_WINDOW (ad), master_pubdialog);
1344 return; 1410
1345 } 1411 gtk_window_present (GTK_WINDOW (ad));
1346 filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (ad));
1347 sb = GTK_SPIN_BUTTON (gtk_builder_get_object
1348 (builder,
1349 "GNUNET_GTK_publish_directory_dialog_expiration_year_spin_button"));
1350 bo.anonymity_level =
1351 gtk_spin_button_get_value (GTK_SPIN_BUTTON
1352 (gtk_builder_get_object
1353 (builder,
1354 "GNUNET_GTK_publish_directory_dialog_anonymity_spin_button")));
1355 bo.content_priority =
1356 gtk_spin_button_get_value (GTK_SPIN_BUTTON
1357 (gtk_builder_get_object
1358 (builder,
1359 "GNUNET_GTK_publish_directory_dialog_priority_spin_button")));
1360 bo.expiration_time = GNUNET_FS_GTK_get_expiration_time (sb);
1361 do_index =
1362 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
1363 (gtk_builder_get_object
1364 (builder,
1365 "GNUNET_GTK_publish_directory_dialog_do_index_checkbutton")));
1366
1367 gtk_widget_destroy (ad);
1368 g_object_unref (G_OBJECT (builder));
1369 /* FIXME: open progress dialog here... */
1370 add_dir (filename, &bo, do_index);
1371 g_free (filename);
1372 update_selectivity ();
1373} 1412}
1374 1413
1375 1414
@@ -1598,52 +1637,58 @@ free_file_information_tree_store (GtkTreeModel * tm, GtkTreeIter * iter)
1598 } 1637 }
1599} 1638}
1600 1639
1601
1602/**
1603 */
1604void 1640void
1605GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, gpointer data) 1641GNUNET_GTK_master_publish_dialog_realize_cb (GtkWidget *widget,
1642 gpointer user_data)
1606{ 1643{
1607 GtkWidget *ad;
1608 GtkTreeStore *ts;
1609 gint ret;
1610 GtkTreeView *tv; 1644 GtkTreeView *tv;
1611 GtkTreeSelection *sel; 1645 GtkTreeSelection *sel;
1612 GtkTreeIter iter; 1646 GtkBuilder *builder;
1613 struct GNUNET_FS_FileInformation *fi; 1647
1614 GtkTreeModel *tm; 1648 builder = GTK_BUILDER (user_data);
1615 GtkTreeModel *ptm;
1616 struct GNUNET_FS_Namespace *namespace;
1617 gchar *namespace_id;
1618 gchar *namespace_uid;
1619 1649
1620 GNUNET_assert (master_builder == NULL);
1621 master_builder =
1622 GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_publish_dialog.glade");
1623 if (master_builder == NULL)
1624 return;
1625 tv = GTK_TREE_VIEW (gtk_builder_get_object 1650 tv = GTK_TREE_VIEW (gtk_builder_get_object
1626 (master_builder, 1651 (builder,
1627 "GNUNET_GTK_master_publish_dialog_file_information_tree_view")); 1652 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
1628 sel = gtk_tree_view_get_selection (tv); 1653 sel = gtk_tree_view_get_selection (tv);
1629 g_signal_connect (G_OBJECT (sel), "changed", 1654 g_signal_connect (G_OBJECT (sel), "changed",
1630 G_CALLBACK (selection_changed_cb), NULL); 1655 G_CALLBACK (selection_changed_cb), user_data);
1631 ad = GTK_WIDGET (gtk_builder_get_object
1632 (master_builder, "GNUNET_GTK_master_publish_dialog"));
1633 ts = GTK_TREE_STORE (gtk_builder_get_object
1634 (master_builder, "GNUNET_GTK_pseudonym_tree_store"));
1635 GNUNET_FS_namespace_list (GNUNET_FS_GTK_get_fs_handle (),
1636 &add_namespace_to_ts, ts);
1637 tm = GTK_TREE_MODEL (gtk_builder_get_object
1638 (master_builder,
1639 "GNUNET_GTK_file_sharing_publishing_tree_store"));
1640 tv = GTK_TREE_VIEW (gtk_builder_get_object 1656 tv = GTK_TREE_VIEW (gtk_builder_get_object
1641 (master_builder, 1657 (builder,
1642 "GNUNET_GTK_master_publish_dialog_pseudonym_tree_view")); 1658 "GNUNET_GTK_master_publish_dialog_pseudonym_tree_view"));
1643 sel = gtk_tree_view_get_selection (tv); 1659 sel = gtk_tree_view_get_selection (tv);
1644 g_signal_connect (G_OBJECT (sel), "changed", 1660 g_signal_connect (G_OBJECT (sel), "changed",
1645 G_CALLBACK (selection_changed_cb), NULL); 1661 G_CALLBACK (selection_changed_cb), user_data);
1646 ret = gtk_dialog_run (GTK_DIALOG (ad)); 1662}
1663
1664void
1665hide_master_publish_dialog (gpointer user_data, gint ret)
1666{
1667 GtkTreeView *tv, *ptv;
1668 GtkTreeSelection *sel;
1669 GtkTreeModel *tm, *ptm;
1670 GtkTreeIter iter;
1671 gpointer namespace;
1672 gchar *namespace_id;
1673 gchar *namespace_uid;
1674 struct GNUNET_FS_FileInformation *fi;
1675 GtkWidget *ad;
1676 GtkBuilder *builder = GTK_BUILDER (user_data);
1677
1678 ad = GTK_WIDGET (gtk_builder_get_object
1679 (builder, "GNUNET_GTK_master_publish_dialog"));
1680
1681 ptv = GTK_TREE_VIEW (gtk_builder_get_object
1682 (builder,
1683 "GNUNET_GTK_master_publish_dialog_pseudonym_tree_view"));
1684 sel = gtk_tree_view_get_selection (ptv);
1685 ptm = gtk_tree_view_get_model (ptv);
1686
1687 tv = GTK_TREE_VIEW (gtk_builder_get_object
1688 (builder,
1689 "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
1690 tm = gtk_tree_view_get_model (tv);
1691
1647 if (ret == GTK_RESPONSE_OK) 1692 if (ret == GTK_RESPONSE_OK)
1648 { 1693 {
1649 if (TRUE == gtk_tree_selection_get_selected (sel, &ptm, &iter)) 1694 if (TRUE == gtk_tree_selection_get_selected (sel, &ptm, &iter))
@@ -1666,14 +1711,10 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, gpointer data)
1666 GNUNET_FS_PUBLISH_OPTION_NONE); 1711 GNUNET_FS_PUBLISH_OPTION_NONE);
1667 } 1712 }
1668 while (gtk_tree_model_iter_next (tm, &iter)); 1713 while (gtk_tree_model_iter_next (tm, &iter));
1669 if (namespace_id != NULL) 1714 g_free (namespace_id);
1670 g_free (namespace_id); 1715 g_free (namespace_uid);
1671 if (namespace_uid != NULL)
1672 g_free (namespace_uid);
1673 } 1716 }
1674 ptm = 1717
1675 GTK_TREE_MODEL (gtk_builder_get_object
1676 (master_builder, "GNUNET_GTK_pseudonym_tree_store"));
1677 /* free state from 'ptm' */ 1718 /* free state from 'ptm' */
1678 if (TRUE == gtk_tree_model_get_iter_first (ptm, &iter)) 1719 if (TRUE == gtk_tree_model_get_iter_first (ptm, &iter))
1679 do 1720 do
@@ -1681,6 +1722,7 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, gpointer data)
1681 free_pseudonym_tree_store (ptm, &iter); 1722 free_pseudonym_tree_store (ptm, &iter);
1682 } 1723 }
1683 while (TRUE == gtk_tree_model_iter_next (ptm, &iter)); 1724 while (TRUE == gtk_tree_model_iter_next (ptm, &iter));
1725 gtk_tree_store_clear (GTK_TREE_STORE (ptm));
1684 1726
1685 /* free state from 'tm' */ 1727 /* free state from 'tm' */
1686 if (TRUE == gtk_tree_model_get_iter_first (tm, &iter)) 1728 if (TRUE == gtk_tree_model_get_iter_first (tm, &iter))
@@ -1689,10 +1731,100 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, gpointer data)
1689 free_file_information_tree_store (tm, &iter); 1731 free_file_information_tree_store (tm, &iter);
1690 } 1732 }
1691 while (TRUE == gtk_tree_model_iter_next (tm, &iter)); 1733 while (TRUE == gtk_tree_model_iter_next (tm, &iter));
1734 gtk_tree_store_clear (GTK_TREE_STORE (tm));
1735
1736 gtk_widget_hide (ad);
1737}
1738
1739void
1740GNUNET_GTK_master_publish_dialog_execute_button_clicked_cb (GtkButton *button,
1741 gpointer user_data)
1742{
1743 hide_master_publish_dialog (user_data, GTK_RESPONSE_OK);
1744}
1745
1746void
1747GNUNET_GTK_master_publish_dialog_cancel_button_clicked_cb (GtkButton *button,
1748 gpointer user_data)
1749{
1750 hide_master_publish_dialog (user_data, GTK_RESPONSE_CANCEL);
1751}
1752
1753gboolean
1754GNUNET_GTK_master_publish_dialog_delete_event_cb (GtkWidget *widget,
1755 GdkEvent *event, gpointer user_data)
1756{
1757 hide_master_publish_dialog (user_data, GTK_RESPONSE_CANCEL);
1758 return TRUE;
1759}
1760
1761void
1762GNUNET_GTK_publish_file_dialog_response_cb (GtkDialog *dialog,
1763 gint response_id, gpointer user_data)
1764{
1765 char *filename;
1766 struct GNUNET_FS_BlockOptions bo;
1767 int do_index;
1768 GtkSpinButton *sb;
1769 GtkWidget *ad;
1770
1771 GtkBuilder *builder = GTK_BUILDER (user_data);
1772
1773 ad = GTK_WIDGET (gtk_builder_get_object (builder,
1774 "GNUNET_GTK_publish_file_dialog"));
1775
1776 if (response_id == -5)
1777 {
1778 /* OK */
1779 filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (ad));
1780 sb = GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
1781 "GNUNET_GTK_publish_file_dialog_expiration_year_spin_button"));
1782
1783 if (!GNUNET_GTK_get_selected_anonymity_level (builder,
1784 "GNUNET_GTK_publish_file_dialog_anonymity_combobox", &bo.anonymity_level))
1785 bo.anonymity_level = 1;
1786 bo.content_priority = gtk_spin_button_get_value (GTK_SPIN_BUTTON (
1787 gtk_builder_get_object (builder,
1788 "GNUNET_GTK_publish_file_dialog_priority_spin_button")));
1789 bo.expiration_time = GNUNET_FS_GTK_get_expiration_time (sb);
1790 bo.replication_level = 1; /* FIXME... */
1791 do_index = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
1792 gtk_builder_get_object (builder,
1793 "GNUNET_GTK_publish_file_dialog_do_index_checkbutton")));
1794 add_file_at_iter (user_data, filename, &bo, do_index, NULL);
1795 g_free (filename);
1796 update_selectivity (user_data);
1797 }
1798 else
1799 {
1800 /* Cancel/Escape/close/etc */
1801 }
1802 gtk_widget_hide (ad);
1803}
1804
1805/**
1806 */
1807void
1808GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, gpointer data)
1809{
1810 GtkWidget *ad;
1811 GtkTreeStore *ts;
1812 GtkBuilder *builder;
1813
1814 builder = GTK_BUILDER (data);
1815
1816 ad = GTK_WIDGET (gtk_builder_get_object
1817 (builder, "GNUNET_GTK_master_publish_dialog"));
1818
1819 if (!gtk_widget_get_visible (ad))
1820 {
1821 ts = GTK_TREE_STORE (gtk_builder_get_object (builder,
1822 "GNUNET_GTK_pseudonym_tree_store"));
1823 GNUNET_FS_namespace_list (GNUNET_FS_GTK_get_fs_handle (),
1824 &add_namespace_to_ts, ts);
1825 }
1692 1826
1693 gtk_widget_destroy (ad); 1827 gtk_window_present (GTK_WINDOW (ad));
1694 g_object_unref (G_OBJECT (master_builder));
1695 master_builder = NULL;
1696} 1828}
1697 1829
1698 1830
diff --git a/src/fs/gnunet-fs-gtk-main_window_open_directory.c b/src/fs/gnunet-fs-gtk-main_window_open_directory.c
index ae3b7d0b..23e71fc6 100644
--- a/src/fs/gnunet-fs-gtk-main_window_open_directory.c
+++ b/src/fs/gnunet-fs-gtk-main_window_open_directory.c
@@ -85,6 +85,34 @@ add_child (void *cls, const char *filename, const struct GNUNET_FS_Uri *uri,
85 meta, NULL, 0)); 85 meta, NULL, 0));
86} 86}
87 87
88void
89GNUNET_GTK_open_directory_dialog_response_cb (GtkDialog *dialog,
90 gint response_id, gpointer user_data)
91{
92 GtkBuilder *builder;
93 GtkWidget *ad;
94 char *filename;
95 struct AddChildContext acc;
96
97 builder = GTK_BUILDER (user_data);
98 ad = GTK_WIDGET (gtk_builder_get_object
99 (builder, "GNUNET_GTK_open_directory_dialog"));
100
101 if (response_id != -5)
102 {
103 gtk_widget_destroy (ad);
104 g_object_unref (G_OBJECT (builder));
105 return;
106 }
107
108 filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (ad));
109 gtk_widget_destroy (ad);
110 g_object_unref (G_OBJECT (builder));
111 acc.filename = filename;
112 acc.ts = NULL;
113 GNUNET_FS_GTK_mmap_and_scan (filename, &add_child, &acc);
114 g_free (filename);
115}
88 116
89/** 117/**
90 * User selected "Open directory" in menu. Display dialog, open 118 * User selected "Open directory" in menu. Display dialog, open
@@ -94,12 +122,12 @@ void
94GNUNET_GTK_main_menu_file_open_gnunet_directory_activate_cb (GtkWidget * dummy, 122GNUNET_GTK_main_menu_file_open_gnunet_directory_activate_cb (GtkWidget * dummy,
95 gpointer data) 123 gpointer data)
96{ 124{
97 struct AddChildContext acc;
98 GtkWidget *ad; 125 GtkWidget *ad;
99 GtkBuilder *builder; 126 GtkBuilder *builder;
100 char *filename; 127 GtkWidget *toplevel;
101 GtkFileFilter *ff; 128 GtkFileFilter *ff;
102 129
130
103 builder = 131 builder =
104 GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_open_directory_dialog.glade"); 132 GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_open_directory_dialog.glade");
105 if (builder == NULL) 133 if (builder == NULL)
@@ -113,19 +141,11 @@ GNUNET_GTK_main_menu_file_open_gnunet_directory_activate_cb (GtkWidget * dummy,
113 (builder, "gnunet_directory_filter")); 141 (builder, "gnunet_directory_filter"));
114 /* FIXME: some day, write a custom file filter for gnunet-directories... */ 142 /* FIXME: some day, write a custom file filter for gnunet-directories... */
115 gtk_file_filter_add_pattern (ff, "*" GNUNET_FS_DIRECTORY_EXT); 143 gtk_file_filter_add_pattern (ff, "*" GNUNET_FS_DIRECTORY_EXT);
116 if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad))) 144
117 { 145 toplevel = gtk_widget_get_toplevel (dummy);
118 gtk_widget_destroy (ad); 146 if (GTK_IS_WINDOW (toplevel))
119 g_object_unref (G_OBJECT (builder)); 147 gtk_window_set_transient_for (GTK_WINDOW (ad), GTK_WINDOW (toplevel));
120 return; 148 gtk_window_present (GTK_WINDOW (ad));
121 }
122 filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (ad));
123 gtk_widget_destroy (ad);
124 g_object_unref (G_OBJECT (builder));
125 acc.filename = filename;
126 acc.ts = NULL;
127 GNUNET_FS_GTK_mmap_and_scan (filename, &add_child, &acc);
128 g_free (filename);
129} 149}
130 150
131/* end of gnunet-fs-gtk-main_window_open_directory.c */ 151/* end of gnunet-fs-gtk-main_window_open_directory.c */
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index 2e0f2999..3c485126 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -247,7 +247,7 @@ GNUNET_GTK_get_selected_anonymity_level (GtkBuilder *builder, gchar *combo_name,
247 GtkTreeModel *model; 247 GtkTreeModel *model;
248 guint level; 248 guint level;
249 249
250 combo = GTK_COMBO_BOX(gtk_builder_get_object (builder, combo_name)); 250 combo = GTK_COMBO_BOX (gtk_builder_get_object (builder, combo_name));
251 if (!combo) 251 if (!combo)
252 return FALSE; 252 return FALSE;
253 253
@@ -265,6 +265,38 @@ GNUNET_GTK_get_selected_anonymity_level (GtkBuilder *builder, gchar *combo_name,
265} 265}
266 266
267gboolean 267gboolean
268GNUNET_GTK_select_anonymity_level (GtkBuilder *builder, gchar *combo_name, guint sel_level)
269{
270 GtkComboBox *combo;
271 GtkTreeIter iter;
272 GtkTreeModel *model;
273 guint level;
274 gboolean go_on;
275
276 combo = GTK_COMBO_BOX (gtk_builder_get_object (builder, combo_name));
277 if (!combo)
278 return FALSE;
279
280 model = gtk_combo_box_get_model (combo);
281 if (!model)
282 return FALSE;
283
284 for (go_on = gtk_tree_model_get_iter_first (model, &iter);
285 go_on;
286 go_on = gtk_tree_model_iter_next (model, &iter))
287 {
288 gboolean is_it = FALSE;
289 gtk_tree_model_get (model, &iter, 1, &level, -1);
290 if (level == sel_level)
291 {
292 gtk_combo_box_set_active_iter (combo, &iter);
293 return TRUE;
294 }
295 }
296 return FALSE;
297}
298
299gboolean
268get_selected_namespace_treepath_iter_model_widget (GtkBuilder *builder, 300get_selected_namespace_treepath_iter_model_widget (GtkBuilder *builder,
269 GtkTreePath **p_treepath, GtkTreeIter *p_iter, GtkTreeModel **p_model, 301 GtkTreePath **p_treepath, GtkTreeIter *p_iter, GtkTreeModel **p_model,
270 GtkWidget **p_widget) 302 GtkWidget **p_widget)
diff --git a/src/fs/gnunet-fs-gtk.h b/src/fs/gnunet-fs-gtk.h
index 4cd76de6..114be040 100644
--- a/src/fs/gnunet-fs-gtk.h
+++ b/src/fs/gnunet-fs-gtk.h
@@ -76,5 +76,18 @@ GNUNET_GTK_get_selected_anonymity_level (GtkBuilder *builder,
76 gchar *combo_name, guint *p_level); 76 gchar *combo_name, guint *p_level);
77 77
78 78
79/**
80 * Set the selected anonymity level.
81 * For dialogue initialization.
82 *
83 * @param builder builder object for the window
84 * @param combo_name name of the combobox widget to get anonymity from
85 * @param sel_level the level value to select
86 * @return TRUE on success, FALSE on error (no item with such level)
87 */
88gboolean
89GNUNET_GTK_select_anonymity_level (GtkBuilder *builder,
90 gchar *combo_name, guint sel_level);
91
79#endif 92#endif
80/* end of gnunet-fs-gtk.h */ 93/* end of gnunet-fs-gtk.h */