aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2008-06-02 02:53:19 +0000
committerChristian Grothoff <christian@grothoff.org>2008-06-02 02:53:19 +0000
commit3544ee02a62da4f022848214af2e18f3bec7f881 (patch)
tree9b93e19530c11a9fb18180fac2614cc538974785
parentcf046f64fcfe7437e34293a428ef6372a372ad6b (diff)
downloadgnunet-gtk-3544ee02a62da4f022848214af2e18f3bec7f881.tar.gz
gnunet-gtk-3544ee02a62da4f022848214af2e18f3bec7f881.zip
whitespace
-rw-r--r--src/plugins/chat/chat.c197
-rw-r--r--src/plugins/fs/collection.c4
-rw-r--r--src/plugins/fs/download.c47
-rw-r--r--src/plugins/fs/fs.c20
-rw-r--r--src/plugins/fs/namespace.c17
-rw-r--r--src/plugins/fs/namespace_create.c3
-rw-r--r--src/plugins/fs/namespace_search.c10
-rw-r--r--src/plugins/fs/search.c345
-rw-r--r--src/plugins/fs/search.h8
9 files changed, 306 insertions, 345 deletions
diff --git a/src/plugins/chat/chat.c b/src/plugins/chat/chat.c
index fb3b609a..b9fceec8 100644
--- a/src/plugins/chat/chat.c
+++ b/src/plugins/chat/chat.c
@@ -32,7 +32,7 @@
32 32
33struct GNUNET_CHAT_safe_write_struct 33struct GNUNET_CHAT_safe_write_struct
34{ 34{
35 GtkWidget * text_view; 35 GtkWidget *text_view;
36 const char *message; 36 const char *message;
37 const char *sender; 37 const char *sender;
38}; 38};
@@ -40,7 +40,7 @@ struct GNUNET_CHAT_safe_write_struct
40struct GNUNET_CHAT_safe_nick_write_struct 40struct GNUNET_CHAT_safe_nick_write_struct
41{ 41{
42 GtkListStore *model; 42 GtkListStore *model;
43 GdkPixbuf * icon; 43 GdkPixbuf *icon;
44 const struct GNUNET_ECRS_MetaData *meta; 44 const struct GNUNET_ECRS_MetaData *meta;
45 const char *nick; 45 const char *nick;
46 GNUNET_HashCode pid; 46 GNUNET_HashCode pid;
@@ -49,9 +49,9 @@ struct GNUNET_CHAT_safe_nick_write_struct
49struct GNUNET_CHAT_gui_chat_client 49struct GNUNET_CHAT_gui_chat_client
50{ 50{
51 struct GNUNET_CHAT_gui_chat_client *next; 51 struct GNUNET_CHAT_gui_chat_client *next;
52 GtkWidget * send_button; 52 GtkWidget *send_button;
53 GtkWidget * text_view; 53 GtkWidget *text_view;
54 GtkListStore * nick_model; 54 GtkListStore *nick_model;
55 GtkWidget *chatFrame; 55 GtkWidget *chatFrame;
56 GtkWidget *chat_entry; 56 GtkWidget *chat_entry;
57 GladeXML *chatXML; 57 GladeXML *chatXML;
@@ -90,59 +90,51 @@ write_save_call (void *arg)
90 90
91 buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (cls->text_view)); 91 buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (cls->text_view));
92 message_buf_size = 92 message_buf_size =
93 snprintf (NULL, 0, 93 snprintf (NULL, 0, "<%s>: %s\n", cls->sender, cls->message);
94 "<%s>: %s\n",
95 cls->sender,
96 cls->message);
97 message_buf = GNUNET_malloc (message_buf_size + 1); 94 message_buf = GNUNET_malloc (message_buf_size + 1);
98 GNUNET_snprintf (message_buf, 95 GNUNET_snprintf (message_buf,
99 message_buf_size + 1, 96 message_buf_size + 1,
100 "<%s>: %s\n", 97 "<%s>: %s\n", cls->sender, cls->message);
101 cls->sender, 98 gtk_text_buffer_insert_at_cursor (buffer, message_buf, message_buf_size);
102 cls->message); 99 GNUNET_free (message_buf);
103 gtk_text_buffer_insert_at_cursor (buffer,
104 message_buf,
105 message_buf_size);
106 GNUNET_free(message_buf);
107 return NULL; 100 return NULL;
108} 101}
109 102
110/** 103/**
111 * Safe call to add a nick to the chat room view 104 * Safe call to add a nick to the chat room view
112 */ 105 */
113static void * 106static void *
114add_nick_save_call (void *arg) 107add_nick_save_call (void *arg)
115{ 108{
116 struct GNUNET_CHAT_safe_nick_write_struct *cls = arg; 109 struct GNUNET_CHAT_safe_nick_write_struct *cls = arg;
117 GtkListStore * model; 110 GtkListStore *model;
118 GtkTreeIter iter; 111 GtkTreeIter iter;
119 GNUNET_HashCode * pid; 112 GNUNET_HashCode *pid;
120 113
121 model = GTK_LIST_STORE (cls->model); 114 model = GTK_LIST_STORE (cls->model);
122 gtk_list_store_append (model, &iter); 115 gtk_list_store_append (model, &iter);
123 pid = GNUNET_malloc(sizeof(GNUNET_HashCode)); 116 pid = GNUNET_malloc (sizeof (GNUNET_HashCode));
124 *pid = cls->pid; 117 *pid = cls->pid;
125 gtk_list_store_set(model, 118 gtk_list_store_set (model,
126 &iter, 119 &iter,
127 CHAT_PID, pid, 120 CHAT_PID, pid,
128 CHAT_METADATA, GNUNET_ECRS_meta_data_duplicate(cls->meta), 121 CHAT_METADATA,
129 CHAT_ICON, cls->icon, 122 GNUNET_ECRS_meta_data_duplicate (cls->meta), CHAT_ICON,
130 CHAT_NICKNAME, cls->nick, 123 cls->icon, CHAT_NICKNAME, cls->nick, -1);
131 -1);
132 return NULL; 124 return NULL;
133} 125}
134 126
135/** 127/**
136 * Safe call to remove a nick from the chat room view 128 * Safe call to remove a nick from the chat room view
137 */ 129 */
138static void * 130static void *
139remove_nick_save_call (void *arg) 131remove_nick_save_call (void *arg)
140{ 132{
141 struct GNUNET_CHAT_safe_nick_write_struct *cls = arg; 133 struct GNUNET_CHAT_safe_nick_write_struct *cls = arg;
142 GtkListStore * model; 134 GtkListStore *model;
143 GtkTreeIter iter; 135 GtkTreeIter iter;
144 GNUNET_HashCode * pid; 136 GNUNET_HashCode *pid;
145 struct GNUNET_ECRS_MetaData * meta; 137 struct GNUNET_ECRS_MetaData *meta;
146 138
147 model = GTK_LIST_STORE (cls->model); 139 model = GTK_LIST_STORE (cls->model);
148 /* find and remove existing entry */ 140 /* find and remove existing entry */
@@ -153,19 +145,15 @@ remove_nick_save_call (void *arg)
153 pid = NULL; 145 pid = NULL;
154 gtk_tree_model_get (GTK_TREE_MODEL (model), 146 gtk_tree_model_get (GTK_TREE_MODEL (model),
155 &iter, 147 &iter,
156 CHAT_PID, &pid, 148 CHAT_PID, &pid, CHAT_METADATA, &meta, -1);
157 CHAT_METADATA, &meta, 149 if ((pid != NULL) &&
158 -1); 150 (0 == memcmp (pid, &cls->pid, sizeof (GNUNET_HashCode))))
159 if ( (pid != NULL) && 151 {
160 (0 == memcmp(pid, 152 GNUNET_ECRS_meta_data_destroy (meta);
161 &cls->pid, 153 GNUNET_free (pid);
162 sizeof(GNUNET_HashCode))) ) 154 gtk_list_store_remove (model, &iter);
163 { 155 return NULL; /* done! */
164 GNUNET_ECRS_meta_data_destroy(meta); 156 }
165 GNUNET_free(pid);
166 gtk_list_store_remove(model, &iter);
167 return NULL; /* done! */
168 }
169 } 157 }
170 while (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter)); 158 while (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter));
171 } 159 }
@@ -189,40 +177,38 @@ remove_nick_save_call (void *arg)
189static int 177static int
190receive_callback (void *cls, 178receive_callback (void *cls,
191 struct GNUNET_CHAT_Room *room, 179 struct GNUNET_CHAT_Room *room,
192 const GNUNET_HashCode *sender, 180 const GNUNET_HashCode * sender,
193 const struct GNUNET_ECRS_MetaData * member_info, 181 const struct GNUNET_ECRS_MetaData *member_info,
194 const char *message, 182 const char *message, GNUNET_CHAT_MSG_OPTIONS options)
195 GNUNET_CHAT_MSG_OPTIONS options)
196{ 183{
197 struct GNUNET_CHAT_gui_chat_client *client = cls; 184 struct GNUNET_CHAT_gui_chat_client *client = cls;
198 struct GNUNET_CHAT_safe_write_struct writearg; 185 struct GNUNET_CHAT_safe_write_struct writearg;
199 char * sndr; 186 char *sndr;
200 187
201 sndr = sender == NULL ? _("anonymous") : GNUNET_PSEUDO_id_to_name(chat_ectx, chat_cfg, sender); 188 sndr =
189 sender == NULL ? _("anonymous") : GNUNET_PSEUDO_id_to_name (chat_ectx,
190 chat_cfg,
191 sender);
202 writearg.text_view = client->text_view; 192 writearg.text_view = client->text_view;
203 writearg.message = message; 193 writearg.message = message;
204 writearg.sender = sndr; 194 writearg.sender = sndr;
205 GNUNET_GTK_save_call (&write_save_call, &writearg); 195 GNUNET_GTK_save_call (&write_save_call, &writearg);
206 GNUNET_free_non_null(sndr); 196 GNUNET_free_non_null (sndr);
207 return GNUNET_OK; 197 return GNUNET_OK;
208} 198}
209 199
210static int 200static int
211member_list_callback (void *cls, 201member_list_callback (void *cls,
212 const struct GNUNET_ECRS_MetaData * member_info, 202 const struct GNUNET_ECRS_MetaData *member_info,
213 const GNUNET_RSA_PublicKey * pkey, 203 const GNUNET_RSA_PublicKey * pkey,
214 GNUNET_CHAT_MSG_OPTIONS opt) 204 GNUNET_CHAT_MSG_OPTIONS opt)
215{ 205{
216 struct GNUNET_CHAT_gui_chat_client *client = cls; 206 struct GNUNET_CHAT_gui_chat_client *client = cls;
217 struct GNUNET_CHAT_safe_nick_write_struct writearg; 207 struct GNUNET_CHAT_safe_nick_write_struct writearg;
218 char *nick; 208 char *nick;
219 209
220 GNUNET_hash(pkey, 210 GNUNET_hash (pkey, sizeof (GNUNET_RSA_PublicKey), &writearg.pid);
221 sizeof(GNUNET_RSA_PublicKey), 211 nick = GNUNET_PSEUDO_id_to_name (chat_ectx, chat_cfg, &writearg.pid);
222 &writearg.pid);
223 nick = GNUNET_PSEUDO_id_to_name(chat_ectx,
224 chat_cfg,
225 &writearg.pid);
226 writearg.model = client->nick_model; 212 writearg.model = client->nick_model;
227 /* FIXME: set icon if pid == ours */ 213 /* FIXME: set icon if pid == ours */
228 writearg.icon = NULL; 214 writearg.icon = NULL;
@@ -232,7 +218,7 @@ member_list_callback (void *cls,
232 GNUNET_GTK_save_call (&add_nick_save_call, &writearg); 218 GNUNET_GTK_save_call (&add_nick_save_call, &writearg);
233 else 219 else
234 GNUNET_GTK_save_call (&remove_nick_save_call, &writearg); 220 GNUNET_GTK_save_call (&remove_nick_save_call, &writearg);
235 GNUNET_free(nick); 221 GNUNET_free (nick);
236 return GNUNET_OK; 222 return GNUNET_OK;
237} 223}
238 224
@@ -243,20 +229,17 @@ on_chat_frame_send_button_click_event_chat (GtkWidget * widget, gpointer data)
243 const char *message; 229 const char *message;
244 struct GNUNET_CHAT_gui_chat_client *pos; 230 struct GNUNET_CHAT_gui_chat_client *pos;
245 231
246 GNUNET_mutex_lock(lock); 232 GNUNET_mutex_lock (lock);
247 pos = list; 233 pos = list;
248 while ( (pos != NULL) && 234 while ((pos != NULL) && (pos->send_button != widget))
249 (pos->send_button != widget) )
250 pos = pos->next; 235 pos = pos->next;
251 GNUNET_GE_ASSERT(NULL, pos != NULL); 236 GNUNET_GE_ASSERT (NULL, pos != NULL);
252 237
253 message = (const char *) gtk_entry_get_text (GTK_ENTRY(pos->chat_entry)); 238 message = (const char *) gtk_entry_get_text (GTK_ENTRY (pos->chat_entry));
254 GNUNET_CHAT_send_message (pos->room, 239 GNUNET_CHAT_send_message (pos->room,
255 message, 240 message, GNUNET_CHAT_MSG_OPTION_NONE, NULL, &seq);
256 GNUNET_CHAT_MSG_OPTION_NONE, 241 gtk_entry_set_text (GTK_ENTRY (pos->chat_entry), "");
257 NULL, &seq); 242 GNUNET_mutex_unlock (lock);
258 gtk_entry_set_text (GTK_ENTRY(pos->chat_entry), "");
259 GNUNET_mutex_unlock(lock);
260} 243}
261 244
262/** FIXME: move to gtkcommon! */ 245/** FIXME: move to gtkcommon! */
@@ -275,44 +258,44 @@ extractMainWidgetFromWindow (GladeXML * xml, const char *windowName)
275} 258}
276 259
277static void 260static void
278create_chat_room_tab (const char *room_name, 261create_chat_room_tab (const char *room_name, const char *nick)
279 const char *nick)
280{ 262{
281 GtkWidget *chatLabel; 263 GtkWidget *chatLabel;
282 GtkWidget *chatnotebook; 264 GtkWidget *chatnotebook;
283 GtkTreeView *treeview; 265 GtkTreeView *treeview;
284 struct GNUNET_CHAT_gui_chat_client *client; 266 struct GNUNET_CHAT_gui_chat_client *client;
285 struct GNUNET_ECRS_MetaData * meta; 267 struct GNUNET_ECRS_MetaData *meta;
286 GtkCellRenderer *renderer; 268 GtkCellRenderer *renderer;
287 GtkTreeViewColumn *column; 269 GtkTreeViewColumn *column;
288 int col; 270 int col;
289 271
290 chatnotebook = 272 chatnotebook =
291 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "chatnotebook"); 273 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "chatnotebook");
292 274
293 client = GNUNET_malloc (sizeof (struct GNUNET_CHAT_gui_chat_client)); 275 client = GNUNET_malloc (sizeof (struct GNUNET_CHAT_gui_chat_client));
294 client->chatXML = 276 client->chatXML =
295 glade_xml_new (GNUNET_GTK_get_glade_filename (), 277 glade_xml_new (GNUNET_GTK_get_glade_filename (),
296 "chatFrame", 278 "chatFrame", PACKAGE_NAME);
297 PACKAGE_NAME);
298 GNUNET_GTK_connect_glade_with_plugins (client->chatXML); 279 GNUNET_GTK_connect_glade_with_plugins (client->chatXML);
299 client->chatFrame = extractMainWidgetFromWindow (client->chatXML, 280 client->chatFrame = extractMainWidgetFromWindow (client->chatXML,
300 "chatFrame"); 281 "chatFrame");
301 chatLabel = gtk_label_new (room_name); 282 chatLabel = gtk_label_new (room_name);
302 gtk_notebook_append_page (GTK_NOTEBOOK (chatnotebook), 283 gtk_notebook_append_page (GTK_NOTEBOOK (chatnotebook),
303 client->chatFrame, 284 client->chatFrame, chatLabel);
304 chatLabel);
305 gtk_widget_show (chatnotebook); 285 gtk_widget_show (chatnotebook);
306 286
307 client->nick_model = gtk_list_store_new (CHAT_NUM, 287 client->nick_model = gtk_list_store_new (CHAT_NUM, G_TYPE_STRING, /* nickname */
308 G_TYPE_STRING, /* nickname */ 288 G_TYPE_POINTER, /* metadata */
309 G_TYPE_POINTER, /* metadata */ 289 GDK_TYPE_PIXBUF, /* icon */
310 GDK_TYPE_PIXBUF, /* icon */ 290 G_TYPE_POINTER); /* pid */
311 G_TYPE_POINTER); /* pid */ 291 client->send_button =
312 client->send_button = glade_xml_get_widget (client->chatXML, "chatSendButton"); 292 glade_xml_get_widget (client->chatXML, "chatSendButton");
313 client->text_view = glade_xml_get_widget (client->chatXML, "chatLogViewer"); 293 client->text_view = glade_xml_get_widget (client->chatXML, "chatLogViewer");
314 client->chat_entry = glade_xml_get_widget (client->chatXML, "chatLineTextEntry"); 294 client->chat_entry =
315 treeview = GTK_TREE_VIEW(glade_xml_get_widget (client->chatXML, "roomMembersTreeView")); 295 glade_xml_get_widget (client->chatXML, "chatLineTextEntry");
296 treeview =
297 GTK_TREE_VIEW (glade_xml_get_widget
298 (client->chatXML, "roomMembersTreeView"));
316 gtk_tree_view_set_model (treeview, GTK_TREE_MODEL (client->nick_model)); 299 gtk_tree_view_set_model (treeview, GTK_TREE_MODEL (client->nick_model));
317 300
318 renderer = gtk_cell_renderer_text_new (); 301 renderer = gtk_cell_renderer_text_new ();
@@ -328,7 +311,7 @@ create_chat_room_tab (const char *room_name,
328 gtk_tree_view_column_set_reorderable (column, TRUE); 311 gtk_tree_view_column_set_reorderable (column, TRUE);
329 gtk_tree_view_column_set_sort_column_id (column, CHAT_NICKNAME); 312 gtk_tree_view_column_set_sort_column_id (column, CHAT_NICKNAME);
330 gtk_tree_view_column_set_min_width (column, 0); 313 gtk_tree_view_column_set_min_width (column, 0);
331 314
332 renderer = gtk_cell_renderer_pixbuf_new (); 315 renderer = gtk_cell_renderer_pixbuf_new ();
333 col = gtk_tree_view_insert_column_with_attributes (treeview, 316 col = gtk_tree_view_insert_column_with_attributes (treeview,
334 -1, 317 -1,
@@ -341,25 +324,21 @@ create_chat_room_tab (const char *room_name,
341 gtk_tree_view_column_set_clickable (column, FALSE); 324 gtk_tree_view_column_set_clickable (column, FALSE);
342 gtk_tree_view_column_set_reorderable (column, FALSE); 325 gtk_tree_view_column_set_reorderable (column, FALSE);
343 326
344 GNUNET_mutex_lock(lock); 327 GNUNET_mutex_lock (lock);
345 client->next = list; 328 client->next = list;
346 list = client; 329 list = client;
347 GNUNET_mutex_unlock(lock); 330 GNUNET_mutex_unlock (lock);
348 331
349 meta = GNUNET_ECRS_meta_data_create(); 332 meta = GNUNET_ECRS_meta_data_create ();
350 GNUNET_ECRS_meta_data_insert(meta, 333 GNUNET_ECRS_meta_data_insert (meta, EXTRACTOR_TITLE, nick);
351 EXTRACTOR_TITLE,
352 nick);
353 client->room = 334 client->room =
354 GNUNET_CHAT_join_room (chat_ectx, chat_cfg, nick, 335 GNUNET_CHAT_join_room (chat_ectx, chat_cfg, nick,
355 meta, 336 meta,
356 room_name, 337 room_name,
357 -1, 338 -1,
358 &receive_callback, client, &member_list_callback, 339 &receive_callback, client, &member_list_callback,
359 client, 340 client, NULL, NULL, &client->mypid);
360 NULL, NULL, 341 GNUNET_ECRS_meta_data_destroy (meta);
361 &client->mypid);
362 GNUNET_ECRS_meta_data_destroy(meta);
363} 342}
364 343
365void 344void
diff --git a/src/plugins/fs/collection.c b/src/plugins/fs/collection.c
index 2f8ecf64..cc8a25a2 100644
--- a/src/plugins/fs/collection.c
+++ b/src/plugins/fs/collection.c
@@ -118,7 +118,7 @@ createCollection_clicked_fs (GtkWidget * dummy1, GtkWidget * dummy2)
118 gtk_widget_set_sensitive (w, FALSE); 118 gtk_widget_set_sensitive (w, FALSE);
119 w = 119 w =
120 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), 120 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
121 "deleteCollection"); 121 "deleteCollection");
122 gtk_widget_set_sensitive (w, TRUE); 122 gtk_widget_set_sensitive (w, TRUE);
123 } 123 }
124 else 124 else
@@ -171,7 +171,7 @@ fs_collection_start ()
171{ 171{
172 GtkWidget *w; 172 GtkWidget *w;
173 struct GNUNET_ECRS_MetaData *h; 173 struct GNUNET_ECRS_MetaData *h;
174 174
175 h = GNUNET_CO_collection_get_name (); 175 h = GNUNET_CO_collection_get_name ();
176 if (NULL != h) 176 if (NULL != h)
177 { 177 {
diff --git a/src/plugins/fs/download.c b/src/plugins/fs/download.c
index a7868f2c..fdde54ca 100644
--- a/src/plugins/fs/download.c
+++ b/src/plugins/fs/download.c
@@ -146,7 +146,7 @@ refreshDirectoryViewFromDisk (DownloadList * list)
146 meta = NULL; 146 meta = NULL;
147 GNUNET_ECRS_directory_list_contents (ectx, data, size, &meta, 147 GNUNET_ECRS_directory_list_contents (ectx, data, size, &meta,
148 &addFilesToDirectory, list); 148 &addFilesToDirectory, list);
149 MUNMAP ((void*)data, size); 149 MUNMAP ((void *) data, size);
150 CLOSE (fd); 150 CLOSE (fd);
151 if (meta != NULL) 151 if (meta != NULL)
152 GNUNET_ECRS_meta_data_destroy (meta); 152 GNUNET_ECRS_meta_data_destroy (meta);
@@ -189,8 +189,8 @@ fs_download_started (struct GNUNET_FSUI_DownloadList *fsui_dl,
189 if ((dl_parent != NULL) && 189 if ((dl_parent != NULL) &&
190 (NULL != 190 (NULL !=
191 (path = 191 (path =
192 gtk_tree_row_reference_get_path (dl_parent-> 192 gtk_tree_row_reference_get_path
193 summaryViewRowReference)))) 193 (dl_parent->summaryViewRowReference))))
194 { 194 {
195 valid = gtk_tree_model_get_iter (GTK_TREE_MODEL (download_summary), 195 valid = gtk_tree_model_get_iter (GTK_TREE_MODEL (download_summary),
196 &piter, path); 196 &piter, path);
@@ -246,13 +246,12 @@ fs_download_started (struct GNUNET_FSUI_DownloadList *fsui_dl,
246 solution is to #ifndef it */ 246 solution is to #ifndef it */
247#ifndef MINGW 247#ifndef MINGW
248 GNUNET_GE_BREAK (ectx, 248 GNUNET_GE_BREAK (ectx,
249 gtk_tree_row_reference_get_model (dl_parent-> 249 gtk_tree_row_reference_get_model
250 searchViewRowReference) 250 (dl_parent->searchViewRowReference) == model);
251 == model);
252#endif 251#endif
253 path = 252 path =
254 gtk_tree_row_reference_get_path (dl_parent-> 253 gtk_tree_row_reference_get_path
255 searchViewRowReference); 254 (dl_parent->searchViewRowReference);
256 if (path != NULL) 255 if (path != NULL)
257 { 256 {
258 valid = gtk_tree_model_get_iter (model, &piter, path); 257 valid = gtk_tree_model_get_iter (model, &piter, path);
@@ -370,8 +369,8 @@ fs_download_completed (DownloadList * downloadContext)
370 if (downloadContext->searchViewRowReference != NULL) 369 if (downloadContext->searchViewRowReference != NULL)
371 { 370 {
372 path = 371 path =
373 gtk_tree_row_reference_get_path (downloadContext-> 372 gtk_tree_row_reference_get_path
374 searchViewRowReference); 373 (downloadContext->searchViewRowReference);
375 gtk_tree_model_get_iter (GTK_TREE_MODEL 374 gtk_tree_model_get_iter (GTK_TREE_MODEL
376 (downloadContext->searchList->tree), &iter, 375 (downloadContext->searchList->tree), &iter,
377 path); 376 path);
@@ -401,8 +400,8 @@ fs_download_aborted (DownloadList * downloadContext)
401 if (downloadContext->searchViewRowReference != NULL) 400 if (downloadContext->searchViewRowReference != NULL)
402 { 401 {
403 path = 402 path =
404 gtk_tree_row_reference_get_path (downloadContext-> 403 gtk_tree_row_reference_get_path
405 searchViewRowReference); 404 (downloadContext->searchViewRowReference);
406 gtk_tree_model_get_iter (GTK_TREE_MODEL 405 gtk_tree_model_get_iter (GTK_TREE_MODEL
407 (downloadContext->searchList->tree), &iter, 406 (downloadContext->searchList->tree), &iter,
408 path); 407 path);
@@ -633,9 +632,8 @@ initiateDownload (GtkTreeModel * model,
633 strlen (GNUNET_ECRS_FILE_INFIX)); 632 strlen (GNUNET_ECRS_FILE_INFIX));
634 GNUNET_free_non_null (idc_name); 633 GNUNET_free_non_null (idc_name);
635 filehash = 634 filehash =
636 GNUNET_strdup (&sdc. 635 GNUNET_strdup (&sdc.uri_name[strlen (GNUNET_ECRS_URI_PREFIX) +
637 uri_name[strlen (GNUNET_ECRS_URI_PREFIX) + 636 strlen (GNUNET_ECRS_FILE_INFIX)]);
638 strlen (GNUNET_ECRS_FILE_INFIX)]);
639 filehash[16] = 0; 637 filehash[16] = 0;
640 idc_name = GNUNET_strdup (filehash); 638 idc_name = GNUNET_strdup (filehash);
641 GNUNET_free_non_null (filehash); 639 GNUNET_free_non_null (filehash);
@@ -646,9 +644,8 @@ initiateDownload (GtkTreeModel * model,
646 strlen (GNUNET_ECRS_FILE_INFIX)); 644 strlen (GNUNET_ECRS_FILE_INFIX));
647 GNUNET_free_non_null (idc_name); 645 GNUNET_free_non_null (idc_name);
648 idc_name = 646 idc_name =
649 GNUNET_strdup (&sdc. 647 GNUNET_strdup (&sdc.uri_name[strlen (GNUNET_ECRS_URI_PREFIX) +
650 uri_name[strlen (GNUNET_ECRS_URI_PREFIX) + 648 strlen (GNUNET_ECRS_FILE_INFIX)]);
651 strlen (GNUNET_ECRS_FILE_INFIX)]);
652#endif 649#endif
653 } 650 }
654 651
@@ -725,10 +722,10 @@ initiateDownload (GtkTreeModel * model,
725 GNUNET_malloc (strlen (final_download_dir) + 2 + strlen (idc_name) + 722 GNUNET_malloc (strlen (final_download_dir) + 2 + strlen (idc_name) +
726 strlen (GNUNET_DIRECTORY_EXT) + strlen (dirPath)); 723 strlen (GNUNET_DIRECTORY_EXT) + strlen (dirPath));
727 strcpy (sdc.idc_final_download_destination, final_download_dir); 724 strcpy (sdc.idc_final_download_destination, final_download_dir);
728 if (sdc. 725 if (sdc.idc_final_download_destination[strlen
729 idc_final_download_destination[strlen 726 (sdc.
730 (sdc.idc_final_download_destination) - 727 idc_final_download_destination) -
731 1] != DIR_SEPARATOR) 728 1] != DIR_SEPARATOR)
732 strcat (sdc.idc_final_download_destination, DIR_SEPARATOR_STR); 729 strcat (sdc.idc_final_download_destination, DIR_SEPARATOR_STR);
733 strcat (sdc.idc_final_download_destination, dirPath); 730 strcat (sdc.idc_final_download_destination, dirPath);
734 strcat (sdc.idc_final_download_destination, idc_name); 731 strcat (sdc.idc_final_download_destination, idc_name);
@@ -826,9 +823,9 @@ on_statusDownloadURIEntry_editing_done_fs (GtkWidget * entry,
826 GNUNET_malloc (strlen (final_download_dir) + strlen (dname) + 2); 823 GNUNET_malloc (strlen (final_download_dir) + strlen (dname) + 2);
827 strcpy (sdc.idc_final_download_destination, final_download_dir); 824 strcpy (sdc.idc_final_download_destination, final_download_dir);
828 GNUNET_free (final_download_dir); 825 GNUNET_free (final_download_dir);
829 if (sdc. 826 if (sdc.idc_final_download_destination[strlen
830 idc_final_download_destination[strlen 827 (sdc.
831 (sdc.idc_final_download_destination)] != 828 idc_final_download_destination)] !=
832 DIR_SEPARATOR) 829 DIR_SEPARATOR)
833 strcat (sdc.idc_final_download_destination, DIR_SEPARATOR_STR); 830 strcat (sdc.idc_final_download_destination, DIR_SEPARATOR_STR);
834 strcat (sdc.idc_final_download_destination, dname); 831 strcat (sdc.idc_final_download_destination, dname);
diff --git a/src/plugins/fs/fs.c b/src/plugins/fs/fs.c
index a7442ee1..88a86cc9 100644
--- a/src/plugins/fs/fs.c
+++ b/src/plugins/fs/fs.c
@@ -158,22 +158,22 @@ saveEventProcessor (void *cls)
158 event->data.SearchResumed.fisSize, 158 event->data.SearchResumed.fisSize,
159 event->data.SearchResumed.fis, 159 event->data.SearchResumed.fis,
160 event->data.SearchResumed.state); 160 event->data.SearchResumed.state);
161 for (i=0;i<event->data.SearchResumed.fisSize;i++) 161 for (i = 0; i < event->data.SearchResumed.fisSize; i++)
162 fs_search_update(ret, 162 fs_search_update (ret,
163 &event->data.SearchResumed.fis[i], 163 &event->data.SearchResumed.fis[i],
164 event->data.SearchResumed.availability_rank[i], 164 event->data.SearchResumed.availability_rank[i],
165 event->data.SearchResumed.availability_certainty[i], 165 event->data.SearchResumed.availability_certainty[i],
166 event->data.SearchResumed.applicability_rank[i]); 166 event->data.SearchResumed.applicability_rank[i]);
167 break; 167 break;
168 case GNUNET_FSUI_search_stopped: 168 case GNUNET_FSUI_search_stopped:
169 fs_search_stopped (event->data.SearchStopped.sc.cctx); 169 fs_search_stopped (event->data.SearchStopped.sc.cctx);
170 break; 170 break;
171 case GNUNET_FSUI_search_update: 171 case GNUNET_FSUI_search_update:
172 fs_search_update (event->data.SearchUpdate.sc.cctx, 172 fs_search_update (event->data.SearchUpdate.sc.cctx,
173 &event->data.SearchUpdate.fi, 173 &event->data.SearchUpdate.fi,
174 event->data.SearchUpdate.availability_rank, 174 event->data.SearchUpdate.availability_rank,
175 event->data.SearchUpdate.availability_certainty, 175 event->data.SearchUpdate.availability_certainty,
176 event->data.SearchUpdate.applicability_rank); 176 event->data.SearchUpdate.applicability_rank);
177 break; 177 break;
178 /* download events */ 178 /* download events */
179 case GNUNET_FSUI_download_aborted: 179 case GNUNET_FSUI_download_aborted:
diff --git a/src/plugins/fs/namespace.c b/src/plugins/fs/namespace.c
index 0449e3b0..f7a12816 100644
--- a/src/plugins/fs/namespace.c
+++ b/src/plugins/fs/namespace.c
@@ -410,14 +410,12 @@ addTabForNamespace (void *unused,
410 GtkWidget *label; 410 GtkWidget *label;
411 GtkWidget *notebook; 411 GtkWidget *notebook;
412 GtkWidget *del_menu; 412 GtkWidget *del_menu;
413 char * namespaceName; 413 char *namespaceName;
414 414
415 if (GNUNET_OK != 415 if (GNUNET_OK != GNUNET_ECRS_namespace_test_exists (NULL, cfg, namespaceId))
416 GNUNET_ECRS_namespace_test_exists (NULL, cfg,
417 namespaceId))
418 return GNUNET_OK; 416 return GNUNET_OK;
419 GNUNET_GTK_DEBUG_BEGIN (); 417 GNUNET_GTK_DEBUG_BEGIN ();
420 namespaceName = GNUNET_PSEUDO_id_to_name(ectx, cfg, namespaceId); 418 namespaceName = GNUNET_PSEUDO_id_to_name (ectx, cfg, namespaceId);
421 label = gtk_label_new (namespaceName); 419 label = gtk_label_new (namespaceName);
422 list = GNUNET_malloc (sizeof (NamespaceList)); 420 list = GNUNET_malloc (sizeof (NamespaceList));
423 list->name = GNUNET_strdup (namespaceName); 421 list->name = GNUNET_strdup (namespaceName);
@@ -443,7 +441,7 @@ addTabForNamespace (void *unused,
443 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), 441 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
444 "namespaceDelete"); 442 "namespaceDelete");
445 gtk_widget_set_sensitive (del_menu, TRUE); 443 gtk_widget_set_sensitive (del_menu, TRUE);
446 GNUNET_free(namespaceName); 444 GNUNET_free (namespaceName);
447 return GNUNET_OK; 445 return GNUNET_OK;
448} 446}
449 447
@@ -994,8 +992,8 @@ fs_namespace_start ()
994 TRUE); 992 TRUE);
995 GNUNET_URITRACK_register_track_callback (ectx, cfg, &updateViewSave, NULL); 993 GNUNET_URITRACK_register_track_callback (ectx, cfg, &updateViewSave, NULL);
996 GNUNET_PSEUDO_list_all (ectx, cfg, &addTabForNamespace, NULL); 994 GNUNET_PSEUDO_list_all (ectx, cfg, &addTabForNamespace, NULL);
997 GNUNET_PSEUDO_register_discovery_callback (ectx, cfg, &namespace_discovered_cb, 995 GNUNET_PSEUDO_register_discovery_callback (ectx, cfg,
998 NULL); 996 &namespace_discovered_cb, NULL);
999 GNUNET_GTK_DEBUG_END (); 997 GNUNET_GTK_DEBUG_END ();
1000} 998}
1001 999
@@ -1003,7 +1001,8 @@ fs_namespace_start ()
1003void 1001void
1004fs_namespace_stop () 1002fs_namespace_stop ()
1005{ 1003{
1006 GNUNET_PSEUDO_unregister_discovery_callback (&namespace_discovered_cb, NULL); 1004 GNUNET_PSEUDO_unregister_discovery_callback (&namespace_discovered_cb,
1005 NULL);
1007 while (head != NULL) 1006 while (head != NULL)
1008 frame_destroy (head->treeview); 1007 frame_destroy (head->treeview);
1009 GNUNET_URITRACK_unregister_track_callback (&updateViewSave, NULL); 1008 GNUNET_URITRACK_unregister_track_callback (&updateViewSave, NULL);
diff --git a/src/plugins/fs/namespace_create.c b/src/plugins/fs/namespace_create.c
index d38aaab7..802c7096 100644
--- a/src/plugins/fs/namespace_create.c
+++ b/src/plugins/fs/namespace_create.c
@@ -249,8 +249,7 @@ create_namespace_clicked_fs (GtkWidget * dummy1, GtkWidget * dummy2)
249 namespaceName = gtk_entry_get_text (GTK_ENTRY (nameLine)); 249 namespaceName = gtk_entry_get_text (GTK_ENTRY (nameLine));
250 root = GNUNET_NS_namespace_create (ectx, cfg, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin)), 1000, /* FIXME: priority */ 250 root = GNUNET_NS_namespace_create (ectx, cfg, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin)), 1000, /* FIXME: priority */
251 GNUNET_get_time () + 2 * GNUNET_CRON_YEARS, /* FIXME: expiration */ 251 GNUNET_get_time () + 2 * GNUNET_CRON_YEARS, /* FIXME: expiration */
252 meta, keywordURI, 252 meta, keywordURI, &rootEntry);
253 &rootEntry);
254 if (root != NULL) 253 if (root != NULL)
255 { 254 {
256 GNUNET_ECRS_uri_get_namespace_from_sks (root, &namespaceId); 255 GNUNET_ECRS_uri_get_namespace_from_sks (root, &namespaceId);
diff --git a/src/plugins/fs/namespace_search.c b/src/plugins/fs/namespace_search.c
index baed05fe..d8900c93 100644
--- a/src/plugins/fs/namespace_search.c
+++ b/src/plugins/fs/namespace_search.c
@@ -80,12 +80,10 @@ on_namespaceRatingSpinButton_changed_fs (GtkWidget * dummy,
80 { 80 {
81 if (encStr != NULL) 81 if (encStr != NULL)
82 { 82 {
83 GNUNET_enc_to_hash(encStr, 83 GNUNET_enc_to_hash (encStr, &nsid);
84 &nsid);
85 newrating = gtk_spin_button_get_value (GTK_SPIN_BUTTON (spin)); 84 newrating = gtk_spin_button_get_value (GTK_SPIN_BUTTON (spin));
86 rating = GNUNET_PSEUDO_rank (ectx, 85 rating = GNUNET_PSEUDO_rank (ectx,
87 cfg, &nsid, 86 cfg, &nsid, newrating - rating);
88 newrating - rating);
89 if (rating != newrating) 87 if (rating != newrating)
90 { 88 {
91 /* concurrent modification? */ 89 /* concurrent modification? */
@@ -302,11 +300,11 @@ namespace_discovered_cb (void *cls,
302{ 300{
303 struct NewNamespaceInfo nni; 301 struct NewNamespaceInfo nni;
304 302
305 nni.namespaceName = GNUNET_PSEUDO_id_to_name(ectx, cfg, namespaceId); 303 nni.namespaceName = GNUNET_PSEUDO_id_to_name (ectx, cfg, namespaceId);
306 nni.namespaceId = namespaceId; 304 nni.namespaceId = namespaceId;
307 nni.md = md; 305 nni.md = md;
308 nni.rating = rating; 306 nni.rating = rating;
309 GNUNET_GTK_save_call (&saveDiscovery, &nni); 307 GNUNET_GTK_save_call (&saveDiscovery, &nni);
310 GNUNET_free(nni.namespaceName); 308 GNUNET_free (nni.namespaceName);
311 return GNUNET_OK; 309 return GNUNET_OK;
312} 310}
diff --git a/src/plugins/fs/search.c b/src/plugins/fs/search.c
index b92b50a3..d924b26b 100644
--- a/src/plugins/fs/search.c
+++ b/src/plugins/fs/search.c
@@ -98,93 +98,93 @@ updateSearchSummary (SearchList * searchContext)
98} 98}
99 99
100static GdkPixbuf * 100static GdkPixbuf *
101make_ranking_pixbuf(int availability_rank, 101make_ranking_pixbuf (int availability_rank,
102 unsigned int availability_certainty, 102 unsigned int availability_certainty,
103 unsigned int applicability_rank, 103 unsigned int applicability_rank, unsigned int kwords)
104 unsigned int kwords)
105{ 104{
106 GdkPixbuf *pixbuf; 105 GdkPixbuf *pixbuf;
107 guchar * pixels; 106 guchar *pixels;
108 guchar * pixel; 107 guchar *pixel;
109 int n_channels; 108 int n_channels;
110 int rowstride; 109 int rowstride;
111 unsigned int x; 110 unsigned int x;
112 unsigned int y; 111 unsigned int y;
113 112
114#define P_HEIGHT 21 113#define P_HEIGHT 21
115#define P_WIDTH 60 114#define P_WIDTH 60
116 pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, 115 pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, /* alpha */
117 TRUE, /* alpha */ 116 8, /* bits per sample */
118 8, /* bits per sample */ 117 P_WIDTH, /* width */
119 P_WIDTH, /* width */ 118 P_HEIGHT /* height */
120 P_HEIGHT /* height */ 119 );
121 );
122 n_channels = gdk_pixbuf_get_n_channels (pixbuf); 120 n_channels = gdk_pixbuf_get_n_channels (pixbuf);
123 pixels = gdk_pixbuf_get_pixels(pixbuf); 121 pixels = gdk_pixbuf_get_pixels (pixbuf);
124 rowstride = gdk_pixbuf_get_rowstride(pixbuf); 122 rowstride = gdk_pixbuf_get_rowstride (pixbuf);
125 for (x=0;x<P_WIDTH;x++) 123 for (x = 0; x < P_WIDTH; x++)
126 for (y=0;y<P_HEIGHT;y++) 124 for (y = 0; y < P_HEIGHT; y++)
127 { 125 {
128 pixel = pixels + y * rowstride + x * n_channels; 126 pixel = pixels + y * rowstride + x * n_channels;
129#define PX_RED 0 127#define PX_RED 0
130#define PX_GREEN 1 128#define PX_GREEN 1
131#define PX_BLUE 2 129#define PX_BLUE 2
132#define PX_ALPHA 3 130#define PX_ALPHA 3
133 pixel[PX_RED] = 0; 131 pixel[PX_RED] = 0;
134 pixel[PX_GREEN] = 0; 132 pixel[PX_GREEN] = 0;
135 pixel[PX_BLUE] = 0; 133 pixel[PX_BLUE] = 0;
136 pixel[PX_ALPHA] = 0; 134 pixel[PX_ALPHA] = 0;
137 if (y < P_HEIGHT / 2) 135 if (y < P_HEIGHT / 2)
138 { 136 {
139 /* applicability */ 137 /* applicability */
140 if (x * kwords < applicability_rank * P_WIDTH) 138 if (x * kwords < applicability_rank * P_WIDTH)
141 { 139 {
142 pixel[PX_RED] = 0; 140 pixel[PX_RED] = 0;
143 pixel[PX_GREEN] = 0; 141 pixel[PX_GREEN] = 0;
144 pixel[PX_BLUE] = 255; 142 pixel[PX_BLUE] = 255;
145 pixel[PX_ALPHA] = 255; 143 pixel[PX_ALPHA] = 255;
146 } 144 }
147 } 145 }
148 else if ( (y > P_HEIGHT / 2) && 146 else if ((y > P_HEIGHT / 2) &&
149 ( (y-P_HEIGHT/2) * GNUNET_FSUI_MAX_PROBES 147 ((y - P_HEIGHT / 2) * GNUNET_FSUI_MAX_PROBES
150 < availability_certainty * P_HEIGHT / 2) ) 148 < availability_certainty * P_HEIGHT / 2))
151 { 149 {
152 /* availability */ 150 /* availability */
153 if (availability_rank < 0) 151 if (availability_rank < 0)
154 { 152 {
155 if ( (x * GNUNET_FSUI_MAX_PROBES > (GNUNET_FSUI_MAX_PROBES+availability_rank) * P_WIDTH/2) && 153 if ((x * GNUNET_FSUI_MAX_PROBES >
156 (x <= P_WIDTH/2) ) 154 (GNUNET_FSUI_MAX_PROBES +
157 { 155 availability_rank) * P_WIDTH / 2) && (x <= P_WIDTH / 2))
158 pixel[PX_RED] = 255; 156 {
159 pixel[PX_GREEN] = 0; 157 pixel[PX_RED] = 255;
160 pixel[PX_BLUE] = 0; 158 pixel[PX_GREEN] = 0;
161 pixel[PX_ALPHA] = 255; 159 pixel[PX_BLUE] = 0;
162 } 160 pixel[PX_ALPHA] = 255;
163 } 161 }
164 else if (availability_rank > 0) 162 }
165 { 163 else if (availability_rank > 0)
166 if ( (x >= P_WIDTH/2) && 164 {
167 ( (x - (P_WIDTH/2)) * GNUNET_FSUI_MAX_PROBES < availability_rank * P_WIDTH/2) ) 165 if ((x >= P_WIDTH / 2) &&
168 { 166 ((x - (P_WIDTH / 2)) * GNUNET_FSUI_MAX_PROBES <
169 pixel[PX_RED] = 0; 167 availability_rank * P_WIDTH / 2))
170 pixel[PX_GREEN] = 255; 168 {
171 pixel[PX_BLUE] = 0; 169 pixel[PX_RED] = 0;
172 pixel[PX_ALPHA] = 255; 170 pixel[PX_GREEN] = 255;
173 } 171 pixel[PX_BLUE] = 0;
174 } 172 pixel[PX_ALPHA] = 255;
175 else 173 }
176 { 174 }
177 if (x == P_WIDTH / 2) 175 else
178 { 176 {
179 /* yellow */ 177 if (x == P_WIDTH / 2)
180 pixel[PX_RED] = 255; 178 {
181 pixel[PX_GREEN] = 255; 179 /* yellow */
182 pixel[PX_BLUE] = 0; 180 pixel[PX_RED] = 255;
183 pixel[PX_ALPHA] = 255; 181 pixel[PX_GREEN] = 255;
184 } 182 pixel[PX_BLUE] = 0;
185 } 183 pixel[PX_ALPHA] = 255;
186 } 184 }
187 } 185 }
186 }
187 }
188 return pixbuf; 188 return pixbuf;
189} 189}
190 190
@@ -211,34 +211,26 @@ addEntryToSearchTree (SearchList * searchContext,
211 desc = getDescriptionFromMetaData (info->meta); 211 desc = getDescriptionFromMetaData (info->meta);
212 name = getFileNameFromMetaData (info->meta); 212 name = getFileNameFromMetaData (info->meta);
213 size = GNUNET_ECRS_uri_test_chk (info->uri) 213 size = GNUNET_ECRS_uri_test_chk (info->uri)
214 || GNUNET_ECRS_uri_test_loc (info-> 214 || GNUNET_ECRS_uri_test_loc (info->uri) ?
215 uri) ? GNUNET_ECRS_uri_get_file_size (info-> 215 GNUNET_ECRS_uri_get_file_size (info->uri) : 0;
216 uri) :
217 0;
218 pixbuf = getThumbnailFromMetaData (info->meta); 216 pixbuf = getThumbnailFromMetaData (info->meta);
219 size_h = GNUNET_get_byte_size_as_fancy_string (size); 217 size_h = GNUNET_get_byte_size_as_fancy_string (size);
220 rankbuf = make_ranking_pixbuf(0, 0, 1, 218 rankbuf = make_ranking_pixbuf (0, 0, 1,
221 GNUNET_ECRS_uri_get_keyword_count_from_ksk(searchContext->uri)); 219 GNUNET_ECRS_uri_get_keyword_count_from_ksk
222 gtk_tree_store_set (searchContext->tree, 220 (searchContext->uri));
223 iter, 221 gtk_tree_store_set (searchContext->tree, iter, SEARCH_NAME, name,
224 SEARCH_NAME, name, 222 SEARCH_SIZE, size, SEARCH_HSIZE, size_h, SEARCH_MIME,
225 SEARCH_SIZE, size, 223 mime, SEARCH_DESC, desc, SEARCH_PIXBUF, pixbuf,
226 SEARCH_HSIZE, size_h,
227 SEARCH_MIME, mime,
228 SEARCH_DESC, desc,
229 SEARCH_PIXBUF, pixbuf,
230 SEARCH_URI, GNUNET_ECRS_uri_duplicate (info->uri), 224 SEARCH_URI, GNUNET_ECRS_uri_duplicate (info->uri),
231 SEARCH_META, GNUNET_ECRS_meta_data_duplicate (info->meta), 225 SEARCH_META,
226 GNUNET_ECRS_meta_data_duplicate (info->meta),
232 SEARCH_CELL_BG_COLOR, getColorCode (state), 227 SEARCH_CELL_BG_COLOR, getColorCode (state),
233 SEARCH_CELL_FG_COLOR, "black", 228 SEARCH_CELL_FG_COLOR, "black", SEARCH_INTERNAL,
234 SEARCH_INTERNAL, searchContext, 229 searchContext, SEARCH_INTERNAL_PARENT, downloadParent,
235 SEARCH_INTERNAL_PARENT, downloadParent, 230 SEARCH_STATUS, getStatusName (state),
236 SEARCH_STATUS, getStatusName (state), 231 SEARCH_APPLICABILITY_RANK, 1, SEARCH_RANK_SORT,
237 SEARCH_APPLICABILITY_RANK, 1, 232 (long long) 1, SEARCH_RANK_PIXBUF, rankbuf, -1);
238 SEARCH_RANK_SORT, (long long) 1, 233 g_object_unref (rankbuf);
239 SEARCH_RANK_PIXBUF, rankbuf,
240 -1);
241 g_object_unref(rankbuf);
242 if (pixbuf != NULL) 234 if (pixbuf != NULL)
243 g_object_unref (pixbuf); 235 g_object_unref (pixbuf);
244 GNUNET_free (size_h); 236 GNUNET_free (size_h);
@@ -301,11 +293,12 @@ fs_search_result_received (SearchList * searchContext,
301 * @param availability_rank availability estimate 293 * @param availability_rank availability estimate
302 * @param applicability_rank relevance 294 * @param applicability_rank relevance
303 */ 295 */
304void fs_search_update (SearchList * searchContext, 296void
305 const GNUNET_ECRS_FileInfo * info, 297fs_search_update (SearchList * searchContext,
306 int availability_rank, 298 const GNUNET_ECRS_FileInfo * info,
307 unsigned int availability_certainty, 299 int availability_rank,
308 unsigned int applicability_rank) 300 unsigned int availability_certainty,
301 unsigned int applicability_rank)
309{ 302{
310 GtkTreeStore *model; 303 GtkTreeStore *model;
311 GtkTreeIter iter; 304 GtkTreeIter iter;
@@ -314,7 +307,7 @@ void fs_search_update (SearchList * searchContext,
314 long long rank; 307 long long rank;
315 unsigned int kwords; 308 unsigned int kwords;
316 309
317 kwords = GNUNET_ECRS_uri_get_keyword_count_from_ksk(searchContext->uri); 310 kwords = GNUNET_ECRS_uri_get_keyword_count_from_ksk (searchContext->uri);
318 model = GTK_TREE_STORE (gtk_tree_view_get_model (searchContext->treeview)); 311 model = GTK_TREE_STORE (gtk_tree_view_get_model (searchContext->treeview));
319 /* find existing entry */ 312 /* find existing entry */
320 if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter)) 313 if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter))
@@ -324,31 +317,33 @@ void fs_search_update (SearchList * searchContext,
324 have = NULL; 317 have = NULL;
325 gtk_tree_model_get (GTK_TREE_MODEL (model), 318 gtk_tree_model_get (GTK_TREE_MODEL (model),
326 &iter, SEARCH_URI, &have, -1); 319 &iter, SEARCH_URI, &have, -1);
327 if ( (have != NULL) && 320 if ((have != NULL) &&
328 (GNUNET_ECRS_uri_test_equal (have, info->uri)) ) 321 (GNUNET_ECRS_uri_test_equal (have, info->uri)))
329 { 322 {
330 /* gotcha, create pixbuf and rank info! */ 323 /* gotcha, create pixbuf and rank info! */
331 rank = (int) applicability_rank + (int) (availability_rank * (int) availability_certainty * 65536); 324 rank =
332 pixbuf = make_ranking_pixbuf(availability_rank, 325 (int) applicability_rank +
333 availability_certainty, 326 (int) (availability_rank * (int) availability_certainty *
334 applicability_rank, 327 65536);
335 kwords); 328 pixbuf =
336 gtk_tree_store_set(searchContext->tree, 329 make_ranking_pixbuf (availability_rank,
337 &iter, 330 availability_certainty,
338 SEARCH_AVAILABILITY_RANK, availability_rank, 331 applicability_rank, kwords);
339 SEARCH_AVAILABILITY_CERTAINTY, availability_certainty, 332 gtk_tree_store_set (searchContext->tree, &iter,
340 SEARCH_APPLICABILITY_RANK, applicability_rank, 333 SEARCH_AVAILABILITY_RANK, availability_rank,
341 SEARCH_RANK_PIXBUF, pixbuf, 334 SEARCH_AVAILABILITY_CERTAINTY,
342 SEARCH_RANK_SORT, rank, 335 availability_certainty,
343 -1); 336 SEARCH_APPLICABILITY_RANK,
344 g_object_unref (pixbuf); 337 applicability_rank, SEARCH_RANK_PIXBUF,
345 return; /* done! */ 338 pixbuf, SEARCH_RANK_SORT, rank, -1);
346 } 339 g_object_unref (pixbuf);
340 return; /* done! */
341 }
347 } 342 }
348 while (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter)); 343 while (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter));
349 } 344 }
350 /* not found!? */ 345 /* not found!? */
351 GNUNET_GE_BREAK(NULL, 0); 346 GNUNET_GE_BREAK (NULL, 0);
352} 347}
353 348
354 349
@@ -361,10 +356,10 @@ on_search_display_metadata_activate (void *cls, GtkWidget * searchEntry)
361 GtkTreePath *path; 356 GtkTreePath *path;
362 GtkTreeIter iter; 357 GtkTreeIter iter;
363 struct GNUNET_ECRS_URI *uri; 358 struct GNUNET_ECRS_URI *uri;
364 struct GNUNET_ECRS_MetaData * meta; 359 struct GNUNET_ECRS_MetaData *meta;
365 char *str; 360 char *str;
366 GladeXML * xml; 361 GladeXML *xml;
367 GtkWidget * dialog; 362 GtkWidget *dialog;
368 363
369 path = NULL; 364 path = NULL;
370 if (FALSE == gtk_tree_view_get_path_at_pos (list->treeview, 365 if (FALSE == gtk_tree_view_get_path_at_pos (list->treeview,
@@ -386,21 +381,14 @@ on_search_display_metadata_activate (void *cls, GtkWidget * searchEntry)
386 uri = NULL; 381 uri = NULL;
387 meta = NULL; 382 meta = NULL;
388 gtk_tree_model_get (GTK_TREE_MODEL (list->tree), 383 gtk_tree_model_get (GTK_TREE_MODEL (list->tree),
389 &iter, 384 &iter, SEARCH_URI, &uri, SEARCH_META, &meta, -1);
390 SEARCH_URI, &uri,
391 SEARCH_META, &meta,
392 -1);
393 str = GNUNET_ECRS_uri_to_string (uri); 385 str = GNUNET_ECRS_uri_to_string (uri);
394 xml = glade_xml_new(GNUNET_GTK_get_glade_filename (), 386 xml = glade_xml_new (GNUNET_GTK_get_glade_filename (),
395 "metaDisplayDialog", 387 "metaDisplayDialog", PACKAGE_NAME);
396 PACKAGE_NAME);
397 GNUNET_GTK_connect_glade_with_plugins (xml); 388 GNUNET_GTK_connect_glade_with_plugins (xml);
398 dialog = glade_xml_get_widget (xml, "metaDisplayDialog"); 389 dialog = glade_xml_get_widget (xml, "metaDisplayDialog");
399 gtk_window_set_title(GTK_WINDOW(dialog), str); 390 gtk_window_set_title (GTK_WINDOW (dialog), str);
400 createMetaDataListTreeView(xml, 391 createMetaDataListTreeView (xml, "metaDisplayDialogTreeView", NULL, meta);
401 "metaDisplayDialogTreeView",
402 NULL,
403 meta);
404 gtk_dialog_run (GTK_DIALOG (dialog)); 392 gtk_dialog_run (GTK_DIALOG (dialog));
405 GNUNET_free_non_null (str); 393 GNUNET_free_non_null (str);
406 gtk_widget_destroy (dialog); 394 gtk_widget_destroy (dialog);
@@ -571,7 +559,8 @@ search_click_handler (void *cls, GdkEvent * event)
571 entry = gtk_menu_item_new_with_label (_("_Display metadata")); 559 entry = gtk_menu_item_new_with_label (_("_Display metadata"));
572 g_signal_connect_swapped (entry, 560 g_signal_connect_swapped (entry,
573 "activate", 561 "activate",
574 G_CALLBACK (on_search_display_metadata_activate), list); 562 G_CALLBACK (on_search_display_metadata_activate),
563 list);
575 gtk_label_set_use_underline (GTK_LABEL 564 gtk_label_set_use_underline (GTK_LABEL
576 (gtk_bin_get_child (GTK_BIN (entry))), TRUE); 565 (gtk_bin_get_child (GTK_BIN (entry))), TRUE);
577 gtk_widget_show (entry); 566 gtk_widget_show (entry);
@@ -626,7 +615,7 @@ fs_search_started (struct GNUNET_FSUI_SearchList * fsui_list,
626 int i; 615 int i;
627 616
628 /* check that search does not already exist 617 /* check that search does not already exist
629 with fsui_list == NULL; 618 with fsui_list == NULL;
630 (and if so, hijack!) */ 619 (and if so, hijack!) */
631 list = search_head; 620 list = search_head;
632 while (list != NULL) 621 while (list != NULL)
@@ -646,7 +635,7 @@ fs_search_started (struct GNUNET_FSUI_SearchList * fsui_list,
646 } 635 }
647 636
648 /* build new entry */ 637 /* build new entry */
649 if (GNUNET_ECRS_uri_test_ksk(uri)) 638 if (GNUNET_ECRS_uri_test_ksk (uri))
650 description = GNUNET_ECRS_ksk_uri_to_human_readable_string (uri); 639 description = GNUNET_ECRS_ksk_uri_to_human_readable_string (uri);
651 else 640 else
652 description = GNUNET_NS_sks_uri_to_human_readable_string (ectx, cfg, uri); 641 description = GNUNET_NS_sks_uri_to_human_readable_string (ectx, cfg, uri);
@@ -677,8 +666,7 @@ fs_search_started (struct GNUNET_FSUI_SearchList * fsui_list,
677 g_signal_connect_swapped (list->treeview, 666 g_signal_connect_swapped (list->treeview,
678 "button-press-event", 667 "button-press-event",
679 G_CALLBACK (search_click_handler), list); 668 G_CALLBACK (search_click_handler), list);
680 list->tree = gtk_tree_store_new (SEARCH_NUM, 669 list->tree = gtk_tree_store_new (SEARCH_NUM, G_TYPE_STRING, /* name */
681 G_TYPE_STRING, /* name */
682 G_TYPE_UINT64, /* size */ 670 G_TYPE_UINT64, /* size */
683 G_TYPE_STRING, /* human-readable size */ 671 G_TYPE_STRING, /* human-readable size */
684 G_TYPE_STRING, /* mime-type */ 672 G_TYPE_STRING, /* mime-type */
@@ -691,12 +679,12 @@ fs_search_started (struct GNUNET_FSUI_SearchList * fsui_list,
691 G_TYPE_POINTER, /* internal: search list */ 679 G_TYPE_POINTER, /* internal: search list */
692 G_TYPE_POINTER, /* internal: download parent list */ 680 G_TYPE_POINTER, /* internal: download parent list */
693 G_TYPE_STRING, /* status */ 681 G_TYPE_STRING, /* status */
694 G_TYPE_INT, /* availability rank */ 682 G_TYPE_INT, /* availability rank */
695 G_TYPE_UINT, /* availability certainty */ 683 G_TYPE_UINT, /* availability certainty */
696 G_TYPE_UINT, /* applicability rank */ 684 G_TYPE_UINT, /* applicability rank */
697 GDK_TYPE_PIXBUF, /* ranking visualization */ 685 GDK_TYPE_PIXBUF, /* ranking visualization */
698 G_TYPE_INT64 /* numeric sort */ 686 G_TYPE_INT64 /* numeric sort */
699 ); 687 );
700 688
701 gtk_tree_view_set_model (list->treeview, GTK_TREE_MODEL (list->tree)); 689 gtk_tree_view_set_model (list->treeview, GTK_TREE_MODEL (list->tree));
702 gtk_tree_selection_set_mode (gtk_tree_view_get_selection (list->treeview), 690 gtk_tree_selection_set_mode (gtk_tree_view_get_selection (list->treeview),
@@ -770,36 +758,39 @@ fs_search_started (struct GNUNET_FSUI_SearchList * fsui_list,
770 gtk_tree_view_column_set_reorderable (column, TRUE); 758 gtk_tree_view_column_set_reorderable (column, TRUE);
771 gtk_tree_view_column_set_sort_column_id (column, SEARCH_MIME); 759 gtk_tree_view_column_set_sort_column_id (column, SEARCH_MIME);
772 760
773#if 0 761#if 0
774 /* colums for data visualized graphically */ 762 /* colums for data visualized graphically */
775 renderer = gtk_cell_renderer_text_new (); 763 renderer = gtk_cell_renderer_text_new ();
776 gtk_tree_view_insert_column_with_attributes (list->treeview, 764 gtk_tree_view_insert_column_with_attributes (list->treeview,
777 -1, 765 -1,
778 _("Availability"), 766 _("Availability"),
779 renderer, 767 renderer,
780 "text", SEARCH_AVAILABILITY_RANK, 768 "text",
781 NULL); 769 SEARCH_AVAILABILITY_RANK,
770 NULL);
782 renderer = gtk_cell_renderer_text_new (); 771 renderer = gtk_cell_renderer_text_new ();
783 gtk_tree_view_insert_column_with_attributes (list->treeview, 772 gtk_tree_view_insert_column_with_attributes (list->treeview,
784 -1, 773 -1,
785 _("Certainty"), 774 _("Certainty"),
786 renderer, 775 renderer,
787 "text", SEARCH_AVAILABILITY_CERTAINTY, 776 "text",
788 NULL); 777 SEARCH_AVAILABILITY_CERTAINTY,
778 NULL);
789 renderer = gtk_cell_renderer_text_new (); 779 renderer = gtk_cell_renderer_text_new ();
790 gtk_tree_view_insert_column_with_attributes (list->treeview, 780 gtk_tree_view_insert_column_with_attributes (list->treeview,
791 -1, 781 -1,
792 _("Applicability"), 782 _("Applicability"),
793 renderer, 783 renderer,
794 "text", SEARCH_APPLICABILITY_RANK, 784 "text",
795 NULL); 785 SEARCH_APPLICABILITY_RANK,
786 NULL);
796 renderer = gtk_cell_renderer_text_new (); 787 renderer = gtk_cell_renderer_text_new ();
797 gtk_tree_view_insert_column_with_attributes (list->treeview, 788 gtk_tree_view_insert_column_with_attributes (list->treeview,
798 -1, 789 -1,
799 _("Sort"), 790 _("Sort"),
800 renderer, 791 renderer,
801 "text", SEARCH_RANK_SORT, 792 "text", SEARCH_RANK_SORT,
802 NULL); 793 NULL);
803#endif 794#endif
804 795
805 renderer = gtk_cell_renderer_pixbuf_new (); 796 renderer = gtk_cell_renderer_pixbuf_new ();
@@ -807,7 +798,8 @@ fs_search_started (struct GNUNET_FSUI_SearchList * fsui_list,
807 -1, 798 -1,
808 _("Ranking"), 799 _("Ranking"),
809 renderer, 800 renderer,
810 "pixbuf", SEARCH_RANK_PIXBUF, 801 "pixbuf",
802 SEARCH_RANK_PIXBUF,
811 NULL); 803 NULL);
812 column = gtk_tree_view_get_column (list->treeview, col - 1); 804 column = gtk_tree_view_get_column (list->treeview, col - 1);
813 gtk_tree_view_column_set_resizable (column, FALSE); 805 gtk_tree_view_column_set_resizable (column, FALSE);
@@ -913,10 +905,7 @@ freeIterSubtree (GtkTreeModel * tree, GtkTreeIter * iter)
913 if (meta != NULL) 905 if (meta != NULL)
914 GNUNET_ECRS_meta_data_destroy (meta); 906 GNUNET_ECRS_meta_data_destroy (meta);
915 gtk_tree_store_set (GTK_TREE_STORE (tree), 907 gtk_tree_store_set (GTK_TREE_STORE (tree),
916 iter, 908 iter, SEARCH_URI, NULL, SEARCH_META, NULL, -1);
917 SEARCH_URI, NULL,
918 SEARCH_META, NULL,
919 -1);
920 if (gtk_tree_model_iter_children (tree, &child, iter)) 909 if (gtk_tree_model_iter_children (tree, &child, iter))
921 freeIterSubtree (tree, &child); 910 freeIterSubtree (tree, &child);
922 } 911 }
@@ -1229,7 +1218,7 @@ on_closeSearchButton_clicked_fs (GtkWidget * searchPage,
1229 GNUNET_GE_ASSERT (ectx, list != NULL); 1218 GNUNET_GE_ASSERT (ectx, list != NULL);
1230 if (list->fsui_list == NULL) 1219 if (list->fsui_list == NULL)
1231 { 1220 {
1232 /* open directory or paused search; 1221 /* open directory or paused search;
1233 close directly */ 1222 close directly */
1234 fs_search_stopped (list); 1223 fs_search_stopped (list);
1235 } 1224 }
diff --git a/src/plugins/fs/search.h b/src/plugins/fs/search.h
index 546c7bfd..3c7d26e7 100644
--- a/src/plugins/fs/search.h
+++ b/src/plugins/fs/search.h
@@ -62,10 +62,10 @@ void fs_search_result_received (SearchList * searchContext,
62 * @param applicability_rank relevance 62 * @param applicability_rank relevance
63 */ 63 */
64void fs_search_update (SearchList * searchContext, 64void fs_search_update (SearchList * searchContext,
65 const GNUNET_ECRS_FileInfo * info, 65 const GNUNET_ECRS_FileInfo * info,
66 int availability_rank, 66 int availability_rank,
67 unsigned int availability_certainty, 67 unsigned int availability_certainty,
68 unsigned int applicability_rank); 68 unsigned int applicability_rank);
69 69
70/** 70/**
71 * A search has been started. Open tab. 71 * A search has been started. Open tab.