diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-12-26 12:05:15 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-12-26 12:05:15 +0000 |
commit | cdd93f38e6365e3f1c6449a991e7550396b03aeb (patch) | |
tree | fbf051b16bd46b5643d6c957df6288ba7f798b32 | |
parent | 504cc2aea6c402c1e940663b3283c8296bf6a7e2 (diff) | |
download | gnunet-gtk-cdd93f38e6365e3f1c6449a991e7550396b03aeb.tar.gz gnunet-gtk-cdd93f38e6365e3f1c6449a991e7550396b03aeb.zip |
-LRN: removing sentimental code - #1759
-rw-r--r-- | contrib/Makefile.am | 1 | ||||
-rw-r--r-- | contrib/gnunet_fs_gtk_main_window.glade | 51 | ||||
-rw-r--r-- | contrib/gnunet_fs_gtk_search_dialog.glade | 238 | ||||
-rw-r--r-- | src/fs/Makefile.am | 1 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk-main_window_file_search.c | 219 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk.c | 7 |
6 files changed, 3 insertions, 514 deletions
diff --git a/contrib/Makefile.am b/contrib/Makefile.am index e5b4ae86..7c838e79 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am | |||
@@ -25,7 +25,6 @@ pkgdata_DATA = \ | |||
25 | gnunet_fs_gtk_publish_edit_dialog.glade \ | 25 | gnunet_fs_gtk_publish_edit_dialog.glade \ |
26 | gnunet_fs_gtk_publish_file_dialog.glade \ | 26 | gnunet_fs_gtk_publish_file_dialog.glade \ |
27 | gnunet_fs_gtk_publish_tab.glade \ | 27 | gnunet_fs_gtk_publish_tab.glade \ |
28 | gnunet_fs_gtk_search_dialog.glade \ | ||
29 | gnunet_fs_gtk_search_tab.glade \ | 28 | gnunet_fs_gtk_search_tab.glade \ |
30 | gnunet_fs_gtk_select_pseudonym_dialog.glade \ | 29 | gnunet_fs_gtk_select_pseudonym_dialog.glade \ |
31 | gnunet_gtk_status_bar_menu.glade \ | 30 | gnunet_gtk_status_bar_menu.glade \ |
diff --git a/contrib/gnunet_fs_gtk_main_window.glade b/contrib/gnunet_fs_gtk_main_window.glade index 1909c2d0..fbf09588 100644 --- a/contrib/gnunet_fs_gtk_main_window.glade +++ b/contrib/gnunet_fs_gtk_main_window.glade | |||
@@ -877,26 +877,6 @@ | |||
877 | </object> | 877 | </object> |
878 | </child> | 878 | </child> |
879 | <child> | 879 | <child> |
880 | <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_search"> | ||
881 | <property name="label" translatable="yes">_Search</property> | ||
882 | <property name="use_action_appearance">False</property> | ||
883 | <property name="can_focus">False</property> | ||
884 | <property name="tooltip_text" translatable="yes">Search GNUnet for files</property> | ||
885 | <property name="accel_path"><gnunet-fs-gtk>/File sharing/Search</property> | ||
886 | <property name="use_underline">True</property> | ||
887 | <property name="use_stock">False</property> | ||
888 | <accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/> | ||
889 | <signal name="activate" handler="GNUNET_GTK_main_menu_file_search_activate_cb" swapped="no"/> | ||
890 | </object> | ||
891 | </child> | ||
892 | <child> | ||
893 | <object class="GtkSeparatorMenuItem" id="GNUNET_GTK_main_menu_file_sep2"> | ||
894 | <property name="use_action_appearance">False</property> | ||
895 | <property name="visible">True</property> | ||
896 | <property name="can_focus">False</property> | ||
897 | </object> | ||
898 | </child> | ||
899 | <child> | ||
900 | <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_download_uri"> | 880 | <object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_download_uri"> |
901 | <property name="label" translatable="yes">_Download</property> | 881 | <property name="label" translatable="yes">_Download</property> |
902 | <property name="use_action_appearance">False</property> | 882 | <property name="use_action_appearance">False</property> |
@@ -927,7 +907,7 @@ | |||
927 | </object> | 907 | </object> |
928 | </child> | 908 | </child> |
929 | <child> | 909 | <child> |
930 | <object class="GtkSeparatorMenuItem" id="GNUNET_GTK_main_menu_file_sep3"> | 910 | <object class="GtkSeparatorMenuItem" id="GNUNET_GTK_main_menu_file_sep2"> |
931 | <property name="use_action_appearance">False</property> | 911 | <property name="use_action_appearance">False</property> |
932 | <property name="visible">True</property> | 912 | <property name="visible">True</property> |
933 | <property name="can_focus">False</property> | 913 | <property name="can_focus">False</property> |
@@ -1064,31 +1044,6 @@ | |||
1064 | </packing> | 1044 | </packing> |
1065 | </child> | 1045 | </child> |
1066 | <child> | 1046 | <child> |
1067 | <object class="GtkToolbar" id="GNUNET_GTK_main_window_toolbar"> | ||
1068 | <property name="can_focus">False</property> | ||
1069 | <property name="toolbar_style">icons</property> | ||
1070 | <child> | ||
1071 | <object class="GtkToolButton" id="GNUNET_GTK_toolbar_search"> | ||
1072 | <property name="use_action_appearance">False</property> | ||
1073 | <property name="visible">True</property> | ||
1074 | <property name="can_focus">False</property> | ||
1075 | <property name="label" translatable="yes">_Search</property> | ||
1076 | <property name="use_underline">True</property> | ||
1077 | <property name="stock_id">gtk-find</property> | ||
1078 | </object> | ||
1079 | <packing> | ||
1080 | <property name="expand">False</property> | ||
1081 | <property name="homogeneous">True</property> | ||
1082 | </packing> | ||
1083 | </child> | ||
1084 | </object> | ||
1085 | <packing> | ||
1086 | <property name="expand">False</property> | ||
1087 | <property name="fill">False</property> | ||
1088 | <property name="position">2</property> | ||
1089 | </packing> | ||
1090 | </child> | ||
1091 | <child> | ||
1092 | <object class="GtkHBox" id="main_window_search_hbox"> | 1047 | <object class="GtkHBox" id="main_window_search_hbox"> |
1093 | <property name="visible">True</property> | 1048 | <property name="visible">True</property> |
1094 | <property name="can_focus">False</property> | 1049 | <property name="can_focus">False</property> |
@@ -1316,7 +1271,7 @@ | |||
1316 | <packing> | 1271 | <packing> |
1317 | <property name="expand">False</property> | 1272 | <property name="expand">False</property> |
1318 | <property name="fill">False</property> | 1273 | <property name="fill">False</property> |
1319 | <property name="position">3</property> | 1274 | <property name="position">2</property> |
1320 | </packing> | 1275 | </packing> |
1321 | </child> | 1276 | </child> |
1322 | <child> | 1277 | <child> |
@@ -1443,7 +1398,7 @@ | |||
1443 | <packing> | 1398 | <packing> |
1444 | <property name="expand">True</property> | 1399 | <property name="expand">True</property> |
1445 | <property name="fill">True</property> | 1400 | <property name="fill">True</property> |
1446 | <property name="position">4</property> | 1401 | <property name="position">3</property> |
1447 | </packing> | 1402 | </packing> |
1448 | </child> | 1403 | </child> |
1449 | </object> | 1404 | </object> |
diff --git a/contrib/gnunet_fs_gtk_search_dialog.glade b/contrib/gnunet_fs_gtk_search_dialog.glade deleted file mode 100644 index 2aa5360f..00000000 --- a/contrib/gnunet_fs_gtk_search_dialog.glade +++ /dev/null | |||
@@ -1,238 +0,0 @@ | |||
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="adjustment2"> | ||
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="GtkAdjustment" id="adjustment1"> | ||
12 | <property name="upper">100</property> | ||
13 | <property name="step_increment">1</property> | ||
14 | <property name="page_increment">10</property> | ||
15 | <property name="page_size">10</property> | ||
16 | </object> | ||
17 | <object class="GtkAdjustment" id="GNUNET_GTK_search_anonymity_adjustment"> | ||
18 | <property name="upper">100000</property> | ||
19 | <property name="value">1</property> | ||
20 | <property name="step_increment">1</property> | ||
21 | <property name="page_increment">10</property> | ||
22 | </object> | ||
23 | <object class="GtkDialog" id="GNUNET_GTK_search_dialog"> | ||
24 | <property name="width_request">500</property> | ||
25 | <property name="height_request">350</property> | ||
26 | <property name="border_width">5</property> | ||
27 | <property name="title" translatable="yes">Search GNUnet</property> | ||
28 | <property name="modal">True</property> | ||
29 | <property name="destroy_with_parent">True</property> | ||
30 | <property name="icon_name">system-search</property> | ||
31 | <property name="type_hint">dialog</property> | ||
32 | <property name="skip_taskbar_hint">True</property> | ||
33 | <property name="skip_pager_hint">True</property> | ||
34 | <property name="has_separator">False</property> | ||
35 | <child internal-child="vbox"> | ||
36 | <object class="GtkVBox" id="GNUNET_GTK_search_dialog_main_vbox"> | ||
37 | <property name="visible">True</property> | ||
38 | <property name="spacing">2</property> | ||
39 | <child> | ||
40 | <object class="GtkHBox" id="GNUNET_GTK_search_dialog_query_hbox"> | ||
41 | <property name="visible">True</property> | ||
42 | <child> | ||
43 | <object class="GtkLabel" id="GNUNET_GTK_search_dialog_keyword_label"> | ||
44 | <property name="visible">True</property> | ||
45 | <property name="label" translatable="yes">_Query:</property> | ||
46 | <property name="use_underline">True</property> | ||
47 | <property name="selectable">True</property> | ||
48 | <property name="mnemonic_widget">GNUNET_GTK_search_dialog_keyword_entry</property> | ||
49 | </object> | ||
50 | <packing> | ||
51 | <property name="expand">False</property> | ||
52 | <property name="fill">False</property> | ||
53 | <property name="position">0</property> | ||
54 | </packing> | ||
55 | </child> | ||
56 | <child> | ||
57 | <object class="GtkEntry" id="GNUNET_GTK_search_dialog_keyword_entry"> | ||
58 | <property name="visible">True</property> | ||
59 | <property name="can_focus">True</property> | ||
60 | <property name="invisible_char">●</property> | ||
61 | <property name="activates_default">True</property> | ||
62 | <property name="caps_lock_warning">False</property> | ||
63 | <property name="primary_icon_stock">gtk-find</property> | ||
64 | <property name="primary_icon_tooltip_text" translatable="yes">Separate multiple keywords with spaces, prefix mandatory keywords with "+"</property> | ||
65 | <signal name="activate" handler="GNUNET_GTK_search_dialog_search_button_clicked_cb" swapped="no"/> | ||
66 | </object> | ||
67 | <packing> | ||
68 | <property name="position">1</property> | ||
69 | </packing> | ||
70 | </child> | ||
71 | <child> | ||
72 | <object class="GtkLabel" id="GNUNET_GTK_search_dialog_anonymity_label"> | ||
73 | <property name="visible">True</property> | ||
74 | <property name="label" translatable="yes">_Anonymity:</property> | ||
75 | <property name="use_underline">True</property> | ||
76 | <property name="selectable">True</property> | ||
77 | <property name="mnemonic_widget">GNUNET_GTK_search_dialog_anonymity_spin_button</property> | ||
78 | </object> | ||
79 | <packing> | ||
80 | <property name="expand">False</property> | ||
81 | <property name="fill">False</property> | ||
82 | <property name="position">2</property> | ||
83 | </packing> | ||
84 | </child> | ||
85 | <child> | ||
86 | <object class="GtkSpinButton" id="GNUNET_GTK_search_dialog_anonymity_spin_button"> | ||
87 | <property name="visible">True</property> | ||
88 | <property name="can_focus">True</property> | ||
89 | <property name="invisible_char">●</property> | ||
90 | <property name="caps_lock_warning">False</property> | ||
91 | <property name="adjustment">GNUNET_GTK_search_anonymity_adjustment</property> | ||
92 | <property name="climb_rate">1</property> | ||
93 | <property name="numeric">True</property> | ||
94 | <signal name="value-changed" handler="GNUNET_GTK_anonymity_spin_button_value_changed_cb" swapped="no"/> | ||
95 | </object> | ||
96 | <packing> | ||
97 | <property name="position">3</property> | ||
98 | </packing> | ||
99 | </child> | ||
100 | </object> | ||
101 | <packing> | ||
102 | <property name="expand">False</property> | ||
103 | <property name="fill">False</property> | ||
104 | <property name="padding">5</property> | ||
105 | <property name="position">1</property> | ||
106 | </packing> | ||
107 | </child> | ||
108 | <child> | ||
109 | <object class="GtkScrolledWindow" id="GNUNET_GTK_search_dialog_namespace_scrolled_window"> | ||
110 | <property name="height_request">100</property> | ||
111 | <property name="visible">True</property> | ||
112 | <property name="can_focus">True</property> | ||
113 | <property name="hadjustment">adjustment1</property> | ||
114 | <property name="vadjustment">adjustment2</property> | ||
115 | <property name="hscrollbar_policy">automatic</property> | ||
116 | <property name="vscrollbar_policy">automatic</property> | ||
117 | <child> | ||
118 | <object class="GtkTreeView" id="GNUNET_GTK_search_dialog_namespace_tree_view"> | ||
119 | <property name="visible">True</property> | ||
120 | <property name="can_focus">True</property> | ||
121 | <property name="model">GNUNET_GTK_namespace_list_store</property> | ||
122 | <property name="hadjustment">adjustment1</property> | ||
123 | <property name="vadjustment">adjustment2</property> | ||
124 | <property name="reorderable">True</property> | ||
125 | <property name="rules_hint">True</property> | ||
126 | <signal name="row-activated" handler="GNUNET_GTK_search_dialog_namespace_tree_view_row_activated_cb" swapped="no"/> | ||
127 | <child> | ||
128 | <object class="GtkTreeViewColumn" id="GNUNET_GTK_search_dialog_namespace_name_column"> | ||
129 | <property name="resizable">True</property> | ||
130 | <property name="title" translatable="yes">Name</property> | ||
131 | <property name="clickable">True</property> | ||
132 | <property name="reorderable">True</property> | ||
133 | <property name="sort_indicator">True</property> | ||
134 | <child> | ||
135 | <object class="GtkCellRendererText" id="GNUNET_GTK_search_dialog_namespace_name_renderer"/> | ||
136 | <attributes> | ||
137 | <attribute name="text">0</attribute> | ||
138 | </attributes> | ||
139 | </child> | ||
140 | </object> | ||
141 | </child> | ||
142 | <child> | ||
143 | <object class="GtkTreeViewColumn" id="GNUNET_GTK_search_dialog_namespace_root_column"> | ||
144 | <property name="resizable">True</property> | ||
145 | <property name="title" translatable="yes">Root</property> | ||
146 | <property name="clickable">True</property> | ||
147 | <child> | ||
148 | <object class="GtkCellRendererText" id="GNUNET_GTK_search_dialog_namespace_root_renderer"/> | ||
149 | <attributes> | ||
150 | <attribute name="text">1</attribute> | ||
151 | </attributes> | ||
152 | </child> | ||
153 | </object> | ||
154 | </child> | ||
155 | <child> | ||
156 | <object class="GtkTreeViewColumn" id="GNUNET_GTK_search_dialog_namespace_description_column"> | ||
157 | <property name="title" translatable="yes">Description</property> | ||
158 | <property name="expand">True</property> | ||
159 | <property name="clickable">True</property> | ||
160 | <child> | ||
161 | <object class="GtkCellRendererText" id="GNUNET_GTK_search_dialog_namespace_description_renderer"> | ||
162 | <property name="wrap_mode">word</property> | ||
163 | </object> | ||
164 | <attributes> | ||
165 | <attribute name="text">3</attribute> | ||
166 | </attributes> | ||
167 | </child> | ||
168 | </object> | ||
169 | </child> | ||
170 | </object> | ||
171 | </child> | ||
172 | </object> | ||
173 | <packing> | ||
174 | <property name="position">2</property> | ||
175 | </packing> | ||
176 | </child> | ||
177 | <child internal-child="action_area"> | ||
178 | <object class="GtkHButtonBox" id="GNUNET_GTK_search_dialog_action_area"> | ||
179 | <property name="visible">True</property> | ||
180 | <property name="layout_style">end</property> | ||
181 | <child> | ||
182 | <object class="GtkButton" id="GNUNET_GTK_search_dialog_cancel_button"> | ||
183 | <property name="label">gtk-cancel</property> | ||
184 | <property name="visible">True</property> | ||
185 | <property name="can_focus">True</property> | ||
186 | <property name="receives_default">True</property> | ||
187 | <property name="use_action_appearance">False</property> | ||
188 | <property name="use_stock">True</property> | ||
189 | </object> | ||
190 | <packing> | ||
191 | <property name="expand">False</property> | ||
192 | <property name="fill">False</property> | ||
193 | <property name="position">0</property> | ||
194 | </packing> | ||
195 | </child> | ||
196 | <child> | ||
197 | <object class="GtkButton" id="GNUNET_GTK_search_dialog_search_button"> | ||
198 | <property name="label">gtk-find</property> | ||
199 | <property name="visible">True</property> | ||
200 | <property name="can_focus">True</property> | ||
201 | <property name="receives_default">True</property> | ||
202 | <property name="use_action_appearance">False</property> | ||
203 | <property name="use_stock">True</property> | ||
204 | <signal name="clicked" handler="GNUNET_GTK_search_dialog_search_button_clicked_cb" swapped="no"/> | ||
205 | </object> | ||
206 | <packing> | ||
207 | <property name="expand">False</property> | ||
208 | <property name="fill">False</property> | ||
209 | <property name="position">1</property> | ||
210 | </packing> | ||
211 | </child> | ||
212 | </object> | ||
213 | <packing> | ||
214 | <property name="expand">False</property> | ||
215 | <property name="pack_type">end</property> | ||
216 | <property name="position">0</property> | ||
217 | </packing> | ||
218 | </child> | ||
219 | </object> | ||
220 | </child> | ||
221 | <action-widgets> | ||
222 | <action-widget response="-6">GNUNET_GTK_search_dialog_cancel_button</action-widget> | ||
223 | <action-widget response="0">GNUNET_GTK_search_dialog_search_button</action-widget> | ||
224 | </action-widgets> | ||
225 | </object> | ||
226 | <object class="GtkListStore" id="GNUNET_GTK_namespace_list_store"> | ||
227 | <columns> | ||
228 | <!-- column-name unique_name --> | ||
229 | <column type="gchararray"/> | ||
230 | <!-- column-name namespace_root --> | ||
231 | <column type="gchararray"/> | ||
232 | <!-- column-name nsid --> | ||
233 | <column type="gpointer"/> | ||
234 | <!-- column-name namespace_description --> | ||
235 | <column type="gchararray"/> | ||
236 | </columns> | ||
237 | </object> | ||
238 | </interface> | ||
diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am index 18f52582..89562f4d 100644 --- a/src/fs/Makefile.am +++ b/src/fs/Makefile.am | |||
@@ -20,7 +20,6 @@ gnunet_fs_gtk_SOURCES = \ | |||
20 | gnunet-fs-gtk-main_window_create_pseudonym.c \ | 20 | gnunet-fs-gtk-main_window_create_pseudonym.c \ |
21 | gnunet-fs-gtk-main_window_file_download.c \ | 21 | gnunet-fs-gtk-main_window_file_download.c \ |
22 | gnunet-fs-gtk-main_window_file_publish.c \ | 22 | gnunet-fs-gtk-main_window_file_publish.c \ |
23 | gnunet-fs-gtk-main_window_file_search.c \ | ||
24 | gnunet-fs-gtk-main_window_open_directory.c \ | 23 | gnunet-fs-gtk-main_window_open_directory.c \ |
25 | gnunet-fs-gtk-main_window_adv_pseudonym.c \ | 24 | gnunet-fs-gtk-main_window_adv_pseudonym.c \ |
26 | gnunet-fs-gtk-main_window_view_toggles.c | 25 | gnunet-fs-gtk-main_window_view_toggles.c |
diff --git a/src/fs/gnunet-fs-gtk-main_window_file_search.c b/src/fs/gnunet-fs-gtk-main_window_file_search.c deleted file mode 100644 index 9d776eec..00000000 --- a/src/fs/gnunet-fs-gtk-main_window_file_search.c +++ /dev/null | |||
@@ -1,219 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | (C) 2005, 2006, 2010 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-main_window_file_search.c | ||
23 | * @author Christian Grothoff | ||
24 | */ | ||
25 | #include "gnunet-fs-gtk-common.h" | ||
26 | #include "gnunet-fs-gtk.h" | ||
27 | |||
28 | /** | ||
29 | * Builder used for the search dialog. | ||
30 | */ | ||
31 | static GtkBuilder *builder; | ||
32 | |||
33 | |||
34 | /** | ||
35 | * User double-clicked on namespace or pressed enter; | ||
36 | * move namespace root to the 'keywords' line. | ||
37 | */ | ||
38 | void | ||
39 | GNUNET_GTK_search_dialog_namespace_tree_view_row_activated_cb (GtkTreeView * | ||
40 | tree_view, | ||
41 | GtkTreePath * | ||
42 | path, | ||
43 | GtkTreeViewColumn | ||
44 | * column, | ||
45 | gpointer | ||
46 | user_data) | ||
47 | { | ||
48 | GtkTreeModel *ls; | ||
49 | GtkTreeSelection *sel; | ||
50 | GtkEntry *query; | ||
51 | GtkTreeIter iter; | ||
52 | char *root; | ||
53 | |||
54 | query = | ||
55 | GTK_ENTRY (gtk_builder_get_object | ||
56 | (builder, "GNUNET_GTK_search_dialog_keyword_entry")); | ||
57 | sel = gtk_tree_view_get_selection (tree_view); | ||
58 | if (TRUE == gtk_tree_selection_get_selected (sel, &ls, &iter)) | ||
59 | { | ||
60 | gtk_tree_model_get (ls, &iter, 1, &root, -1); | ||
61 | gtk_entry_set_text (query, root); | ||
62 | GNUNET_free (root); | ||
63 | } | ||
64 | } | ||
65 | |||
66 | |||
67 | void | ||
68 | GNUNET_GTK_search_dialog_search_button_clicked_cb (GtkWidget * dummy, | ||
69 | gpointer data) | ||
70 | { | ||
71 | GtkEntry *query; | ||
72 | GtkSpinButton *anonymity; | ||
73 | GtkTreeView *namespace; | ||
74 | const char *keywords; | ||
75 | char *emsg; | ||
76 | struct GNUNET_FS_Uri *uri; | ||
77 | GNUNET_HashCode *nsid; | ||
78 | GtkTreeModel *ls; | ||
79 | GtkTreeSelection *sel; | ||
80 | GtkTreeIter iter; | ||
81 | |||
82 | query = | ||
83 | GTK_ENTRY (gtk_builder_get_object | ||
84 | (builder, "GNUNET_GTK_search_dialog_keyword_entry")); | ||
85 | anonymity = | ||
86 | GTK_SPIN_BUTTON (gtk_builder_get_object | ||
87 | (builder, | ||
88 | "GNUNET_GTK_search_dialog_anonymity_spin_button")); | ||
89 | namespace = | ||
90 | GTK_TREE_VIEW (gtk_builder_get_object | ||
91 | (builder, "GNUNET_GTK_search_dialog_namespace_tree_view")); | ||
92 | keywords = gtk_entry_get_text (query); | ||
93 | nsid = NULL; | ||
94 | sel = gtk_tree_view_get_selection (namespace); | ||
95 | if (TRUE == gtk_tree_selection_get_selected (sel, &ls, &iter)) | ||
96 | gtk_tree_model_get (ls, &iter, 2, &nsid, -1); | ||
97 | if (nsid != NULL) | ||
98 | { | ||
99 | uri = GNUNET_FS_uri_sks_create_from_nsid (nsid, keywords); | ||
100 | GNUNET_assert (uri != NULL); | ||
101 | } | ||
102 | else | ||
103 | { | ||
104 | emsg = NULL; | ||
105 | uri = GNUNET_FS_uri_ksk_create (keywords, &emsg); | ||
106 | if (uri == NULL) | ||
107 | { | ||
108 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Invalid keyword string `%s': %s"), | ||
109 | keywords, emsg); | ||
110 | GNUNET_free_non_null (emsg); | ||
111 | return; | ||
112 | } | ||
113 | } | ||
114 | GNUNET_FS_search_start (GNUNET_FS_GTK_get_fs_handle (), uri, | ||
115 | gtk_spin_button_get_value_as_int (anonymity), | ||
116 | GNUNET_FS_SEARCH_OPTION_NONE, NULL); | ||
117 | GNUNET_FS_uri_destroy (uri); | ||
118 | } | ||
119 | |||
120 | |||
121 | |||
122 | /** | ||
123 | * Add pseudonym data to list store | ||
124 | * | ||
125 | * @param cls closure (the 'GtkListStore') | ||
126 | * @param pseudonym hash code of public key of pseudonym | ||
127 | * @param md meta data known about the pseudonym | ||
128 | * @param rating the local rating of the pseudonym | ||
129 | * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort | ||
130 | */ | ||
131 | static int | ||
132 | add_namespace_to_ls (void *cls, const GNUNET_HashCode * pseudonym, | ||
133 | const struct GNUNET_CONTAINER_MetaData *md, int rating) | ||
134 | { | ||
135 | GtkListStore *ls = cls; | ||
136 | char *root; | ||
137 | char *ns_name; | ||
138 | GNUNET_HashCode *nsid; | ||
139 | char *description; | ||
140 | char *uris; | ||
141 | char *emsg; | ||
142 | struct GNUNET_FS_Uri *uri; | ||
143 | GtkTreeIter iter; | ||
144 | |||
145 | ns_name = | ||
146 | GNUNET_PSEUDONYM_id_to_name (GNUNET_FS_GTK_get_configuration (), | ||
147 | pseudonym); | ||
148 | nsid = GNUNET_malloc (sizeof (GNUNET_HashCode)); | ||
149 | *nsid = *pseudonym; | ||
150 | root = NULL; | ||
151 | uris = GNUNET_CONTAINER_meta_data_get_by_type (md, EXTRACTOR_METATYPE_URI); | ||
152 | if (uris != NULL) | ||
153 | { | ||
154 | emsg = NULL; | ||
155 | uri = GNUNET_FS_uri_parse (uris, &emsg); | ||
156 | if (uri == NULL) | ||
157 | GNUNET_free (emsg); | ||
158 | root = GNUNET_FS_uri_sks_get_content_id (uri); | ||
159 | GNUNET_FS_uri_destroy (uri); | ||
160 | } | ||
161 | description = | ||
162 | GNUNET_CONTAINER_meta_data_get_first_by_types (md, | ||
163 | EXTRACTOR_METATYPE_TITLE, | ||
164 | EXTRACTOR_METATYPE_BOOK_TITLE, | ||
165 | EXTRACTOR_METATYPE_DESCRIPTION, | ||
166 | EXTRACTOR_METATYPE_SUMMARY, | ||
167 | EXTRACTOR_METATYPE_ALBUM, | ||
168 | EXTRACTOR_METATYPE_COMMENT, | ||
169 | EXTRACTOR_METATYPE_SUBJECT, | ||
170 | EXTRACTOR_METATYPE_KEYWORDS, | ||
171 | -1); | ||
172 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, ns_name, 1, root, | ||
173 | 2, nsid, 3, description, -1); | ||
174 | GNUNET_free (ns_name); | ||
175 | GNUNET_free_non_null (root); | ||
176 | GNUNET_free_non_null (description); | ||
177 | return GNUNET_OK; | ||
178 | } | ||
179 | |||
180 | |||
181 | /** | ||
182 | * Search selected in 'file' menu. | ||
183 | */ | ||
184 | void | ||
185 | GNUNET_GTK_main_menu_file_search_activate_cb (GtkWidget * dummy, gpointer data) | ||
186 | { | ||
187 | GtkWidget *ad; | ||
188 | GtkListStore *ls; | ||
189 | GtkTreeIter iter; | ||
190 | GNUNET_HashCode *nsid; | ||
191 | |||
192 | GNUNET_assert (builder == NULL); | ||
193 | builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_search_dialog.glade"); | ||
194 | if (builder == NULL) | ||
195 | return; | ||
196 | ad = GTK_WIDGET (gtk_builder_get_object | ||
197 | (builder, "GNUNET_GTK_search_dialog")); | ||
198 | ls = GTK_LIST_STORE (gtk_builder_get_object | ||
199 | (builder, "GNUNET_GTK_namespace_list_store")); | ||
200 | GNUNET_PSEUDONYM_list_all (GNUNET_FS_GTK_get_configuration (), | ||
201 | &add_namespace_to_ls, ls); | ||
202 | gtk_dialog_run (GTK_DIALOG (ad)); | ||
203 | |||
204 | /* free nsids from 'ls' */ | ||
205 | if (TRUE == gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ls), &iter)) | ||
206 | { | ||
207 | do | ||
208 | { | ||
209 | gtk_tree_model_get (GTK_TREE_MODEL (ls), &iter, 2, &nsid, -1); | ||
210 | GNUNET_free (nsid); | ||
211 | } | ||
212 | while (TRUE == gtk_tree_model_iter_next (GTK_TREE_MODEL (ls), &iter)); | ||
213 | } | ||
214 | gtk_widget_destroy (ad); | ||
215 | g_object_unref (G_OBJECT (builder)); | ||
216 | builder = NULL; | ||
217 | } | ||
218 | |||
219 | /* end of gnunet-fs-gtk-main_window_file_search.c */ | ||
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c index f5e7dad1..257fb311 100644 --- a/src/fs/gnunet-fs-gtk.c +++ b/src/fs/gnunet-fs-gtk.c | |||
@@ -124,13 +124,6 @@ GNUNET_GTK_quit_cb (GObject * object, gpointer user_data) | |||
124 | } | 124 | } |
125 | 125 | ||
126 | 126 | ||
127 | /** | ||
128 | * Search selected in 'file' menu. (from main_window_file_search.c) | ||
129 | */ | ||
130 | void | ||
131 | GNUNET_GTK_main_menu_file_search_activate_cb (GtkWidget * dummy, gpointer data); | ||
132 | |||
133 | |||
134 | void | 127 | void |
135 | main_window_search_namespace_dropdown_button_toggled_cb (GtkToggleButton *togglebutton, | 128 | main_window_search_namespace_dropdown_button_toggled_cb (GtkToggleButton *togglebutton, |
136 | gpointer user_data) | 129 | gpointer user_data) |