diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-10 19:04:41 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-10 19:04:41 +0000 |
commit | e975394827547a02dcc091f31b1f2145075ec751 (patch) | |
tree | 26cdd91ed956f71ce9aa7b5c96c11ec7e2d31e59 | |
parent | 30618bc1046bcdfd640a18a4095c31869eda0c86 (diff) | |
download | gnunet-gtk-e975394827547a02dcc091f31b1f2145075ec751.tar.gz gnunet-gtk-e975394827547a02dcc091f31b1f2145075ec751.zip |
implemented #3024, but untested
-rw-r--r-- | contrib/Makefile.am | 2 | ||||
-rw-r--r-- | contrib/gnunet_fs_gtk_enter_nick_dialog.glade | 125 | ||||
-rw-r--r-- | contrib/gnunet_fs_gtk_main_window.glade | 71 | ||||
-rw-r--r-- | contrib/gnunet_fs_gtk_open_url_dialog.glade | 123 | ||||
-rw-r--r-- | contrib/gnunet_fs_gtk_pseu_progress_dialog.glade | 78 | ||||
-rw-r--r-- | src/fs/Makefile.am | 1 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk.h | 43 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_main-window-search.c | 329 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_publish-dialog.c | 2 |
9 files changed, 668 insertions, 106 deletions
diff --git a/contrib/Makefile.am b/contrib/Makefile.am index a720526e..23f761f5 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am | |||
@@ -31,6 +31,7 @@ pkgdata_DATA = \ | |||
31 | gnunet_fs_gtk_download_as_dialog.glade \ | 31 | gnunet_fs_gtk_download_as_dialog.glade \ |
32 | gnunet_fs_gtk_main_window.glade \ | 32 | gnunet_fs_gtk_main_window.glade \ |
33 | gnunet_fs_gtk_edit_publication.glade \ | 33 | gnunet_fs_gtk_edit_publication.glade \ |
34 | gnunet_fs_gtk_enter_nick_dialog.glade \ | ||
34 | gnunet_fs_gtk_open_directory_dialog.glade \ | 35 | gnunet_fs_gtk_open_directory_dialog.glade \ |
35 | gnunet_fs_gtk_open_url_dialog.glade \ | 36 | gnunet_fs_gtk_open_url_dialog.glade \ |
36 | gnunet_fs_gtk_publish_dialog.glade \ | 37 | gnunet_fs_gtk_publish_dialog.glade \ |
@@ -39,6 +40,7 @@ pkgdata_DATA = \ | |||
39 | gnunet_fs_gtk_publish_tab.glade \ | 40 | gnunet_fs_gtk_publish_tab.glade \ |
40 | gnunet_fs_gtk_search_tab.glade \ | 41 | gnunet_fs_gtk_search_tab.glade \ |
41 | gnunet_fs_gtk_unindex.glade \ | 42 | gnunet_fs_gtk_unindex.glade \ |
43 | gnunet_fs_gtk_pseu_progress_dialog.glade \ | ||
42 | gnunet_fs_gtk_progress_dialog.glade \ | 44 | gnunet_fs_gtk_progress_dialog.glade \ |
43 | gnunet_gtk_status_bar_menu.glade \ | 45 | gnunet_gtk_status_bar_menu.glade \ |
44 | gnunet_identity_gtk_about_window.glade \ | 46 | gnunet_identity_gtk_about_window.glade \ |
diff --git a/contrib/gnunet_fs_gtk_enter_nick_dialog.glade b/contrib/gnunet_fs_gtk_enter_nick_dialog.glade new file mode 100644 index 00000000..79b46428 --- /dev/null +++ b/contrib/gnunet_fs_gtk_enter_nick_dialog.glade | |||
@@ -0,0 +1,125 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <interface> | ||
3 | <requires lib="gtk+" version="2.24"/> | ||
4 | <!-- interface-naming-policy project-wide --> | ||
5 | <object class="GtkWindow" id="GNUNET_GTK_enter_nick_window"> | ||
6 | <property name="can_focus">False</property> | ||
7 | <property name="title" translatable="yes">Enter the desired nickname for the namespace</property> | ||
8 | <property name="modal">True</property> | ||
9 | <property name="default_width">640</property> | ||
10 | <property name="default_height">240</property> | ||
11 | <property name="destroy_with_parent">True</property> | ||
12 | <property name="skip_taskbar_hint">True</property> | ||
13 | <property name="skip_pager_hint">True</property> | ||
14 | <property name="deletable">False</property> | ||
15 | <signal name="delete-event" handler="GNUNET_GTK_enter_nick_window_delete_event_cb" swapped="no"/> | ||
16 | <child> | ||
17 | <object class="GtkVBox" id="GNUNET_GTK_enter_nick_window_main_vbox"> | ||
18 | <property name="visible">True</property> | ||
19 | <property name="can_focus">False</property> | ||
20 | <property name="spacing">2</property> | ||
21 | <child> | ||
22 | <object class="GtkHBox" id="GNUNET_GTK_enter_nick_window__nick_hbox"> | ||
23 | <property name="visible">True</property> | ||
24 | <property name="can_focus">False</property> | ||
25 | <child> | ||
26 | <object class="GtkLabel" id="GNUNET_GTK_enter_nick_window_nick_label"> | ||
27 | <property name="visible">True</property> | ||
28 | <property name="can_focus">False</property> | ||
29 | <property name="label" translatable="yes">_Nickname:</property> | ||
30 | <property name="use_underline">True</property> | ||
31 | <property name="mnemonic_widget">GNUNET_GTK_open_url_dialog_url_textview</property> | ||
32 | </object> | ||
33 | <packing> | ||
34 | <property name="expand">False</property> | ||
35 | <property name="fill">False</property> | ||
36 | <property name="padding">5</property> | ||
37 | <property name="position">0</property> | ||
38 | </packing> | ||
39 | </child> | ||
40 | <child> | ||
41 | <object class="GtkEntry" id="GNUNET_GTK_enter_nick_window_nick_entry"> | ||
42 | <property name="visible">True</property> | ||
43 | <property name="can_focus">True</property> | ||
44 | <property name="invisible_char">●</property> | ||
45 | <property name="primary_icon_activatable">False</property> | ||
46 | <property name="secondary_icon_activatable">False</property> | ||
47 | <property name="primary_icon_sensitive">True</property> | ||
48 | <property name="secondary_icon_sensitive">True</property> | ||
49 | <signal name="changed" handler="GNUNET_GTK_enter_nick_window_nick_entry_changed_cb" swapped="no"/> | ||
50 | </object> | ||
51 | <packing> | ||
52 | <property name="expand">True</property> | ||
53 | <property name="fill">True</property> | ||
54 | <property name="padding">5</property> | ||
55 | <property name="position">1</property> | ||
56 | </packing> | ||
57 | </child> | ||
58 | </object> | ||
59 | <packing> | ||
60 | <property name="expand">False</property> | ||
61 | <property name="fill">False</property> | ||
62 | <property name="padding">5</property> | ||
63 | <property name="position">0</property> | ||
64 | </packing> | ||
65 | </child> | ||
66 | <child> | ||
67 | <object class="GtkHBox" id="GNUNET_GTK_enter_nick_window_dialog_button_hbox"> | ||
68 | <property name="visible">True</property> | ||
69 | <property name="can_focus">False</property> | ||
70 | <child> | ||
71 | <object class="GtkButton" id="GNUNET_GTK_enter_nick_window_execute_button"> | ||
72 | <property name="label">gtk-execute</property> | ||
73 | <property name="use_action_appearance">False</property> | ||
74 | <property name="visible">True</property> | ||
75 | <property name="sensitive">False</property> | ||
76 | <property name="can_focus">True</property> | ||
77 | <property name="receives_default">True</property> | ||
78 | <property name="use_underline">True</property> | ||
79 | <property name="use_stock">True</property> | ||
80 | <property name="image_position">right</property> | ||
81 | <signal name="clicked" handler="GNUNET_GTK_enter_nick_window_execute_button_clicked_cb" swapped="no"/> | ||
82 | </object> | ||
83 | <packing> | ||
84 | <property name="expand">False</property> | ||
85 | <property name="fill">False</property> | ||
86 | <property name="padding">4</property> | ||
87 | <property name="pack_type">end</property> | ||
88 | <property name="position">0</property> | ||
89 | </packing> | ||
90 | </child> | ||
91 | <child> | ||
92 | <object class="GtkButton" id="GNUNET_GTK_enter_nick_window_cancel_button"> | ||
93 | <property name="label">gtk-cancel</property> | ||
94 | <property name="use_action_appearance">False</property> | ||
95 | <property name="visible">True</property> | ||
96 | <property name="can_focus">True</property> | ||
97 | <property name="receives_default">True</property> | ||
98 | <property name="use_stock">True</property> | ||
99 | <signal name="clicked" handler="GNUNET_GTK_enter_nick_window_cancel_button_clicked_cb" swapped="no"/> | ||
100 | </object> | ||
101 | <packing> | ||
102 | <property name="expand">False</property> | ||
103 | <property name="fill">False</property> | ||
104 | <property name="padding">4</property> | ||
105 | <property name="pack_type">end</property> | ||
106 | <property name="position">1</property> | ||
107 | </packing> | ||
108 | </child> | ||
109 | </object> | ||
110 | <packing> | ||
111 | <property name="expand">False</property> | ||
112 | <property name="fill">False</property> | ||
113 | <property name="padding">4</property> | ||
114 | <property name="position">1</property> | ||
115 | </packing> | ||
116 | </child> | ||
117 | </object> | ||
118 | </child> | ||
119 | </object> | ||
120 | <object class="GtkImage" id="execute-stock-image"> | ||
121 | <property name="visible">True</property> | ||
122 | <property name="can_focus">False</property> | ||
123 | <property name="stock">gtk-execute</property> | ||
124 | </object> | ||
125 | </interface> | ||
diff --git a/contrib/gnunet_fs_gtk_main_window.glade b/contrib/gnunet_fs_gtk_main_window.glade index 64611d5c..f9bf328b 100644 --- a/contrib/gnunet_fs_gtk_main_window.glade +++ b/contrib/gnunet_fs_gtk_main_window.glade | |||
@@ -32,6 +32,30 @@ | |||
32 | <column type="guint"/> | 32 | <column type="guint"/> |
33 | </columns> | 33 | </columns> |
34 | </object> | 34 | </object> |
35 | <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store"> | ||
36 | <columns> | ||
37 | <!-- column-name extractor_meta_type --> | ||
38 | <column type="guint"/> | ||
39 | <!-- column-name extractor_meta_format --> | ||
40 | <column type="guint"/> | ||
41 | <!-- column-name extractor_meta_type_string --> | ||
42 | <column type="gchararray"/> | ||
43 | <!-- column-name extracotr_meta_value --> | ||
44 | <column type="gchararray"/> | ||
45 | </columns> | ||
46 | </object> | ||
47 | <object class="GtkAdjustment" id="adjustment1"> | ||
48 | <property name="upper">100</property> | ||
49 | <property name="step_increment">1</property> | ||
50 | <property name="page_increment">10</property> | ||
51 | <property name="page_size">10</property> | ||
52 | </object> | ||
53 | <object class="GtkAdjustment" id="adjustment2"> | ||
54 | <property name="upper">100</property> | ||
55 | <property name="step_increment">1</property> | ||
56 | <property name="page_increment">10</property> | ||
57 | <property name="page_size">10</property> | ||
58 | </object> | ||
35 | <object class="GtkWindow" id="GNUNET_GTK_main_window"> | 59 | <object class="GtkWindow" id="GNUNET_GTK_main_window"> |
36 | <property name="can_focus">False</property> | 60 | <property name="can_focus">False</property> |
37 | <property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property> | 61 | <property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property> |
@@ -352,8 +376,8 @@ | |||
352 | <property name="use_action_appearance">False</property> | 376 | <property name="use_action_appearance">False</property> |
353 | <property name="can_focus">True</property> | 377 | <property name="can_focus">True</property> |
354 | <property name="receives_default">True</property> | 378 | <property name="receives_default">True</property> |
355 | <property name="tooltip_text" translatable="yes">Remember the specified namespace for later.</property> | 379 | <property name="tooltip_text" translatable="yes">Remember the specified namespace for later. |
356 | <property name="relief">none</property> | 380 | This operation will be executed using the anonymity level specified on the right.</property> |
357 | <property name="use_stock">True</property> | 381 | <property name="use_stock">True</property> |
358 | <property name="image_position">top</property> | 382 | <property name="image_position">top</property> |
359 | <signal name="clicked" handler="GNUNET_FS_GTK_save_button_clicked_cb" swapped="no"/> | 383 | <signal name="clicked" handler="GNUNET_FS_GTK_save_button_clicked_cb" swapped="no"/> |
@@ -417,6 +441,9 @@ | |||
417 | <property name="visible">True</property> | 441 | <property name="visible">True</property> |
418 | <property name="can_focus">True</property> | 442 | <property name="can_focus">True</property> |
419 | <property name="receives_default">True</property> | 443 | <property name="receives_default">True</property> |
444 | <property name="tooltip_text" translatable="yes">Search using the given keywords. The search may be narrowed by the given mime type and/or restricted to a namespace. | ||
445 | This operation will be executed using the anonymity level specified on the right. | ||
446 | </property> | ||
420 | <property name="image">find_stock_image</property> | 447 | <property name="image">find_stock_image</property> |
421 | <property name="image_position">top</property> | 448 | <property name="image_position">top</property> |
422 | <signal name="clicked" handler="main_window_search_button_clicked_cb" swapped="no"/> | 449 | <signal name="clicked" handler="main_window_search_button_clicked_cb" swapped="no"/> |
@@ -907,38 +934,6 @@ | |||
907 | </object> | 934 | </object> |
908 | </child> | 935 | </child> |
909 | </object> | 936 | </object> |
910 | <object class="GtkListStore" id="GNUNET_GTK_select_pseudonym_liststore"> | ||
911 | <columns> | ||
912 | <!-- column-name namespace_name --> | ||
913 | <column type="gchararray"/> | ||
914 | <!-- column-name namespace_handle --> | ||
915 | <column type="gpointer"/> | ||
916 | </columns> | ||
917 | </object> | ||
918 | <object class="GtkAdjustment" id="adjustment1"> | ||
919 | <property name="upper">100</property> | ||
920 | <property name="step_increment">1</property> | ||
921 | <property name="page_increment">10</property> | ||
922 | <property name="page_size">10</property> | ||
923 | </object> | ||
924 | <object class="GtkAdjustment" id="adjustment2"> | ||
925 | <property name="upper">100</property> | ||
926 | <property name="step_increment">1</property> | ||
927 | <property name="page_increment">10</property> | ||
928 | <property name="page_size">10</property> | ||
929 | </object> | ||
930 | <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store"> | ||
931 | <columns> | ||
932 | <!-- column-name extractor_meta_type --> | ||
933 | <column type="guint"/> | ||
934 | <!-- column-name extractor_meta_format --> | ||
935 | <column type="guint"/> | ||
936 | <!-- column-name extractor_meta_type_string --> | ||
937 | <column type="gchararray"/> | ||
938 | <!-- column-name extracotr_meta_value --> | ||
939 | <column type="gchararray"/> | ||
940 | </columns> | ||
941 | </object> | ||
942 | <object class="GtkListStore" id="GNUNET_GTK_peer_info_list_store"> | 937 | <object class="GtkListStore" id="GNUNET_GTK_peer_info_list_store"> |
943 | <columns> | 938 | <columns> |
944 | <!-- column-name peer_identity --> | 939 | <!-- column-name peer_identity --> |
@@ -953,6 +948,14 @@ | |||
953 | <column type="guint64"/> | 948 | <column type="guint64"/> |
954 | </columns> | 949 | </columns> |
955 | </object> | 950 | </object> |
951 | <object class="GtkListStore" id="GNUNET_GTK_select_pseudonym_liststore"> | ||
952 | <columns> | ||
953 | <!-- column-name namespace_name --> | ||
954 | <column type="gchararray"/> | ||
955 | <!-- column-name namespace_handle --> | ||
956 | <column type="gpointer"/> | ||
957 | </columns> | ||
958 | </object> | ||
956 | <object class="GtkAdjustment" id="adjustment3"> | 959 | <object class="GtkAdjustment" id="adjustment3"> |
957 | <property name="upper">100</property> | 960 | <property name="upper">100</property> |
958 | <property name="step_increment">1</property> | 961 | <property name="step_increment">1</property> |
diff --git a/contrib/gnunet_fs_gtk_open_url_dialog.glade b/contrib/gnunet_fs_gtk_open_url_dialog.glade index e5d85243..1fbcf5bb 100644 --- a/contrib/gnunet_fs_gtk_open_url_dialog.glade +++ b/contrib/gnunet_fs_gtk_open_url_dialog.glade | |||
@@ -1,8 +1,17 @@ | |||
1 | <?xml version="1.0"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <interface> | 2 | <interface> |
3 | <requires lib="gtk+" version="2.20"/> | 3 | <requires lib="gtk+" version="2.20"/> |
4 | <!-- interface-naming-policy toplevel-contextual --> | 4 | <!-- interface-naming-policy toplevel-contextual --> |
5 | <object class="GtkTextBuffer" id="GNUNET_GTK_open_url_dialog_url_textview_buffer"> | ||
6 | <signal name="changed" handler="GNUNET_GTK_open_url_dialog_url_textview_buffer_changed_cb" swapped="no"/> | ||
7 | </object> | ||
8 | <object class="GtkImage" id="execute-stock-image"> | ||
9 | <property name="visible">True</property> | ||
10 | <property name="can_focus">False</property> | ||
11 | <property name="stock">gtk-execute</property> | ||
12 | </object> | ||
5 | <object class="GtkWindow" id="GNUNET_GTK_open_url_window"> | 13 | <object class="GtkWindow" id="GNUNET_GTK_open_url_window"> |
14 | <property name="can_focus">False</property> | ||
6 | <property name="title" translatable="yes">Enter the URI to be downloaded</property> | 15 | <property name="title" translatable="yes">Enter the URI to be downloaded</property> |
7 | <property name="modal">True</property> | 16 | <property name="modal">True</property> |
8 | <property name="default_width">640</property> | 17 | <property name="default_width">640</property> |
@@ -11,18 +20,20 @@ | |||
11 | <property name="skip_taskbar_hint">True</property> | 20 | <property name="skip_taskbar_hint">True</property> |
12 | <property name="skip_pager_hint">True</property> | 21 | <property name="skip_pager_hint">True</property> |
13 | <property name="deletable">False</property> | 22 | <property name="deletable">False</property> |
14 | <signal name="delete_event" handler="GNUNET_GTK_open_url_window_delete_event_cb"/> | 23 | <signal name="delete-event" handler="GNUNET_GTK_open_url_window_delete_event_cb" swapped="no"/> |
15 | <child> | 24 | <child> |
16 | <object class="GtkVBox" id="GNUNET_GTK_open_url_dialog_main_vbox"> | 25 | <object class="GtkVBox" id="GNUNET_GTK_open_url_dialog_main_vbox"> |
17 | <property name="visible">True</property> | 26 | <property name="visible">True</property> |
18 | <property name="orientation">vertical</property> | 27 | <property name="can_focus">False</property> |
19 | <property name="spacing">2</property> | 28 | <property name="spacing">2</property> |
20 | <child> | 29 | <child> |
21 | <object class="GtkHBox" id="GNUNET_GTK_open_url_dialog_query_hbox"> | 30 | <object class="GtkHBox" id="GNUNET_GTK_open_url_dialog_query_hbox"> |
22 | <property name="visible">True</property> | 31 | <property name="visible">True</property> |
32 | <property name="can_focus">False</property> | ||
23 | <child> | 33 | <child> |
24 | <object class="GtkLabel" id="GNUNET_GTK_open_url_dialog_url_label"> | 34 | <object class="GtkLabel" id="GNUNET_GTK_open_url_dialog_url_label"> |
25 | <property name="visible">True</property> | 35 | <property name="visible">True</property> |
36 | <property name="can_focus">False</property> | ||
26 | <property name="label" translatable="yes">_URI:</property> | 37 | <property name="label" translatable="yes">_URI:</property> |
27 | <property name="use_underline">True</property> | 38 | <property name="use_underline">True</property> |
28 | <property name="mnemonic_widget">GNUNET_GTK_open_url_dialog_url_textview</property> | 39 | <property name="mnemonic_widget">GNUNET_GTK_open_url_dialog_url_textview</property> |
@@ -37,11 +48,13 @@ | |||
37 | <child> | 48 | <child> |
38 | <object class="GtkFrame" id="GNUNET_GTK_open_url_dialog_url_frame"> | 49 | <object class="GtkFrame" id="GNUNET_GTK_open_url_dialog_url_frame"> |
39 | <property name="visible">True</property> | 50 | <property name="visible">True</property> |
51 | <property name="can_focus">False</property> | ||
40 | <property name="label_xalign">0</property> | 52 | <property name="label_xalign">0</property> |
41 | <property name="shadow_type">in</property> | 53 | <property name="shadow_type">in</property> |
42 | <child> | 54 | <child> |
43 | <object class="GtkAlignment" id="GNUNET_GTK_open_url_dialog_url_alignment"> | 55 | <object class="GtkAlignment" id="GNUNET_GTK_open_url_dialog_url_alignment"> |
44 | <property name="visible">True</property> | 56 | <property name="visible">True</property> |
57 | <property name="can_focus">False</property> | ||
45 | <child> | 58 | <child> |
46 | <object class="GtkTextView" id="GNUNET_GTK_open_url_dialog_url_textview"> | 59 | <object class="GtkTextView" id="GNUNET_GTK_open_url_dialog_url_textview"> |
47 | <property name="visible">True</property> | 60 | <property name="visible">True</property> |
@@ -51,7 +64,7 @@ | |||
51 | <property name="indent">20</property> | 64 | <property name="indent">20</property> |
52 | <property name="buffer">GNUNET_GTK_open_url_dialog_url_textview_buffer</property> | 65 | <property name="buffer">GNUNET_GTK_open_url_dialog_url_textview_buffer</property> |
53 | <property name="accepts_tab">False</property> | 66 | <property name="accepts_tab">False</property> |
54 | <signal name="key_press_event" handler="GNUNET_GTK_open_url_dialog_url_textview_key_press_event_cb"/> | 67 | <signal name="key-press-event" handler="GNUNET_GTK_open_url_dialog_url_textview_key_press_event_cb" swapped="no"/> |
55 | </object> | 68 | </object> |
56 | </child> | 69 | </child> |
57 | </object> | 70 | </object> |
@@ -61,24 +74,52 @@ | |||
61 | </child> | 74 | </child> |
62 | </object> | 75 | </object> |
63 | <packing> | 76 | <packing> |
77 | <property name="expand">True</property> | ||
78 | <property name="fill">True</property> | ||
64 | <property name="position">1</property> | 79 | <property name="position">1</property> |
65 | </packing> | 80 | </packing> |
66 | </child> | 81 | </child> |
67 | </object> | 82 | </object> |
68 | <packing> | 83 | <packing> |
84 | <property name="expand">True</property> | ||
85 | <property name="fill">True</property> | ||
69 | <property name="padding">5</property> | 86 | <property name="padding">5</property> |
70 | <property name="position">0</property> | 87 | <property name="position">0</property> |
71 | </packing> | 88 | </packing> |
72 | </child> | 89 | </child> |
73 | <child> | 90 | <child> |
74 | <object class="GtkHBox" id="GNUNET_GTK_open_url_dialog_anonymity_hbox"> | 91 | <object class="GtkHBox" id="GNUNET_GTK_open_url_dialog_button_hbox"> |
75 | <property name="visible">True</property> | 92 | <property name="visible">True</property> |
93 | <property name="can_focus">False</property> | ||
76 | <child> | 94 | <child> |
77 | <object class="GtkLabel" id="GNUNET_GTK_open_url_dialog_anonymity_label"> | 95 | <object class="GtkButton" id="GNUNET_GTK_open_url_dialog_execute_button"> |
96 | <property name="label">_Execute</property> | ||
97 | <property name="use_action_appearance">False</property> | ||
78 | <property name="visible">True</property> | 98 | <property name="visible">True</property> |
79 | <property name="label" translatable="yes">_Anonymity:</property> | 99 | <property name="sensitive">False</property> |
100 | <property name="can_focus">True</property> | ||
101 | <property name="receives_default">True</property> | ||
102 | <property name="image">execute-stock-image</property> | ||
80 | <property name="use_underline">True</property> | 103 | <property name="use_underline">True</property> |
81 | <property name="mnemonic_widget">GNUNET_GTK_open_url_dialog_anonymity_combobox</property> | 104 | <signal name="clicked" handler="GNUNET_GTK_open_url_dialog_execute_button_clicked_cb" swapped="no"/> |
105 | </object> | ||
106 | <packing> | ||
107 | <property name="expand">False</property> | ||
108 | <property name="fill">False</property> | ||
109 | <property name="padding">4</property> | ||
110 | <property name="pack_type">end</property> | ||
111 | <property name="position">0</property> | ||
112 | </packing> | ||
113 | </child> | ||
114 | <child> | ||
115 | <object class="GtkButton" id="GNUNET_GTK_open_url_dialog_cancel_button"> | ||
116 | <property name="label">gtk-cancel</property> | ||
117 | <property name="use_action_appearance">False</property> | ||
118 | <property name="visible">True</property> | ||
119 | <property name="can_focus">True</property> | ||
120 | <property name="receives_default">True</property> | ||
121 | <property name="use_stock">True</property> | ||
122 | <signal name="clicked" handler="GNUNET_GTK_open_url_dialog_cancel_button_clicked_cb" swapped="no"/> | ||
82 | </object> | 123 | </object> |
83 | <packing> | 124 | <packing> |
84 | <property name="expand">False</property> | 125 | <property name="expand">False</property> |
@@ -88,13 +129,28 @@ | |||
88 | <property name="position">1</property> | 129 | <property name="position">1</property> |
89 | </packing> | 130 | </packing> |
90 | </child> | 131 | </child> |
132 | </object> | ||
133 | <packing> | ||
134 | <property name="expand">False</property> | ||
135 | <property name="fill">False</property> | ||
136 | <property name="padding">4</property> | ||
137 | <property name="pack_type">end</property> | ||
138 | <property name="position">1</property> | ||
139 | </packing> | ||
140 | </child> | ||
141 | <child> | ||
142 | <object class="GtkHBox" id="GNUNET_GTK_open_url_dialog_anonymity_hbox"> | ||
143 | <property name="visible">True</property> | ||
144 | <property name="can_focus">False</property> | ||
91 | <child> | 145 | <child> |
92 | <object class="GtkAlignment" id="GNUNET_GTK_open_url_dialog_anonymity_combobox_alignment"> | 146 | <object class="GtkAlignment" id="GNUNET_GTK_open_url_dialog_anonymity_combobox_alignment"> |
93 | <property name="visible">True</property> | 147 | <property name="visible">True</property> |
148 | <property name="can_focus">False</property> | ||
94 | <property name="yscale">0</property> | 149 | <property name="yscale">0</property> |
95 | <child> | 150 | <child> |
96 | <object class="GtkComboBox" id="GNUNET_GTK_open_url_dialog_anonymity_combobox"> | 151 | <object class="GtkComboBox" id="GNUNET_GTK_open_url_dialog_anonymity_combobox"> |
97 | <property name="visible">True</property> | 152 | <property name="visible">True</property> |
153 | <property name="can_focus">False</property> | ||
98 | <property name="active">1</property> | 154 | <property name="active">1</property> |
99 | <child> | 155 | <child> |
100 | <object class="GtkCellRendererText" id="GNUNET_GTK_open_url_dialog_anonymity_combobox_renderer"/> | 156 | <object class="GtkCellRendererText" id="GNUNET_GTK_open_url_dialog_anonymity_combobox_renderer"/> |
@@ -119,69 +175,30 @@ | |||
119 | <property name="position">0</property> | 175 | <property name="position">0</property> |
120 | </packing> | 176 | </packing> |
121 | </child> | 177 | </child> |
122 | </object> | ||
123 | <packing> | ||
124 | <property name="expand">False</property> | ||
125 | <property name="fill">False</property> | ||
126 | <property name="position">2</property> | ||
127 | </packing> | ||
128 | </child> | ||
129 | <child> | ||
130 | <object class="GtkHBox" id="GNUNET_GTK_open_url_dialog_button_hbox"> | ||
131 | <property name="visible">True</property> | ||
132 | <child> | ||
133 | <object class="GtkButton" id="GNUNET_GTK_open_url_dialog_cancel_button"> | ||
134 | <property name="label">gtk-cancel</property> | ||
135 | <property name="visible">True</property> | ||
136 | <property name="can_focus">True</property> | ||
137 | <property name="receives_default">True</property> | ||
138 | <property name="use_stock">True</property> | ||
139 | <signal name="clicked" handler="GNUNET_GTK_open_url_dialog_cancel_button_clicked_cb"/> | ||
140 | </object> | ||
141 | <packing> | ||
142 | <property name="expand">False</property> | ||
143 | <property name="fill">False</property> | ||
144 | <property name="padding">4</property> | ||
145 | <property name="pack_type">end</property> | ||
146 | <property name="position">1</property> | ||
147 | </packing> | ||
148 | </child> | ||
149 | <child> | 178 | <child> |
150 | <object class="GtkButton" id="GNUNET_GTK_open_url_dialog_execute_button"> | 179 | <object class="GtkLabel" id="GNUNET_GTK_open_url_dialog_anonymity_label"> |
151 | <property name="label">_Execute</property> | ||
152 | <property name="visible">True</property> | 180 | <property name="visible">True</property> |
153 | <property name="sensitive">False</property> | 181 | <property name="can_focus">False</property> |
154 | <property name="can_focus">True</property> | 182 | <property name="label" translatable="yes">_Anonymity:</property> |
155 | <property name="receives_default">True</property> | ||
156 | <property name="image">execute-stock-image</property> | ||
157 | <property name="use_underline">True</property> | 183 | <property name="use_underline">True</property> |
158 | <signal name="clicked" handler="GNUNET_GTK_open_url_dialog_execute_button_clicked_cb"/> | 184 | <property name="mnemonic_widget">GNUNET_GTK_open_url_dialog_anonymity_combobox</property> |
159 | </object> | 185 | </object> |
160 | <packing> | 186 | <packing> |
161 | <property name="expand">False</property> | 187 | <property name="expand">False</property> |
162 | <property name="fill">False</property> | 188 | <property name="fill">False</property> |
163 | <property name="padding">4</property> | 189 | <property name="padding">4</property> |
164 | <property name="pack_type">end</property> | 190 | <property name="pack_type">end</property> |
165 | <property name="position">0</property> | 191 | <property name="position">1</property> |
166 | </packing> | 192 | </packing> |
167 | </child> | 193 | </child> |
168 | </object> | 194 | </object> |
169 | <packing> | 195 | <packing> |
170 | <property name="expand">False</property> | 196 | <property name="expand">False</property> |
171 | <property name="fill">False</property> | 197 | <property name="fill">False</property> |
172 | <property name="padding">4</property> | 198 | <property name="position">2</property> |
173 | <property name="pack_type">end</property> | ||
174 | <property name="position">1</property> | ||
175 | </packing> | 199 | </packing> |
176 | </child> | 200 | </child> |
177 | </object> | 201 | </object> |
178 | </child> | 202 | </child> |
179 | </object> | 203 | </object> |
180 | <object class="GtkTextBuffer" id="GNUNET_GTK_open_url_dialog_url_textview_buffer"> | ||
181 | <signal name="changed" handler="GNUNET_GTK_open_url_dialog_url_textview_buffer_changed_cb"/> | ||
182 | </object> | ||
183 | <object class="GtkImage" id="execute-stock-image"> | ||
184 | <property name="visible">True</property> | ||
185 | <property name="stock">gtk-execute</property> | ||
186 | </object> | ||
187 | </interface> | 204 | </interface> |
diff --git a/contrib/gnunet_fs_gtk_pseu_progress_dialog.glade b/contrib/gnunet_fs_gtk_pseu_progress_dialog.glade new file mode 100644 index 00000000..ebd050e2 --- /dev/null +++ b/contrib/gnunet_fs_gtk_pseu_progress_dialog.glade | |||
@@ -0,0 +1,78 @@ | |||
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="GtkAdjustment" id="GNUNET_FS_GTK_pseu_progress_bar_adjustment"> | ||
6 | <property name="upper">100</property> | ||
7 | <property name="step_increment">1</property> | ||
8 | <property name="page_increment">10</property> | ||
9 | <property name="page_size">10</property> | ||
10 | </object> | ||
11 | <object class="GtkWindow" id="GNUNET_FS_GTK_pseu_progress_dialog"> | ||
12 | <property name="can_focus">False</property> | ||
13 | <property name="border_width">2</property> | ||
14 | <property name="title" translatable="yes">Preparing to save namespace in GNS zone</property> | ||
15 | <property name="window_position">center-on-parent</property> | ||
16 | <property name="default_width">800</property> | ||
17 | <property name="default_height">600</property> | ||
18 | <property name="destroy_with_parent">True</property> | ||
19 | <signal name="delete-event" handler="GNUNET_FS_GTK_pseu_progress_dialog_delete_event_cb" swapped="no"/> | ||
20 | <child> | ||
21 | <object class="GtkVBox" id="GNUNET_FS_GTK_pseu_progress_dialog_main_vbox"> | ||
22 | <property name="visible">True</property> | ||
23 | <property name="can_focus">False</property> | ||
24 | <property name="spacing">2</property> | ||
25 | <child> | ||
26 | <object class="GtkProgressBar" id="GNUNET_FS_GTK_pseu_progress_dialog_progressbar"> | ||
27 | <property name="visible">True</property> | ||
28 | <property name="can_focus">False</property> | ||
29 | <property name="activity_mode">True</property> | ||
30 | <property name="show_text">True</property> | ||
31 | <property name="pulse_step">0.050000000000000003</property> | ||
32 | <property name="text" translatable="yes">Trying to discover nickname...</property> | ||
33 | <property name="adjustment">GNUNET_FS_GTK_pseu_progress_bar_adjustment</property> | ||
34 | <property name="discrete_blocks">5</property> | ||
35 | </object> | ||
36 | <packing> | ||
37 | <property name="expand">False</property> | ||
38 | <property name="fill">False</property> | ||
39 | <property name="position">0</property> | ||
40 | </packing> | ||
41 | </child> | ||
42 | <child> | ||
43 | <object class="GtkHBox" id="GNUNET_FS_GTK_pseu_progress_dialog_buttons_hbox"> | ||
44 | <property name="visible">True</property> | ||
45 | <property name="can_focus">False</property> | ||
46 | <property name="spacing">2</property> | ||
47 | <child> | ||
48 | <placeholder/> | ||
49 | </child> | ||
50 | <child> | ||
51 | <object class="GtkButton" id="GNUNET_FS_GTK_pseu_progress_dialog_cancel_button"> | ||
52 | <property name="label">gtk-cancel</property> | ||
53 | <property name="use_action_appearance">False</property> | ||
54 | <property name="visible">True</property> | ||
55 | <property name="can_focus">True</property> | ||
56 | <property name="receives_default">True</property> | ||
57 | <property name="tooltip_text" translatable="yes">If you cancel this operation, you can enter a nickname manually.</property> | ||
58 | <property name="use_stock">True</property> | ||
59 | <signal name="clicked" handler="GNUNET_FS_GTK_pseu_progress_dialog_cancel_button_clicked_cb" swapped="no"/> | ||
60 | </object> | ||
61 | <packing> | ||
62 | <property name="expand">False</property> | ||
63 | <property name="fill">False</property> | ||
64 | <property name="pack_type">end</property> | ||
65 | <property name="position">1</property> | ||
66 | </packing> | ||
67 | </child> | ||
68 | </object> | ||
69 | <packing> | ||
70 | <property name="expand">False</property> | ||
71 | <property name="fill">False</property> | ||
72 | <property name="position">1</property> | ||
73 | </packing> | ||
74 | </child> | ||
75 | </object> | ||
76 | </child> | ||
77 | </object> | ||
78 | </interface> | ||
diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am index 90bd1b39..553822ee 100644 --- a/src/fs/Makefile.am +++ b/src/fs/Makefile.am | |||
@@ -34,6 +34,7 @@ gnunet_fs_gtk_LDADD = \ | |||
34 | -lextractor \ | 34 | -lextractor \ |
35 | -lgnunetutil \ | 35 | -lgnunetutil \ |
36 | -lgnunetarm \ | 36 | -lgnunetarm \ |
37 | -lgnunetdnsparser \ | ||
37 | -lgnunetfs \ | 38 | -lgnunetfs \ |
38 | -lgnunetgns \ | 39 | -lgnunetgns \ |
39 | -lgnunetnamestore \ | 40 | -lgnunetnamestore \ |
diff --git a/src/fs/gnunet-fs-gtk.h b/src/fs/gnunet-fs-gtk.h index 71cc8e55..ca25bbe8 100644 --- a/src/fs/gnunet-fs-gtk.h +++ b/src/fs/gnunet-fs-gtk.h | |||
@@ -97,7 +97,48 @@ struct PseuLookupContext | |||
97 | /** | 97 | /** |
98 | * Lookup request with GNS. | 98 | * Lookup request with GNS. |
99 | */ | 99 | */ |
100 | struct GNUNET_GNS_LookupRequest *lr; | 100 | struct GNUNET_GNS_LookupRequest *lr; |
101 | |||
102 | /** | ||
103 | * Builder for the progress dialog that is displayed. | ||
104 | */ | ||
105 | GtkBuilder *progress_dialog_builder; | ||
106 | |||
107 | /** | ||
108 | * The progress dialog itself. | ||
109 | */ | ||
110 | GtkWidget *progress_dialog; | ||
111 | |||
112 | /** | ||
113 | * Builder for the nickname dialog that is displayed. | ||
114 | */ | ||
115 | GtkBuilder *nick_dialog_builder; | ||
116 | |||
117 | /** | ||
118 | * The nick dialog itself. | ||
119 | */ | ||
120 | GtkWidget *nick_dialog; | ||
121 | |||
122 | /** | ||
123 | * Handle to the namestore. | ||
124 | */ | ||
125 | struct GNUNET_NAMESTORE_Handle *namestore; | ||
126 | |||
127 | /** | ||
128 | * Handle to our namestore request. | ||
129 | */ | ||
130 | struct GNUNET_NAMESTORE_QueueEntry *qe; | ||
131 | |||
132 | /** | ||
133 | * Public key of the namespace we are trying to save. | ||
134 | */ | ||
135 | struct GNUNET_CRYPTO_EccPublicKey pkey; | ||
136 | |||
137 | /** | ||
138 | * Nickname we're saving under. | ||
139 | */ | ||
140 | char *nick; | ||
141 | |||
101 | }; | 142 | }; |
102 | 143 | ||
103 | 144 | ||
diff --git a/src/fs/gnunet-fs-gtk_main-window-search.c b/src/fs/gnunet-fs-gtk_main-window-search.c index 37bf81b1..4ba47f4c 100644 --- a/src/fs/gnunet-fs-gtk_main-window-search.c +++ b/src/fs/gnunet-fs-gtk_main-window-search.c | |||
@@ -307,28 +307,212 @@ abort_pseu_lookup (struct PseuLookupContext *lctx) | |||
307 | { | 307 | { |
308 | struct GNUNET_GTK_MainWindowContext *main_ctx = lctx->main_ctx; | 308 | struct GNUNET_GTK_MainWindowContext *main_ctx = lctx->main_ctx; |
309 | 309 | ||
310 | if (NULL != lctx->progress_dialog_builder) | ||
311 | { | ||
312 | gtk_widget_destroy (lctx->progress_dialog); | ||
313 | g_object_unref (G_OBJECT (lctx->progress_dialog_builder)); | ||
314 | lctx->progress_dialog_builder = NULL; | ||
315 | } | ||
316 | if (NULL != lctx->nick_dialog_builder) | ||
317 | { | ||
318 | gtk_widget_destroy (lctx->nick_dialog); | ||
319 | g_object_unref (G_OBJECT (lctx->nick_dialog_builder)); | ||
320 | lctx->nick_dialog_builder = NULL; | ||
321 | } | ||
322 | |||
310 | if (NULL != lctx->lr) | 323 | if (NULL != lctx->lr) |
311 | { | 324 | { |
312 | GNUNET_GNS_lookup_cancel (lctx->lr); | 325 | GNUNET_GNS_lookup_cancel (lctx->lr); |
313 | lctx->lr = NULL; | 326 | lctx->lr = NULL; |
314 | } | 327 | } |
328 | if (NULL != lctx->qe) | ||
329 | { | ||
330 | GNUNET_NAMESTORE_cancel (lctx->qe); | ||
331 | lctx->qe = NULL; | ||
332 | } | ||
333 | if (NULL != lctx->namestore) | ||
334 | { | ||
335 | GNUNET_NAMESTORE_disconnect (lctx->namestore); | ||
336 | lctx->namestore = NULL; | ||
337 | } | ||
315 | GNUNET_CONTAINER_DLL_remove (main_ctx->lctx_head, | 338 | GNUNET_CONTAINER_DLL_remove (main_ctx->lctx_head, |
316 | main_ctx->lctx_tail, | 339 | main_ctx->lctx_tail, |
317 | lctx); | 340 | lctx); |
341 | GNUNET_free_non_null (lctx->nick); | ||
318 | GNUNET_free (lctx); | 342 | GNUNET_free (lctx); |
319 | } | 343 | } |
320 | 344 | ||
321 | 345 | ||
322 | /** | 346 | /** |
347 | * Continuation called to notify client about result of the | ||
348 | * operation. | ||
349 | * | ||
350 | * @param cls closure | ||
351 | * @param success #GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate) | ||
352 | * #GNUNET_NO if content was already there or not found | ||
353 | * #GNUNET_YES (or other positive value) on success | ||
354 | * @param emsg NULL on success, otherwise an error message | ||
355 | */ | ||
356 | static void | ||
357 | store_continuation (void *cls, | ||
358 | int32_t success, | ||
359 | const char *emsg) | ||
360 | { | ||
361 | struct PseuLookupContext *lctx = cls; | ||
362 | |||
363 | lctx->qe = NULL; | ||
364 | if (NULL != emsg) | ||
365 | { | ||
366 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
367 | _("Failed to save record: %s\n"), | ||
368 | emsg); | ||
369 | gdk_beep (); | ||
370 | } | ||
371 | abort_pseu_lookup (lctx); | ||
372 | } | ||
373 | |||
374 | |||
375 | /** | ||
376 | * Save the namespace under the given nickname. | ||
377 | * | ||
378 | * @param lctx namespace request we are processing | ||
379 | * @param nick nickname to store the namespace under | ||
380 | */ | ||
381 | static void | ||
382 | save_pseudonym_with_nick (struct PseuLookupContext *lctx, | ||
383 | const char *nick) | ||
384 | { | ||
385 | struct GNUNET_NAMESTORE_RecordData rd; | ||
386 | struct GNUNET_GTK_MainWindowContext *main_ctx; | ||
387 | |||
388 | GNUNET_break (NULL == lctx->nick); | ||
389 | lctx->nick = GNUNET_strdup (nick); | ||
390 | /* again, show progress indicator, this should be fast though... */ | ||
391 | lctx->progress_dialog_builder | ||
392 | = GNUNET_GTK_get_new_builder | ||
393 | ("gnunet_fs_gtk_pseu_progress_dialog.glade", | ||
394 | lctx); | ||
395 | lctx->progress_dialog | ||
396 | = GTK_WIDGET (gtk_builder_get_object | ||
397 | (lctx->progress_dialog_builder, | ||
398 | "GNUNET_FS_GTK_pseu_progress_dialog")); | ||
399 | /* show the window */ | ||
400 | gtk_window_present (GTK_WINDOW (lctx->progress_dialog)); | ||
401 | memset (&rd, 0, sizeof (rd)); | ||
402 | rd.data_size = sizeof (struct GNUNET_CRYPTO_EccPublicKey); | ||
403 | rd.data = &lctx->pkey; | ||
404 | rd.flags = GNUNET_NAMESTORE_RF_PRIVATE; | ||
405 | rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; | ||
406 | rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY; | ||
407 | main_ctx = GNUNET_FS_GTK_get_main_context (); | ||
408 | lctx->namestore = GNUNET_NAMESTORE_connect (main_ctx->cfg); | ||
409 | GNUNET_assert (NULL != lctx->namestore); | ||
410 | lctx->qe = GNUNET_NAMESTORE_records_store (lctx->namestore, | ||
411 | main_ctx->sks_zone, | ||
412 | nick, | ||
413 | 1, &rd, | ||
414 | &store_continuation, lctx); | ||
415 | } | ||
416 | |||
417 | |||
418 | /** | ||
419 | * User clicked on the 'execute' button in nickname dialog. | ||
420 | * Store the selected namespace in the "sks-fs" zone under | ||
421 | * the given nickname. | ||
422 | * | ||
423 | * @param button the "execute" button | ||
424 | * @param user_data the `struct PseuLookupContext` | ||
425 | */ | ||
426 | void | ||
427 | GNUNET_GTK_enter_nick_window_execute_button_clicked_cb (GtkButton * button, | ||
428 | gpointer user_data) | ||
429 | { | ||
430 | struct PseuLookupContext *lctx = user_data; | ||
431 | GtkEntry *entry; | ||
432 | const char *nick; | ||
433 | |||
434 | entry = GTK_ENTRY (gtk_builder_get_object | ||
435 | (lctx->nick_dialog_builder, | ||
436 | "GNUNET_GTK_enter_nick_window_nick_entry")); | ||
437 | nick = gtk_entry_get_text (entry); | ||
438 | if ( (NULL == nick) || | ||
439 | (0 == strlen (nick) )) | ||
440 | { | ||
441 | GNUNET_break (0); | ||
442 | abort_pseu_lookup (lctx); | ||
443 | return; | ||
444 | } | ||
445 | save_pseudonym_with_nick (lctx, nick); | ||
446 | gtk_widget_destroy (lctx->nick_dialog); | ||
447 | g_object_unref (G_OBJECT (lctx->nick_dialog_builder)); | ||
448 | lctx->nick_dialog_builder = NULL; | ||
449 | } | ||
450 | |||
451 | |||
452 | /** | ||
453 | * User edited the nickname. Update sensitivity of the execute button. | ||
454 | * | ||
455 | * @param widget the entry that was changed | ||
456 | * @param user_data the `struct PseuLookupContext` | ||
457 | */ | ||
458 | void | ||
459 | GNUNET_GTK_enter_nick_window_nick_entry_changed_cb (GtkWidget *widget, | ||
460 | gpointer user_data) | ||
461 | { | ||
462 | struct PseuLookupContext *lctx = user_data; | ||
463 | const gchar *new_text; | ||
464 | GtkButton * button; | ||
465 | |||
466 | new_text = gtk_entry_get_text (GTK_ENTRY (widget)); | ||
467 | button = GTK_BUTTON (gtk_builder_get_object (lctx->nick_dialog_builder, | ||
468 | "GNUNET_GTK_enter_nick_window_execute_button")); | ||
469 | gtk_widget_set_sensitive (GTK_WIDGET (button), | ||
470 | (GNUNET_OK == GNUNET_DNSPARSER_check_label (new_text)) ? TRUE : FALSE); | ||
471 | } | ||
472 | |||
473 | |||
474 | /** | ||
475 | * User clicked on the 'cancel' button in nickname dialog. | ||
476 | * Abort the operation. | ||
477 | * | ||
478 | * @param button the "cancel" button | ||
479 | * @param user_data the `struct PseuLookupContext` | ||
480 | */ | ||
481 | void | ||
482 | GNUNET_GTK_enter_nick_window_cancel_button_clicked_cb (GtkButton * button, | ||
483 | gpointer user_data) | ||
484 | { | ||
485 | struct PseuLookupContext *lctx = user_data; | ||
486 | |||
487 | abort_pseu_lookup (lctx); | ||
488 | } | ||
489 | |||
490 | |||
491 | /** | ||
492 | * Run the dialog asking the user to specify a nickname for | ||
493 | * the namespace. | ||
494 | * | ||
495 | * @param lctx namespace request we are processing | ||
496 | */ | ||
497 | static void | ||
498 | ask_for_nickname (struct PseuLookupContext *lctx) | ||
499 | { | ||
500 | /* setup the dialog and get the widgets we need most */ | ||
501 | lctx->nick_dialog_builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_enter_nick_dialog.glade", | ||
502 | lctx); | ||
503 | lctx->progress_dialog = GTK_WIDGET (gtk_builder_get_object (lctx->progress_dialog_builder, | ||
504 | "GNUNET_GTK_enter_nick_window")); | ||
505 | /* show the window */ | ||
506 | gtk_window_present (GTK_WINDOW (lctx->progress_dialog)); | ||
507 | } | ||
508 | |||
509 | |||
510 | /** | ||
323 | * Iterator called on obtained result for a GNS lookup for | 511 | * Iterator called on obtained result for a GNS lookup for |
324 | * the PSEU lookup when "saving" a zone. The actual saving | 512 | * the PSEU lookup when "saving" a zone. The actual saving |
325 | * should already have happened via the shortening of GNS, | 513 | * should already have happened via the shortening of GNS, |
326 | * so we only need to clean up. | 514 | * so we only need to clean up. |
327 | * | 515 | * |
328 | * FIXME: this is a drastic simplification, as shortening | ||
329 | * may fail (name used, PSEU record not found); in those | ||
330 | * cases, we should _still_ do something here... | ||
331 | * | ||
332 | * @param cls closure with the `struct PseuLookupContext` | 516 | * @param cls closure with the `struct PseuLookupContext` |
333 | * @param rd_count number of records in @a rd | 517 | * @param rd_count number of records in @a rd |
334 | * @param rd the records in reply | 518 | * @param rd the records in reply |
@@ -339,10 +523,97 @@ lookup_finished (void *cls, | |||
339 | const struct GNUNET_NAMESTORE_RecordData *rd) | 523 | const struct GNUNET_NAMESTORE_RecordData *rd) |
340 | { | 524 | { |
341 | struct PseuLookupContext *lctx = cls; | 525 | struct PseuLookupContext *lctx = cls; |
526 | unsigned int i; | ||
527 | const char *nick; | ||
342 | 528 | ||
343 | /* FIXME: might want to give visual feedback to the user here */ | ||
344 | lctx->lr = NULL; | 529 | lctx->lr = NULL; |
345 | abort_pseu_lookup (lctx); | 530 | if (NULL != lctx->progress_dialog_builder) |
531 | { | ||
532 | gtk_widget_destroy (lctx->progress_dialog); | ||
533 | g_object_unref (G_OBJECT (lctx->progress_dialog_builder)); | ||
534 | lctx->progress_dialog_builder = NULL; | ||
535 | } | ||
536 | for (i=0;i<rd_count;i++) | ||
537 | { | ||
538 | if (GNUNET_NAMESTORE_TYPE_PSEU == rd[i].record_type) | ||
539 | { | ||
540 | nick = rd[i].data; | ||
541 | if ('\0' != nick[rd[i].data_size - 1]) | ||
542 | { | ||
543 | GNUNET_break (0); | ||
544 | continue; | ||
545 | } | ||
546 | save_pseudonym_with_nick (lctx, | ||
547 | nick); | ||
548 | return; | ||
549 | } | ||
550 | } | ||
551 | /* no valid PSEU record found */ | ||
552 | ask_for_nickname (lctx); | ||
553 | } | ||
554 | |||
555 | |||
556 | /** | ||
557 | * User clicked on the 'cancel' button of the progress dialog. | ||
558 | * Cancel the operation. | ||
559 | * | ||
560 | * @param button the cancel button | ||
561 | * @param user_data the `struct PseuLookupContext` of our window | ||
562 | */ | ||
563 | void | ||
564 | GNUNET_FS_GTK_pseu_progress_dialog_cancel_button_clicked_cb (GtkButton *button, | ||
565 | gpointer user_data) | ||
566 | { | ||
567 | struct PseuLookupContext *lctx = user_data; | ||
568 | |||
569 | if (NULL != lctx->progress_dialog_builder) | ||
570 | { | ||
571 | gtk_widget_destroy (lctx->progress_dialog); | ||
572 | g_object_unref (G_OBJECT (lctx->progress_dialog_builder)); | ||
573 | lctx->progress_dialog_builder = NULL; | ||
574 | } | ||
575 | if (NULL != lctx->nick) | ||
576 | abort_pseu_lookup (lctx); | ||
577 | else | ||
578 | ask_for_nickname (lctx); | ||
579 | } | ||
580 | |||
581 | |||
582 | /** | ||
583 | * User attempted to close the nick dialog. Refuse. | ||
584 | * | ||
585 | * @param widget the widget emitting the event | ||
586 | * @param event the event | ||
587 | * @param cls progress dialog context of our window | ||
588 | * @return TRUE to refuse to close | ||
589 | */ | ||
590 | gboolean | ||
591 | GNUNET_GTK_enter_nick_window_delete_event_cb (GtkWidget *widget, | ||
592 | GdkEvent * event, | ||
593 | void *cls) | ||
594 | { | ||
595 | /* Don't allow GTK to kill the window, user must click execute or cancel */ | ||
596 | gdk_beep (); | ||
597 | return TRUE; | ||
598 | } | ||
599 | |||
600 | |||
601 | /** | ||
602 | * User attempted to close the progress dialog. Refuse. | ||
603 | * | ||
604 | * @param widget the widget emitting the event | ||
605 | * @param event the event | ||
606 | * @param cls progress dialog context of our window | ||
607 | * @return TRUE to refuse to close | ||
608 | */ | ||
609 | gboolean | ||
610 | GNUNET_FS_GTK_pseu_progress_dialog_delete_event_cb (GtkWidget *widget, | ||
611 | GdkEvent * event, | ||
612 | void *cls) | ||
613 | { | ||
614 | /* Don't allow GTK to kill the window, until the search is finished */ | ||
615 | gdk_beep (); | ||
616 | return TRUE; | ||
346 | } | 617 | } |
347 | 618 | ||
348 | 619 | ||
@@ -353,7 +624,6 @@ lookup_finished (void *cls, | |||
353 | * @param button the "save" button | 624 | * @param button the "save" button |
354 | * @param user_data the main window context builder | 625 | * @param user_data the main window context builder |
355 | */ | 626 | */ |
356 | |||
357 | void | 627 | void |
358 | GNUNET_FS_GTK_save_button_clicked_cb (GtkButton * button, | 628 | GNUNET_FS_GTK_save_button_clicked_cb (GtkButton * button, |
359 | gpointer user_data) | 629 | gpointer user_data) |
@@ -364,12 +634,20 @@ GNUNET_FS_GTK_save_button_clicked_cb (GtkButton * button, | |||
364 | struct GNUNET_CRYPTO_EccPublicKey pkey; | 634 | struct GNUNET_CRYPTO_EccPublicKey pkey; |
365 | int ret; | 635 | int ret; |
366 | struct PseuLookupContext *lctx; | 636 | struct PseuLookupContext *lctx; |
637 | guint anonymity_level; | ||
367 | 638 | ||
368 | if (NULL == main_ctx->gns) | 639 | if (NULL == main_ctx->gns) |
369 | { | 640 | { |
370 | GNUNET_break (0); | 641 | GNUNET_break (0); |
371 | return; | 642 | return; |
372 | } | 643 | } |
644 | /* get anonymity level */ | ||
645 | if (!GNUNET_GTK_get_selected_anonymity_level | ||
646 | (main_ctx->builder, "main_window_search_anonymity_combobox", &anonymity_level)) | ||
647 | { | ||
648 | GNUNET_break (0); | ||
649 | return; | ||
650 | } | ||
373 | widget = GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object | 651 | widget = GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object |
374 | ("main_window_search_namespace_combobox")); | 652 | ("main_window_search_namespace_combobox")); |
375 | text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (widget)))); | 653 | text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (widget)))); |
@@ -380,20 +658,37 @@ GNUNET_FS_GTK_save_button_clicked_cb (GtkButton * button, | |||
380 | return; | 658 | return; |
381 | } | 659 | } |
382 | lctx = GNUNET_new (struct PseuLookupContext); | 660 | lctx = GNUNET_new (struct PseuLookupContext); |
661 | lctx->pkey = pkey; | ||
383 | lctx->main_ctx = main_ctx; | 662 | lctx->main_ctx = main_ctx; |
384 | GNUNET_CONTAINER_DLL_insert (main_ctx->lctx_head, | 663 | GNUNET_CONTAINER_DLL_insert (main_ctx->lctx_head, |
385 | main_ctx->lctx_tail, | 664 | main_ctx->lctx_tail, |
386 | lctx); | 665 | lctx); |
387 | lctx->lr = GNUNET_GNS_lookup (main_ctx->gns, | 666 | |
388 | GNUNET_GNS_MASTERZONE_STR, | 667 | if (0 == anonymity_level) |
389 | &pkey, | 668 | { |
390 | GNUNET_NAMESTORE_TYPE_PSEU, | 669 | /* setup the dialog and get the widgets we need most */ |
391 | GNUNET_NO, | 670 | lctx->progress_dialog_builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_pseu_progress_dialog.glade", |
392 | main_ctx->sks_zone /* FIXME: may want more explicit | 671 | lctx); |
393 | control than using shortening here */, | 672 | lctx->progress_dialog = GTK_WIDGET (gtk_builder_get_object (lctx->progress_dialog_builder, |
394 | &lookup_finished, | 673 | "GNUNET_FS_GTK_pseu_progress_dialog")); |
395 | lctx); | 674 | /* show the window */ |
396 | /* give visual feedback that something is happening */ | 675 | gtk_window_present (GTK_WINDOW (lctx->progress_dialog)); |
676 | lctx->lr = GNUNET_GNS_lookup (main_ctx->gns, | ||
677 | GNUNET_GNS_MASTERZONE_STR, | ||
678 | &pkey, | ||
679 | GNUNET_NAMESTORE_TYPE_PSEU, | ||
680 | GNUNET_NO, | ||
681 | NULL, | ||
682 | &lookup_finished, | ||
683 | lctx); | ||
684 | } | ||
685 | else | ||
686 | { | ||
687 | /* anonymous operation; cannot use GNS/DHT, so user | ||
688 | must make a suggestion himself */ | ||
689 | ask_for_nickname (lctx); | ||
690 | } | ||
691 | /* do not allow save again just yet */ | ||
397 | gtk_widget_set_sensitive (GTK_WIDGET (button), | 692 | gtk_widget_set_sensitive (GTK_WIDGET (button), |
398 | FALSE); | 693 | FALSE); |
399 | } | 694 | } |
diff --git a/src/fs/gnunet-fs-gtk_publish-dialog.c b/src/fs/gnunet-fs-gtk_publish-dialog.c index 1aa404a0..56db4492 100644 --- a/src/fs/gnunet-fs-gtk_publish-dialog.c +++ b/src/fs/gnunet-fs-gtk_publish-dialog.c | |||
@@ -1472,7 +1472,7 @@ stop_scanner_task (void *cls, | |||
1472 | * | 1472 | * |
1473 | * @param cls progress dialog context of our window | 1473 | * @param cls progress dialog context of our window |
1474 | * @param filename filename this update is about, can be NULL | 1474 | * @param filename filename this update is about, can be NULL |
1475 | * @param is_directory is this file a directory, SYSERR if not applicable | 1475 | * @param is_directory is this file a directory, #GNUNET_SYSERR if not applicable |
1476 | * @param reason kind of progress that was made | 1476 | * @param reason kind of progress that was made |
1477 | */ | 1477 | */ |
1478 | static void | 1478 | static void |