aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/fs/search.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2005-08-27 23:07:16 +0000
committerChristian Grothoff <christian@grothoff.org>2005-08-27 23:07:16 +0000
commit950dff19d3fcaea9aaf9ba2d8ddb9a7cf117344e (patch)
treeba96835539df3f96d9e728dbc36138f9d8da5172 /src/plugins/fs/search.c
parente7a3ec5e25f2faca329f16f4b40e70808c0df120 (diff)
downloadgnunet-gtk-950dff19d3fcaea9aaf9ba2d8ddb9a7cf117344e.tar.gz
gnunet-gtk-950dff19d3fcaea9aaf9ba2d8ddb9a7cf117344e.zip
fixing namespace search code
Diffstat (limited to 'src/plugins/fs/search.c')
-rw-r--r--src/plugins/fs/search.c53
1 files changed, 32 insertions, 21 deletions
diff --git a/src/plugins/fs/search.c b/src/plugins/fs/search.c
index bf585fce..60eecbf1 100644
--- a/src/plugins/fs/search.c
+++ b/src/plugins/fs/search.c
@@ -199,8 +199,10 @@ void on_namespaceRatingSpinButton_changed(GtkWidget * dummy,
199 GtkTreeModel * model; 199 GtkTreeModel * model;
200 GtkTreeIter iter; 200 GtkTreeIter iter;
201 char * encStr; 201 char * encStr;
202 char * description;
202 int rating; 203 int rating;
203 204 int newrating;
205
204 spin 206 spin
205 = glade_xml_get_widget(getMainXML(), 207 = glade_xml_get_widget(getMainXML(),
206 "namespaceRatingSpinButton"); 208 "namespaceRatingSpinButton");
@@ -212,24 +214,33 @@ void on_namespaceRatingSpinButton_changed(GtkWidget * dummy,
212 &iter)) { 214 &iter)) {
213 gtk_tree_model_get(model, 215 gtk_tree_model_get(model,
214 &iter, 216 &iter,
217 NS_SEARCH_DESCRIPTION, &description,
215 NS_SEARCH_ENCNAME, &encStr, 218 NS_SEARCH_ENCNAME, &encStr,
216 NS_SEARCH_RATING, &rating, 219 NS_SEARCH_RATING, &rating,
217 -1); 220 -1);
218 if (0 == strcmp(encStr, 221 if ( (description != NULL) &&
219 _("globally"))) { 222 (0 == strcmp(description,
220 BREAK(); /* spin button should be insensitive! */ 223 _("globally"))) ) {
224 /* just to be sure */
221 gtk_widget_set_sensitive(spin, 225 gtk_widget_set_sensitive(spin,
222 FALSE); 226 FALSE);
223 } else { 227 } else {
224 FSUI_rankNamespace(ctx, 228 if (encStr != NULL) {
225 encStr, 229 newrating = gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin));
226 rating - FSUI_rankNamespace(ctx, 230 rating = FSUI_rankNamespace(ctx,
227 encStr, 231 encStr,
228 0)); 232 newrating - rating);
229 gtk_list_store_set(GTK_LIST_STORE(model), 233 if (rating != newrating) {
230 &iter, 234 /* concurrent modification? */
231 NS_SEARCH_RATING, rating, 235 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),
232 -1); 236 rating);
237 BREAK();
238 }
239 gtk_list_store_set(GTK_LIST_STORE(model),
240 &iter,
241 NS_SEARCH_RATING, rating,
242 -1);
243 }
233 } 244 }
234 } else { 245 } else {
235 /* FIXME: if enc2hash succeeds, we may want to keep this 246 /* FIXME: if enc2hash succeeds, we may want to keep this
@@ -255,6 +266,7 @@ void on_searchNamespaceComboBoxEntry_changed(GtkWidget * dummy,
255 GtkTreeIter iter; 266 GtkTreeIter iter;
256 int rating; 267 int rating;
257 char * encStr; 268 char * encStr;
269 char * descStr;
258 HashCode512 ns; 270 HashCode512 ns;
259 HashCode512 root; 271 HashCode512 root;
260 EncName enc; 272 EncName enc;
@@ -269,22 +281,21 @@ void on_searchNamespaceComboBoxEntry_changed(GtkWidget * dummy,
269 if (TRUE == gtk_combo_box_get_active_iter(GTK_COMBO_BOX(ncbe), 281 if (TRUE == gtk_combo_box_get_active_iter(GTK_COMBO_BOX(ncbe),
270 &iter)) { 282 &iter)) {
271 encStr = NULL; 283 encStr = NULL;
284 descStr = NULL;
272 gtk_tree_model_get(model, 285 gtk_tree_model_get(model,
273 &iter, 286 &iter,
287 NS_SEARCH_DESCRIPTION, &descStr,
274 NS_SEARCH_ENCNAME, &encStr, 288 NS_SEARCH_ENCNAME, &encStr,
275 NS_SEARCH_RATING, &rating, 289 NS_SEARCH_RATING, &rating,
276 -1); 290 -1);
277 291 if ( (descStr != NULL) &&
278 if (!encStr) 292 (0 == strcmp(descStr,
279 return; 293 _("globally"))) ) {
280
281 if (0 == strcmp(encStr,
282 _("globally"))) {
283 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), 294 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),
284 0); 295 0);
285 gtk_widget_set_sensitive(spin, 296 gtk_widget_set_sensitive(spin,
286 FALSE); 297 FALSE);
287 } else { 298 } else if (encStr != NULL) {
288 enc2hash(encStr, 299 enc2hash(encStr,
289 &ns); 300 &ns);
290 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), 301 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),