aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2013-03-03 01:58:05 +0000
committerLRN <lrn1986@gmail.com>2013-03-03 01:58:05 +0000
commitf4c67987e48202648c7621dd8c9057bd8174d0d5 (patch)
tree11336eff3aa38971e2342f2e876477dd5fd69486
parentcb415c04aac4a8ba95bc40475708ad4b2869a3c8 (diff)
downloadgnunet-gtk-f4c67987e48202648c7621dd8c9057bd8174d0d5.tar.gz
gnunet-gtk-f4c67987e48202648c7621dd8c9057bd8174d0d5.zip
Massive namespace UI update
New Namespace Organizer dialog (replaces the "Create namespace" dialog, also allows namespace deletion and renaming). Allows user to select which namespace to use for publications. Main Window menu was changed appropriately. Glade-3.8 removed use_action_appearance=False eveywhere. Glade-3.8 removed all treeview selection objects. Publication master dialog now uses selected default namespace (if any) only. Added frames to Pubdialog VPaned to make it more obvious, as per GTK docs. Replaced pseudonym-selection treeview with an identifier-selection treeview. Reworked the look of identifiers graph. IDs in italics point at looping points. IDs in bold are graph endpoints (recommended IDs). More precise loop detection (more data is hashed). Removed the hashmap-related fixme. Hash collisions will add some duplicate nodes into the tree. Acceptable. Fixed names of some auxiliary objects (size groups, images). Removed adjustments (use the defaults). Moved some code into GNUNET_FS_GTK_advertise_namespace() function, made it shared. Fixed a bug in main window namespace selector ("selected-row-reference" does not exist anymore). Fixed a bug in OpenURI dialog (correct anonymity widget name). TODO: insert NS advertisements into KBlocks when both global and private namespace publication is enabled.
-rw-r--r--contrib/Makefile.am1
-rw-r--r--contrib/gnunet_fs_gtk_main_window.glade72
-rw-r--r--contrib/gnunet_fs_gtk_namespace_organizer.glade276
-rw-r--r--contrib/gnunet_fs_gtk_publish_dialog.glade861
-rw-r--r--src/fs/Makefile.am7
-rw-r--r--src/fs/gnunet-fs-gtk.h3
-rw-r--r--src/fs/gnunet-fs-gtk_advertise-pseudonym.c25
-rw-r--r--src/fs/gnunet-fs-gtk_advertise-pseudonym.h45
-rw-r--r--src/fs/gnunet-fs-gtk_download-save-as.c2
-rw-r--r--src/fs/gnunet-fs-gtk_main-window-search.c2
-rw-r--r--src/fs/gnunet-fs-gtk_namespace_manager.h36
-rw-r--r--src/fs/gnunet-fs-gtk_namespace_organizer.c744
-rw-r--r--src/fs/gnunet-fs-gtk_namespace_organizer.h36
-rw-r--r--src/fs/gnunet-fs-gtk_open-uri.c2
-rw-r--r--src/fs/gnunet-fs-gtk_publish-dialog.c753
15 files changed, 2233 insertions, 632 deletions
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index a2850246..82907723 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -32,6 +32,7 @@ pkgdata_DATA = \
32 gnunet_fs_gtk_download_as_dialog.glade \ 32 gnunet_fs_gtk_download_as_dialog.glade \
33 gnunet_fs_gtk_main_window.glade \ 33 gnunet_fs_gtk_main_window.glade \
34 gnunet_fs_gtk_namespace_manager.glade \ 34 gnunet_fs_gtk_namespace_manager.glade \
35 gnunet_fs_gtk_namespace_organizer.glade \
35 gnunet_fs_gtk_edit_publication.glade \ 36 gnunet_fs_gtk_edit_publication.glade \
36 gnunet_fs_gtk_open_directory_dialog.glade \ 37 gnunet_fs_gtk_open_directory_dialog.glade \
37 gnunet_fs_gtk_open_url_dialog.glade \ 38 gnunet_fs_gtk_open_url_dialog.glade \
diff --git a/contrib/gnunet_fs_gtk_main_window.glade b/contrib/gnunet_fs_gtk_main_window.glade
index 6fc375cd..b475968c 100644
--- a/contrib/gnunet_fs_gtk_main_window.glade
+++ b/contrib/gnunet_fs_gtk_main_window.glade
@@ -144,6 +144,11 @@
144 <property name="can_focus">False</property> 144 <property name="can_focus">False</property>
145 <property name="stock">gtk-find</property> 145 <property name="stock">gtk-find</property>
146 </object> 146 </object>
147 <object class="GtkImage" id="find_and_replace_stock_image">
148 <property name="visible">True</property>
149 <property name="can_focus">False</property>
150 <property name="stock">gtk-find-and-replace</property>
151 </object>
147 <object class="GtkImage" id="index_stock_image"> 152 <object class="GtkImage" id="index_stock_image">
148 <property name="visible">True</property> 153 <property name="visible">True</property>
149 <property name="can_focus">False</property> 154 <property name="can_focus">False</property>
@@ -227,7 +232,6 @@
227 <property name="can_focus">False</property> 232 <property name="can_focus">False</property>
228 <child> 233 <child>
229 <object class="GtkMenuItem" id="GNUNET_GTK_main_menu_file_sharing"> 234 <object class="GtkMenuItem" id="GNUNET_GTK_main_menu_file_sharing">
230 <property name="use_action_appearance">False</property>
231 <property name="visible">True</property> 235 <property name="visible">True</property>
232 <property name="can_focus">False</property> 236 <property name="can_focus">False</property>
233 <property name="label" translatable="yes">_File sharing</property> 237 <property name="label" translatable="yes">_File sharing</property>
@@ -238,7 +242,6 @@
238 <child> 242 <child>
239 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_publish"> 243 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_publish">
240 <property name="label" translatable="yes">_Publish</property> 244 <property name="label" translatable="yes">_Publish</property>
241 <property name="use_action_appearance">False</property>
242 <property name="visible">True</property> 245 <property name="visible">True</property>
243 <property name="can_focus">False</property> 246 <property name="can_focus">False</property>
244 <property name="tooltip_text" translatable="yes">Publish files or directories on GNUnet</property> 247 <property name="tooltip_text" translatable="yes">Publish files or directories on GNUnet</property>
@@ -252,7 +255,6 @@
252 </child> 255 </child>
253 <child> 256 <child>
254 <object class="GtkMenuItem" id="GNUNET_GTK_main_menu_unindex"> 257 <object class="GtkMenuItem" id="GNUNET_GTK_main_menu_unindex">
255 <property name="use_action_appearance">False</property>
256 <property name="visible">True</property> 258 <property name="visible">True</property>
257 <property name="can_focus">False</property> 259 <property name="can_focus">False</property>
258 <property name="label" translatable="yes">_List indexed files</property> 260 <property name="label" translatable="yes">_List indexed files</property>
@@ -269,7 +271,6 @@
269 <child> 271 <child>
270 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_download_uri"> 272 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_download_uri">
271 <property name="label" translatable="yes">_Download</property> 273 <property name="label" translatable="yes">_Download</property>
272 <property name="use_action_appearance">False</property>
273 <property name="visible">True</property> 274 <property name="visible">True</property>
274 <property name="can_focus">False</property> 275 <property name="can_focus">False</property>
275 <property name="tooltip_text" translatable="yes">Download a file or directory with a known URI.</property> 276 <property name="tooltip_text" translatable="yes">Download a file or directory with a known URI.</property>
@@ -284,7 +285,6 @@
284 <child> 285 <child>
285 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_open_gnunet_directory"> 286 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_open_gnunet_directory">
286 <property name="label" translatable="yes">_Open GNUnet directory</property> 287 <property name="label" translatable="yes">_Open GNUnet directory</property>
287 <property name="use_action_appearance">False</property>
288 <property name="visible">True</property> 288 <property name="visible">True</property>
289 <property name="can_focus">False</property> 289 <property name="can_focus">False</property>
290 <property name="tooltip_text" translatable="yes">Use this option to browse a GNUnet directory file that has been previously downloaded.</property> 290 <property name="tooltip_text" translatable="yes">Use this option to browse a GNUnet directory file that has been previously downloaded.</property>
@@ -303,41 +303,27 @@
303 </object> 303 </object>
304 </child> 304 </child>
305 <child> 305 <child>
306 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_create_pseudonym"> 306 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_manage_pseudonyms">
307 <property name="label" translatable="yes">_Create pseudonym</property> 307 <property name="label" translatable="yes">_Manage namespaces</property>
308 <property name="use_action_appearance">False</property>
309 <property name="visible">True</property> 308 <property name="visible">True</property>
310 <property name="can_focus">False</property> 309 <property name="can_focus">False</property>
311 <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> 310 <property name="tooltip_text" translatable="yes">Opens namespace manager dialog to adjust the list of namespaces you want to search in, as well as get detailed information about all discovered namespaces.</property>
312 <property name="accel_path">&lt;gnunet-fs-gtk&gt;/File sharing/Create pseudonym</property>
313 <property name="use_underline">True</property> 311 <property name="use_underline">True</property>
314 <property name="image">new_stock_image</property> 312 <property name="image">find_and_replace_stock_image</property>
315 <property name="use_stock">False</property> 313 <property name="use_stock">False</property>
316 <accelerator key="n" signal="activate" modifiers="GDK_CONTROL_MASK"/> 314 <signal name="activate" handler="GNUNET_GTK_main_menu_file_manage_pseudonyms_activate_cb" swapped="no"/>
317 <signal name="activate" handler="GNUNET_GTK_main_menu_create_pseudonym_activate_cb" swapped="no"/>
318 </object> 315 </object>
319 </child> 316 </child>
320 <child> 317 <child>
321 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_advertise_pseudonym"> 318 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_organize_namespaces">
322 <property name="label" translatable="yes">_Advertise Pseudonym</property> 319 <property name="label" translatable="yes">Organize _your own namespaces</property>
323 <property name="use_action_appearance">False</property>
324 <property name="visible">True</property> 320 <property name="visible">True</property>
325 <property name="can_focus">False</property> 321 <property name="can_focus">False</property>
322 <property name="tooltip_text" translatable="yes">Opens namespace organizer dialog to adjust the list of your own namespaces and select the one that you will publish in.</property>
326 <property name="use_underline">True</property> 323 <property name="use_underline">True</property>
327 <property name="image">index_stock_image</property> 324 <property name="image">index_stock_image</property>
328 <property name="use_stock">False</property> 325 <property name="use_stock">False</property>
329 <signal name="activate" handler="GNUNET_GTK_main_menu_file_advertise_pseudonym_activate_cb" swapped="no"/> 326 <signal name="activate" handler="GNUNET_GTK_main_menu_file_organize_namespaces_activate_cb" swapped="no"/>
330 </object>
331 </child>
332 <child>
333 <object class="GtkMenuItem" id="GNUNET_GTK_main_menu_file_manage_pseudonyms">
334 <property name="use_action_appearance">False</property>
335 <property name="visible">True</property>
336 <property name="can_focus">False</property>
337 <property name="tooltip_text" translatable="yes">Opens namespace manager dialog to adjust the list of namespaces you want to use, as well as get detailed information about all discovered namespaces.</property>
338 <property name="label" translatable="yes">_Manage namespaces</property>
339 <property name="use_underline">True</property>
340 <signal name="activate" handler="GNUNET_GTK_main_menu_file_manage_pseudonyms_activate_cb" swapped="no"/>
341 </object> 327 </object>
342 </child> 328 </child>
343 <child> 329 <child>
@@ -349,7 +335,6 @@
349 <child> 335 <child>
350 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_quit"> 336 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_quit">
351 <property name="label">gtk-quit</property> 337 <property name="label">gtk-quit</property>
352 <property name="use_action_appearance">False</property>
353 <property name="visible">True</property> 338 <property name="visible">True</property>
354 <property name="can_focus">False</property> 339 <property name="can_focus">False</property>
355 <property name="tooltip_text" translatable="yes">Exit gnunet-fs-gtk. Active file-sharing operations will resume upon restart.</property> 340 <property name="tooltip_text" translatable="yes">Exit gnunet-fs-gtk. Active file-sharing operations will resume upon restart.</property>
@@ -366,7 +351,6 @@
366 </child> 351 </child>
367 <child> 352 <child>
368 <object class="GtkMenuItem" id="GNUNET_GTK_main_menu_edit"> 353 <object class="GtkMenuItem" id="GNUNET_GTK_main_menu_edit">
369 <property name="use_action_appearance">False</property>
370 <property name="can_focus">False</property> 354 <property name="can_focus">False</property>
371 <property name="label" translatable="yes">_Edit</property> 355 <property name="label" translatable="yes">_Edit</property>
372 <property name="use_underline">True</property> 356 <property name="use_underline">True</property>
@@ -377,7 +361,6 @@
377 <child> 361 <child>
378 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_edit_preferences"> 362 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_edit_preferences">
379 <property name="label">gtk-preferences</property> 363 <property name="label">gtk-preferences</property>
380 <property name="use_action_appearance">False</property>
381 <property name="visible">True</property> 364 <property name="visible">True</property>
382 <property name="can_focus">False</property> 365 <property name="can_focus">False</property>
383 <property name="tooltip_text" translatable="yes">Edit the system configuration.</property> 366 <property name="tooltip_text" translatable="yes">Edit the system configuration.</property>
@@ -392,7 +375,6 @@
392 </child> 375 </child>
393 <child> 376 <child>
394 <object class="GtkMenuItem" id="GNUNET_GTK_main_menu_view"> 377 <object class="GtkMenuItem" id="GNUNET_GTK_main_menu_view">
395 <property name="use_action_appearance">False</property>
396 <property name="visible">True</property> 378 <property name="visible">True</property>
397 <property name="can_focus">False</property> 379 <property name="can_focus">False</property>
398 <property name="label" translatable="yes">_View</property> 380 <property name="label" translatable="yes">_View</property>
@@ -403,7 +385,6 @@
403 <property name="can_focus">False</property> 385 <property name="can_focus">False</property>
404 <child> 386 <child>
405 <object class="GtkCheckMenuItem" id="GNUNET_GTK_main_menu_view_metadata"> 387 <object class="GtkCheckMenuItem" id="GNUNET_GTK_main_menu_view_metadata">
406 <property name="use_action_appearance">False</property>
407 <property name="visible">True</property> 388 <property name="visible">True</property>
408 <property name="can_focus">False</property> 389 <property name="can_focus">False</property>
409 <property name="tooltip_text" translatable="yes">Show meta data in main window</property> 390 <property name="tooltip_text" translatable="yes">Show meta data in main window</property>
@@ -415,7 +396,6 @@
415 </child> 396 </child>
416 <child> 397 <child>
417 <object class="GtkCheckMenuItem" id="GNUNET_GTK_main_menu_view_preview"> 398 <object class="GtkCheckMenuItem" id="GNUNET_GTK_main_menu_view_preview">
418 <property name="use_action_appearance">False</property>
419 <property name="visible">True</property> 399 <property name="visible">True</property>
420 <property name="can_focus">False</property> 400 <property name="can_focus">False</property>
421 <property name="tooltip_text" translatable="yes">Show preview (when available)</property> 401 <property name="tooltip_text" translatable="yes">Show preview (when available)</property>
@@ -427,7 +407,6 @@
427 </child> 407 </child>
428 <child> 408 <child>
429 <object class="GtkCheckMenuItem" id="GNUNET_GTK_main_menu_search_preview"> 409 <object class="GtkCheckMenuItem" id="GNUNET_GTK_main_menu_search_preview">
430 <property name="use_action_appearance">False</property>
431 <property name="visible">True</property> 410 <property name="visible">True</property>
432 <property name="can_focus">False</property> 411 <property name="can_focus">False</property>
433 <property name="tooltip_text" translatable="yes">Show search box in main window</property> 412 <property name="tooltip_text" translatable="yes">Show search box in main window</property>
@@ -443,7 +422,6 @@
443 </child> 422 </child>
444 <child> 423 <child>
445 <object class="GtkMenuItem" id="GNUNET_GTK_main_menu_help"> 424 <object class="GtkMenuItem" id="GNUNET_GTK_main_menu_help">
446 <property name="use_action_appearance">False</property>
447 <property name="visible">True</property> 425 <property name="visible">True</property>
448 <property name="can_focus">False</property> 426 <property name="can_focus">False</property>
449 <property name="label" translatable="yes">_Help</property> 427 <property name="label" translatable="yes">_Help</property>
@@ -455,7 +433,6 @@
455 <child> 433 <child>
456 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_help_about"> 434 <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_help_about">
457 <property name="label">gtk-about</property> 435 <property name="label">gtk-about</property>
458 <property name="use_action_appearance">False</property>
459 <property name="visible">True</property> 436 <property name="visible">True</property>
460 <property name="can_focus">False</property> 437 <property name="can_focus">False</property>
461 <property name="tooltip_text" translatable="yes">Display information about this version of gnunet-fs-gtk</property> 438 <property name="tooltip_text" translatable="yes">Display information about this version of gnunet-fs-gtk</property>
@@ -515,14 +492,12 @@
515 <property name="yscale">0</property> 492 <property name="yscale">0</property>
516 <child> 493 <child>
517 <object class="GtkToggleButton" id="main_window_search_namespace_dropdown_button"> 494 <object class="GtkToggleButton" id="main_window_search_namespace_dropdown_button">
518 <property name="use_action_appearance">False</property>
519 <property name="width_request">21</property> 495 <property name="width_request">21</property>
520 <property name="height_request">21</property> 496 <property name="height_request">21</property>
521 <property name="visible">True</property> 497 <property name="visible">True</property>
522 <property name="can_focus">True</property> 498 <property name="can_focus">True</property>
523 <property name="receives_default">True</property> 499 <property name="receives_default">True</property>
524 <property name="events">GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property> 500 <property name="events">GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property>
525 <property name="use_action_appearance">False</property>
526 <property name="image_position">right</property> 501 <property name="image_position">right</property>
527 <signal name="toggled" handler="GNUNET_FS_GTK_search_namespace_dropdown_button_toggled_cb" swapped="no"/> 502 <signal name="toggled" handler="GNUNET_FS_GTK_search_namespace_dropdown_button_toggled_cb" swapped="no"/>
528 <signal name="leave-notify-event" handler="GNUNET_FS_GTK_search_namespace_selector_window_leave_notify_event_cb" swapped="no"/> 503 <signal name="leave-notify-event" handler="GNUNET_FS_GTK_search_namespace_selector_window_leave_notify_event_cb" swapped="no"/>
@@ -554,11 +529,9 @@
554 <child> 529 <child>
555 <object class="GtkButton" id="main_window_search_button"> 530 <object class="GtkButton" id="main_window_search_button">
556 <property name="label" translatable="yes">Find:</property> 531 <property name="label" translatable="yes">Find:</property>
557 <property name="use_action_appearance">False</property>
558 <property name="visible">True</property> 532 <property name="visible">True</property>
559 <property name="can_focus">True</property> 533 <property name="can_focus">True</property>
560 <property name="receives_default">True</property> 534 <property name="receives_default">True</property>
561 <property name="use_action_appearance">False</property>
562 <property name="image">find_stock_image</property> 535 <property name="image">find_stock_image</property>
563 <signal name="clicked" handler="main_window_search_button_clicked_cb" swapped="no"/> 536 <signal name="clicked" handler="main_window_search_button_clicked_cb" swapped="no"/>
564 </object> 537 </object>
@@ -577,6 +550,10 @@
577 <property name="has_focus">True</property> 550 <property name="has_focus">True</property>
578 <property name="invisible_char">●</property> 551 <property name="invisible_char">●</property>
579 <property name="invisible_char_set">True</property> 552 <property name="invisible_char_set">True</property>
553 <property name="primary_icon_activatable">False</property>
554 <property name="secondary_icon_activatable">False</property>
555 <property name="primary_icon_sensitive">True</property>
556 <property name="secondary_icon_sensitive">True</property>
580 <signal name="key-press-event" handler="main_window_search_entry_key_press_event_cb" swapped="no"/> 557 <signal name="key-press-event" handler="main_window_search_entry_key_press_event_cb" swapped="no"/>
581 </object> 558 </object>
582 <packing> 559 <packing>
@@ -728,7 +705,6 @@
728 </child> 705 </child>
729 <child> 706 <child>
730 <object class="GtkVBox" id="GNUNET_GTK_search_frame_download_vbox"> 707 <object class="GtkVBox" id="GNUNET_GTK_search_frame_download_vbox">
731 <property name="visible">False</property>
732 <property name="can_focus">False</property> 708 <property name="can_focus">False</property>
733 <child> 709 <child>
734 <object class="GtkHBox" id="GNUNET_GTK_search_frame_download_into_hbox"> 710 <object class="GtkHBox" id="GNUNET_GTK_search_frame_download_into_hbox">
@@ -810,7 +786,6 @@
810 <child> 786 <child>
811 <object class="GtkButton" id="GNUNET_GTK_search_frame_download_filename_change_button"> 787 <object class="GtkButton" id="GNUNET_GTK_search_frame_download_filename_change_button">
812 <property name="label">…</property> 788 <property name="label">…</property>
813 <property name="use_action_appearance">False</property>
814 <property name="height_request">1</property> 789 <property name="height_request">1</property>
815 <property name="visible">True</property> 790 <property name="visible">True</property>
816 <property name="can_focus">True</property> 791 <property name="can_focus">True</property>
@@ -886,7 +861,6 @@
886 <child> 861 <child>
887 <object class="GtkCheckButton" id="GNUNET_GTK_search_frame_download_recursive_checkbox"> 862 <object class="GtkCheckButton" id="GNUNET_GTK_search_frame_download_recursive_checkbox">
888 <property name="label" translatable="yes">Recursive</property> 863 <property name="label" translatable="yes">Recursive</property>
889 <property name="use_action_appearance">False</property>
890 <property name="visible">True</property> 864 <property name="visible">True</property>
891 <property name="can_focus">True</property> 865 <property name="can_focus">True</property>
892 <property name="receives_default">False</property> 866 <property name="receives_default">False</property>
@@ -913,7 +887,6 @@
913 <child> 887 <child>
914 <object class="GtkButton" id="GNUNET_GTK_search_frame_download_download_button"> 888 <object class="GtkButton" id="GNUNET_GTK_search_frame_download_download_button">
915 <property name="label" translatable="yes">Download!</property> 889 <property name="label" translatable="yes">Download!</property>
916 <property name="use_action_appearance">False</property>
917 <property name="visible">True</property> 890 <property name="visible">True</property>
918 <property name="can_focus">True</property> 891 <property name="can_focus">True</property>
919 <property name="receives_default">True</property> 892 <property name="receives_default">True</property>
@@ -984,9 +957,6 @@
984 <property name="enable_grid_lines">both</property> 957 <property name="enable_grid_lines">both</property>
985 <signal name="button-press-event" handler="GNUNET_GTK_main_window_metadata_treeview_button_press_event_cb" swapped="no"/> 958 <signal name="button-press-event" handler="GNUNET_GTK_main_window_metadata_treeview_button_press_event_cb" swapped="no"/>
986 <signal name="popup-menu" handler="GNUNET_GTK_main_window_metadata_treeview_popup_menu_cb" swapped="no"/> 959 <signal name="popup-menu" handler="GNUNET_GTK_main_window_metadata_treeview_popup_menu_cb" swapped="no"/>
987 <child internal-child="selection">
988 <object class="GtkTreeSelection" id="treeview-selection1"/>
989 </child>
990 <child> 960 <child>
991 <object class="GtkTreeViewColumn" id="GNUNET_GTK_main_window_metadata_type_column"> 961 <object class="GtkTreeViewColumn" id="GNUNET_GTK_main_window_metadata_type_column">
992 <property name="sizing">autosize</property> 962 <property name="sizing">autosize</property>
@@ -1062,7 +1032,6 @@
1062 <property name="can_focus">False</property> 1032 <property name="can_focus">False</property>
1063 <child> 1033 <child>
1064 <object class="GtkMenuItem" id="Copy selection"> 1034 <object class="GtkMenuItem" id="Copy selection">
1065 <property name="use_action_appearance">False</property>
1066 <property name="visible">True</property> 1035 <property name="visible">True</property>
1067 <property name="can_focus">False</property> 1036 <property name="can_focus">False</property>
1068 <property name="label" translatable="yes">Copy selection</property> 1037 <property name="label" translatable="yes">Copy selection</property>
@@ -1102,9 +1071,6 @@
1102 <property name="tooltip_column">3</property> 1071 <property name="tooltip_column">3</property>
1103 <signal name="button-press-event" handler="GNUNET_FS_GTK_namespace_selector_treeview_button_press_event_cb" swapped="no"/> 1072 <signal name="button-press-event" handler="GNUNET_FS_GTK_namespace_selector_treeview_button_press_event_cb" swapped="no"/>
1104 <signal name="button-release-event" handler="GNUNET_FS_GTK_namespace_selector_treeview_button_release_event_cb" swapped="no"/> 1073 <signal name="button-release-event" handler="GNUNET_FS_GTK_namespace_selector_treeview_button_release_event_cb" swapped="no"/>
1105 <child internal-child="selection">
1106 <object class="GtkTreeSelection" id="treeview-selection2"/>
1107 </child>
1108 <child> 1074 <child>
1109 <object class="GtkTreeViewColumn" id="name_column"> 1075 <object class="GtkTreeViewColumn" id="name_column">
1110 <property name="sizing">autosize</property> 1076 <property name="sizing">autosize</property>
@@ -1139,11 +1105,9 @@
1139 <child> 1105 <child>
1140 <object class="GtkButton" id="namespace_selector_manage_namespaces_button"> 1106 <object class="GtkButton" id="namespace_selector_manage_namespaces_button">
1141 <property name="label" translatable="yes">_Manage namespaces</property> 1107 <property name="label" translatable="yes">_Manage namespaces</property>
1142 <property name="use_action_appearance">False</property>
1143 <property name="visible">True</property> 1108 <property name="visible">True</property>
1144 <property name="can_focus">True</property> 1109 <property name="can_focus">True</property>
1145 <property name="receives_default">False</property> 1110 <property name="receives_default">False</property>
1146 <property name="use_action_appearance">False</property>
1147 <property name="use_underline">True</property> 1111 <property name="use_underline">True</property>
1148 <signal name="clicked" handler="namespace_selector_manage_namespaces_button_clicked_cb" swapped="no"/> 1112 <signal name="clicked" handler="namespace_selector_manage_namespaces_button_clicked_cb" swapped="no"/>
1149 </object> 1113 </object>
diff --git a/contrib/gnunet_fs_gtk_namespace_organizer.glade b/contrib/gnunet_fs_gtk_namespace_organizer.glade
new file mode 100644
index 00000000..9015090d
--- /dev/null
+++ b/contrib/gnunet_fs_gtk_namespace_organizer.glade
@@ -0,0 +1,276 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<interface>
3 <requires lib="gtk+" version="2.20"/>
4 <!-- interface-naming-policy project-wide -->
5 <object class="GtkDialog" id="GNUNET_GTK_namespace_organizer_dialog">
6 <property name="can_focus">False</property>
7 <property name="border_width">5</property>
8 <property name="title" translatable="yes">Namespace selection</property>
9 <property name="destroy_with_parent">True</property>
10 <property name="type_hint">dialog</property>
11 <property name="has_separator">True</property>
12 <signal name="response" handler="GNUNET_GTK_namespace_organizer_dialog_response_cb" swapped="no"/>
13 <child internal-child="vbox">
14 <object class="GtkVBox" id="GNUNET_GTK_namespace_organizer_vbox">
15 <property name="visible">True</property>
16 <property name="can_focus">False</property>
17 <property name="spacing">2</property>
18 <child internal-child="action_area">
19 <object class="GtkHButtonBox" id="GNUNET_GTK_namespace_organizer_action_area">
20 <property name="visible">True</property>
21 <property name="can_focus">False</property>
22 <property name="layout_style">end</property>
23 <child>
24 <object class="GtkButton" id="GNUNET_GTK_namespace_organizer_close_button">
25 <property name="label">gtk-close</property>
26 <property name="visible">True</property>
27 <property name="can_focus">True</property>
28 <property name="receives_default">True</property>
29 <property name="tooltip_text" translatable="yes">Saves all changes made in this dialog to disk and closes the dialog.</property>
30 <property name="use_stock">True</property>
31 </object>
32 <packing>
33 <property name="expand">False</property>
34 <property name="fill">False</property>
35 <property name="position">0</property>
36 </packing>
37 </child>
38 </object>
39 <packing>
40 <property name="expand">False</property>
41 <property name="fill">True</property>
42 <property name="pack_type">end</property>
43 <property name="position">0</property>
44 </packing>
45 </child>
46 <child>
47 <object class="GtkLabel" id="GNUNET_GTK_namespace_organizer_namespaces_label">
48 <property name="visible">True</property>
49 <property name="can_focus">False</property>
50 <property name="xalign">0</property>
51 <property name="yalign">0</property>
52 <property name="label" translatable="yes">List of the namespaces you have private key for.
53You can create new namespaces, delete or rename existing ones.
54Select one of the namespaces that will be (optionally) used for publishing.</property>
55 </object>
56 <packing>
57 <property name="expand">False</property>
58 <property name="fill">True</property>
59 <property name="position">1</property>
60 </packing>
61 </child>
62 <child>
63 <object class="GtkScrolledWindow" id="GNUNET_GTK_namespace_organizer_scrolled">
64 <property name="visible">True</property>
65 <property name="can_focus">True</property>
66 <property name="hscrollbar_policy">automatic</property>
67 <property name="vscrollbar_policy">automatic</property>
68 <child>
69 <object class="GtkTreeView" id="GNUNET_GTK_namespace_organizer_namespaces_treeview">
70 <property name="height_request">300</property>
71 <property name="visible">True</property>
72 <property name="can_focus">True</property>
73 <property name="model">GNUNET_GTK_namespace_organizer_namespaces_liststore</property>
74 <property name="headers_clickable">False</property>
75 <property name="rules_hint">True</property>
76 <property name="enable_search">False</property>
77 <property name="show_expanders">False</property>
78 <property name="enable_grid_lines">horizontal</property>
79 <property name="tooltip_column">5</property>
80 <child>
81 <object class="GtkTreeViewColumn" id="GNUNET_GTK_namespace_organizer_namespaces_treeview_column_usethis">
82 <property name="sizing">autosize</property>
83 <property name="title" translatable="yes">Use for publications</property>
84 <child>
85 <object class="GtkCellRendererToggle" id="GNUNET_GTK_namespace_organizer_namespaces_treeview_column_usethis_toggle">
86 <property name="radio">True</property>
87 <signal name="toggled" handler="GNUNET_GTK_namespace_organizer_namespaces_treeview_column_usethis_toggle_toggled_cb" swapped="no"/>
88 </object>
89 <attributes>
90 <attribute name="active">3</attribute>
91 </attributes>
92 </child>
93 </object>
94 </child>
95 <child>
96 <object class="GtkTreeViewColumn" id="GNUNET_GTK_namespace_organizer_namespaces_treeview_column_name">
97 <property name="sizing">autosize</property>
98 <property name="title" translatable="yes">Name</property>
99 <property name="expand">True</property>
100 <child>
101 <object class="GtkCellRendererText" id="GNUNET_GTK_namespace_organizer_namespaces_treeview_column_name_text">
102 <property name="editable">True</property>
103 <signal name="edited" handler="GNUNET_GTK_namespace_organizer_namespaces_treeview_column_name_text_edited_cb" swapped="no"/>
104 </object>
105 <attributes>
106 <attribute name="text">0</attribute>
107 </attributes>
108 </child>
109 </object>
110 </child>
111 <child>
112 <object class="GtkTreeViewColumn" id="GNUNET_GTK_namespace_organizer_namespaces_treeview_column_key">
113 <property name="sizing">autosize</property>
114 <property name="title" translatable="yes">Hash of the public key</property>
115 <child>
116 <object class="GtkCellRendererText" id="GNUNET_GTK_namespace_organizer_namespaces_treeview_column_key_text"/>
117 <attributes>
118 <attribute name="text">1</attribute>
119 </attributes>
120 </child>
121 </object>
122 </child>
123 </object>
124 </child>
125 </object>
126 <packing>
127 <property name="expand">True</property>
128 <property name="fill">True</property>
129 <property name="position">2</property>
130 </packing>
131 </child>
132 <child>
133 <object class="GtkHBox" id="GNUNET_GTK_namespace_organizer_namespaces_extra_buttons_hbox">
134 <property name="visible">True</property>
135 <property name="can_focus">False</property>
136 <property name="spacing">5</property>
137 <child>
138 <object class="GtkButton" id="GNUNET_GTK_namespace_organizer_namespaces_delete_namespace_unconfirmation_button">
139 <property name="label" translatable="yes">No, keep it.</property>
140 <property name="can_focus">True</property>
141 <property name="receives_default">True</property>
142 <signal name="clicked" handler="GNUNET_GTK_namespace_organizer_namespaces_delete_namespace_unconfirmation_button_clicked_cb" swapped="no"/>
143 </object>
144 <packing>
145 <property name="expand">False</property>
146 <property name="fill">True</property>
147 <property name="pack_type">end</property>
148 <property name="position">0</property>
149 </packing>
150 </child>
151 <child>
152 <object class="GtkButton" id="GNUNET_GTK_namespace_organizer_namespaces_delete_namespace_confirmation_button">
153 <property name="label" translatable="yes">Yes, delete it!</property>
154 <property name="can_focus">True</property>
155 <property name="receives_default">True</property>
156 <signal name="clicked" handler="GNUNET_GTK_namespace_organizer_namespaces_delete_namespace_confirmation_button_clicked_cb" swapped="no"/>
157 </object>
158 <packing>
159 <property name="expand">False</property>
160 <property name="fill">True</property>
161 <property name="pack_type">end</property>
162 <property name="position">1</property>
163 </packing>
164 </child>
165 <child>
166 <object class="GtkLabel" id="GNUNET_GTK_namespace_organizer_namespaces_delete_namespace_confirmation_label">
167 <property name="can_focus">False</property>
168 <property name="label" translatable="yes">Are you sure? Once you delete the private key of a namespace, it's lost forever!</property>
169 </object>
170 <packing>
171 <property name="expand">False</property>
172 <property name="fill">True</property>
173 <property name="pack_type">end</property>
174 <property name="position">2</property>
175 </packing>
176 </child>
177 <child>
178 <object class="GtkButton" id="GNUNET_GTK_namespace_organizer_namespaces_delete_namespace_button">
179 <property name="label" translatable="yes">Delete</property>
180 <property name="visible">True</property>
181 <property name="sensitive">False</property>
182 <property name="can_focus">True</property>
183 <property name="receives_default">True</property>
184 <property name="tooltip_text" translatable="yes">Delete namespace key.</property>
185 <signal name="clicked" handler="GNUNET_GTK_namespace_organizer_namespaces_delete_namespace_button_clicked_cb" swapped="no"/>
186 </object>
187 <packing>
188 <property name="expand">False</property>
189 <property name="fill">True</property>
190 <property name="pack_type">end</property>
191 <property name="position">3</property>
192 </packing>
193 </child>
194 <child>
195 <object class="GtkButton" id="GNUNET_GTK_namespace_organizer_namespaces_create_namespace_button">
196 <property name="label" translatable="yes">Create</property>
197 <property name="visible">True</property>
198 <property name="can_focus">True</property>
199 <property name="receives_default">True</property>
200 <property name="tooltip_text" translatable="yes">Generate new namespace.</property>
201 <signal name="clicked" handler="GNUNET_GTK_namespace_organizer_namespaces_create_namespace_button_clicked_cb" swapped="no"/>
202 </object>
203 <packing>
204 <property name="expand">False</property>
205 <property name="fill">True</property>
206 <property name="position">4</property>
207 </packing>
208 </child>
209 <child>
210 <object class="GtkButton" id="GNUNET_GTK_namespace_organizer_namespaces_advertise_namespace_button">
211 <property name="label" translatable="yes">Advertise</property>
212 <property name="visible">True</property>
213 <property name="can_focus">True</property>
214 <property name="receives_default">True</property>
215 <property name="tooltip_text" translatable="yes">Make namespace findable with global file-sharing searches.</property>
216 <signal name="clicked" handler="GNUNET_GTK_namespace_organizer_namespaces_advertise_namespace_button_clicked_cb" swapped="no"/>
217 </object>
218 <packing>
219 <property name="expand">False</property>
220 <property name="fill">True</property>
221 <property name="position">5</property>
222 </packing>
223 </child>
224 <child>
225 <object class="GtkLabel" id="GNUNET_GTK_namespace_organizer_namespaces_create_namespace_progress_label">
226 <property name="can_focus">False</property>
227 <property name="label" translatable="yes">Generating new namespace key...</property>
228 </object>
229 <packing>
230 <property name="expand">False</property>
231 <property name="fill">True</property>
232 <property name="position">6</property>
233 </packing>
234 </child>
235 <child>
236 <object class="GtkSpinner" id="GNUNET_GTK_namespace_organizer_namespaces_create_namespace_progress_spinner">
237 <property name="can_focus">False</property>
238 <property name="active">True</property>
239 </object>
240 <packing>
241 <property name="expand">False</property>
242 <property name="fill">True</property>
243 <property name="position">7</property>
244 </packing>
245 </child>
246 </object>
247 <packing>
248 <property name="expand">False</property>
249 <property name="fill">True</property>
250 <property name="padding">5</property>
251 <property name="position">3</property>
252 </packing>
253 </child>
254 </object>
255 </child>
256 <action-widgets>
257 <action-widget response="-5">GNUNET_GTK_namespace_organizer_close_button</action-widget>
258 </action-widgets>
259 </object>
260 <object class="GtkListStore" id="GNUNET_GTK_namespace_organizer_namespaces_liststore">
261 <columns>
262 <!-- column-name NamespaceName -->
263 <column type="gchararray"/>
264 <!-- column-name NamespaceKey -->
265 <column type="gchararray"/>
266 <!-- column-name NamespaceKeyBinary -->
267 <column type="gpointer"/>
268 <!-- column-name UseThis -->
269 <column type="gboolean"/>
270 <!-- column-name ActualName -->
271 <column type="gchararray"/>
272 <!-- column-name ToolTip -->
273 <column type="gchararray"/>
274 </columns>
275 </object>
276</interface>
diff --git a/contrib/gnunet_fs_gtk_publish_dialog.glade b/contrib/gnunet_fs_gtk_publish_dialog.glade
index f00e87d7..495df952 100644
--- a/contrib/gnunet_fs_gtk_publish_dialog.glade
+++ b/contrib/gnunet_fs_gtk_publish_dialog.glade
@@ -22,6 +22,20 @@
22 <column type="guint"/> 22 <column type="guint"/>
23 </columns> 23 </columns>
24 </object> 24 </object>
25 <object class="GtkTreeStore" id="GNUNET_GTK_indentifiers_treestore">
26 <columns>
27 <!-- column-name Identifier -->
28 <column type="gchararray"/>
29 <!-- column-name UpdateIdentifier -->
30 <column type="gchararray"/>
31 <!-- column-name Description -->
32 <column type="gchararray"/>
33 <!-- column-name PathToOriginal -->
34 <column type="gchararray"/>
35 <!-- column-name IdentifierMarkedUp -->
36 <column type="gchararray"/>
37 </columns>
38 </object>
25 <object class="GtkWindow" id="GNUNET_GTK_master_publish_dialog"> 39 <object class="GtkWindow" id="GNUNET_GTK_master_publish_dialog">
26 <property name="height_request">500</property> 40 <property name="height_request">500</property>
27 <property name="can_focus">False</property> 41 <property name="can_focus">False</property>
@@ -40,349 +54,618 @@
40 <property name="visible">True</property> 54 <property name="visible">True</property>
41 <property name="can_focus">True</property> 55 <property name="can_focus">True</property>
42 <child> 56 <child>
43 <object class="GtkVBox" id="GNUNET_GTK_master_publish_dialog_top_vbox"> 57 <object class="GtkFrame" id="GNUNET_GTK_master_publish_dialog_top_frame">
58 <property name="height_request">200</property>
44 <property name="visible">True</property> 59 <property name="visible">True</property>
45 <property name="can_focus">False</property> 60 <property name="can_focus">False</property>
61 <property name="label_xalign">0</property>
62 <property name="label_yalign">0</property>
63 <property name="shadow_type">in</property>
46 <child> 64 <child>
47 <object class="GtkScrolledWindow" id="GNUNET_GTK_master_publish_dialog_file_information_scrolled_window"> 65 <object class="GtkVBox" id="GNUNET_GTK_master_publish_dialog_top_vbox">
48 <property name="visible">True</property> 66 <property name="visible">True</property>
49 <property name="can_focus">True</property> 67 <property name="can_focus">False</property>
50 <property name="hadjustment">adjustment5</property>
51 <property name="vadjustment">adjustment6</property>
52 <property name="hscrollbar_policy">automatic</property>
53 <property name="vscrollbar_policy">automatic</property>
54 <property name="shadow_type">in</property>
55 <child> 68 <child>
56 <object class="GtkTreeView" id="GNUNET_GTK_master_publish_dialog_file_information_tree_view"> 69 <object class="GtkScrolledWindow" id="GNUNET_GTK_master_publish_dialog_file_information_scrolled_window">
57 <property name="height_request">100</property>
58 <property name="visible">True</property> 70 <property name="visible">True</property>
59 <property name="can_focus">True</property> 71 <property name="can_focus">True</property>
60 <property name="model">GNUNET_GTK_file_sharing_publishing_tree_store</property> 72 <property name="hscrollbar_policy">automatic</property>
61 <property name="hadjustment">adjustment5</property> 73 <property name="vscrollbar_policy">automatic</property>
62 <property name="vadjustment">adjustment6</property>
63 <property name="headers_clickable">False</property>
64 <property name="expander_column">GNUNET_GTK_master_publish_dialog_file_information_filename_column</property>
65 <property name="search_column">0</property>
66 <property name="enable_tree_lines">True</property>
67 <child> 74 <child>
68 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_file_information_filesize_column"> 75 <object class="GtkTreeView" id="GNUNET_GTK_master_publish_dialog_file_information_tree_view">
69 <property name="sizing">autosize</property> 76 <property name="visible">True</property>
70 <property name="title">Size</property> 77 <property name="can_focus">True</property>
78 <property name="model">GNUNET_GTK_file_sharing_publishing_tree_store</property>
79 <property name="headers_clickable">False</property>
80 <property name="expander_column">GNUNET_GTK_master_publish_dialog_file_information_filename_column</property>
81 <property name="search_column">0</property>
82 <property name="enable_tree_lines">True</property>
71 <child> 83 <child>
72 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_file_information_filesize_renderer"/> 84 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_file_information_filesize_column">
73 <attributes> 85 <property name="sizing">autosize</property>
74 <attribute name="text">0</attribute> 86 <property name="title">Size</property>
75 </attributes> 87 <child>
88 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_file_information_filesize_renderer"/>
89 <attributes>
90 <attribute name="text">0</attribute>
91 </attributes>
92 </child>
93 </object>
76 </child> 94 </child>
77 </object>
78 </child>
79 <child>
80 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_file_information_filename_column">
81 <property name="sizing">autosize</property>
82 <property name="title">Filename</property>
83 <property name="expand">True</property>
84 <property name="clickable">True</property>
85 <property name="reorderable">True</property>
86 <property name="sort_indicator">True</property>
87 <child> 95 <child>
88 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_file_information_filename_renderer"/> 96 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_file_information_filename_column">
89 <attributes> 97 <property name="sizing">autosize</property>
90 <attribute name="text">2</attribute> 98 <property name="title">Filename</property>
91 </attributes> 99 <property name="expand">True</property>
100 <property name="clickable">True</property>
101 <property name="reorderable">True</property>
102 <property name="sort_indicator">True</property>
103 <child>
104 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_file_information_filename_renderer"/>
105 <attributes>
106 <attribute name="text">2</attribute>
107 </attributes>
108 </child>
109 </object>
92 </child> 110 </child>
93 </object> 111 </object>
94 </child> 112 </child>
95 </object> 113 </object>
114 <packing>
115 <property name="expand">True</property>
116 <property name="fill">True</property>
117 <property name="position">0</property>
118 </packing>
96 </child> 119 </child>
97 </object>
98 <packing>
99 <property name="expand">True</property>
100 <property name="fill">True</property>
101 <property name="position">0</property>
102 </packing>
103 </child>
104 <child>
105 <object class="GtkHBox" id="GNUNET_GTK_master_dialog_modification_button_hbox">
106 <property name="visible">True</property>
107 <property name="can_focus">False</property>
108 <child> 120 <child>
109 <object class="GtkTable" id="GNUNET_GTK_master_publish_dialog_action_table"> 121 <object class="GtkHBox" id="GNUNET_GTK_master_dialog_modification_button_hbox">
110 <property name="visible">True</property> 122 <property name="visible">True</property>
111 <property name="can_focus">False</property> 123 <property name="can_focus">False</property>
112 <property name="n_rows">2</property>
113 <property name="n_columns">3</property>
114 <child> 124 <child>
115 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_add_button"> 125 <object class="GtkTable" id="GNUNET_GTK_master_publish_dialog_action_table">
116 <property name="label" translatable="yes">Add _File</property>
117 <property name="use_action_appearance">False</property>
118 <property name="visible">True</property> 126 <property name="visible">True</property>
119 <property name="can_focus">True</property> 127 <property name="can_focus">False</property>
120 <property name="receives_default">True</property> 128 <property name="n_rows">2</property>
121 <property name="use_underline">True</property> 129 <property name="n_columns">3</property>
122 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_add_button_clicked_cb" swapped="no"/> 130 <child>
131 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_add_button">
132 <property name="label" translatable="yes">Add _File</property>
133 <property name="visible">True</property>
134 <property name="can_focus">True</property>
135 <property name="receives_default">True</property>
136 <property name="use_underline">True</property>
137 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_add_button_clicked_cb" swapped="no"/>
138 </object>
139 </child>
140 <child>
141 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_new_button">
142 <property name="label" translatable="yes">_Create empty directory</property>
143 <property name="visible">True</property>
144 <property name="can_focus">True</property>
145 <property name="receives_default">True</property>
146 <property name="image">new_stock_image</property>
147 <property name="use_underline">True</property>
148 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_new_button_clicked_cb" swapped="no"/>
149 </object>
150 <packing>
151 <property name="left_attach">1</property>
152 <property name="right_attach">3</property>
153 </packing>
154 </child>
155 <child>
156 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_open_button">
157 <property name="label" translatable="yes">Add _Directory</property>
158 <property name="visible">True</property>
159 <property name="can_focus">True</property>
160 <property name="receives_default">True</property>
161 <property name="use_underline">True</property>
162 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_open_button_clicked_cb" swapped="no"/>
163 </object>
164 <packing>
165 <property name="top_attach">1</property>
166 <property name="bottom_attach">2</property>
167 </packing>
168 </child>
169 <child>
170 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_edit_button">
171 <property name="label">gtk-edit</property>
172 <property name="visible">True</property>
173 <property name="sensitive">False</property>
174 <property name="can_focus">True</property>
175 <property name="receives_default">True</property>
176 <property name="use_stock">True</property>
177 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb" swapped="no"/>
178 </object>
179 <packing>
180 <property name="left_attach">1</property>
181 <property name="right_attach">2</property>
182 <property name="top_attach">1</property>
183 <property name="bottom_attach">2</property>
184 </packing>
185 </child>
186 <child>
187 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_delete_button">
188 <property name="label">gtk-delete</property>
189 <property name="visible">True</property>
190 <property name="sensitive">False</property>
191 <property name="can_focus">True</property>
192 <property name="receives_default">True</property>
193 <property name="use_stock">True</property>
194 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb" swapped="no"/>
195 </object>
196 <packing>
197 <property name="left_attach">2</property>
198 <property name="right_attach">3</property>
199 <property name="top_attach">1</property>
200 <property name="bottom_attach">2</property>
201 </packing>
202 </child>
123 </object> 203 </object>
204 <packing>
205 <property name="expand">False</property>
206 <property name="fill">True</property>
207 <property name="padding">25</property>
208 <property name="position">0</property>
209 </packing>
124 </child> 210 </child>
125 <child> 211 <child>
126 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_new_button"> 212 <object class="GtkTable" id="GNUNET_GTK_master_publish_dialog_arrow_table">
127 <property name="label" translatable="yes">_Create empty directory</property>
128 <property name="use_action_appearance">False</property>
129 <property name="visible">True</property> 213 <property name="visible">True</property>
130 <property name="can_focus">True</property> 214 <property name="can_focus">False</property>
131 <property name="receives_default">True</property> 215 <property name="n_rows">2</property>
132 <property name="image">new_stock_image1</property> 216 <property name="n_columns">3</property>
133 <property name="use_underline">True</property> 217 <property name="homogeneous">True</property>
134 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_new_button_clicked_cb" swapped="no"/> 218 <child>
219 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_up_button">
220 <property name="label">gtk-go-up</property>
221 <property name="visible">True</property>
222 <property name="sensitive">False</property>
223 <property name="can_focus">True</property>
224 <property name="receives_default">True</property>
225 <property name="use_stock">True</property>
226 <property name="xalign">0</property>
227 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_up_button_clicked_cb" swapped="no"/>
228 </object>
229 <packing>
230 <property name="left_attach">1</property>
231 <property name="right_attach">2</property>
232 </packing>
233 </child>
234 <child>
235 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_left_button">
236 <property name="label" translatable="yes">_Left</property>
237 <property name="visible">True</property>
238 <property name="sensitive">False</property>
239 <property name="can_focus">True</property>
240 <property name="receives_default">True</property>
241 <property name="image">left_stock_image</property>
242 <property name="use_underline">True</property>
243 <property name="xalign">0</property>
244 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_left_button_clicked_cb" swapped="no"/>
245 </object>
246 <packing>
247 <property name="top_attach">1</property>
248 <property name="bottom_attach">2</property>
249 </packing>
250 </child>
251 <child>
252 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_down_button">
253 <property name="label">gtk-go-down</property>
254 <property name="visible">True</property>
255 <property name="sensitive">False</property>
256 <property name="can_focus">True</property>
257 <property name="receives_default">True</property>
258 <property name="use_stock">True</property>
259 <property name="xalign">0</property>
260 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_down_button_clicked_cb" swapped="no"/>
261 </object>
262 <packing>
263 <property name="left_attach">1</property>
264 <property name="right_attach">2</property>
265 <property name="top_attach">1</property>
266 <property name="bottom_attach">2</property>
267 </packing>
268 </child>
269 <child>
270 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_right_button">
271 <property name="label" translatable="yes">_Right</property>
272 <property name="visible">True</property>
273 <property name="sensitive">False</property>
274 <property name="can_focus">True</property>
275 <property name="receives_default">True</property>
276 <property name="image">right_stock_image</property>
277 <property name="use_underline">True</property>
278 <property name="xalign">0</property>
279 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_right_button_clicked_cb" swapped="no"/>
280 </object>
281 <packing>
282 <property name="left_attach">2</property>
283 <property name="right_attach">3</property>
284 <property name="top_attach">1</property>
285 <property name="bottom_attach">2</property>
286 </packing>
287 </child>
288 <child>
289 <placeholder/>
290 </child>
291 <child>
292 <placeholder/>
293 </child>
294 <child>
295 <placeholder/>
296 </child>
297 <child>
298 <placeholder/>
299 </child>
300 <child>
301 <placeholder/>
302 </child>
303 <child>
304 <placeholder/>
305 </child>
306 <child>
307 <placeholder/>
308 </child>
309 <child>
310 <placeholder/>
311 </child>
312 <child>
313 <placeholder/>
314 </child>
315 <child>
316 <placeholder/>
317 </child>
318 <child>
319 <placeholder/>
320 </child>
321 <child>
322 <placeholder/>
323 </child>
324 <child>
325 <placeholder/>
326 </child>
327 <child>
328 <placeholder/>
329 </child>
330 <child>
331 <placeholder/>
332 </child>
333 <child>
334 <placeholder/>
335 </child>
336 <child>
337 <placeholder/>
338 </child>
339 <child>
340 <placeholder/>
341 </child>
135 </object> 342 </object>
136 <packing> 343 <packing>
137 <property name="left_attach">1</property> 344 <property name="expand">False</property>
138 <property name="right_attach">3</property> 345 <property name="fill">True</property>
346 <property name="padding">25</property>
347 <property name="position">1</property>
139 </packing> 348 </packing>
140 </child> 349 </child>
350 </object>
351 <packing>
352 <property name="expand">False</property>
353 <property name="fill">True</property>
354 <property name="position">1</property>
355 </packing>
356 </child>
357 </object>
358 </child>
359 <child type="label_item">
360 <placeholder/>
361 </child>
362 </object>
363 <packing>
364 <property name="resize">True</property>
365 <property name="shrink">False</property>
366 </packing>
367 </child>
368 <child>
369 <object class="GtkFrame" id="GNUNET_GTK_master_publish_dialog_bottom_frame">
370 <property name="visible">True</property>
371 <property name="can_focus">False</property>
372 <property name="label_xalign">0</property>
373 <property name="label_yalign">0</property>
374 <property name="shadow_type">in</property>
375 <child>
376 <object class="GtkVBox" id="GNUNET_GTK_master_publish_dialog_bottom_vbox">
377 <property name="visible">True</property>
378 <property name="can_focus">False</property>
379 <child>
380 <object class="GtkHBox" id="dummy_hbox_1">
381 <property name="visible">True</property>
382 <property name="can_focus">False</property>
141 <child> 383 <child>
142 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_open_button"> 384 <object class="GtkCheckButton" id="GNUNET_GTK_master_publish_dialog_global_checkbox">
143 <property name="label" translatable="yes">Add _Directory</property> 385 <property name="label" translatable="yes">Publish in global namespace</property>
144 <property name="use_action_appearance">False</property>
145 <property name="visible">True</property> 386 <property name="visible">True</property>
146 <property name="can_focus">True</property> 387 <property name="can_focus">True</property>
147 <property name="receives_default">True</property> 388 <property name="receives_default">False</property>
148 <property name="use_underline">True</property> 389 <property name="tooltip_text" translatable="yes">Make unsigned publication that will be searchable in global (anonymous) namespace.
149 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_open_button_clicked_cb" swapped="no"/> 390Disabling this is equivalent to pressing the "Remove all Keywords" button before starting the publication.</property>
391 <property name="draw_indicator">True</property>
392 <signal name="toggled" handler="GNUNET_GTK_master_publish_dialog_global_checkbox_toggled_cb" swapped="no"/>
150 </object> 393 </object>
151 <packing> 394 <packing>
152 <property name="top_attach">1</property> 395 <property name="expand">False</property>
153 <property name="bottom_attach">2</property> 396 <property name="fill">False</property>
397 <property name="position">0</property>
154 </packing> 398 </packing>
155 </child> 399 </child>
156 <child> 400 <child>
157 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_edit_button"> 401 <placeholder/>
158 <property name="label">gtk-edit</property> 402 </child>
159 <property name="use_action_appearance">False</property> 403 </object>
404 <packing>
405 <property name="expand">False</property>
406 <property name="fill">False</property>
407 <property name="position">0</property>
408 </packing>
409 </child>
410 <child>
411 <object class="GtkHBox" id="GNUNET_GTK_master_publish_dialog_own_hbox">
412 <property name="visible">True</property>
413 <property name="can_focus">False</property>
414 <child>
415 <object class="GtkCheckButton" id="GNUNET_GTK_master_publish_dialog_own_checkbox">
416 <property name="label" translatable="yes">Publish in your own namespace</property>
160 <property name="visible">True</property> 417 <property name="visible">True</property>
161 <property name="sensitive">False</property>
162 <property name="can_focus">True</property> 418 <property name="can_focus">True</property>
163 <property name="receives_default">True</property> 419 <property name="receives_default">False</property>
164 <property name="use_stock">True</property> 420 <property name="tooltip_text" translatable="yes">Sign the publication with your private key (pseudonym), and give it an identifier, under which it will be found in your namespace.
165 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb" swapped="no"/> 421Other users will be able to browse anything you publish in your namespace (if you maintain a root element), or get separate files from your namespace by their identifiers, and be assured that these files come from the same (anonymous) publisher.
422
423Unless specifically disabled in the configuration file, global namespace publications will also advertise your namespace, if you enable both global and private namespace publication.
424
425Despite all that, private namespace publications are just as anonymous as global namespace publications.
426
427Publishing in both global and private namespaces will not double storage requirements for published files.</property>
428 <property name="draw_indicator">True</property>
429 <signal name="toggled" handler="GNUNET_GTK_master_publish_dialog_own_checkbox_toggled_cb" swapped="no"/>
166 </object> 430 </object>
167 <packing> 431 <packing>
168 <property name="left_attach">1</property> 432 <property name="expand">False</property>
169 <property name="right_attach">2</property> 433 <property name="fill">True</property>
170 <property name="top_attach">1</property> 434 <property name="position">0</property>
171 <property name="bottom_attach">2</property>
172 </packing> 435 </packing>
173 </child> 436 </child>
174 <child> 437 <child>
175 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_delete_button"> 438 <object class="GtkLabel" id="GNUNET_GTK_master_publish_dialog_own_label">
176 <property name="label">gtk-delete</property>
177 <property name="use_action_appearance">False</property>
178 <property name="visible">True</property> 439 <property name="visible">True</property>
179 <property name="sensitive">False</property> 440 <property name="can_focus">False</property>
180 <property name="can_focus">True</property> 441 <property name="label">&lt;filled with the name of selected default namespace&gt;</property>
181 <property name="receives_default">True</property>
182 <property name="use_stock">True</property>
183 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb" swapped="no"/>
184 </object> 442 </object>
185 <packing> 443 <packing>
186 <property name="left_attach">2</property> 444 <property name="expand">False</property>
187 <property name="right_attach">3</property> 445 <property name="fill">True</property>
188 <property name="top_attach">1</property> 446 <property name="position">1</property>
189 <property name="bottom_attach">2</property>
190 </packing> 447 </packing>
191 </child> 448 </child>
192 </object> 449 </object>
193 <packing> 450 <packing>
194 <property name="expand">False</property> 451 <property name="expand">False</property>
195 <property name="fill">True</property> 452 <property name="fill">True</property>
196 <property name="padding">25</property> 453 <property name="position">1</property>
197 <property name="position">0</property>
198 </packing> 454 </packing>
199 </child> 455 </child>
200 <child> 456 <child>
201 <object class="GtkTable" id="GNUNET_GTK_master_publish_dialog_arrow_table"> 457 <object class="GtkVBox" id="GNUNET_GTK_master_publish_dialog_own_vbox">
202 <property name="visible">True</property> 458 <property name="visible">True</property>
203 <property name="can_focus">False</property> 459 <property name="can_focus">False</property>
204 <property name="n_rows">2</property>
205 <property name="n_columns">3</property>
206 <property name="homogeneous">True</property>
207 <child> 460 <child>
208 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_up_button"> 461 <object class="GtkHBox" id="GNUNET_GTK_master_publish_dialog_identifier_hbox">
209 <property name="label">gtk-go-up</property>
210 <property name="use_action_appearance">False</property>
211 <property name="visible">True</property> 462 <property name="visible">True</property>
212 <property name="sensitive">False</property> 463 <property name="can_focus">False</property>
213 <property name="can_focus">True</property> 464 <child>
214 <property name="receives_default">True</property> 465 <object class="GtkLabel" id="GNUNET_GTK_master_publish_dialog_identifier_label">
215 <property name="use_stock">True</property> 466 <property name="visible">True</property>
216 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_up_button_clicked_cb" swapped="no"/> 467 <property name="can_focus">False</property>
468 <property name="xalign">0</property>
469 <property name="label" translatable="yes">Identifier:</property>
470 </object>
471 <packing>
472 <property name="expand">False</property>
473 <property name="fill">True</property>
474 <property name="position">0</property>
475 </packing>
476 </child>
477 <child>
478 <object class="GtkEntry" id="GNUNET_GTK_master_publish_dialog_identifier_entry">
479 <property name="visible">True</property>
480 <property name="can_focus">True</property>
481 <property name="tooltip_text" translatable="yes">Identifier under which this publication will be found in your namespace.
482Publications made in your namespace use only these identifiers, one per publication, instead of keywords.
483Type in an identifier, or select one of the update identifiers (from previous updateable publications) in the list below.</property>
484 <property name="invisible_char">●</property>
485 <property name="primary_icon_activatable">False</property>
486 <property name="secondary_icon_activatable">False</property>
487 <property name="primary_icon_sensitive">True</property>
488 <property name="secondary_icon_sensitive">True</property>
489 <signal name="changed" handler="GNUNET_GTK_master_publish_dialog_identifier_entry_changed_cb" swapped="no"/>
490 </object>
491 <packing>
492 <property name="expand">True</property>
493 <property name="fill">True</property>
494 <property name="position">1</property>
495 </packing>
496 </child>
217 </object> 497 </object>
218 <packing> 498 <packing>
219 <property name="left_attach">1</property> 499 <property name="expand">False</property>
220 <property name="right_attach">2</property> 500 <property name="fill">True</property>
501 <property name="position">0</property>
221 </packing> 502 </packing>
222 </child> 503 </child>
223 <child> 504 <child>
224 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_left_button"> 505 <object class="GtkExpander" id="GNUNET_GTK_master_publish_dialog_previous_identifiers_expander">
225 <property name="label" translatable="yes">_Left</property>
226 <property name="use_action_appearance">False</property>
227 <property name="visible">True</property> 506 <property name="visible">True</property>
228 <property name="sensitive">False</property>
229 <property name="can_focus">True</property> 507 <property name="can_focus">True</property>
230 <property name="receives_default">True</property> 508 <child>
231 <property name="image">left_stock_image1</property> 509 <placeholder/>
232 <property name="use_underline">True</property> 510 </child>
233 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_left_button_clicked_cb" swapped="no"/> 511 <child type="label">
512 <object class="GtkLabel" id="GNUNET_GTK_master_publish_dialog_previous_identifiers_label">
513 <property name="visible">True</property>
514 <property name="can_focus">False</property>
515 <property name="label" translatable="yes">Previous identifiers</property>
516 </object>
517 </child>
234 </object> 518 </object>
235 <packing> 519 <packing>
236 <property name="top_attach">1</property> 520 <property name="expand">False</property>
237 <property name="bottom_attach">2</property> 521 <property name="fill">True</property>
522 <property name="position">1</property>
238 </packing> 523 </packing>
239 </child> 524 </child>
240 <child> 525 <child>
241 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_down_button"> 526 <object class="GtkScrolledWindow" id="GNUNET_GTK_master_publish_dialog_previous_identifiers_scrolled">
242 <property name="label">gtk-go-down</property>
243 <property name="use_action_appearance">False</property>
244 <property name="visible">True</property>
245 <property name="sensitive">False</property>
246 <property name="can_focus">True</property> 527 <property name="can_focus">True</property>
247 <property name="receives_default">True</property> 528 <property name="hscrollbar_policy">automatic</property>
248 <property name="use_stock">True</property> 529 <property name="vscrollbar_policy">automatic</property>
249 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_down_button_clicked_cb" swapped="no"/> 530 <property name="shadow_type">in</property>
531 <child>
532 <object class="GtkTreeView" id="GNUNET_GTK_master_publish_dialog_previous_identifiers_treeview">
533 <property name="visible">True</property>
534 <property name="can_focus">True</property>
535 <property name="model">GNUNET_GTK_indentifiers_treestore</property>
536 <property name="headers_clickable">False</property>
537 <property name="expander_column">GNUNET_GTK_master_publish_dialog_previous_identifiers_treeview_id_column</property>
538 <property name="enable_search">False</property>
539 <property name="enable_tree_lines">True</property>
540 <child>
541 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_previous_identifiers_treeview_id_column">
542 <property name="sizing">autosize</property>
543 <property name="title" translatable="yes">Identifier</property>
544 <child>
545 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_previous_identifiers_treeview_id_renderer"/>
546 <attributes>
547 <attribute name="markup">4</attribute>
548 </attributes>
549 </child>
550 </object>
551 </child>
552 <child>
553 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_previous_identifiers_treeview_update_id_column">
554 <property name="sizing">autosize</property>
555 <property name="title" translatable="yes">Update identifier</property>
556 <child>
557 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_previous_identifiers_treeview_update_id_renderer"/>
558 <attributes>
559 <attribute name="markup">1</attribute>
560 </attributes>
561 </child>
562 </object>
563 </child>
564 <child>
565 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_previous_identifiers_treeview_description_column">
566 <property name="sizing">autosize</property>
567 <property name="title" translatable="yes">Description</property>
568 <child>
569 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_previous_identifiers_treeview_description_renderer"/>
570 <attributes>
571 <attribute name="text">2</attribute>
572 </attributes>
573 </child>
574 </object>
575 </child>
576 </object>
577 </child>
250 </object> 578 </object>
251 <packing> 579 <packing>
252 <property name="left_attach">1</property> 580 <property name="expand">True</property>
253 <property name="right_attach">2</property> 581 <property name="fill">True</property>
254 <property name="top_attach">1</property> 582 <property name="position">2</property>
255 <property name="bottom_attach">2</property>
256 </packing> 583 </packing>
257 </child> 584 </child>
258 <child> 585 <child>
259 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_right_button"> 586 <object class="GtkHBox" id="dummy_hbox_2">
260 <property name="label" translatable="yes">_Right</property>
261 <property name="use_action_appearance">False</property>
262 <property name="visible">True</property> 587 <property name="visible">True</property>
263 <property name="sensitive">False</property> 588 <property name="can_focus">False</property>
264 <property name="can_focus">True</property> 589 <child>
265 <property name="receives_default">True</property> 590 <object class="GtkCheckButton" id="GNUNET_GTK_master_publish_dialog_updateable_checkbox">
266 <property name="image">right_stock_image1</property> 591 <property name="label" translatable="yes">Make publication updateable</property>
267 <property name="use_underline">True</property> 592 <property name="visible">True</property>
268 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_right_button_clicked_cb" swapped="no"/> 593 <property name="can_focus">True</property>
594 <property name="receives_default">False</property>
595 <property name="tooltip_text" translatable="yes">Enable and specify an update identifier to make this publication updateable.</property>
596 <property name="draw_indicator">True</property>
597 <signal name="toggled" handler="GNUNET_GTK_master_publish_dialog_updateable_checkbox_toggled_cb" swapped="no"/>
598 </object>
599 <packing>
600 <property name="expand">False</property>
601 <property name="fill">False</property>
602 <property name="position">0</property>
603 </packing>
604 </child>
605 <child>
606 <placeholder/>
607 </child>
269 </object> 608 </object>
270 <packing> 609 <packing>
271 <property name="left_attach">2</property> 610 <property name="expand">False</property>
272 <property name="right_attach">3</property> 611 <property name="fill">False</property>
273 <property name="top_attach">1</property> 612 <property name="position">3</property>
274 <property name="bottom_attach">2</property>
275 </packing> 613 </packing>
276 </child> 614 </child>
277 <child> 615 <child>
278 <placeholder/> 616 <object class="GtkHBox" id="GNUNET_GTK_master_publish_dialog_update_id_hbox">
279 </child> 617 <property name="visible">True</property>
280 <child> 618 <property name="can_focus">False</property>
281 <placeholder/> 619 <child>
620 <object class="GtkLabel" id="GNUNET_GTK_master_publish_dialog_update_id_label">
621 <property name="visible">True</property>
622 <property name="can_focus">False</property>
623 <property name="label" translatable="yes">Update identifier:</property>
624 </object>
625 <packing>
626 <property name="expand">False</property>
627 <property name="fill">True</property>
628 <property name="position">0</property>
629 </packing>
630 </child>
631 <child>
632 <object class="GtkEntry" id="GNUNET_GTK_master_publish_dialog_update_id_entry">
633 <property name="visible">True</property>
634 <property name="can_focus">True</property>
635 <property name="tooltip_text" translatable="yes">Identifier under which the updated version will be published later.
636GNUnet clients will use it to try to find updated version of this publication automatically.
637Leaving this field blank makes publication unupdateable.</property>
638 <property name="invisible_char">●</property>
639 <property name="invisible_char_set">True</property>
640 <property name="primary_icon_activatable">False</property>
641 <property name="secondary_icon_activatable">False</property>
642 <property name="primary_icon_sensitive">True</property>
643 <property name="secondary_icon_sensitive">True</property>
644 </object>
645 <packing>
646 <property name="expand">True</property>
647 <property name="fill">True</property>
648 <property name="position">1</property>
649 </packing>
650 </child>
651 </object>
652 <packing>
653 <property name="expand">False</property>
654 <property name="fill">True</property>
655 <property name="position">4</property>
656 </packing>
282 </child> 657 </child>
283 </object> 658 </object>
284 <packing> 659 <packing>
285 <property name="expand">False</property> 660 <property name="expand">True</property>
286 <property name="fill">True</property> 661 <property name="fill">True</property>
287 <property name="padding">25</property> 662 <property name="position">2</property>
288 <property name="position">1</property>
289 </packing> 663 </packing>
290 </child> 664 </child>
291 </object> 665 </object>
292 <packing>
293 <property name="expand">False</property>
294 <property name="fill">True</property>
295 <property name="position">1</property>
296 </packing>
297 </child> 666 </child>
298 </object> 667 <child type="label_item">
299 <packing> 668 <placeholder/>
300 <property name="resize">False</property>
301 <property name="shrink">False</property>
302 </packing>
303 </child>
304 <child>
305 <object class="GtkScrolledWindow" id="GNUNET_GTK_master_publish_dialog_pseudonym_scrolled_window">
306 <property name="visible">True</property>
307 <property name="can_focus">True</property>
308 <property name="hadjustment">adjustment1</property>
309 <property name="vadjustment">adjustment2</property>
310 <property name="hscrollbar_policy">automatic</property>
311 <property name="vscrollbar_policy">automatic</property>
312 <property name="shadow_type">in</property>
313 <child>
314 <object class="GtkTreeView" id="GNUNET_GTK_master_publish_dialog_pseudonym_tree_view">
315 <property name="visible">True</property>
316 <property name="can_focus">True</property>
317 <property name="model">GNUNET_GTK_pseudonym_tree_store</property>
318 <property name="hadjustment">adjustment1</property>
319 <property name="vadjustment">adjustment2</property>
320 <property name="headers_clickable">False</property>
321 <property name="reorderable">True</property>
322 <property name="search_column">0</property>
323 <property name="rubber_banding">True</property>
324 <property name="enable_grid_lines">both</property>
325 <child>
326 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_name_column">
327 <property name="resizable">True</property>
328 <property name="title">Pseudonym</property>
329 <property name="clickable">True</property>
330 <property name="reorderable">True</property>
331 <property name="sort_indicator">True</property>
332 <child>
333 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_name_renderer"/>
334 <attributes>
335 <attribute name="text">0</attribute>
336 </attributes>
337 </child>
338 </object>
339 </child>
340 <child>
341 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_identifier_column">
342 <property name="sizing">autosize</property>
343 <property name="title">Current identifier</property>
344 <property name="clickable">True</property>
345 <child>
346 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_identifier_renderer">
347 <signal name="edited" handler="GNUNET_GTK_master_publish_dialog_pseudonym_identifier_renderer_edited_cb" swapped="no"/>
348 </object>
349 <attributes>
350 <attribute name="editable">8</attribute>
351 <attribute name="text">2</attribute>
352 </attributes>
353 </child>
354 </object>
355 </child>
356 <child>
357 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_updates_column">
358 <property name="sizing">autosize</property>
359 <property name="title">Update identifier</property>
360 <child>
361 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_updates_renderer">
362 <signal name="edited" handler="GNUNET_GTK_master_publish_dialog_pseudonym_updates_renderer_edited_cb" swapped="no"/>
363 </object>
364 <attributes>
365 <attribute name="editable">7</attribute>
366 <attribute name="text">5</attribute>
367 </attributes>
368 </child>
369 </object>
370 </child>
371 <child>
372 <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_description_column">
373 <property name="resizable">True</property>
374 <property name="title">Description (of existing content)</property>
375 <child>
376 <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_description_renderer">
377 <property name="wrap_mode">word</property>
378 </object>
379 <attributes>
380 <attribute name="text">6</attribute>
381 </attributes>
382 </child>
383 </object>
384 </child>
385 </object>
386 </child> 669 </child>
387 </object> 670 </object>
388 <packing> 671 <packing>
@@ -405,7 +688,6 @@
405 <child> 688 <child>
406 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_execute_button"> 689 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_execute_button">
407 <property name="label" translatable="yes">_Execute</property> 690 <property name="label" translatable="yes">_Execute</property>
408 <property name="use_action_appearance">False</property>
409 <property name="visible">True</property> 691 <property name="visible">True</property>
410 <property name="can_focus">True</property> 692 <property name="can_focus">True</property>
411 <property name="receives_default">True</property> 693 <property name="receives_default">True</property>
@@ -422,12 +704,13 @@
422 <child> 704 <child>
423 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_clear_button"> 705 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_clear_button">
424 <property name="label" translatable="yes">Remove all _Keywords</property> 706 <property name="label" translatable="yes">Remove all _Keywords</property>
425 <property name="use_action_appearance">False</property>
426 <property name="visible">True</property> 707 <property name="visible">True</property>
427 <property name="can_focus">True</property> 708 <property name="can_focus">True</property>
428 <property name="receives_default">True</property> 709 <property name="receives_default">True</property>
710 <property name="tooltip_text" translatable="yes">This button removes all keywords from all files and directories in this dialog.
711This is useful if you want to get rid of the automatically extracted keywords to make sure that your published file(s) are only available from the resulting URI or from keywords that you manually enter after clicking this button.
712Note that meta data is unaffected when using this function.</property>
429 <property name="use_underline">True</property> 713 <property name="use_underline">True</property>
430 <property name="tooltip_text" translatable="yes">This button removes all keywords from all files and directories in this dialog. This is useful if you want to get rid of the automatically extracted keywords to make sure that your published file(s) are only available from the resulting URI or from keywords that you manually enter after clicking this button. Note that meta data is unaffected when using this function.</property>
431 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_clear_button_clicked_cb" swapped="no"/> 714 <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_clear_button_clicked_cb" swapped="no"/>
432 </object> 715 </object>
433 <packing> 716 <packing>
@@ -440,7 +723,6 @@
440 <child> 723 <child>
441 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_cancel_button"> 724 <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_cancel_button">
442 <property name="label" translatable="yes">_Cancel</property> 725 <property name="label" translatable="yes">_Cancel</property>
443 <property name="use_action_appearance">False</property>
444 <property name="visible">True</property> 726 <property name="visible">True</property>
445 <property name="can_focus">True</property> 727 <property name="can_focus">True</property>
446 <property name="receives_default">True</property> 728 <property name="receives_default">True</property>
@@ -464,79 +746,28 @@
464 </object> 746 </object>
465 </child> 747 </child>
466 </object> 748 </object>
467 <object class="GtkAdjustment" id="adjustment6">
468 <property name="upper">100</property>
469 <property name="step_increment">1</property>
470 <property name="page_increment">10</property>
471 </object>
472 <object class="GtkTreeStore" id="GNUNET_GTK_pseudonym_tree_store">
473 <columns>
474 <!-- column-name local_name -->
475 <column type="gchararray"/>
476 <!-- column-name namespace_handle -->
477 <column type="gpointer"/>
478 <!-- column-name last_id -->
479 <column type="gchararray"/>
480 <!-- column-name last_uri -->
481 <column type="gchararray"/>
482 <!-- column-name last_meta -->
483 <column type="gpointer"/>
484 <!-- column-name next_id -->
485 <column type="gchararray"/>
486 <!-- column-name last_description_from_meta -->
487 <column type="gchararray"/>
488 <!-- column-name next_id_editable -->
489 <column type="gboolean"/>
490 <!-- column-name current_id_editable -->
491 <column type="gboolean"/>
492 </columns>
493 </object>
494 <object class="GtkAdjustment" id="adjustment1">
495 <property name="upper">100</property>
496 <property name="step_increment">1</property>
497 <property name="page_increment">10</property>
498 </object>
499 <object class="GtkAdjustment" id="adjustment2">
500 <property name="upper">100</property>
501 <property name="step_increment">1</property>
502 <property name="page_increment">10</property>
503 </object>
504 <object class="GtkAdjustment" id="adjustment5">
505 <property name="upper">100</property>
506 <property name="step_increment">1</property>
507 <property name="page_increment">10</property>
508 </object>
509 <object class="GtkImage" id="left_stock_image">
510 <property name="visible">True</property>
511 <property name="can_focus">False</property>
512 <property name="stock">gtk-go-back</property>
513 </object>
514 <object class="GtkImage" id="left_stock_image1">
515 <property name="visible">True</property>
516 <property name="can_focus">False</property>
517 <property name="stock">gtk-go-back</property>
518 </object>
519 <object class="GtkImage" id="new_stock_image"> 749 <object class="GtkImage" id="new_stock_image">
520 <property name="visible">True</property> 750 <property name="visible">True</property>
521 <property name="can_focus">False</property> 751 <property name="can_focus">False</property>
522 <property name="stock">gtk-new</property> 752 <property name="stock">gtk-new</property>
523 </object> 753 </object>
524 <object class="GtkImage" id="new_stock_image1">
525 <property name="visible">True</property>
526 <property name="can_focus">False</property>
527 <property name="stock">gtk-new</property>
528 </object>
529 <object class="GtkImage" id="right_stock_image"> 754 <object class="GtkImage" id="right_stock_image">
530 <property name="visible">True</property> 755 <property name="visible">True</property>
531 <property name="can_focus">False</property> 756 <property name="can_focus">False</property>
532 <property name="stock">gtk-go-forward</property> 757 <property name="stock">gtk-go-forward</property>
533 </object> 758 </object>
534 <object class="GtkImage" id="right_stock_image1"> 759 <object class="GtkImage" id="left_stock_image">
535 <property name="visible">True</property> 760 <property name="visible">True</property>
536 <property name="can_focus">False</property> 761 <property name="can_focus">False</property>
537 <property name="stock">gtk-go-forward</property> 762 <property name="stock">gtk-go-back</property>
763 </object>
764 <object class="GtkSizeGroup" id="GNUNET_GTK_master_publish_dialog_labels_sizegroup">
765 <widgets>
766 <widget name="GNUNET_GTK_master_publish_dialog_identifier_label"/>
767 <widget name="GNUNET_GTK_master_publish_dialog_update_id_label"/>
768 </widgets>
538 </object> 769 </object>
539 <object class="GtkSizeGroup" id="sizegroup1"> 770 <object class="GtkSizeGroup" id="GNUNET_GTK_master_publish_dialog_master_buttons_sizegroup">
540 <widgets> 771 <widgets>
541 <widget name="GNUNET_GTK_master_publish_dialog_execute_button"/> 772 <widget name="GNUNET_GTK_master_publish_dialog_execute_button"/>
542 <widget name="GNUNET_GTK_master_publish_dialog_cancel_button"/> 773 <widget name="GNUNET_GTK_master_publish_dialog_cancel_button"/>
diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am
index 9bfa0db6..6ea4a604 100644
--- a/src/fs/Makefile.am
+++ b/src/fs/Makefile.am
@@ -14,6 +14,7 @@ gnunet_fs_gtk_SOURCES = \
14 gnunet-fs-gtk.c gnunet-fs-gtk.h \ 14 gnunet-fs-gtk.c gnunet-fs-gtk.h \
15 gnunet-fs-gtk_about.c \ 15 gnunet-fs-gtk_about.c \
16 gnunet-fs-gtk_advertise-pseudonym.c \ 16 gnunet-fs-gtk_advertise-pseudonym.c \
17 gnunet-fs-gtk_advertise-pseudonym.h \
17 gnunet-fs-gtk_anonymity-widgets.c gnunet-fs-gtk_anonymity-widgets.h \ 18 gnunet-fs-gtk_anonymity-widgets.c gnunet-fs-gtk_anonymity-widgets.h \
18 gnunet-fs-gtk_common.c gnunet-fs-gtk_common.h \ 19 gnunet-fs-gtk_common.c gnunet-fs-gtk_common.h \
19 gnunet-fs-gtk_create-pseudonym.c \ 20 gnunet-fs-gtk_create-pseudonym.c \
@@ -28,7 +29,11 @@ gnunet_fs_gtk_SOURCES = \
28 gnunet-fs-gtk_unindex.c gnunet-fs-gtk_unindex.h \ 29 gnunet-fs-gtk_unindex.c gnunet-fs-gtk_unindex.h \
29 gnunet-fs-gtk_publish-dialog.c \ 30 gnunet-fs-gtk_publish-dialog.c \
30 gnunet-fs-gtk_publish-edit-dialog.c gnunet-fs-gtk_publish-edit-dialog.h \ 31 gnunet-fs-gtk_publish-edit-dialog.c gnunet-fs-gtk_publish-edit-dialog.h \
31 gnunet-fs-gtk_namespace_manager.c 32 gnunet-fs-gtk_namespace_organizer.c \
33 gnunet-fs-gtk_namespace_organizer.h \
34 gnunet-fs-gtk_namespace_manager.c \
35 gnunet-fs-gtk_namespace_manager.h
36
32gnunet_fs_gtk_LDADD = \ 37gnunet_fs_gtk_LDADD = \
33 $(top_builddir)/src/lib/libgnunetgtk.la \ 38 $(top_builddir)/src/lib/libgnunetgtk.la \
34 @GTK_LIBS@ \ 39 @GTK_LIBS@ \
diff --git a/src/fs/gnunet-fs-gtk.h b/src/fs/gnunet-fs-gtk.h
index 2d19a91a..4c3ccbfd 100644
--- a/src/fs/gnunet-fs-gtk.h
+++ b/src/fs/gnunet-fs-gtk.h
@@ -59,6 +59,9 @@ struct GNUNET_GTK_MainWindowContext
59 GtkWindow *ns_manager; 59 GtkWindow *ns_manager;
60 gulong ns_manager_delete_handler_id; 60 gulong ns_manager_delete_handler_id;
61 61
62 GtkWindow *ns_organizer;
63 gulong ns_organizer_delete_handler_id;
64
62 GtkFileChooser *download_location_chooser; 65 GtkFileChooser *download_location_chooser;
63 GtkEntry *download_name_entry; 66 GtkEntry *download_name_entry;
64 GtkComboBox *download_anonymity_combo; 67 GtkComboBox *download_anonymity_combo;
diff --git a/src/fs/gnunet-fs-gtk_advertise-pseudonym.c b/src/fs/gnunet-fs-gtk_advertise-pseudonym.c
index 69ac2714..e77798a4 100644
--- a/src/fs/gnunet-fs-gtk_advertise-pseudonym.c
+++ b/src/fs/gnunet-fs-gtk_advertise-pseudonym.c
@@ -28,6 +28,7 @@
28#include "gnunet-fs-gtk_common.h" 28#include "gnunet-fs-gtk_common.h"
29#include "gnunet-fs-gtk.h" 29#include "gnunet-fs-gtk.h"
30#include "gnunet-fs-gtk_publish-edit-dialog.h" 30#include "gnunet-fs-gtk_publish-edit-dialog.h"
31#include "gnunet-fs-gtk_advertise-pseudonym.h"
31 32
32 33
33/** 34/**
@@ -153,9 +154,6 @@ GNUNET_GTK_select_pseudonym_dialog_response_cb (GtkDialog * dialog,
153 struct GNUNET_FS_Namespace *ns; 154 struct GNUNET_FS_Namespace *ns;
154 struct GNUNET_FS_Namespace *nso; 155 struct GNUNET_FS_Namespace *nso;
155 GtkWindow *transient; 156 GtkWindow *transient;
156 struct NamespaceAdvertisementContext *nds;
157 struct GNUNET_CONTAINER_MetaData *meta;
158 struct GNUNET_FS_BlockOptions bo;
159 157
160 if (GTK_RESPONSE_OK != response_id) 158 if (GTK_RESPONSE_OK != response_id)
161 { 159 {
@@ -192,6 +190,23 @@ GNUNET_GTK_select_pseudonym_dialog_response_cb (GtkDialog * dialog,
192 gtk_widget_destroy (GTK_WIDGET (dialog)); 190 gtk_widget_destroy (GTK_WIDGET (dialog));
193 g_object_unref (G_OBJECT (builder)); 191 g_object_unref (G_OBJECT (builder));
194 192
193 GNUNET_FS_GTK_advertise_namespace (ns, transient);
194}
195
196/**
197 * Call the publication editor dialog in namespace advertising mode,
198 * and publish the namespace when it's OK'ed.
199 *
200 * @param ns namespace to advertise (takes ownership of it)
201 * @param transient_for parent window for the dialog
202 */
203void
204GNUNET_FS_GTK_advertise_namespace (struct GNUNET_FS_Namespace *ns, GtkWindow *transient_for)
205{
206 struct NamespaceAdvertisementContext *nds;
207 struct GNUNET_FS_BlockOptions bo;
208 struct GNUNET_CONTAINER_MetaData *meta;
209
195 nds = GNUNET_malloc (sizeof (struct NamespaceAdvertisementContext)); 210 nds = GNUNET_malloc (sizeof (struct NamespaceAdvertisementContext));
196 nds->ns = ns; 211 nds->ns = ns;
197 memset (&bo, 0, sizeof (struct GNUNET_FS_BlockOptions)); 212 memset (&bo, 0, sizeof (struct GNUNET_FS_BlockOptions));
@@ -204,8 +219,8 @@ GNUNET_GTK_select_pseudonym_dialog_response_cb (GtkDialog * dialog,
204 GNUNET_FS_file_information_create_empty_directory (NULL, NULL, NULL, meta, 219 GNUNET_FS_file_information_create_empty_directory (NULL, NULL, NULL, meta,
205 &bo, NULL); 220 &bo, NULL);
206 GNUNET_CONTAINER_meta_data_destroy (meta); 221 GNUNET_CONTAINER_meta_data_destroy (meta);
207 GNUNET_FS_GTK_edit_publish_dialog (transient, 222 GNUNET_FS_GTK_edit_publish_dialog (transient_for,
208 nds->fip, 223 nds->fip,
209 GNUNET_YES, 224 GNUNET_YES,
210 &adv_pseudonym_edit_publish_dialog_cb, 225 &adv_pseudonym_edit_publish_dialog_cb,
211 nds); 226 nds);
diff --git a/src/fs/gnunet-fs-gtk_advertise-pseudonym.h b/src/fs/gnunet-fs-gtk_advertise-pseudonym.h
new file mode 100644
index 00000000..c5c53de7
--- /dev/null
+++ b/src/fs/gnunet-fs-gtk_advertise-pseudonym.h
@@ -0,0 +1,45 @@
1/*
2 This file is part of GNUnet
3 (C) 2005, 2006, 2010, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21#ifndef GNUNET_FS_GTK_ADVERTISE_PSEUDONYM_H
22#define GNUNET_FS_GTK_ADVERTISE_PSEUDONYM_H
23
24/**
25 * @file src/fs/gnunet-fs-gtk_advertise-pseudonym.h
26 * @author Christian Grothoff
27 * @brief run the advertising dialog (using the edit-publish
28 * dialog functions) and finally do the advertising
29 */
30#include "gnunet-fs-gtk_common.h"
31
32/**
33 * Call the publication editor dialog in namespace advertising mode,
34 * and publish the namespace when it's OK'ed.
35 *
36 * @param ns namespace to advertise (takes ownership of it)
37 * @param transient_for parent window for the dialog
38 */
39void
40GNUNET_FS_GTK_advertise_namespace (struct GNUNET_FS_Namespace *ns, GtkWindow *transient_for);
41
42#endif
43
44/* end of gnunet-fs-gtk_advertise-pseudonym.h */
45
diff --git a/src/fs/gnunet-fs-gtk_download-save-as.c b/src/fs/gnunet-fs-gtk_download-save-as.c
index 76022afa..f33daa3a 100644
--- a/src/fs/gnunet-fs-gtk_download-save-as.c
+++ b/src/fs/gnunet-fs-gtk_download-save-as.c
@@ -316,7 +316,7 @@ GNUNET_FS_GTK_download_context_start_download (struct DownloadEntry *de)
316 if (de->is_recursive) 316 if (de->is_recursive)
317 opt |= GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE; 317 opt |= GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE;
318 len = GNUNET_FS_uri_chk_get_file_size (de->uri); 318 len = GNUNET_FS_uri_chk_get_file_size (de->uri);
319 if (NULL != de->sr->result) 319 if ((NULL != de->sr) && (NULL != de->sr->result))
320 { 320 {
321 GNUNET_break (NULL != 321 GNUNET_break (NULL !=
322 GNUNET_FS_download_start_from_search (fs, 322 GNUNET_FS_download_start_from_search (fs,
diff --git a/src/fs/gnunet-fs-gtk_main-window-search.c b/src/fs/gnunet-fs-gtk_main-window-search.c
index 6a049f1b..c64e5940 100644
--- a/src/fs/gnunet-fs-gtk_main-window-search.c
+++ b/src/fs/gnunet-fs-gtk_main-window-search.c
@@ -80,7 +80,7 @@ start_search (struct GNUNET_GTK_MainWindowContext *main_ctx)
80 GtkTreeIter iter; 80 GtkTreeIter iter;
81 81
82 nsid = NULL; 82 nsid = NULL;
83 ref = g_object_get_data (G_OBJECT (main_ctx->ns_dropdown_button), "selected-row-reference"); 83 ref = main_ctx->selected_ns_row;
84 if (NULL != ref) 84 if (NULL != ref)
85 { 85 {
86 GtkTreePath *namespace_treepath; 86 GtkTreePath *namespace_treepath;
diff --git a/src/fs/gnunet-fs-gtk_namespace_manager.h b/src/fs/gnunet-fs-gtk_namespace_manager.h
new file mode 100644
index 00000000..cffa6894
--- /dev/null
+++ b/src/fs/gnunet-fs-gtk_namespace_manager.h
@@ -0,0 +1,36 @@
1/*
2 This file is part of GNUnet
3 (C) 2005, 2006, 2010, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file src/fs/gnunet-fs-gtk_namespace_manager.h
23 * @author LRN
24 */
25
26#ifndef GNUNET_FS_GTK_NAMESPACE_MANAGER_H
27#define GNUNET_FS_GTK_NAMESPACE_MANAGER_H
28
29#include "gnunet-fs-gtk_common.h"
30#include "gnunet-fs-gtk.h"
31
32GtkObject *
33GNUNET_GTK_namespace_manager_open (struct GNUNET_GTK_MainWindowContext *main_ctx);
34
35#endif /* GNUNET_FS_GTK_NAMESPACE_MANAGER_H */
36/* end of gnunet-fs-gtk_namespace_manager.c */
diff --git a/src/fs/gnunet-fs-gtk_namespace_organizer.c b/src/fs/gnunet-fs-gtk_namespace_organizer.c
new file mode 100644
index 00000000..7e0df276
--- /dev/null
+++ b/src/fs/gnunet-fs-gtk_namespace_organizer.c
@@ -0,0 +1,744 @@
1/*
2 This file is part of GNUnet
3 (C) 2005, 2006, 2010, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file src/fs/gnunet-fs-gtk_namespace_organizer.c
23 * @author LRN
24 */
25#include "gnunet-fs-gtk_common.h"
26#include "gnunet-fs-gtk.h"
27#include "gnunet-fs-gtk_advertise-pseudonym.h"
28#include <gnunet/gnunet_util_lib.h>
29#include <gnunet/gnunet_fs_service.h>
30
31struct GNUNET_GTK_NamespaceSelectorContext
32{
33 GtkBuilder *builder;
34 GtkWidget *my_ns;
35 GtkTreeSelection *my_ns_sel;
36 GtkListStore *my_ns_store;
37 GtkWindow *namespace_organizer;
38 GtkWidget *create_button;
39 GtkWidget *delete_button;
40 GtkWidget *advertise_button;
41 GtkWidget *do_delete_button;
42 GtkWidget *do_keep_button;
43 GtkWidget *progress_spinner;
44 GtkWidget *progress_label;
45 GtkWidget *confirmation_label;
46 char *default_ns;
47 GtkTreeRowReference *default_ns_rref;
48 struct GNUNET_GTK_MainWindowContext *main_ctx;
49
50 struct GNUNET_FS_NamespaceCreationContext *nscreator;
51};
52
53#define GNUNET_GTK_MY_NAMESPACES_NAME_COLUMN 0
54#define GNUNET_GTK_MY_NAMESPACES_KEY_COLUMN 1
55#define GNUNET_GTK_MY_NAMESPACES_KEY_BINARY_COLUMN 2
56#define GNUNET_GTK_MY_NAMESPACES_USE_THIS_COLUMN 3
57#define GNUNET_GTK_MY_NAMESPACES_ACTUAL_NAME_COLUMN 4
58
59void
60GNUNET_GTK_namespace_organizer_namespaces_treeview_column_name_text_edited_cb (
61 GtkCellRendererText *renderer, gchar *path, gchar *new_text,
62 gpointer user_data)
63{
64 struct GNUNET_GTK_NamespaceSelectorContext *ctx = user_data;
65 GtkTreePath *tree_path;
66 GtkTreeIter iter;
67
68 if (strlen (new_text) == 0)
69 return;
70
71 tree_path = gtk_tree_path_new_from_string (path);
72 if (tree_path != NULL)
73 {
74 if (gtk_tree_model_get_iter (GTK_TREE_MODEL (ctx->my_ns_store),
75 &iter, tree_path))
76 {
77 struct GNUNET_HashCode *nsid;
78 char *old_name;
79 gtk_tree_model_get (GTK_TREE_MODEL (ctx->my_ns_store), &iter,
80 GNUNET_GTK_MY_NAMESPACES_NAME_COLUMN, &old_name,
81 GNUNET_GTK_MY_NAMESPACES_KEY_BINARY_COLUMN, &nsid,
82 -1);
83
84 if ((NULL == nsid) ||
85 (GNUNET_OK == GNUNET_FS_namespace_rename (
86 GNUNET_FS_GTK_get_fs_handle (), old_name, new_text)))
87 {
88 gtk_list_store_set (ctx->my_ns_store, &iter,
89 GNUNET_GTK_MY_NAMESPACES_NAME_COLUMN, new_text, -1);
90 }
91
92 GNUNET_free (old_name);
93 }
94 gtk_tree_path_free (tree_path);
95 }
96}
97
98/**
99 * Iterate over items in the liststore, find the one that has
100 * KEY_BINARY == NULL - that is the item for which the key is
101 * being generated.
102 * We need this because we don't store a rowreference to the item,
103 * although maybe we should...
104 *
105 * @param ctx NS organizer context
106 * @param iter pointer to GTK Tree iterator. If the call succeeds,
107 * iter will refer to the item found.
108 * @return TRUE if item is found (and *iter is valid), FALSE otherwise
109 */
110static gboolean
111find_item_being_generated (struct GNUNET_GTK_NamespaceSelectorContext *ctx, GtkTreeIter *iter)
112{
113 gint row_count;
114 struct GNUNET_HashCode *nsid;
115
116 row_count = gtk_tree_model_iter_n_children (
117 GTK_TREE_MODEL (ctx->my_ns_store), NULL);
118
119 if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (
120 ctx->my_ns_store), iter))
121 {
122 gint i;
123 for (i = 0; i < row_count; i++)
124 {
125 gtk_tree_model_get (GTK_TREE_MODEL (ctx->my_ns_store), iter,
126 GNUNET_GTK_MY_NAMESPACES_KEY_BINARY_COLUMN, &nsid,
127 -1);
128 if (nsid == NULL)
129 return TRUE;
130 if (TRUE != gtk_tree_model_iter_next (GTK_TREE_MODEL (
131 ctx->my_ns_store), iter))
132 break;
133 }
134 }
135 return FALSE;
136}
137
138static void
139stop_generation (struct GNUNET_GTK_NamespaceSelectorContext *ctx)
140{
141 GtkTreeIter iter;
142 GNUNET_FS_namespace_create_stop (ctx->nscreator);
143 ctx->nscreator = NULL;
144 if (find_item_being_generated (ctx, &iter))
145 gtk_list_store_remove (ctx->my_ns_store, &iter);
146 gtk_widget_set_visible (ctx->progress_spinner, FALSE);
147 gtk_widget_set_visible (ctx->progress_label, FALSE);
148}
149
150static void
151free_lists_contents (struct GNUNET_GTK_NamespaceSelectorContext *ctx)
152{
153 GtkTreeIter iter;
154 gint i;
155 gint row_count;
156 struct GNUNET_HashCode *nsid;
157
158 row_count = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (
159 ctx->my_ns_store), NULL);
160 if (! gtk_tree_model_get_iter_first (GTK_TREE_MODEL (
161 ctx->my_ns_store), &iter))
162 return;
163
164 for (i = 0; i < row_count; i++)
165 {
166 gtk_tree_model_get (GTK_TREE_MODEL (ctx->my_ns_store), &iter,
167 GNUNET_GTK_MY_NAMESPACES_KEY_BINARY_COLUMN, &nsid,
168 -1);
169 GNUNET_free (nsid);
170 if (TRUE != gtk_tree_model_iter_next (GTK_TREE_MODEL (
171 ctx->my_ns_store), &iter))
172 break;
173 }
174
175 gtk_list_store_clear (ctx->my_ns_store);
176}
177
178void
179GNUNET_GTK_namespace_organizer_dialog_response_cb (GtkDialog *dialog,
180 gint response_id, gpointer user_data)
181{
182 struct GNUNET_GTK_NamespaceSelectorContext *ctx = user_data;
183 switch (response_id)
184 {
185 case GTK_RESPONSE_CLOSE:
186 default:
187 if (ctx->nscreator)
188 stop_generation (ctx);
189 free_lists_contents (ctx);
190 gtk_widget_destroy (GTK_WIDGET (ctx->namespace_organizer));
191 GNUNET_free (ctx);
192 }
193}
194
195static void
196save_default_ns_reference (struct GNUNET_GTK_NamespaceSelectorContext *ctx, GtkTreeIter *iter)
197{
198 GtkTreeRowReference *ref;
199 GtkTreePath *rowpath;
200
201 rowpath = gtk_tree_model_get_path (GTK_TREE_MODEL (ctx->my_ns_store), iter);
202 if (rowpath)
203 {
204 ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (ctx->my_ns_store), rowpath);
205 if (ref)
206 {
207 gtk_tree_row_reference_free (ctx->default_ns_rref);
208 ctx->default_ns_rref = ref;
209 }
210 gtk_tree_path_free (rowpath);
211 }
212}
213
214
215static void
216try_make_default (struct GNUNET_GTK_NamespaceSelectorContext *ctx, GtkTreeIter *toggled)
217{
218 GtkTreeIter iter;
219 gchar *new_default_ns;
220 gint i;
221 gint row_count;
222 GtkTreePath *path;
223
224 row_count = gtk_tree_model_iter_n_children (
225 GTK_TREE_MODEL (ctx->my_ns_store), NULL);
226 if (! gtk_tree_model_get_iter_first (
227 GTK_TREE_MODEL (ctx->my_ns_store), &iter))
228 return;
229
230 path = gtk_tree_row_reference_get_path (ctx->default_ns_rref);
231 if (path)
232 {
233 /* We know where previous default was, only untoggle that item */
234 GtkTreeIter old_default;
235 if (gtk_tree_model_get_iter (GTK_TREE_MODEL (ctx->my_ns_store), &old_default, path))
236 {
237 gtk_list_store_set (ctx->my_ns_store, &old_default,
238 GNUNET_GTK_MY_NAMESPACES_USE_THIS_COLUMN, FALSE,
239 -1);
240 }
241 gtk_tree_path_free (path);
242 }
243 else
244 {
245 /* Just untoggle all items */
246 for (i = 0; i < row_count; i++)
247 {
248 gtk_list_store_set (ctx->my_ns_store, &iter,
249 GNUNET_GTK_MY_NAMESPACES_USE_THIS_COLUMN, FALSE,
250 -1);
251 if (TRUE != gtk_tree_model_iter_next (
252 GTK_TREE_MODEL (ctx->my_ns_store), &iter))
253 break;
254 }
255 }
256
257 gtk_list_store_set (ctx->my_ns_store, toggled,
258 GNUNET_GTK_MY_NAMESPACES_USE_THIS_COLUMN, TRUE, -1);
259 gtk_tree_model_get (GTK_TREE_MODEL (ctx->my_ns_store), toggled,
260 GNUNET_GTK_MY_NAMESPACES_NAME_COLUMN, &new_default_ns, -1);
261
262 save_default_ns_reference (ctx, toggled);
263
264 if (new_default_ns)
265 {
266 ctx->default_ns = GNUNET_strdup (new_default_ns);
267 GNUNET_CONFIGURATION_set_value_string (
268 (struct GNUNET_CONFIGURATION_Handle *) GNUNET_FS_GTK_get_configuration (),
269 "gnunet-fs-gtk", "DEFAULT_NAMESPACE", ctx->default_ns);
270
271 g_free (new_default_ns);
272 }
273}
274
275
276
277/**
278 * Callback with information about local (!) namespaces.
279 * Contains the names of the local namespace and the global
280 * ID.
281 *
282 * @param cls closure
283 * @param name human-readable identifier of the namespace
284 * @param id hash identifier for the namespace
285 */
286static void
287populate_my_ns_list (void *cls, const char *name,
288 const struct GNUNET_HashCode * id)
289{
290 struct GNUNET_GTK_NamespaceSelectorContext *ctx = cls;
291
292 struct GNUNET_CRYPTO_HashAsciiEncoded identifier;
293 GtkTreeIter my_iter;
294 struct GNUNET_HashCode *nsid;
295 gboolean is_default;
296
297 nsid = GNUNET_malloc (sizeof (struct GNUNET_HashCode));
298 *nsid = *id;
299
300 GNUNET_CRYPTO_hash_to_enc (nsid, &identifier);
301
302 if (NULL == ctx->default_ns)
303 {
304 ctx->default_ns = GNUNET_strdup (name);
305 GNUNET_CONFIGURATION_set_value_string (
306 (struct GNUNET_CONFIGURATION_Handle *) GNUNET_FS_GTK_get_configuration (),
307 "gnunet-fs-gtk", "DEFAULT_NAMESPACE", ctx->default_ns);
308 is_default = TRUE;
309 }
310 else
311 is_default = (0 == strcmp (name, ctx->default_ns)) ? TRUE : FALSE;
312
313 gtk_list_store_insert_with_values (ctx->my_ns_store, &my_iter, G_MAXINT,
314 GNUNET_GTK_MY_NAMESPACES_NAME_COLUMN, name,
315 GNUNET_GTK_MY_NAMESPACES_KEY_COLUMN, identifier.encoding,
316 GNUNET_GTK_MY_NAMESPACES_KEY_BINARY_COLUMN, nsid,
317 GNUNET_GTK_MY_NAMESPACES_USE_THIS_COLUMN, is_default,
318 GNUNET_GTK_MY_NAMESPACES_ACTUAL_NAME_COLUMN, NULL,
319 -1);
320
321 if (is_default)
322 save_default_ns_reference (ctx, &my_iter);
323}
324
325static void
326set_normal_state (struct GNUNET_GTK_NamespaceSelectorContext *ctx, gboolean anything_selected)
327{
328 gtk_widget_set_visible (ctx->do_delete_button, FALSE);
329 gtk_widget_set_visible (ctx->do_keep_button, FALSE);
330 gtk_widget_set_visible (ctx->confirmation_label, FALSE);
331
332 gtk_widget_set_sensitive (ctx->advertise_button, anything_selected);
333 gtk_widget_set_sensitive (ctx->delete_button, anything_selected);
334 if (NULL == ctx->nscreator)
335 gtk_widget_set_sensitive (ctx->create_button, TRUE);
336}
337
338static void
339my_ns_selection_changed (GtkTreeSelection *treeselection,
340 gpointer user_data)
341{
342 struct GNUNET_GTK_NamespaceSelectorContext *ctx = user_data;
343 GtkTreeIter iter;
344 struct GNUNET_HashCode *nsid;
345 gboolean selected;
346
347 nsid = NULL;
348 selected = gtk_tree_selection_get_selected (ctx->my_ns_sel, NULL, &iter);
349 if (selected)
350 gtk_tree_model_get (GTK_TREE_MODEL (ctx->my_ns_store), &iter,
351 GNUNET_GTK_MY_NAMESPACES_KEY_BINARY_COLUMN, &nsid, -1);
352 if (NULL == nsid)
353 selected = FALSE;
354 set_normal_state (ctx, selected);
355}
356
357GtkWindow *
358GNUNET_GTK_namespace_organizer_open (struct GNUNET_GTK_MainWindowContext *main_ctx)
359{
360 struct GNUNET_GTK_NamespaceSelectorContext *ctx;
361 const struct GNUNET_CONFIGURATION_Handle *cfg;
362
363 ctx = GNUNET_malloc (sizeof (struct GNUNET_GTK_NamespaceSelectorContext));
364 ctx->builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_namespace_organizer.glade", ctx);
365 if (ctx->builder == NULL)
366 {
367 GNUNET_break (0);
368 GNUNET_free (ctx);
369 return NULL;
370 }
371
372 ctx->main_ctx = main_ctx;
373
374 ctx->nscreator = NULL;
375
376 /* initialize widget references */
377 ctx->my_ns = GTK_WIDGET (gtk_builder_get_object (ctx->builder,
378 "GNUNET_GTK_namespace_organizer_namespaces_treeview"));
379 ctx->my_ns_sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (
380 ctx->my_ns));
381 ctx->my_ns_store = GTK_LIST_STORE (gtk_tree_view_get_model (
382 GTK_TREE_VIEW (ctx->my_ns)));
383 ctx->namespace_organizer = GTK_WINDOW (gtk_builder_get_object (
384 ctx->builder, "GNUNET_GTK_namespace_organizer_dialog"));
385 ctx->create_button = GTK_WIDGET (gtk_builder_get_object (ctx->builder,
386 "GNUNET_GTK_namespace_organizer_namespaces_create_namespace_button"));
387 ctx->advertise_button = GTK_WIDGET (gtk_builder_get_object (ctx->builder,
388 "GNUNET_GTK_namespace_organizer_namespaces_advertise_namespace_button"));
389 ctx->delete_button = GTK_WIDGET (gtk_builder_get_object (ctx->builder,
390 "GNUNET_GTK_namespace_organizer_namespaces_delete_namespace_button"));
391 ctx->do_delete_button = GTK_WIDGET (gtk_builder_get_object (ctx->builder,
392 "GNUNET_GTK_namespace_organizer_namespaces_delete_namespace_confirmation_button"));
393 ctx->do_keep_button = GTK_WIDGET (gtk_builder_get_object (ctx->builder,
394 "GNUNET_GTK_namespace_organizer_namespaces_delete_namespace_unconfirmation_button"));
395 ctx->progress_spinner = GTK_WIDGET (gtk_builder_get_object (ctx->builder,
396 "GNUNET_GTK_namespace_organizer_namespaces_create_namespace_progress_spinner"));
397 ctx->progress_label = GTK_WIDGET (gtk_builder_get_object (ctx->builder,
398 "GNUNET_GTK_namespace_organizer_namespaces_create_namespace_progress_label"));
399 ctx->confirmation_label = GTK_WIDGET (gtk_builder_get_object (ctx->builder,
400 "GNUNET_GTK_namespace_organizer_namespaces_delete_namespace_confirmation_label"));
401
402 /* connect signals; FIXME-GTK3: these could be connected with (modern) Glade */
403 g_signal_connect (G_OBJECT (ctx->my_ns_sel), "changed",
404 G_CALLBACK (my_ns_selection_changed), ctx);
405
406 cfg = GNUNET_FS_GTK_get_configuration ();
407
408 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg,
409 "gnunet-fs-gtk", "DEFAULT_NAMESPACE", &ctx->default_ns))
410 ctx->default_ns = NULL;
411
412 gtk_widget_set_sensitive (ctx->advertise_button, FALSE);
413 gtk_widget_set_sensitive (ctx->delete_button, FALSE);
414
415 gtk_widget_set_visible (ctx->do_delete_button, FALSE);
416 gtk_widget_set_visible (ctx->do_keep_button, FALSE);
417 gtk_widget_set_visible (ctx->progress_spinner, FALSE);
418 gtk_widget_set_visible (ctx->progress_label, FALSE);
419 gtk_widget_set_visible (ctx->confirmation_label, FALSE);
420
421 /* populate namespace model */
422 GNUNET_FS_namespace_list (GNUNET_FS_GTK_get_fs_handle (),
423 populate_my_ns_list, ctx);
424
425 /* show dialog */
426 gtk_window_present (ctx->namespace_organizer);
427 return ctx->namespace_organizer;
428}
429
430void
431GNUNET_GTK_namespace_organizer_dialog_destroy_cb (GtkWindow *object, gpointer user_data)
432{
433 struct GNUNET_GTK_MainWindowContext *ctx = user_data;
434 g_signal_handler_disconnect (object, ctx->ns_organizer_delete_handler_id);
435 g_object_unref (G_OBJECT (ctx->ns_organizer));
436 ctx->ns_organizer = NULL;
437 ctx->ns_organizer_delete_handler_id = 0;
438 return;
439}
440
441void
442GNUNET_GTK_open_ns_organizer (struct GNUNET_GTK_MainWindowContext *ctx)
443{
444 if (ctx->ns_organizer != NULL)
445 {
446 gtk_window_present (ctx->ns_organizer);
447 return;
448 }
449
450 ctx->ns_organizer = GNUNET_GTK_namespace_organizer_open (ctx);
451 if (ctx->ns_organizer == NULL)
452 return;
453
454 g_object_ref (G_OBJECT (ctx->ns_organizer));
455 ctx->ns_organizer_delete_handler_id = g_signal_connect (G_OBJECT (ctx->ns_organizer), "destroy", G_CALLBACK (GNUNET_GTK_namespace_organizer_dialog_destroy_cb), ctx);
456}
457
458void
459GNUNET_GTK_namespace_organizer_namespaces_advertise_namespace_button_clicked_cb (
460 GtkButton *button, gpointer user_data)
461{
462 struct GNUNET_GTK_NamespaceSelectorContext *ctx = user_data;
463 GtkTreeIter iter;
464 gchar *name;
465 gboolean selected;
466 struct GNUNET_HashCode id;
467 struct GNUNET_HashCode *nsid;
468
469 nsid = NULL;
470 name = NULL;
471 if (gtk_tree_selection_get_selected (ctx->my_ns_sel, NULL, &iter))
472 gtk_tree_model_get (GTK_TREE_MODEL (ctx->my_ns_store), &iter,
473 GNUNET_GTK_MY_NAMESPACES_NAME_COLUMN, &name,
474 GNUNET_GTK_MY_NAMESPACES_KEY_BINARY_COLUMN, &nsid,
475 -1);
476 if (NULL != nsid)
477 {
478 struct GNUNET_FS_Namespace *ns;
479 ns = GNUNET_FS_namespace_open_existing (GNUNET_FS_GTK_get_fs_handle (), name);
480 if (ns)
481 GNUNET_FS_GTK_advertise_namespace (ns, ctx->namespace_organizer);
482 }
483 g_free (name);
484}
485
486void
487GNUNET_GTK_namespace_organizer_namespaces_delete_namespace_unconfirmation_button_clicked_cb (
488 GtkButton *button, gpointer user_data)
489{
490 set_normal_state (user_data, TRUE);
491}
492
493
494void
495GNUNET_GTK_namespace_organizer_namespaces_delete_namespace_confirmation_button_clicked_cb (
496 GtkButton *button, gpointer user_data)
497{
498 struct GNUNET_GTK_NamespaceSelectorContext *ctx = user_data;
499 GtkTreeIter iter;
500 gchar *name;
501 gboolean selected;
502 struct GNUNET_HashCode id;
503 struct GNUNET_HashCode *nsid;
504
505 nsid = NULL;
506 name = NULL;
507 selected = gtk_tree_selection_get_selected (ctx->my_ns_sel, NULL, &iter);
508 if (selected)
509 gtk_tree_model_get (GTK_TREE_MODEL (ctx->my_ns_store), &iter,
510 GNUNET_GTK_MY_NAMESPACES_NAME_COLUMN, &name,
511 GNUNET_GTK_MY_NAMESPACES_KEY_BINARY_COLUMN, &nsid,
512 -1);
513 if (NULL == nsid)
514 selected = FALSE;
515
516 if (selected)
517 {
518 struct GNUNET_FS_Namespace *ns;
519 ns = GNUNET_FS_namespace_open_existing (GNUNET_FS_GTK_get_fs_handle (), name);
520 if (ns)
521 {
522 if (GNUNET_FS_namespace_get_public_key_hash (ns, &id))
523 {
524 if (0 == GNUNET_CRYPTO_hash_cmp (&id, nsid))
525 {
526 GtkTreeIter first;
527
528 GNUNET_free (nsid);
529 gtk_list_store_remove (ctx->my_ns_store, &iter);
530 GNUNET_FS_namespace_delete (ns, GNUNET_YES);
531
532 if (gtk_tree_model_get_iter_first (
533 GTK_TREE_MODEL (ctx->my_ns_store), &first))
534 try_make_default (ctx, &first);
535 }
536 else
537 {
538 /* We were trying to delete namespace FOO with key X
539 * but when we opened FOO, we discovered that its key is Y.
540 * Clearly this is not the right namespace (something changed
541 * the namespace list right under us?).
542 */
543 /* TODO: display error message */
544 }
545 }
546 else
547 {
548 /* We were trying to delete namespace FOO,
549 * but we can't even get its key
550 */
551 /* TODO: display error message */
552 GNUNET_FS_namespace_delete (ns, GNUNET_NO);
553 }
554 }
555 }
556 g_free (name);
557 set_normal_state (user_data, selected);
558}
559
560void
561GNUNET_GTK_namespace_organizer_namespaces_delete_namespace_button_clicked_cb (
562 GtkButton *button, gpointer user_data)
563{
564 struct GNUNET_GTK_NamespaceSelectorContext *ctx = user_data;
565 gtk_widget_set_visible (ctx->do_delete_button, TRUE);
566 gtk_widget_set_visible (ctx->do_keep_button, TRUE);
567 gtk_widget_set_visible (ctx->confirmation_label, TRUE);
568 gtk_widget_set_sensitive (ctx->advertise_button, FALSE);
569 gtk_widget_set_sensitive (ctx->delete_button, FALSE);
570 gtk_widget_set_sensitive (ctx->create_button, FALSE);
571}
572
573char *
574generate_local_ns_name ()
575{
576 const char *table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
577 size_t tablelen = strlen (table);
578 char random_str[9];
579 char *result;
580 int i;
581 for (i = 0; i < 8; i++)
582 {
583 uint32_t index = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, tablelen);
584 GNUNET_assert (index < tablelen);
585 random_str[i] = table[index];
586 }
587 random_str[8] = '\0';
588
589 GNUNET_asprintf (&result, _("MyNamespace-%s"), random_str);
590 return result;
591}
592
593
594static void
595ns_created (void *cls, struct GNUNET_FS_Namespace *ns, const char *emsg)
596{
597 struct GNUNET_GTK_NamespaceSelectorContext *ctx = cls;
598
599 GtkTreeIter iter;
600 gboolean found_item;
601 struct GNUNET_HashCode *nsid;
602 struct GNUNET_HashCode id;
603
604 gtk_widget_set_visible (ctx->progress_spinner, FALSE);
605 gtk_widget_set_visible (ctx->progress_label, FALSE);
606
607 /* We don't keep a row reference to the placeholder ns item,
608 * so let's find it (it's the only one with nsid == NULL)
609 */
610 ctx->nscreator = NULL;
611
612 found_item = find_item_being_generated (ctx, &iter);
613
614 /* If ns was created, get its public key hash */
615 nsid = NULL;
616 if ((NULL != ns) && (GNUNET_OK == GNUNET_FS_namespace_get_public_key_hash (ns, &id)))
617 {
618 nsid = GNUNET_malloc (sizeof (struct GNUNET_HashCode));
619 memcpy (nsid, &id, sizeof (struct GNUNET_HashCode));
620 }
621
622 /* If anything of the above went wrong, or ns creation failed, we abort */
623 if ((NULL == ns) || (NULL == nsid) || (!found_item))
624 {
625 /* TODO: figure out how to present an error message to the user */
626 if (ns)
627 GNUNET_FS_namespace_delete (ns, GNUNET_NO);
628
629 if (nsid)
630 GNUNET_free (nsid);
631
632 if (found_item)
633 gtk_list_store_remove (ctx->my_ns_store, &iter);
634 }
635 else
636 {
637 gchar *actual_name;
638 gchar *name;
639 struct GNUNET_CRYPTO_HashAsciiEncoded identifier;
640
641 gtk_tree_model_get (GTK_TREE_MODEL (ctx->my_ns_store), &iter,
642 GNUNET_GTK_MY_NAMESPACES_NAME_COLUMN, &name,
643 GNUNET_GTK_MY_NAMESPACES_ACTUAL_NAME_COLUMN, &actual_name,
644 -1);
645
646 /* Renaming was delayed until generation is finished. */
647 if (0 != strcmp (actual_name, name))
648 if (GNUNET_OK != GNUNET_FS_namespace_rename (
649 GNUNET_FS_GTK_get_fs_handle (), actual_name, name))
650 {
651 g_free (name);
652 name = g_strdup (actual_name);
653 }
654
655 GNUNET_CRYPTO_hash_to_enc (nsid, &identifier);
656
657 gtk_list_store_set (ctx->my_ns_store, &iter,
658 GNUNET_GTK_MY_NAMESPACES_KEY_COLUMN, identifier.encoding,
659 GNUNET_GTK_MY_NAMESPACES_KEY_BINARY_COLUMN, nsid,
660 GNUNET_GTK_MY_NAMESPACES_NAME_COLUMN, name,
661 GNUNET_GTK_MY_NAMESPACES_ACTUAL_NAME_COLUMN, NULL,
662 -1);
663
664 g_free (actual_name);
665 g_free (name);
666 }
667}
668
669
670static void
671create_namespace (struct GNUNET_GTK_NamespaceSelectorContext *ctx)
672{
673 gchar *name;
674 GtkTreeIter my_iter;
675 struct GNUNET_FS_Namespace *ns;
676 gint row_count;
677
678 if (ctx->nscreator)
679 return;
680
681 ns = NULL;
682 name = NULL;
683 do
684 {
685 if (ns)
686 GNUNET_FS_namespace_delete (ns, GNUNET_NO);
687 GNUNET_free_non_null (name);
688 name = generate_local_ns_name ();
689 ns = GNUNET_FS_namespace_open_existing (GNUNET_FS_GTK_get_fs_handle (), name);
690 } while (NULL != ns);
691
692 ctx->nscreator = GNUNET_FS_namespace_create_start (
693 GNUNET_FS_GTK_get_fs_handle (), name, ns_created, ctx);
694 if (NULL == ctx->nscreator)
695 {
696 GNUNET_free (name);
697 return;
698 }
699
700 gtk_list_store_insert_with_values (ctx->my_ns_store, &my_iter, G_MAXINT,
701 GNUNET_GTK_MY_NAMESPACES_NAME_COLUMN, name,
702 GNUNET_GTK_MY_NAMESPACES_ACTUAL_NAME_COLUMN, name,
703 GNUNET_GTK_MY_NAMESPACES_KEY_COLUMN, _("Key is not ready yet"),
704 GNUNET_GTK_MY_NAMESPACES_KEY_BINARY_COLUMN, NULL,
705 GNUNET_GTK_MY_NAMESPACES_USE_THIS_COLUMN, FALSE,
706 -1);
707
708 GNUNET_free (name);
709
710 gtk_widget_set_visible (ctx->progress_spinner, TRUE);
711 gtk_widget_set_visible (ctx->progress_label, TRUE);
712
713 row_count = gtk_tree_model_iter_n_children (
714 GTK_TREE_MODEL (ctx->my_ns_store), NULL);
715 if (row_count == 1)
716 try_make_default (ctx, &my_iter);
717}
718
719void
720GNUNET_GTK_namespace_organizer_namespaces_create_namespace_button_clicked_cb (
721 GtkButton *button, gpointer user_data)
722{
723 create_namespace (user_data);
724}
725
726void
727GNUNET_GTK_namespace_organizer_namespaces_treeview_column_usethis_toggle_toggled_cb (
728 GtkCellRendererToggle *cell_renderer, gchar *path, gpointer user_data)
729{
730 struct GNUNET_GTK_NamespaceSelectorContext *ctx = user_data;
731 GtkTreeIter iter;
732 if (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ctx->my_ns_store),
733 &iter, path))
734 try_make_default (ctx, &iter);
735}
736
737void
738GNUNET_GTK_main_menu_file_organize_namespaces_activate_cb (GtkMenuItem *menuitem,
739 gpointer user_data)
740{
741 GNUNET_GTK_open_ns_organizer (user_data);
742}
743
744/* end of gnunet-fs-gtk_namespace_organizer.c */
diff --git a/src/fs/gnunet-fs-gtk_namespace_organizer.h b/src/fs/gnunet-fs-gtk_namespace_organizer.h
new file mode 100644
index 00000000..0cc20ee4
--- /dev/null
+++ b/src/fs/gnunet-fs-gtk_namespace_organizer.h
@@ -0,0 +1,36 @@
1/*
2 This file is part of GNUnet
3 (C) 2005, 2006, 2010, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file src/fs/gnunet-fs-gtk_namespace_organizer.h
23 * @author LRN
24 */
25
26#ifndef GNUNET_FS_GTK_NAMESPACE_ORGANIZER_H
27#define GNUNET_FS_GTK_NAMESPACE_ORGANIZER_H
28
29#include "gnunet-fs-gtk_common.h"
30#include "gnunet-fs-gtk.h"
31
32GtkObject *
33GNUNET_GTK_namespace_selector_open (struct GNUNET_GTK_MainWindowContext *main_ctx);
34
35#endif /* GNUNET_FS_GTK_NAMESPACE_ORGANIZER_H */
36/* end of gnunet-fs-gtk_namespace_organizer.c */
diff --git a/src/fs/gnunet-fs-gtk_open-uri.c b/src/fs/gnunet-fs-gtk_open-uri.c
index 93a164cc..8fcb4b62 100644
--- a/src/fs/gnunet-fs-gtk_open-uri.c
+++ b/src/fs/gnunet-fs-gtk_open-uri.c
@@ -88,7 +88,7 @@ GNUNET_GTK_open_url_dialog_execute_button_clicked_cb (GtkButton * button,
88 88
89 uris = gtk_text_buffer_get_text (tb, &ti_start, &ti_end, FALSE); 89 uris = gtk_text_buffer_get_text (tb, &ti_start, &ti_end, FALSE);
90 if (!GNUNET_GTK_get_selected_anonymity_level 90 if (!GNUNET_GTK_get_selected_anonymity_level
91 (builder, "main_window_search_anonymity_combobox", &anonymity_level)) 91 (builder, "GNUNET_GTK_open_url_dialog_anonymity_combobox", &anonymity_level))
92 { 92 {
93 GNUNET_break (0); 93 GNUNET_break (0);
94 gtk_widget_destroy (dialog); 94 gtk_widget_destroy (dialog);
diff --git a/src/fs/gnunet-fs-gtk_publish-dialog.c b/src/fs/gnunet-fs-gtk_publish-dialog.c
index 49d01f8d..3154f50b 100644
--- a/src/fs/gnunet-fs-gtk_publish-dialog.c
+++ b/src/fs/gnunet-fs-gtk_publish-dialog.c
@@ -87,52 +87,32 @@ enum PUBLISH_ModelColumns
87/** 87/**
88 * Columns in the pseudonym model. 88 * Columns in the pseudonym model.
89 */ 89 */
90enum PSEUDONYM_ModelColumns 90enum IDENTIFIERS_ModelColumns
91 { 91 {
92 /** 92 /**
93 * A gchararray. 93 * A gchararray.
94 */ 94 */
95 PSEUDONYM_MC_LOCAL_NAME = 0, 95 IDENTIFIERS_MC_ID = 0,
96
97 /**
98 * A gpointer.
99 */
100 PSEUDONYM_MC_NAMESPACE_HANDLE = 1,
101 96
102 /** 97 /**
103 * A gchararray. 98 * A gchararray.
104 */ 99 */
105 PSEUDONYM_MC_LAST_ID = 2, 100 IDENTIFIERS_MC_UPDATE_ID = 1,
106 101
107 /** 102 /**
108 * A gchararray. 103 * A gchararray.
109 */ 104 */
110 PSEUDONYM_MC_LAST_URI = 3, 105 IDENTIFIERS_MC_DESCRIPTION = 2,
111
112 /**
113 * A gpointer.
114 */
115 PSEUDONYM_MC_LAST_META = 4,
116 106
117 /** 107 /**
118 * A gchararray. 108 * A gchararray.
119 */ 109 */
120 PSEUDONYM_MC_NEXT_ID = 5, 110 IDENTIFIERS_MC_PATH_TO_ORIGINAL = 3,
121 111
122 /** 112 /**
123 * A gchararray. 113 * A gchararray.
124 */ 114 */
125 PSEUDONYM_MC_LAST_DESCRIPTION_FROM_META = 6, 115 IDENTIFIERS_MC_ID_MARKED_UP = 4,
126
127 /**
128 * A gboolean.
129 */
130 PSEUDONYM_MC_NEXT_ID_EDITABLE = 7,
131
132 /**
133 * A gboolean.
134 */
135 PSEUDONYM_MC_CURRENT_ID_EDITABLE = 8,
136 }; 116 };
137 117
138 118
@@ -158,16 +138,6 @@ struct MainPublishingDialogContext
158 GtkWindow *master_pubdialog; 138 GtkWindow *master_pubdialog;
159 139
160 /** 140 /**
161 * Selected pseudonym.
162 */
163 GtkTreeSelection *pseudonym_selection;
164
165 /**
166 * Model with the list of (our) pseudonyms.
167 */
168 GtkTreeModel *pseudonym_treemodel;
169
170 /**
171 * Tree view listing files to be published. 141 * Tree view listing files to be published.
172 */ 142 */
173 GtkTreeView *file_info_treeview; 143 GtkTreeView *file_info_treeview;
@@ -212,6 +182,29 @@ struct MainPublishingDialogContext
212 */ 182 */
213 GtkWidget *edit_button; 183 GtkWidget *edit_button;
214 184
185 GtkWidget *global_checkbox;
186 GtkWidget *own_checkbox;
187 GtkWidget *own_label;
188 GtkTreeView *identifiers_treeview;
189 GtkTreeModel *identifiers_treemodel;
190 GtkTreeSelection *identifiers_selection;
191 GtkWidget *identifier_entry;
192 GtkWidget *updateable_checkbox;
193 GtkWidget *update_id_entry;
194
195 GtkWidget *own_vbox;
196 GtkWidget *update_id_hbox;
197
198 gchar *ns_name;
199 struct GNUNET_FS_Namespace *ns;
200
201 gchar *previous_id;
202
203 GtkWidget *vpaned;
204 GtkWidget *bottom_frame;
205 GtkWidget *identifiers_scrolled;
206 GtkWidget *identifiers_expander;
207
215 /** 208 /**
216 * Button to publish all files from the dialog 209 * Button to publish all files from the dialog
217 */ 210 */
@@ -329,6 +322,8 @@ struct AddDirClientContext
329}; 322};
330 323
331 324
325static void clear_keywords_from_tm (struct MainPublishingDialogContext *ctx);
326
332 327
333/* ************************ editing operations inside the master dialog ********************* */ 328/* ************************ editing operations inside the master dialog ********************* */
334 329
@@ -361,37 +356,32 @@ gtk_tree_iter_equals (GtkTreeModel * tm,
361 356
362 357
363/** 358/**
364 * Update selectivity of buttons (up/down/left/right/cancel/execute) in the master dialog. 359 * Update selectivity of execute/cancel buttons in the master dialog.
365 * 360 *
366 * @param ctx master dialog to update selectivity for 361 * @param ctx master dialog to update selectivity for
367 */ 362 */
368static void 363static void
369update_selectivity (struct MainPublishingDialogContext *ctx) 364update_selectivity_execute_cancel (struct MainPublishingDialogContext *ctx)
370{ 365{
366 gboolean pub_in_global;
367 gboolean pub_in_own;
368 gboolean updateable;
369 const gchar *ns_id;
371 GtkTreeIter iter; 370 GtkTreeIter iter;
372 GtkTreeIter parent;
373 GtkTreeIter pred;
374 int is_dir;
375 struct GNUNET_FS_FileInformation *fip;
376 int ns_ok;
377 gchar *namespace_id;
378 371
379 /* find out if a namespace was selected */ 372 pub_in_global = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ctx->global_checkbox));
380 ns_ok = GNUNET_YES; 373 pub_in_own = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ctx->own_checkbox));
381 if (gtk_tree_selection_get_selected (ctx->pseudonym_selection, NULL, &iter)) 374 updateable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ctx->updateable_checkbox));
382 { 375 gtk_widget_set_sensitive (ctx->update_id_hbox, updateable);
383 gtk_tree_model_get (ctx->pseudonym_treemodel, &iter, 376 gtk_widget_set_sensitive (ctx->own_vbox, pub_in_own);
384 PSEUDONYM_MC_LAST_ID, &namespace_id, -1); 377
385 if (namespace_id == NULL) 378 ns_id = gtk_entry_get_text (GTK_ENTRY (ctx->identifier_entry));
386 ns_ok = GNUNET_NO;
387 else
388 g_free (namespace_id);
389 }
390 379
391 /* Don't let the user close the dialog until all scanners are finished and 380 /* Don't let the user close the dialog until all scanners are finished and
392 their windows are closed */ 381 their windows are closed */
393 if ( (gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter)) && 382 if ( (gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter)) &&
394 (ns_ok == GNUNET_YES) && 383 (pub_in_global || pub_in_own) &&
384 ((!pub_in_own) || ((NULL != ns_id) && ('\0' != ns_id[0]))) &&
395 (ctx->adddir_head == NULL) ) 385 (ctx->adddir_head == NULL) )
396 gtk_widget_set_sensitive (ctx->execute_button, TRUE); 386 gtk_widget_set_sensitive (ctx->execute_button, TRUE);
397 else 387 else
@@ -402,8 +392,22 @@ update_selectivity (struct MainPublishingDialogContext *ctx)
402 gtk_widget_set_sensitive (ctx->cancel_button, TRUE); 392 gtk_widget_set_sensitive (ctx->cancel_button, TRUE);
403 else 393 else
404 gtk_widget_set_sensitive (ctx->cancel_button, FALSE); 394 gtk_widget_set_sensitive (ctx->cancel_button, FALSE);
395}
396
397/**
398 * Update selectivity of up/down/left/right buttons in the master dialog.
399 *
400 * @param ctx master dialog to update selectivity for
401 */
402static void
403update_selectivity_edit (struct MainPublishingDialogContext *ctx)
404{
405 GtkTreeIter iter;
406 GtkTreeIter parent;
407 GtkTreeIter pred;
408 int is_dir;
409 struct GNUNET_FS_FileInformation *fip;
405 410
406 /* now for the editing buttons... */
407 if (! gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter)) 411 if (! gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter))
408 { 412 {
409 gtk_widget_set_sensitive (ctx->up_button, FALSE); 413 gtk_widget_set_sensitive (ctx->up_button, FALSE);
@@ -467,7 +471,7 @@ selection_changed_cb (GtkTreeSelection * ts,
467{ 471{
468 struct MainPublishingDialogContext *ctx = user_data; 472 struct MainPublishingDialogContext *ctx = user_data;
469 473
470 update_selectivity (ctx); 474 update_selectivity_edit (ctx);
471} 475}
472 476
473 477
@@ -517,7 +521,8 @@ create_dir_at_iter (struct MainPublishingDialogContext *ctx,
517 PUBLISH_MC_REPLICATION_LEVEL, 521 PUBLISH_MC_REPLICATION_LEVEL,
518 (guint) bo->replication_level, 522 (guint) bo->replication_level,
519 -1); 523 -1);
520 update_selectivity (ctx); 524 update_selectivity_edit (ctx);
525 update_selectivity_execute_cancel (ctx);
521} 526}
522 527
523 528
@@ -624,68 +629,142 @@ copy_entry (struct MainPublishingDialogContext *ctx, GtkTreeModel * tm, GtkTreeI
624 GNUNET_assert (TRUE == gtk_tree_model_get_iter (tm, newpos, path)); 629 GNUNET_assert (TRUE == gtk_tree_model_get_iter (tm, newpos, path));
625 gtk_tree_path_free (path); 630 gtk_tree_path_free (path);
626 gtk_tree_selection_select_iter (ctx->file_info_selection, newpos); 631 gtk_tree_selection_select_iter (ctx->file_info_selection, newpos);
627 update_selectivity (ctx); 632 update_selectivity_edit (ctx);
633 }
634}
635
636void
637GNUNET_GTK_master_publish_dialog_global_checkbox_toggled_cb (
638 GtkToggleButton *togglebutton, gpointer user_data)
639{
640 update_selectivity_execute_cancel (user_data);
641}
642
643void
644GNUNET_GTK_master_publish_dialog_own_checkbox_toggled_cb (
645 GtkToggleButton *togglebutton, gpointer user_data)
646{
647 update_selectivity_execute_cancel (user_data);
648}
649
650void
651GNUNET_GTK_master_publish_dialog_updateable_checkbox_toggled_cb (
652 GtkToggleButton *togglebutton, gpointer user_data)
653{
654 update_selectivity_execute_cancel (user_data);
655}
656
657static gchar *
658generate_update_id (const gchar *new_text)
659{
660 gchar *dash;
661 gint64 num;
662 gchar *new_update_id;
663 gchar *copy_part;
664
665 copy_part = g_strdup (new_text);
666 dash = strrchr (copy_part, '-');
667 if (!dash)
668 num = 0;
669 else
670 {
671 gchar *endptr;
672 num = g_ascii_strtoll (&dash[1], &endptr, 10);
673 if (((0 <= num) && (endptr == &dash[1])) || (G_MAXINT64 == num) || ('\0' != endptr[0]))
674 num = 0;
675 else
676 dash[0] = '\0';
628 } 677 }
678 if ('\0' != new_text[0])
679 new_update_id = g_strdup_printf ("%s-%" G_GINT64_FORMAT, copy_part, num + 1);
680 else
681 new_update_id = g_strdup ("");
682 g_free (copy_part);
683 return new_update_id;
629} 684}
630 685
686static gboolean
687update_id_is_autofilled (const gchar *existing_update_id, gchar *previous_id)
688{
689 gboolean result;
690 result = TRUE;
691 gchar *gen_update_id = generate_update_id (previous_id);
692 if (0 != strcmp (gen_update_id, existing_update_id))
693 result = FALSE;
694 g_free (gen_update_id);
695 return result;
696}
631 697
632/** 698static void
633 * User has changed the "update" identifier for the content in 699maybe_change_update_id (struct MainPublishingDialogContext *ctx,
634 * the GtkTreeView. Update the model. 700 const gchar *new_text)
635 * 701{
636 * @param renderer pseudonym renderer that notified us about the edit 702 const gchar *existing_update_id;
637 * @param cpath where the edit happened 703 gchar *new_update_id;
638 * @param new_text the new value 704
639 * @param user_data master publishing dialog context of our window 705 new_update_id = NULL;
640 */ 706 existing_update_id = gtk_entry_get_text (GTK_ENTRY (ctx->update_id_entry));
641void 707
642GNUNET_GTK_master_publish_dialog_pseudonym_updates_renderer_edited_cb (GtkCellRendererText * renderer, 708 if (((NULL == ctx->previous_id) && ('\0' == existing_update_id[0]))
643 gchar * cpath, 709 || update_id_is_autofilled (existing_update_id, ctx->previous_id))
644 gchar * new_text, 710 new_update_id = generate_update_id (new_text);
645 gpointer user_data) 711 if (new_update_id)
712 gtk_entry_set_text (GTK_ENTRY (ctx->update_id_entry), new_update_id);
713 g_free (new_update_id);
714
715 g_free (ctx->previous_id);
716 ctx->previous_id = g_strdup (new_text);
717}
718
719void
720GNUNET_GTK_master_publish_dialog_identifier_entry_changed_cb (
721 GtkWidget *widget, gpointer user_data)
646{ 722{
647 struct MainPublishingDialogContext *ctx = user_data; 723 struct MainPublishingDialogContext *ctx = user_data;
648 GtkTreeIter iter; 724 const gchar *new_text;
649 725
650 if (! gtk_tree_model_get_iter_from_string (ctx->pseudonym_treemodel, &iter, cpath)) 726 new_text = gtk_entry_get_text (GTK_ENTRY (widget));
651 { 727
652 GNUNET_break (0); 728 if (NULL == new_text)
653 return; 729 return;
654 } 730 maybe_change_update_id (ctx, new_text);
655 gtk_tree_store_set (GTK_TREE_STORE (ctx->pseudonym_treemodel), &iter, 731 update_selectivity_execute_cancel (ctx);
656 PSEUDONYM_MC_NEXT_ID, new_text,
657 -1);
658 update_selectivity (ctx);
659} 732}
660 733
661 734
662/** 735/**
663 * User has changed the "current" identifier for the content in 736 * The selection in the identifier tree view changed.
664 * the GtkTreeView. Update the model. 737 * Update copy text into identifier entry.
665 * 738 *
666 * @param renderer pseudonym renderer that notified us about the edit 739 * @param ts the changed selection
667 * @param cpath where the edit happened 740 * @param user_data master publishing dialog context of our window
668 * @param new_text the new value
669 * @param user_data master publishing dialog context of our window
670 */ 741 */
671void 742static void
672GNUNET_GTK_master_publish_dialog_pseudonym_identifier_renderer_edited_cb (GtkCellRendererText * renderer, 743identifiers_selection_changed_cb (GtkTreeSelection *ts, gpointer user_data)
673 gchar * cpath,
674 gchar * new_text,
675 gpointer user_data)
676{ 744{
677 struct MainPublishingDialogContext *ctx = user_data; 745 struct MainPublishingDialogContext *ctx = user_data;
678 GtkTreeIter iter; 746 GtkTreeIter iter;
747 gchar *new_text;
748 gchar *spath;
749 GtkTreePath *path;
679 750
680 if (! gtk_tree_model_get_iter_from_string (ctx->pseudonym_treemodel, &iter, cpath)) 751 if (!gtk_tree_selection_get_selected (ts, NULL, &iter))
681 {
682 GNUNET_break (0);
683 return; 752 return;
753 gtk_tree_model_get (ctx->identifiers_treemodel, &iter,
754 IDENTIFIERS_MC_ID, &new_text,
755 IDENTIFIERS_MC_PATH_TO_ORIGINAL, &spath,
756 -1);
757 path = NULL;
758 if (spath)
759 path = gtk_tree_path_new_from_string (spath);
760 if (path)
761 {
762 gtk_tree_selection_select_path (ts, path);
763 gtk_tree_path_free (path);
684 } 764 }
685 gtk_tree_store_set (GTK_TREE_STORE (ctx->pseudonym_treemodel), &iter, 765 else if (new_text)
686 PSEUDONYM_MC_LAST_ID, new_text, 766 gtk_entry_set_text (GTK_ENTRY (ctx->identifier_entry), new_text);
687 -1); 767 g_free (new_text);
688 update_selectivity (ctx);
689} 768}
690 769
691 770
@@ -999,7 +1078,8 @@ GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb (GtkWidget * dummy,
999 } 1078 }
1000 1079
1001 /* and now, depending on the selection, update the sensitivity of buttons */ 1080 /* and now, depending on the selection, update the sensitivity of buttons */
1002 update_selectivity (ctx); 1081 update_selectivity_execute_cancel (ctx);
1082 update_selectivity_edit (ctx);
1003} 1083}
1004 1084
1005 1085
@@ -1026,7 +1106,8 @@ destroy_progress_dialog (struct AddDirClientContext *adcc)
1026 GNUNET_CONTAINER_DLL_remove (adcc->ctx->adddir_head, 1106 GNUNET_CONTAINER_DLL_remove (adcc->ctx->adddir_head,
1027 adcc->ctx->adddir_tail, 1107 adcc->ctx->adddir_tail,
1028 adcc); 1108 adcc);
1029 update_selectivity (adcc->ctx); 1109 update_selectivity_execute_cancel (adcc->ctx);
1110 update_selectivity_edit (adcc->ctx);
1030 GNUNET_free (adcc); 1111 GNUNET_free (adcc);
1031} 1112}
1032 1113
@@ -1334,7 +1415,6 @@ directory_scan_cb (void *cls,
1334 directory_scan_result, 1415 directory_scan_result,
1335 NULL); 1416 NULL);
1336 GNUNET_FS_share_tree_free (directory_scan_result); 1417 GNUNET_FS_share_tree_free (directory_scan_result);
1337 update_selectivity (adcc->ctx);
1338 destroy_progress_dialog (adcc); 1418 destroy_progress_dialog (adcc);
1339 } 1419 }
1340 break; 1420 break;
@@ -1393,7 +1473,7 @@ scan_file_or_directory (struct MainPublishingDialogContext *ctx,
1393 &directory_scan_cb, adcc); 1473 &directory_scan_cb, adcc);
1394 1474
1395 /* disables 'cancel' button of the master dialog */ 1475 /* disables 'cancel' button of the master dialog */
1396 update_selectivity (ctx); 1476 update_selectivity_execute_cancel (ctx);
1397} 1477}
1398 1478
1399 1479
@@ -1776,38 +1856,6 @@ get_file_information (GtkTreeModel * tm, GtkTreeIter * iter)
1776 1856
1777 1857
1778/** 1858/**
1779 * (Recursively) clean up the tree store with the pseudonyms.
1780 *
1781 * @param tm tree model we are cleaning up
1782 * @param iter current position to clean up
1783 */
1784static void
1785free_pseudonym_tree_store (GtkTreeModel * tm, GtkTreeIter * iter)
1786{
1787 GtkTreeIter child;
1788 struct GNUNET_CONTAINER_MetaData *meta;
1789 struct GNUNET_FS_Namespace *ns;
1790
1791 gtk_tree_model_get (tm, iter,
1792 PSEUDONYM_MC_NAMESPACE_HANDLE, &ns,
1793 PSEUDONYM_MC_LAST_META, &meta,
1794 -1);
1795 if (NULL != meta)
1796 GNUNET_CONTAINER_meta_data_destroy (meta);
1797 if (NULL != ns)
1798 GNUNET_FS_namespace_delete (ns, GNUNET_NO);
1799 /* recursively clean up children */
1800 if (! gtk_tree_model_iter_children (tm, &child, iter))
1801 return;
1802 do
1803 {
1804 free_pseudonym_tree_store (tm, &child);
1805 }
1806 while (gtk_tree_model_iter_next (tm, &child));
1807}
1808
1809
1810/**
1811 * Recursively clean up the tree store with the file information in it. 1859 * Recursively clean up the tree store with the file information in it.
1812 * 1860 *
1813 * @param tm tree model we are cleaning up 1861 * @param tm tree model we are cleaning up
@@ -1851,16 +1899,10 @@ close_master_publish_dialog (struct MainPublishingDialogContext *ctx)
1851 if (NULL != ctx->adddir_head) 1899 if (NULL != ctx->adddir_head)
1852 return GNUNET_NO; 1900 return GNUNET_NO;
1853 1901
1854 /* free state from 'ptm' */ 1902 /* free state from the identifiers treemodel */
1855 if (gtk_tree_model_get_iter_first (ctx->pseudonym_treemodel, &iter)) 1903 gtk_tree_store_clear (GTK_TREE_STORE (ctx->identifiers_treemodel));
1856 do
1857 {
1858 free_pseudonym_tree_store (ctx->pseudonym_treemodel, &iter);
1859 }
1860 while (gtk_tree_model_iter_next (ctx->pseudonym_treemodel, &iter));
1861 gtk_tree_store_clear (GTK_TREE_STORE (ctx->pseudonym_treemodel));
1862 1904
1863 /* free state from 'tm' */ 1905 /* free state from the file info treemodel */
1864 if (gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter)) 1906 if (gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter))
1865 do 1907 do
1866 { 1908 {
@@ -1871,6 +1913,10 @@ close_master_publish_dialog (struct MainPublishingDialogContext *ctx)
1871 1913
1872 gtk_widget_destroy (GTK_WIDGET (ctx->master_pubdialog)); 1914 gtk_widget_destroy (GTK_WIDGET (ctx->master_pubdialog));
1873 g_object_unref (G_OBJECT (ctx->builder)); 1915 g_object_unref (G_OBJECT (ctx->builder));
1916 GNUNET_free_non_null (ctx->ns_name);
1917 if (ctx->ns)
1918 GNUNET_FS_namespace_delete (ctx->ns, GNUNET_NO);
1919 g_free (ctx->previous_id);
1874 GNUNET_free (ctx); 1920 GNUNET_free (ctx);
1875 return GNUNET_YES; 1921 return GNUNET_YES;
1876} 1922}
@@ -1888,44 +1934,76 @@ GNUNET_GTK_master_publish_dialog_execute_button_clicked_cb (GtkButton * button,
1888 gpointer user_data) 1934 gpointer user_data)
1889{ 1935{
1890 struct MainPublishingDialogContext *ctx = user_data; 1936 struct MainPublishingDialogContext *ctx = user_data;
1891 gpointer namespace;
1892 gchar *namespace_id; 1937 gchar *namespace_id;
1893 gchar *namespace_uid; 1938 struct GNUNET_FS_Namespace *ns;
1939 const gchar *namespace_uid;
1894 struct GNUNET_FS_FileInformation *fi; 1940 struct GNUNET_FS_FileInformation *fi;
1895 GtkTreeIter iter; 1941 GtkTreeIter iter;
1942 gboolean do_global;
1943 gboolean do_updateable;
1944 gboolean do_own;
1896 1945
1897 if (NULL != ctx->adddir_head) 1946 if (NULL != ctx->adddir_head)
1898 { 1947 {
1899 GNUNET_break (0); 1948 GNUNET_break (0);
1900 return; 1949 return;
1901 } 1950 }
1902 if (TRUE == gtk_tree_selection_get_selected (ctx->pseudonym_selection, NULL, &iter)) 1951
1952 do_global = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ctx->global_checkbox));
1953 do_updateable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ctx->updateable_checkbox));
1954 do_own = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ctx->own_checkbox));
1955 ns = NULL;
1956 namespace_id = NULL;
1957 namespace_uid = NULL;
1958 if (ctx->ns && do_own)
1903 { 1959 {
1904 gtk_tree_model_get (ctx->pseudonym_treemodel, &iter, 1960 const gchar *id_entry_text;
1905 PSEUDONYM_MC_NAMESPACE_HANDLE, &namespace, 1961 if (NULL != (id_entry_text = gtk_entry_get_text (GTK_ENTRY (ctx->identifier_entry))))
1906 PSEUDONYM_MC_LAST_ID, &namespace_id, 1962 namespace_id = g_strdup (id_entry_text);
1907 PSEUDONYM_MC_NEXT_ID, &namespace_uid, 1963 else if (!do_global)
1908 -1); 1964 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Global publication is disabled, but namespace_id is not available\n");
1965 if ((NULL != namespace_id) && ('\0' == namespace_id[0]))
1966 {
1967 g_free (namespace_id);
1968 namespace_id = NULL;
1969 }
1970 if (NULL != namespace_id)
1971 {
1972 namespace_uid = gtk_entry_get_text (GTK_ENTRY (ctx->update_id_entry));
1973 if ((NULL == namespace_uid) || ('\0' == namespace_uid[0]) || (!do_updateable))
1974 namespace_uid = NULL;
1975 ns = ctx->ns;
1976 }
1977 else if (!do_global)
1978 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Global publication is disabled, but namespace_id unavailable or zero-length\n");
1909 } 1979 }
1910 else 1980 else if (!do_global)
1981 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Global publication is disabled, ns is either NULL or disabled, yet 'Execute' was pressed\n");
1982 if ((!do_global) && (NULL == ns))
1911 { 1983 {
1912 namespace = NULL; 1984 g_free (namespace_id);
1913 namespace_id = NULL; 1985 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctx->own_checkbox), FALSE);
1914 namespace_uid = NULL; 1986 return;
1915 } 1987 }
1916 if (gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter)) 1988 if (gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter))
1989 {
1990 clear_keywords_from_tm (ctx);
1917 do 1991 do
1918 { 1992 {
1919 fi = get_file_information (ctx->file_info_treemodel, &iter); 1993 fi = get_file_information (ctx->file_info_treemodel, &iter);
1920 /* FIXME-FEATURE-BUG-MINOR: should we convert namespace id and uid from UTF8? */ 1994 /* FIXME-FEATURE-BUG-MINOR: should we convert namespace id and uid from UTF8? */
1921 GNUNET_FS_publish_start (GNUNET_FS_GTK_get_fs_handle (), 1995 GNUNET_FS_publish_start (GNUNET_FS_GTK_get_fs_handle (),
1922 fi, namespace, 1996 fi, ns,
1923 namespace_id, namespace_uid, 1997 namespace_id, namespace_uid,
1924 GNUNET_FS_PUBLISH_OPTION_NONE); 1998 GNUNET_FS_PUBLISH_OPTION_NONE);
1925 } 1999 }
1926 while (gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter)); 2000 while (gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter));
2001 }
2002 else
2003 {
2004 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to get firet item in files tree view. Is it empty?\n");
2005 }
1927 g_free (namespace_id); 2006 g_free (namespace_id);
1928 g_free (namespace_uid);
1929 GNUNET_break (GNUNET_YES == close_master_publish_dialog (ctx)); 2007 GNUNET_break (GNUNET_YES == close_master_publish_dialog (ctx));
1930} 2008}
1931 2009
@@ -1992,6 +2070,19 @@ clear_keywords_from_file_information_in_tree_store (GtkTreeModel * tm,
1992 } 2070 }
1993} 2071}
1994 2072
2073static void
2074clear_keywords_from_tm (struct MainPublishingDialogContext *ctx)
2075{
2076 GtkTreeIter iter;
2077
2078 /* clear keywords from 'tm' */
2079 if (gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter))
2080 do
2081 {
2082 clear_keywords_from_file_information_in_tree_store (ctx->file_info_treemodel, &iter);
2083 }
2084 while (gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter));
2085}
1995 2086
1996/** 2087/**
1997 * The user pushed the 'clear' button. Remove all keywords. 2088 * The user pushed the 'clear' button. Remove all keywords.
@@ -2003,16 +2094,7 @@ void
2003GNUNET_GTK_master_publish_dialog_clear_button_clicked_cb (GtkButton * button, 2094GNUNET_GTK_master_publish_dialog_clear_button_clicked_cb (GtkButton * button,
2004 gpointer user_data) 2095 gpointer user_data)
2005{ 2096{
2006 struct MainPublishingDialogContext *ctx = user_data; 2097 clear_keywords_from_tm (user_data);
2007 GtkTreeIter iter;
2008
2009 /* clear keywords from 'tm' */
2010 if (gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter))
2011 do
2012 {
2013 clear_keywords_from_file_information_in_tree_store (ctx->file_info_treemodel, &iter);
2014 }
2015 while (gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter));
2016} 2098}
2017 2099
2018 2100
@@ -2054,7 +2136,31 @@ GNUNET_GTK_master_publish_dialog_delete_event_cb (GtkWidget * widget,
2054 return FALSE; 2136 return FALSE;
2055} 2137}
2056 2138
2057 2139static void
2140expander_callback (GObject *object,
2141 GParamSpec *param_spec,
2142 gpointer user_data)
2143{
2144 GtkExpander *expander;
2145 struct MainPublishingDialogContext *ctx = user_data;
2146 GtkAllocation scrolled_allocation;
2147 gint paned_pos;
2148 GValue gv = G_VALUE_INIT;
2149 gboolean expanded;
2150 expander = GTK_EXPANDER (object);
2151
2152 gtk_widget_get_allocation (GTK_WIDGET (ctx->identifiers_scrolled),
2153 &scrolled_allocation);
2154 expanded = gtk_expander_get_expanded (expander);
2155 gtk_widget_set_visible (GTK_WIDGET (ctx->identifiers_scrolled), expanded);
2156
2157 g_value_init (&gv, G_TYPE_BOOLEAN);
2158 g_value_set_boolean (&gv, expanded);
2159 gtk_container_child_set_property (GTK_CONTAINER (ctx->vpaned), ctx->bottom_frame, "resize", &gv);
2160 paned_pos = gtk_paned_get_position (GTK_PANED (ctx->vpaned));
2161 paned_pos = paned_pos + (scrolled_allocation.height * (expanded ? -1 : 1));
2162 gtk_paned_set_position (GTK_PANED (ctx->vpaned), paned_pos);
2163}
2058 2164
2059/* ******************** master edit dialog initialization *********************** */ 2165/* ******************** master edit dialog initialization *********************** */
2060 2166
@@ -2075,11 +2181,6 @@ struct UpdateableContext
2075 GtkTreeStore *ts; 2181 GtkTreeStore *ts;
2076 2182
2077 /** 2183 /**
2078 * Name of the namespace.
2079 */
2080 const char *namespace_name;
2081
2082 /**
2083 * Handle to the namespace. 2184 * Handle to the namespace.
2084 */ 2185 */
2085 struct GNUNET_FS_Namespace *ns; 2186 struct GNUNET_FS_Namespace *ns;
@@ -2118,38 +2219,114 @@ add_updateable_to_ts (void *cls, const char *last_id,
2118 char *desc; 2219 char *desc;
2119 int desc_is_a_dup; 2220 int desc_is_a_dup;
2120 struct GNUNET_HashCode hc; 2221 struct GNUNET_HashCode hc;
2222 gchar *displaytext;
2223 gchar *hashbuf;
2224 char *mdbuf;
2225 ssize_t hashbufsize;
2226 ssize_t mdsize;
2227 ssize_t next_id_len;
2228 char *uristring;
2229 ssize_t urilen;
2230 ssize_t last_id_len;
2231 gchar *spath;
2121 2232
2122 uc->update_called = GNUNET_YES; 2233 uc->update_called = GNUNET_YES;
2123 GNUNET_CRYPTO_hash (last_id, strlen (last_id), &hc); 2234
2124 if (NULL != GNUNET_CONTAINER_multihashmap_get (uc->seen, &hc)) 2235 if (next_id)
2125 return; 2236 next_id_len = strlen (next_id);
2126 GNUNET_CONTAINER_multihashmap_put (uc->seen, &hc, "dummy", 2237 else
2127 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); 2238 next_id_len = 0;
2128 /* FIXME-BUG-MAYBE: what if this put fails? Not convinced it cannot... */ 2239
2240 if (last_id)
2241 last_id_len = strlen (last_id);
2242 else
2243 last_id_len = 0;
2244
2245 uristring = GNUNET_FS_uri_to_string (last_uri);
2246 if (uristring)
2247 urilen = strlen (uristring);
2248 else
2249 urilen = 0;
2250
2251 mdbuf = NULL;
2252 mdsize = GNUNET_CONTAINER_meta_data_serialize (last_meta, &mdbuf, 64*1024, GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL);
2253 if (0 > mdsize)
2254 mdsize = 0;
2255
2256 hashbufsize = last_id_len + next_id_len + urilen + mdsize;
2257 hashbuf = GNUNET_malloc (hashbufsize);
2258 if (last_id)
2259 strcpy (&hashbuf[0], last_id);
2260 if (next_id)
2261 strcpy (&hashbuf[last_id_len], next_id);
2262 if (uristring)
2263 strcpy (&hashbuf[last_id_len + next_id_len], uristring);
2264 if (mdbuf)
2265 memcpy (&hashbuf[last_id_len + next_id_len + urilen], mdbuf, mdsize);
2266
2267 GNUNET_CRYPTO_hash (hashbuf, hashbufsize, &hc);
2268
2269 GNUNET_free (uristring);
2270 GNUNET_free_non_null (mdbuf);
2271 GNUNET_free (hashbuf);
2272
2273 spath = NULL;
2274 spath = GNUNET_CONTAINER_multihashmap_get (uc->seen, &hc);
2275
2129 desc = GNUNET_FS_GTK_get_description_from_metadata (last_meta, &desc_is_a_dup); 2276 desc = GNUNET_FS_GTK_get_description_from_metadata (last_meta, &desc_is_a_dup);
2130 gtk_tree_store_insert_with_values (uc->ts, &iter, uc->parent, G_MAXINT, 2277 if (NULL != spath)
2131 PSEUDONYM_MC_LOCAL_NAME, 2278 {
2132 uc->namespace_name, 2279 displaytext = g_strdup_printf ("<i>%s</i>", last_id);
2133 PSEUDONYM_MC_NAMESPACE_HANDLE, 2280 gtk_tree_store_insert_with_values (uc->ts, &iter, uc->parent, G_MAXINT,
2134 GNUNET_FS_namespace_dup (uc->ns), 2281 IDENTIFIERS_MC_ID, last_id,
2135 PSEUDONYM_MC_LAST_ID, last_id, 2282 IDENTIFIERS_MC_UPDATE_ID, next_id,
2136 PSEUDONYM_MC_LAST_URI, 2283 IDENTIFIERS_MC_DESCRIPTION, desc,
2137 GNUNET_FS_uri_dup (last_uri), 2284 IDENTIFIERS_MC_PATH_TO_ORIGINAL, spath,
2138 PSEUDONYM_MC_LAST_META, 2285 IDENTIFIERS_MC_ID_MARKED_UP, displaytext,
2139 GNUNET_CONTAINER_meta_data_duplicate 2286 -1);
2140 (last_meta), 2287 }
2141 PSEUDONYM_MC_NEXT_ID, "", 2288 else if (NULL == uc->parent)
2142 PSEUDONYM_MC_LAST_DESCRIPTION_FROM_META, 2289 {
2143 desc, 2290 displaytext = g_strdup_printf ("%s", last_id);
2144 PSEUDONYM_MC_NEXT_ID_EDITABLE, 2291 gtk_tree_store_insert_with_values (uc->ts, &iter, uc->parent, G_MAXINT,
2145 TRUE /* update editable (always) */ , 2292 IDENTIFIERS_MC_ID, last_id,
2146 PSEUDONYM_MC_CURRENT_ID_EDITABLE, FALSE 2293 IDENTIFIERS_MC_UPDATE_ID, next_id,
2147 /* current not editable (only for top-level) */ 2294 IDENTIFIERS_MC_DESCRIPTION, desc,
2148 , -1); 2295 IDENTIFIERS_MC_PATH_TO_ORIGINAL, NULL,
2149 GNUNET_free_non_null (desc); 2296 IDENTIFIERS_MC_ID_MARKED_UP, displaytext,
2297 -1);
2298 }
2299 else
2300 {
2301 displaytext = g_strdup_printf ("%s", last_id);
2302 gtk_tree_store_insert_with_values (uc->ts, &iter, uc->parent, G_MAXINT,
2303 IDENTIFIERS_MC_ID, last_id,
2304 IDENTIFIERS_MC_UPDATE_ID, next_id,
2305 IDENTIFIERS_MC_DESCRIPTION, desc,
2306 IDENTIFIERS_MC_PATH_TO_ORIGINAL, NULL,
2307 IDENTIFIERS_MC_ID_MARKED_UP, displaytext,
2308 -1);
2309 }
2310 g_free (displaytext);
2311
2312 if (NULL == spath)
2313 {
2314 GtkTreePath *path;
2315 char *gspath;
2316 path = gtk_tree_model_get_path (GTK_TREE_MODEL (uc->ts), &iter);
2317 spath = gtk_tree_path_to_string (path);
2318 gtk_tree_path_free (path);
2319 /* for the sake of consistency, only put GNUNET_free'able things into the map */
2320 gspath = GNUNET_strdup (spath);
2321 if (GNUNET_SYSERR == GNUNET_CONTAINER_multihashmap_put (uc->seen, &hc, gspath,
2322 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
2323 GNUNET_free (gspath);
2324 }
2325 else
2326 return;
2327
2150 sc.parent = &iter; 2328 sc.parent = &iter;
2151 sc.ts = uc->ts; 2329 sc.ts = uc->ts;
2152 sc.namespace_name = uc->namespace_name;
2153 sc.ns = uc->ns; 2330 sc.ns = uc->ns;
2154 sc.seen = uc->seen; 2331 sc.seen = uc->seen;
2155 sc.update_called = GNUNET_NO; 2332 sc.update_called = GNUNET_NO;
@@ -2159,27 +2336,26 @@ add_updateable_to_ts (void *cls, const char *last_id,
2159 (strlen (next_id) > 0)) 2336 (strlen (next_id) > 0))
2160 { 2337 {
2161 /* add leaf */ 2338 /* add leaf */
2339 displaytext = g_strdup_printf ("<b>%s</b>", next_id);
2162 gtk_tree_store_insert_with_values (uc->ts, &titer, &iter, G_MAXINT, 2340 gtk_tree_store_insert_with_values (uc->ts, &titer, &iter, G_MAXINT,
2163 PSEUDONYM_MC_LOCAL_NAME, 2341 IDENTIFIERS_MC_ID, next_id,
2164 uc->namespace_name, 2342 IDENTIFIERS_MC_UPDATE_ID, NULL,
2165 PSEUDONYM_MC_NAMESPACE_HANDLE, 2343 IDENTIFIERS_MC_DESCRIPTION, NULL,
2166 GNUNET_FS_namespace_dup (uc->ns), 2344 IDENTIFIERS_MC_PATH_TO_ORIGINAL, NULL,
2167 PSEUDONYM_MC_LAST_ID, next_id, 2345 IDENTIFIERS_MC_ID_MARKED_UP, displaytext,
2168 PSEUDONYM_MC_LAST_URI, NULL, 2346 -1);
2169 PSEUDONYM_MC_LAST_META, NULL, 2347 g_free (displaytext);
2170 PSEUDONYM_MC_NEXT_ID, "",
2171 PSEUDONYM_MC_LAST_DESCRIPTION_FROM_META,
2172 "",
2173 PSEUDONYM_MC_NEXT_ID_EDITABLE,
2174 TRUE /* update editable (always) */ ,
2175 PSEUDONYM_MC_CURRENT_ID_EDITABLE,
2176 FALSE
2177 /* current not editable (only for top-level) */
2178 , -1);
2179 } 2348 }
2180} 2349}
2181 2350
2182 2351
2352static int
2353free_seen_paths (void *cls, const struct GNUNET_HashCode * key, void *value)
2354{
2355 GNUNET_free_non_null (value);
2356 return GNUNET_YES;
2357}
2358
2183/** 2359/**
2184 * Add all updateable entries of the current namespace to the 2360 * Add all updateable entries of the current namespace to the
2185 * tree store. 2361 * tree store.
@@ -2189,36 +2365,17 @@ add_updateable_to_ts (void *cls, const char *last_id,
2189 * @param id identity of the namespace to add 2365 * @param id identity of the namespace to add
2190 */ 2366 */
2191static void 2367static void
2192add_namespace_to_ts (void *cls, const char *name, const struct GNUNET_HashCode * id) 2368add_namespace_to_ts (GtkTreeStore *ts, struct GNUNET_FS_Namespace *ns)
2193{ 2369{
2194 GtkTreeStore *ts = cls;
2195 struct UpdateableContext uc; 2370 struct UpdateableContext uc;
2196 GtkTreeIter iter;
2197 2371
2198 uc.parent = &iter; 2372 uc.parent = NULL;
2199 uc.namespace_name = name;
2200 uc.ts = ts; 2373 uc.ts = ts;
2201 uc.ns = GNUNET_FS_namespace_create (GNUNET_FS_GTK_get_fs_handle (), name); 2374 uc.ns = ns;
2202 uc.update_called = GNUNET_NO; 2375 uc.update_called = GNUNET_NO;
2203 if (NULL == uc.ns)
2204 {
2205 GNUNET_break (0);
2206 return;
2207 }
2208 gtk_tree_store_insert_with_values (ts, &iter, NULL, G_MAXINT,
2209 PSEUDONYM_MC_LOCAL_NAME, name,
2210 PSEUDONYM_MC_NAMESPACE_HANDLE, uc.ns,
2211 PSEUDONYM_MC_LAST_ID, NULL,
2212 PSEUDONYM_MC_LAST_URI, NULL,
2213 PSEUDONYM_MC_LAST_META, NULL,
2214 PSEUDONYM_MC_NEXT_ID, NULL,
2215 PSEUDONYM_MC_LAST_DESCRIPTION_FROM_META,
2216 NULL,
2217 PSEUDONYM_MC_NEXT_ID_EDITABLE, TRUE,
2218 PSEUDONYM_MC_CURRENT_ID_EDITABLE, TRUE,
2219 -1);
2220 uc.seen = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); 2376 uc.seen = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO);
2221 GNUNET_FS_namespace_list_updateable (uc.ns, NULL, &add_updateable_to_ts, &uc); 2377 GNUNET_FS_namespace_list_updateable (uc.ns, NULL, &add_updateable_to_ts, &uc);
2378 GNUNET_CONTAINER_multihashmap_iterate (uc.seen, free_seen_paths, NULL);
2222 GNUNET_CONTAINER_multihashmap_destroy (uc.seen); 2379 GNUNET_CONTAINER_multihashmap_destroy (uc.seen);
2223} 2380}
2224 2381
@@ -2234,7 +2391,12 @@ void
2234GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, gpointer user_data) 2391GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, gpointer user_data)
2235{ 2392{
2236 struct MainPublishingDialogContext *ctx; 2393 struct MainPublishingDialogContext *ctx;
2237 GtkTreeView *pseudonym_treeview; 2394/* GtkTreeView *pseudonym_treeview;*/
2395 const struct GNUNET_CONFIGURATION_Handle *cfg;
2396 gboolean have_ns;
2397 int updateable_enabled;
2398 int own_enabled;
2399 int global_enabled;
2238 2400
2239 ctx = GNUNET_malloc (sizeof (struct MainPublishingDialogContext)); 2401 ctx = GNUNET_malloc (sizeof (struct MainPublishingDialogContext));
2240 ctx->builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_publish_dialog.glade", ctx); 2402 ctx->builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_publish_dialog.glade", ctx);
@@ -2269,22 +2431,105 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, gpointer user_
2269 ctx->master_pubdialog = 2431 ctx->master_pubdialog =
2270 GTK_WINDOW (gtk_builder_get_object 2432 GTK_WINDOW (gtk_builder_get_object
2271 (ctx->builder, "GNUNET_GTK_master_publish_dialog")); 2433 (ctx->builder, "GNUNET_GTK_master_publish_dialog"));
2272 pseudonym_treeview = GTK_TREE_VIEW (gtk_builder_get_object 2434
2273 (ctx->builder, 2435 ctx->global_checkbox = GTK_WIDGET (gtk_builder_get_object
2274 "GNUNET_GTK_master_publish_dialog_pseudonym_tree_view")); 2436 (ctx->builder , "GNUNET_GTK_master_publish_dialog_global_checkbox"));
2275 ctx->pseudonym_selection = gtk_tree_view_get_selection (pseudonym_treeview); 2437 ctx->own_checkbox = GTK_WIDGET (gtk_builder_get_object
2276 ctx->pseudonym_treemodel = gtk_tree_view_get_model (pseudonym_treeview); 2438 (ctx->builder , "GNUNET_GTK_master_publish_dialog_own_checkbox"));
2439 ctx->own_label = GTK_WIDGET (gtk_builder_get_object
2440 (ctx->builder , "GNUNET_GTK_master_publish_dialog_own_label"));
2441 ctx->updateable_checkbox = GTK_WIDGET (gtk_builder_get_object
2442 (ctx->builder , "GNUNET_GTK_master_publish_dialog_updateable_checkbox"));
2443 ctx->update_id_entry = GTK_WIDGET (gtk_builder_get_object
2444 (ctx->builder , "GNUNET_GTK_master_publish_dialog_update_id_entry"));
2445
2446 ctx->own_vbox = GTK_WIDGET (gtk_builder_get_object
2447 (ctx->builder , "GNUNET_GTK_master_publish_dialog_own_vbox"));
2448 ctx->update_id_hbox = GTK_WIDGET (gtk_builder_get_object
2449 (ctx->builder , "GNUNET_GTK_master_publish_dialog_update_id_hbox"));
2450
2451 ctx->identifiers_expander = GTK_WIDGET (gtk_builder_get_object (ctx->builder, "GNUNET_GTK_master_publish_dialog_previous_identifiers_expander"));
2452 ctx->vpaned = GTK_WIDGET (gtk_builder_get_object (ctx->builder, "GNUNET_GTK_master_publish_dialog_vpaned"));
2453 ctx->bottom_frame = GTK_WIDGET (gtk_builder_get_object (ctx->builder, "GNUNET_GTK_master_publish_dialog_bottom_frame"));
2454
2455 ctx->identifier_entry = GTK_WIDGET (gtk_builder_get_object
2456 (ctx->builder , "GNUNET_GTK_master_publish_dialog_identifier_entry"));
2457 ctx->identifiers_scrolled = GTK_WIDGET (gtk_builder_get_object (ctx->builder, "GNUNET_GTK_master_publish_dialog_previous_identifiers_scrolled"));
2458 ctx->identifiers_treeview = GTK_TREE_VIEW (gtk_builder_get_object (ctx->builder, "GNUNET_GTK_master_publish_dialog_previous_identifiers_treeview"));
2459 ctx->identifiers_treemodel = gtk_tree_view_get_model (ctx->identifiers_treeview);
2460 ctx->identifiers_selection = gtk_tree_view_get_selection (ctx->identifiers_treeview);
2461
2462 g_signal_connect (ctx->identifiers_expander, "notify::expanded", G_CALLBACK (expander_callback), ctx);
2277 2463
2278 /* connect signals; FIXME-GTK3: these could be connected with (modern) Glade */ 2464 /* connect signals; FIXME-GTK3: these could be connected with (modern) Glade */
2279 g_signal_connect (G_OBJECT (ctx->file_info_selection), "changed", 2465 g_signal_connect (G_OBJECT (ctx->file_info_selection), "changed",
2280 G_CALLBACK (selection_changed_cb), ctx); 2466 G_CALLBACK (selection_changed_cb), ctx);
2281 g_signal_connect (G_OBJECT (ctx->pseudonym_selection), "changed", 2467 g_signal_connect (G_OBJECT (ctx->identifiers_selection), "changed",
2282 G_CALLBACK (selection_changed_cb), ctx); 2468 G_CALLBACK (identifiers_selection_changed_cb), ctx);
2283 2469
2284 /* populate namespace model */ 2470 cfg = GNUNET_FS_GTK_get_configuration ();
2285 GNUNET_FS_namespace_list (GNUNET_FS_GTK_get_fs_handle (), 2471 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg,
2286 &add_namespace_to_ts, 2472 "gnunet-fs-gtk", "DEFAULT_NAMESPACE", &ctx->ns_name))
2287 GTK_TREE_STORE (ctx->pseudonym_treemodel)); 2473 ctx->ns_name = NULL;
2474 else
2475 {
2476 ctx->ns = GNUNET_FS_namespace_open_existing (GNUNET_FS_GTK_get_fs_handle (), ctx->ns_name);
2477 if (NULL == ctx->ns)
2478 GNUNET_free (ctx->ns_name);
2479 }
2480
2481 have_ns = (NULL != ctx->ns);
2482
2483 gtk_widget_set_sensitive (ctx->own_checkbox, have_ns);
2484 gtk_widget_set_sensitive (ctx->identifier_entry, have_ns);
2485 gtk_widget_set_sensitive (ctx->updateable_checkbox, have_ns);
2486 gtk_widget_set_sensitive (ctx->update_id_entry, have_ns);
2487 if (ctx->ns)
2488 {
2489 gtk_label_set_text (GTK_LABEL (ctx->own_label), ctx->ns_name);
2490 gtk_widget_set_tooltip_text (ctx->own_label, _(
2491 "This is the label of your namespace that will be used for "
2492 "publication, if you enable that option.\n"
2493 "This label will not be part of the publication.\n"
2494 "If you don't like this label, use Namespace Organizer to change it."
2495 ));
2496 add_namespace_to_ts (GTK_TREE_STORE (ctx->identifiers_treemodel), ctx->ns);
2497 gtk_tree_view_expand_all (ctx->identifiers_treeview);
2498 }
2499 else
2500 {
2501 gtk_label_set_text (GTK_LABEL (ctx->own_label),
2502 _("<no namespace is selected>"));
2503 gtk_widget_set_tooltip_text (ctx->own_label, _(
2504 "Namespace publication is unavailable, no namespace is selected.\n"
2505 "Try to close this dialog, open Namespace Organizer dialog, and "
2506 "select a namespace from a list of namespaces you own.\n"
2507 "You may need to create one, if you don't have any."
2508 ));
2509 }
2510
2511 updateable_enabled = GNUNET_CONFIGURATION_get_value_yesno (cfg,
2512 "gnunet-gtk", "MAKE_UPDATEABLE_PUBLICATIONS_BY_DEFAULT");
2513 if (GNUNET_SYSERR)
2514 updateable_enabled = GNUNET_YES;
2515 own_enabled = GNUNET_CONFIGURATION_get_value_yesno (cfg,
2516 "gnunet-gtk", "MAKE_NAMESPACE_PUBLICATIONS_BY_DEFAULT");
2517 if (GNUNET_SYSERR)
2518 own_enabled = GNUNET_NO;
2519 global_enabled = GNUNET_CONFIGURATION_get_value_yesno (cfg,
2520 "gnunet-gtk", "MAKE_GLOBAL_PUBLICATIONS_BY_DEFAULT");
2521 if (GNUNET_SYSERR)
2522 global_enabled = GNUNET_YES;
2523
2524 /* This will emit appropriate signals, their handlers will hide
2525 * parts of the dialog as needed.
2526 */
2527 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctx->updateable_checkbox),
2528 GNUNET_YES == updateable_enabled);
2529 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctx->own_checkbox),
2530 GNUNET_YES == own_enabled);
2531 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctx->global_checkbox),
2532 GNUNET_YES == global_enabled);
2288 2533
2289 /* show dialog */ 2534 /* show dialog */
2290 gtk_window_present (GTK_WINDOW (ctx->master_pubdialog)); 2535 gtk_window_present (GTK_WINDOW (ctx->master_pubdialog));