aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/fs/fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/fs/fs.c')
-rw-r--r--src/plugins/fs/fs.c1086
1 files changed, 521 insertions, 565 deletions
diff --git a/src/plugins/fs/fs.c b/src/plugins/fs/fs.c
index 6661cae5..aae21346 100644
--- a/src/plugins/fs/fs.c
+++ b/src/plugins/fs/fs.c
@@ -35,23 +35,23 @@
35#include "collection.h" 35#include "collection.h"
36#include "namespace.h" 36#include "namespace.h"
37 37
38struct FSUI_Context * ctx; 38struct FSUI_Context *ctx;
39 39
40struct GE_Context * ectx; 40struct GE_Context *ectx;
41 41
42struct GC_Configuration * cfg; 42struct GC_Configuration *cfg;
43 43
44SearchList * search_head; 44SearchList *search_head;
45 45
46DownloadList * download_head; 46DownloadList *download_head;
47 47
48UploadList * upload_head; 48UploadList *upload_head;
49 49
50GtkListStore * search_summary; 50GtkListStore *search_summary;
51 51
52GtkTreeStore * download_summary; 52GtkTreeStore *download_summary;
53 53
54GtkTreeStore * upload_summary; 54GtkTreeStore *upload_summary;
55 55
56/** 56/**
57 * Last right-click event coordinates in summary. 57 * Last right-click event coordinates in summary.
@@ -64,22 +64,24 @@ static unsigned int last_x;
64static unsigned int last_y; 64static unsigned int last_y;
65 65
66 66
67void on_updateIntervalComboEntry_changed_fs(GtkWidget * button, 67void
68 GtkWidget * entryBox) { 68on_updateIntervalComboEntry_changed_fs (GtkWidget * button,
69 const char * time; 69 GtkWidget * entryBox)
70{
71 const char *time;
70 TIME_T t; 72 TIME_T t;
71 GtkEntry * entry; 73 GtkEntry *entry;
72 74
73 entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(entryBox))); 75 entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (entryBox)));
74 time = gtk_entry_get_text(entry); 76 time = gtk_entry_get_text (entry);
75 if (OK != parseTimeInterval(time, 77 if (OK != parseTimeInterval (time, &t))
76 &t)) { 78 {
77 gtk_widget_set_sensitive(button, 79 gtk_widget_set_sensitive (button, FALSE);
78 FALSE); 80 }
79 } else { 81 else
80 gtk_widget_set_sensitive(button, 82 {
81 TRUE); 83 gtk_widget_set_sensitive (button, TRUE);
82 } 84 }
83} 85}
84 86
85 87
@@ -87,305 +89,295 @@ void on_updateIntervalComboEntry_changed_fs(GtkWidget * button,
87 * The selection of the download summary changed. 89 * The selection of the download summary changed.
88 * Update button status. 90 * Update button status.
89 */ 91 */
90void on_anonymity_spin_changed_fs(GtkWidget * w, 92void
91 gpointer dummy) { 93on_anonymity_spin_changed_fs (GtkWidget * w, gpointer dummy)
94{
92 gint val; 95 gint val;
93 GdkColor color; 96 GdkColor color;
94 GtkSpinButton * spin; 97 GtkSpinButton *spin;
95 98
96 spin = GTK_SPIN_BUTTON(w); 99 spin = GTK_SPIN_BUTTON (w);
97 if (spin == NULL) { 100 if (spin == NULL)
98 GE_BREAK(NULL, 0); 101 {
99 return; 102 GE_BREAK (NULL, 0);
100 } 103 return;
101 val = gtk_spin_button_get_value_as_int(spin); 104 }
102 if (val == 0) { 105 val = gtk_spin_button_get_value_as_int (spin);
103 if ( (TRUE == gdk_color_parse("red", 106 if (val == 0)
104 &color)) && 107 {
105 (TRUE == gdk_colormap_alloc_color(gdk_colormap_get_system(), 108 if ((TRUE == gdk_color_parse ("red",
106 &color, 109 &color)) &&
107 FALSE, 110 (TRUE == gdk_colormap_alloc_color (gdk_colormap_get_system (),
108 TRUE)) ) 111 &color, FALSE, TRUE)))
109 gtk_widget_modify_base(w, 112 gtk_widget_modify_base (w, GTK_STATE_NORMAL, &color);
110 GTK_STATE_NORMAL, 113 }
111 &color); 114 else
112 } else 115 gtk_widget_modify_base (w, GTK_STATE_NORMAL, NULL);
113 gtk_widget_modify_base(w,
114 GTK_STATE_NORMAL,
115 NULL);
116 116
117 117
118} 118}
119 119
120static void * 120static void *
121saveEventProcessor(void * cls) { 121saveEventProcessor (void *cls)
122 const FSUI_Event * event = cls; 122{
123 void * ret; 123 const FSUI_Event *event = cls;
124 void *ret;
124 125
125 ret = NULL; 126 ret = NULL;
126 switch (event->type) { 127 switch (event->type)
127 /* search events */ 128 {
128 case FSUI_search_started: 129 /* search events */
129 ret = fs_search_started(event->data.SearchStarted.sc.pos, 130 case FSUI_search_started:
130 event->data.SearchStarted.searchURI, 131 ret = fs_search_started (event->data.SearchStarted.sc.pos,
131 event->data.SearchStarted.anonymityLevel, 132 event->data.SearchStarted.searchURI,
132 0, 133 event->data.SearchStarted.anonymityLevel,
133 NULL, 134 0, NULL, FSUI_ACTIVE);
134 FSUI_ACTIVE); 135 break;
135 break; 136 case FSUI_search_result:
136 case FSUI_search_result: 137 fs_search_result_received (event->data.SearchResult.sc.cctx,
137 fs_search_result_received(event->data.SearchResult.sc.cctx, 138 &event->data.SearchResult.fi,
138 &event->data.SearchResult.fi, 139 event->data.SearchResult.searchURI);
139 event->data.SearchResult.searchURI); 140 break;
140 break; 141 case FSUI_search_error:
141 case FSUI_search_error: 142 fs_search_aborted (event->data.SearchError.sc.cctx);
142 fs_search_aborted(event->data.SearchError.sc.cctx); 143 break;
143 break; 144 case FSUI_search_aborted:
144 case FSUI_search_aborted: 145 fs_search_aborted (event->data.SearchAborted.sc.cctx);
145 fs_search_aborted(event->data.SearchAborted.sc.cctx); 146 break;
146 break; 147 case FSUI_search_completed:
147 case FSUI_search_completed: 148 // FIXME...
148 // FIXME... 149 fs_search_aborted (event->data.SearchCompleted.sc.cctx);
149 fs_search_aborted(event->data.SearchCompleted.sc.cctx); 150 break;
150 break; 151 case FSUI_search_suspended:
151 case FSUI_search_suspended: 152 fs_search_aborted (event->data.SearchSuspended.sc.cctx);
152 fs_search_aborted(event->data.SearchSuspended.sc.cctx); 153 break;
153 break; 154 case FSUI_search_resumed:
154 case FSUI_search_resumed: 155 ret = fs_search_started (event->data.SearchResumed.sc.pos,
155 ret = fs_search_started(event->data.SearchResumed.sc.pos, 156 event->data.SearchResumed.searchURI,
156 event->data.SearchResumed.searchURI, 157 event->data.SearchResumed.anonymityLevel,
157 event->data.SearchResumed.anonymityLevel, 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 break;
161 break; 162 case FSUI_search_stopped:
162 case FSUI_search_stopped: 163 fs_search_stopped (event->data.SearchStopped.sc.cctx);
163 fs_search_stopped(event->data.SearchStopped.sc.cctx); 164 break;
164 break; 165
165 166 /* download events */
166 /* download events */ 167 case FSUI_download_aborted:
167 case FSUI_download_aborted: 168 fs_download_aborted (event->data.DownloadAborted.dc.cctx);
168 fs_download_aborted(event->data.DownloadAborted.dc.cctx); 169 break;
169 break; 170 case FSUI_download_error:
170 case FSUI_download_error: 171 fs_download_aborted (event->data.DownloadError.dc.cctx);
171 fs_download_aborted(event->data.DownloadError.dc.cctx); 172 break;
172 break; 173 case FSUI_download_suspended:
173 case FSUI_download_suspended: 174 fs_download_stopped (event->data.DownloadSuspended.dc.cctx);
174 fs_download_stopped(event->data.DownloadSuspended.dc.cctx); 175 break;
175 break; 176 case FSUI_download_progress:
176 case FSUI_download_progress: 177 fs_download_update (event->data.DownloadProgress.dc.cctx,
177 fs_download_update(event->data.DownloadProgress.dc.cctx, 178 event->data.DownloadProgress.completed,
178 event->data.DownloadProgress.completed, 179 event->data.DownloadProgress.last_block,
179 event->data.DownloadProgress.last_block, 180 event->data.DownloadProgress.last_size);
180 event->data.DownloadProgress.last_size); 181 break;
181 break; 182 case FSUI_download_completed:
182 case FSUI_download_completed: 183 fs_download_completed (event->data.DownloadCompleted.dc.cctx);
183 fs_download_completed(event->data.DownloadCompleted.dc.cctx); 184 break;
184 break; 185 case FSUI_download_stopped:
185 case FSUI_download_stopped: 186 fs_download_stopped (event->data.DownloadStopped.dc.cctx);
186 fs_download_stopped(event->data.DownloadStopped.dc.cctx); 187 break;
187 break; 188 case FSUI_download_started:
188 case FSUI_download_started: 189 ret = fs_download_started (event->data.DownloadStarted.dc.pos,
189 ret = fs_download_started(event->data.DownloadStarted.dc.pos, 190 event->data.DownloadStarted.dc.pcctx,
190 event->data.DownloadStarted.dc.pcctx, 191 event->data.DownloadStarted.dc.sctx,
191 event->data.DownloadStarted.dc.sctx, 192 event->data.DownloadStarted.total,
192 event->data.DownloadStarted.total, 193 event->data.DownloadStarted.anonymityLevel,
193 event->data.DownloadStarted.anonymityLevel, 194 &event->data.DownloadStarted.fi,
194 &event->data.DownloadStarted.fi, 195 event->data.DownloadStarted.filename,
195 event->data.DownloadStarted.filename, 196 0, get_time (), FSUI_ACTIVE);
196 0, 197 break;
197 get_time(), 198 case FSUI_download_resumed:
198 FSUI_ACTIVE); 199 ret = fs_download_started (event->data.DownloadResumed.dc.pos,
199 break; 200 event->data.DownloadResumed.dc.pcctx,
200 case FSUI_download_resumed: 201 event->data.DownloadResumed.dc.sctx,
201 ret = fs_download_started(event->data.DownloadResumed.dc.pos, 202 event->data.DownloadResumed.total,
202 event->data.DownloadResumed.dc.pcctx, 203 event->data.DownloadResumed.anonymityLevel,
203 event->data.DownloadResumed.dc.sctx, 204 &event->data.DownloadResumed.fi,
204 event->data.DownloadResumed.total, 205 event->data.DownloadResumed.filename,
205 event->data.DownloadResumed.anonymityLevel, 206 event->data.DownloadResumed.completed,
206 &event->data.DownloadResumed.fi, 207 event->data.DownloadResumed.eta,
207 event->data.DownloadResumed.filename, 208 event->data.DownloadResumed.state);
208 event->data.DownloadResumed.completed, 209 break;
209 event->data.DownloadResumed.eta, 210
210 event->data.DownloadResumed.state); 211 /* upload events */
211 break; 212 case FSUI_upload_progress:
212 213 fs_upload_update (event->data.UploadProgress.uc.cctx,
213 /* upload events */ 214 event->data.UploadProgress.completed);
214 case FSUI_upload_progress: 215 break;
215 fs_upload_update(event->data.UploadProgress.uc.cctx, 216 case FSUI_upload_completed:
216 event->data.UploadProgress.completed); 217 fs_upload_complete (event->data.UploadCompleted.uc.cctx,
217 break; 218 event->data.UploadCompleted.uri);
218 case FSUI_upload_completed: 219 break;
219 fs_upload_complete(event->data.UploadCompleted.uc.cctx, 220 case FSUI_upload_error:
220 event->data.UploadCompleted.uri); 221 fs_upload_error (event->data.UploadError.uc.cctx);
221 break; 222 break;
222 case FSUI_upload_error: 223 case FSUI_upload_aborted:
223 fs_upload_error(event->data.UploadError.uc.cctx); 224 fs_upload_error (event->data.UploadAborted.uc.cctx);
224 break; 225 break;
225 case FSUI_upload_aborted: 226 case FSUI_upload_stopped:
226 fs_upload_error(event->data.UploadAborted.uc.cctx); 227 fs_upload_stopped (event->data.UploadStopped.uc.cctx);
227 break; 228 break;
228 case FSUI_upload_stopped: 229 case FSUI_upload_suspended:
229 fs_upload_stopped(event->data.UploadStopped.uc.cctx); 230 fs_upload_stopped (event->data.UploadSuspended.uc.cctx);
230 break; 231 break;
231 case FSUI_upload_suspended: 232 case FSUI_upload_started:
232 fs_upload_stopped(event->data.UploadSuspended.uc.cctx); 233 ret = fs_upload_started (event->data.UploadStarted.uc.pos,
233 break; 234 event->data.UploadStarted.uc.pcctx,
234 case FSUI_upload_started: 235 event->data.UploadStarted.filename,
235 ret = fs_upload_started(event->data.UploadStarted.uc.pos, 236 NULL,
236 event->data.UploadStarted.uc.pcctx, 237 event->data.UploadStarted.total,
237 event->data.UploadStarted.filename, 238 0, FSUI_ACTIVE);
238 NULL, 239 break;
239 event->data.UploadStarted.total, 240 case FSUI_upload_resumed:
240 0, 241 ret = fs_upload_started (event->data.UploadResumed.uc.pos,
241 FSUI_ACTIVE); 242 event->data.UploadResumed.uc.pcctx,
242 break; 243 event->data.UploadResumed.filename,
243 case FSUI_upload_resumed: 244 event->data.UploadResumed.uri,
244 ret = fs_upload_started(event->data.UploadResumed.uc.pos, 245 event->data.UploadResumed.total,
245 event->data.UploadResumed.uc.pcctx, 246 event->data.UploadResumed.completed,
246 event->data.UploadResumed.filename, 247 event->data.UploadResumed.state);
247 event->data.UploadResumed.uri, 248 break;
248 event->data.UploadResumed.total, 249 /* TODO: unindex events */
249 event->data.UploadResumed.completed, 250 default:
250 event->data.UploadResumed.state); 251 GE_BREAK (ectx, 0);
251 break; 252 GE_LOG (ectx,
252 /* TODO: unindex events */ 253 GE_ERROR,
253 default: 254 _("Unhandled (unknown) FSUI event: %u.\n"), event->type);
254 GE_BREAK(ectx, 0); 255 break;
255 GE_LOG(ectx, 256 }
256 GE_ERROR,
257 _("Unhandled (unknown) FSUI event: %u.\n"),
258 event->type);
259 break;
260 }
261 return ret; 257 return ret;
262} 258}
263 259
264static void * 260static void *
265eventProcessor(void * unused, 261eventProcessor (void *unused, const FSUI_Event * event)
266 const FSUI_Event * event) { 262{
267 return gtkSaveCall(&saveEventProcessor, 263 return gtkSaveCall (&saveEventProcessor, (void *) event);
268 (void*) event);
269} 264}
270 265
271/** 266/**
272 * The selection of the upload summary changed. 267 * The selection of the upload summary changed.
273 * Update button status. 268 * Update button status.
274 */ 269 */
275static void on_upload_summary_selection_changed(gpointer signal, 270static void
276 gpointer cls) { 271on_upload_summary_selection_changed (gpointer signal, gpointer cls)
277 GtkTreeSelection * selection; 272{
278 GtkWidget * button; 273 GtkTreeSelection *selection;
279 274 GtkWidget *button;
280 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(glade_xml_get_widget(getMainXML(), 275
281 "activeUploadsList"))); 276 selection =
282 button 277 gtk_tree_view_get_selection (GTK_TREE_VIEW
283 = glade_xml_get_widget(getMainXML(), 278 (glade_xml_get_widget
284 "cancelUploadButton"); 279 (getMainXML (), "activeUploadsList")));
285 gtk_widget_set_sensitive(button, 280 button = glade_xml_get_widget (getMainXML (), "cancelUploadButton");
286 gtk_tree_selection_count_selected_rows(selection) > 0); 281 gtk_widget_set_sensitive (button,
287 button 282 gtk_tree_selection_count_selected_rows (selection)
288 = glade_xml_get_widget(getMainXML(), 283 > 0);
289 "stopUploadButton"); 284 button = glade_xml_get_widget (getMainXML (), "stopUploadButton");
290 gtk_widget_set_sensitive(button, 285 gtk_widget_set_sensitive (button,
291 gtk_tree_selection_count_selected_rows(selection) > 0); 286 gtk_tree_selection_count_selected_rows (selection)
287 > 0);
292} 288}
293 289
294/** 290/**
295 * The selection of the download summary changed. 291 * The selection of the download summary changed.
296 * Update button status. 292 * Update button status.
297 */ 293 */
298static void on_download_summary_selection_changed(gpointer signal, 294static void
299 gpointer cls) { 295on_download_summary_selection_changed (gpointer signal, gpointer cls)
300 GtkTreeSelection * selection; 296{
301 GtkWidget * button; 297 GtkTreeSelection *selection;
302 298 GtkWidget *button;
303 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(glade_xml_get_widget(getMainXML(), 299
304 "activeDownloadsList"))); 300 selection =
305 button 301 gtk_tree_view_get_selection (GTK_TREE_VIEW
306 = glade_xml_get_widget(getMainXML(), 302 (glade_xml_get_widget
307 "abortDownloadButton"); 303 (getMainXML (), "activeDownloadsList")));
308 gtk_widget_set_sensitive(button, 304 button = glade_xml_get_widget (getMainXML (), "abortDownloadButton");
309 gtk_tree_selection_count_selected_rows(selection) > 0); 305 gtk_widget_set_sensitive (button,
310 button 306 gtk_tree_selection_count_selected_rows (selection)
311 = glade_xml_get_widget(getMainXML(), 307 > 0);
312 "stopDownloadButton"); 308 button = glade_xml_get_widget (getMainXML (), "stopDownloadButton");
313 gtk_widget_set_sensitive(button, 309 gtk_widget_set_sensitive (button,
314 gtk_tree_selection_count_selected_rows(selection) > 0); 310 gtk_tree_selection_count_selected_rows (selection)
311 > 0);
315} 312}
316 313
317/** 314/**
318 * The selection of the download summary changed. 315 * The selection of the download summary changed.
319 * Update button status. 316 * Update button status.
320 */ 317 */
321static void on_search_summary_selection_changed(gpointer signal, 318static void
322 gpointer cls) { 319on_search_summary_selection_changed (gpointer signal, gpointer cls)
323 GtkTreeSelection * selection; 320{
324 GtkWidget * button; 321 GtkTreeSelection *selection;
325 322 GtkWidget *button;
326 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(glade_xml_get_widget(getMainXML(), 323
327 "activeSearchesSummary"))); 324 selection =
328 button 325 gtk_tree_view_get_selection (GTK_TREE_VIEW
329 = glade_xml_get_widget(getMainXML(), 326 (glade_xml_get_widget
330 "cancelSearchButton"); 327 (getMainXML (), "activeSearchesSummary")));
331 gtk_widget_set_sensitive(button, 328 button = glade_xml_get_widget (getMainXML (), "cancelSearchButton");
332 gtk_tree_selection_count_selected_rows(selection) > 0); 329 gtk_widget_set_sensitive (button,
333 button 330 gtk_tree_selection_count_selected_rows (selection)
334 = glade_xml_get_widget(getMainXML(), 331 > 0);
335 "stopSearchButton"); 332 button = glade_xml_get_widget (getMainXML (), "stopSearchButton");
336 gtk_widget_set_sensitive(button, 333 gtk_widget_set_sensitive (button,
337 gtk_tree_selection_count_selected_rows(selection) > 0); 334 gtk_tree_selection_count_selected_rows (selection)
335 > 0);
338} 336}
339 337
340static int 338static int
341on_upload_copy_uri_activate(void * cls, 339on_upload_copy_uri_activate (void *cls, GtkWidget * searchEntry)
342 GtkWidget * searchEntry) { 340{
343 GtkTreeView * uploadList = cls; 341 GtkTreeView *uploadList = cls;
344 GtkTreePath *path; 342 GtkTreePath *path;
345 GtkTreeIter iter; 343 GtkTreeIter iter;
346 struct ECRS_URI * uri; 344 struct ECRS_URI *uri;
347 char * str; 345 char *str;
348 GtkClipboard * clip; 346 GtkClipboard *clip;
349 347
350 path = NULL; 348 path = NULL;
351 if (FALSE == gtk_tree_view_get_path_at_pos(uploadList, 349 if (FALSE == gtk_tree_view_get_path_at_pos (uploadList,
352 last_x, 350 last_x,
353 last_y, 351 last_y,
354 &path, 352 &path, NULL, NULL, NULL))
355 NULL, 353 {
356 NULL, 354 GE_BREAK (NULL, 0);
357 NULL)) { 355 return FALSE;
358 GE_BREAK(NULL, 0); 356 }
359 return FALSE; 357 if (FALSE == gtk_tree_model_get_iter (GTK_TREE_MODEL (upload_summary),
360 } 358 &iter, path))
361 if (FALSE == gtk_tree_model_get_iter(GTK_TREE_MODEL(upload_summary), 359 {
362 &iter, 360 GE_BREAK (NULL, 0);
363 path)) { 361 gtk_tree_path_free (path);
364 GE_BREAK(NULL, 0); 362 return FALSE;
365 gtk_tree_path_free(path); 363 }
366 return FALSE; 364 gtk_tree_path_free (path);
367 }
368 gtk_tree_path_free(path);
369 uri = NULL; 365 uri = NULL;
370 gtk_tree_model_get(GTK_TREE_MODEL(upload_summary), 366 gtk_tree_model_get (GTK_TREE_MODEL (upload_summary),
371 &iter, 367 &iter, UPLOAD_URISTRING, &str, -1);
372 UPLOAD_URISTRING, &str, 368 clip = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
373 -1); 369 gtk_clipboard_set_text (clip, str, strlen (str));
374 clip = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); 370 FREE (str);
375 gtk_clipboard_set_text(clip,
376 str,
377 strlen(str));
378 FREE(str);
379 return FALSE; 371 return FALSE;
380} 372}
381 373
382static gint 374static gint
383upload_click_handler(void * cls, 375upload_click_handler (void *cls, GdkEvent * event)
384 GdkEvent *event) { 376{
385 GtkTreeView * uploadList = cls; 377 GtkTreeView *uploadList = cls;
386 GtkMenu * menu; 378 GtkMenu *menu;
387 GtkWidget * entry; 379 GtkWidget *entry;
388 GdkEventButton * event_button; 380 GdkEventButton *event_button;
389 381
390 g_return_val_if_fail (event != NULL, FALSE); 382 g_return_val_if_fail (event != NULL, FALSE);
391 if (event->type != GDK_BUTTON_PRESS) 383 if (event->type != GDK_BUTTON_PRESS)
@@ -395,24 +387,19 @@ upload_click_handler(void * cls,
395 return FALSE; 387 return FALSE;
396 last_x = event_button->x; 388 last_x = event_button->x;
397 last_y = event_button->y; 389 last_y = event_button->y;
398 entry = gtk_menu_item_new_with_label(_("_Copy URI to Clipboard")); 390 entry = gtk_menu_item_new_with_label (_("_Copy URI to Clipboard"));
399 g_signal_connect_swapped (entry, 391 g_signal_connect_swapped (entry,
400 "activate", 392 "activate",
401 G_CALLBACK(on_upload_copy_uri_activate), 393 G_CALLBACK (on_upload_copy_uri_activate),
402 uploadList); 394 uploadList);
403 gtk_label_set_use_underline(GTK_LABEL(gtk_bin_get_child(GTK_BIN(entry))), 395 gtk_label_set_use_underline (GTK_LABEL
404 TRUE); 396 (gtk_bin_get_child (GTK_BIN (entry))), TRUE);
405 gtk_widget_show(entry); 397 gtk_widget_show (entry);
406 menu = GTK_MENU(gtk_menu_new()); 398 menu = GTK_MENU (gtk_menu_new ());
407 gtk_menu_shell_append(GTK_MENU_SHELL(menu), 399 gtk_menu_shell_append (GTK_MENU_SHELL (menu), entry);
408 entry);
409 gtk_menu_popup (menu, 400 gtk_menu_popup (menu,
410 NULL, 401 NULL,
411 NULL, 402 NULL, NULL, NULL, event_button->button, event_button->time);
412 NULL,
413 NULL,
414 event_button->button,
415 event_button->time);
416 return TRUE; 403 return TRUE;
417} 404}
418 405
@@ -420,328 +407,297 @@ upload_click_handler(void * cls,
420 * Setup the summary views (in particular the models 407 * Setup the summary views (in particular the models
421 * and the renderers). 408 * and the renderers).
422 */ 409 */
423static void fs_summary_start() { 410static void
424 GtkComboBoxEntry * searchCB; 411fs_summary_start ()
425 GtkWidget * uploadEntry; 412{
426 GtkTreeView * searchList; 413 GtkComboBoxEntry *searchCB;
427 GtkTreeView * downloadList; 414 GtkWidget *uploadEntry;
428 GtkTreeView * uploadList; 415 GtkTreeView *searchList;
429 GtkListStore * model; 416 GtkTreeView *downloadList;
430 GtkCellRenderer * renderer; 417 GtkTreeView *uploadList;
431 GtkTreeViewColumn * column; 418 GtkListStore *model;
419 GtkCellRenderer *renderer;
420 GtkTreeViewColumn *column;
432 int col; 421 int col;
433 422
434 /* keyword list setup */ 423 /* keyword list setup */
435 searchCB 424 searchCB
436 = GTK_COMBO_BOX_ENTRY(glade_xml_get_widget(getMainXML(), 425 = GTK_COMBO_BOX_ENTRY (glade_xml_get_widget (getMainXML (),
437 "fssearchKeywordComboBoxEntry")); 426 "fssearchKeywordComboBoxEntry"));
438 model = gtk_list_store_new(1, 427 model = gtk_list_store_new (1, G_TYPE_STRING /* search string */ );
439 G_TYPE_STRING /* search string*/ ); 428 gtk_combo_box_set_model (GTK_COMBO_BOX (searchCB), GTK_TREE_MODEL (model));
440 gtk_combo_box_set_model(GTK_COMBO_BOX(searchCB), 429 gtk_combo_box_entry_set_text_column (searchCB, 0);
441 GTK_TREE_MODEL(model));
442 gtk_combo_box_entry_set_text_column(searchCB,
443 0);
444 430
445 /* search namespace selection setup */ 431 /* search namespace selection setup */
446 searchCB 432 searchCB
447 = GTK_COMBO_BOX_ENTRY(glade_xml_get_widget(getMainXML(), 433 = GTK_COMBO_BOX_ENTRY (glade_xml_get_widget (getMainXML (),
448 "searchNamespaceComboBoxEntry")); 434 "searchNamespaceComboBoxEntry"));
449 435
450 model = gtk_list_store_new(NS_SEARCH_NUM, 436 model = gtk_list_store_new (NS_SEARCH_NUM, G_TYPE_STRING, /* what we show */
451 G_TYPE_STRING, /* what we show */ 437 G_TYPE_STRING, /* EncName of namespace */
452 G_TYPE_STRING, /* EncName of namespace */ 438 G_TYPE_POINTER, /* ECRS MetaData */
453 G_TYPE_POINTER, /* ECRS MetaData */ 439 G_TYPE_INT); /* Meta-data about namespace */
454 G_TYPE_INT); /* Meta-data about namespace */ 440 gtk_combo_box_set_model (GTK_COMBO_BOX (searchCB), GTK_TREE_MODEL (model));
455 gtk_combo_box_set_model(GTK_COMBO_BOX(searchCB), 441 gtk_combo_box_entry_set_text_column (searchCB, NS_SEARCH_DESCRIPTION);
456 GTK_TREE_MODEL(model));
457 gtk_combo_box_entry_set_text_column(searchCB,
458 NS_SEARCH_DESCRIPTION);
459 442
460 /* search summary setup */ 443 /* search summary setup */
461 searchList = GTK_TREE_VIEW(glade_xml_get_widget(getMainXML(), 444 searchList = GTK_TREE_VIEW (glade_xml_get_widget (getMainXML (),
462 "activeSearchesSummary")); 445 "activeSearchesSummary"));
463 search_summary = 446 search_summary = gtk_list_store_new (SEARCH_SUMMARY_NUM, G_TYPE_STRING, /* name */
464 gtk_list_store_new(SEARCH_SUMMARY_NUM, 447 G_TYPE_INT, /* # results */
465 G_TYPE_STRING, /* name */ 448 G_TYPE_POINTER); /* internal: search list */
466 G_TYPE_INT, /* # results */ 449 gtk_tree_view_set_model (searchList, GTK_TREE_MODEL (search_summary));
467 G_TYPE_POINTER); /* internal: search list */ 450 gtk_tree_selection_set_mode (gtk_tree_view_get_selection (searchList),
468 gtk_tree_view_set_model(searchList, 451 GTK_SELECTION_MULTIPLE);
469 GTK_TREE_MODEL(search_summary)); 452 g_signal_connect_data (gtk_tree_view_get_selection (searchList),
470 gtk_tree_selection_set_mode(gtk_tree_view_get_selection(searchList), 453 "changed",
471 GTK_SELECTION_MULTIPLE); 454 G_CALLBACK (&on_search_summary_selection_changed),
472 g_signal_connect_data(gtk_tree_view_get_selection(searchList), 455 NULL, NULL, 0);
473 "changed", 456
474 G_CALLBACK(&on_search_summary_selection_changed), 457 renderer = gtk_cell_renderer_text_new ();
475 NULL, 458 col = gtk_tree_view_insert_column_with_attributes (searchList,
476 NULL, 459 -1,
477 0); 460 _("Query"),
478 461 renderer,
479 renderer = gtk_cell_renderer_text_new(); 462 "text",
480 col = gtk_tree_view_insert_column_with_attributes(searchList, 463 SEARCH_SUMMARY_NAME,
481 -1, 464 NULL);
482 _("Query"), 465 column = gtk_tree_view_get_column (searchList, col - 1);
483 renderer, 466 gtk_tree_view_column_set_resizable (column, TRUE);
484 "text", SEARCH_SUMMARY_NAME, 467 gtk_tree_view_column_set_clickable (column, TRUE);
485 NULL); 468 gtk_tree_view_column_set_reorderable (column, TRUE);
486 column = gtk_tree_view_get_column(searchList, 469 gtk_tree_view_column_set_sort_column_id (column, SEARCH_SUMMARY_NAME);
487 col - 1); 470 gtk_tree_view_column_set_resizable (column, TRUE);
488 gtk_tree_view_column_set_resizable(column, TRUE); 471 renderer = gtk_cell_renderer_text_new ();
489 gtk_tree_view_column_set_clickable(column, TRUE); 472 col = gtk_tree_view_insert_column_with_attributes (searchList,
490 gtk_tree_view_column_set_reorderable(column, TRUE); 473 -1,
491 gtk_tree_view_column_set_sort_column_id(column, SEARCH_SUMMARY_NAME); 474 _("Results"),
492 gtk_tree_view_column_set_resizable(column, TRUE); 475 renderer,
493 renderer = gtk_cell_renderer_text_new(); 476 "text",
494 col = gtk_tree_view_insert_column_with_attributes(searchList, 477 SEARCH_SUMMARY_RESULT_COUNT,
495 -1, 478 NULL);
496 _("Results"), 479 column = gtk_tree_view_get_column (searchList, col - 1);
497 renderer, 480 gtk_tree_view_column_set_resizable (column, TRUE);
498 "text", SEARCH_SUMMARY_RESULT_COUNT, 481 gtk_tree_view_column_set_clickable (column, TRUE);
499 NULL); 482 gtk_tree_view_column_set_reorderable (column, TRUE);
500 column = gtk_tree_view_get_column(searchList, 483 gtk_tree_view_column_set_sort_column_id (column,
501 col - 1); 484 SEARCH_SUMMARY_RESULT_COUNT);
502 gtk_tree_view_column_set_resizable(column, TRUE); 485 gtk_tree_view_column_set_resizable (column, TRUE);
503 gtk_tree_view_column_set_clickable(column, TRUE);
504 gtk_tree_view_column_set_reorderable(column, TRUE);
505 gtk_tree_view_column_set_sort_column_id(column, SEARCH_SUMMARY_RESULT_COUNT);
506 gtk_tree_view_column_set_resizable(column, TRUE);
507 486
508 /* download summary setup */ 487 /* download summary setup */
509 downloadList = GTK_TREE_VIEW(glade_xml_get_widget(getMainXML(), 488 downloadList = GTK_TREE_VIEW (glade_xml_get_widget (getMainXML (),
510 "activeDownloadsList")); 489 "activeDownloadsList"));
511 download_summary = 490 download_summary = gtk_tree_store_new (DOWNLOAD_NUM, G_TYPE_STRING, /* name (full-path file name) */
512 gtk_tree_store_new(DOWNLOAD_NUM, 491 G_TYPE_STRING, /* name (user-friendly name) */
513 G_TYPE_STRING, /* name (full-path file name) */ 492 G_TYPE_UINT64, /* size */
514 G_TYPE_STRING, /* name (user-friendly name) */ 493 G_TYPE_STRING, /* human readable size */
515 G_TYPE_UINT64, /* size */ 494 G_TYPE_INT, /* progress */
516 G_TYPE_STRING, /* human readable size */ 495 G_TYPE_STRING, /* uri as string */
517 G_TYPE_INT, /* progress */ 496 G_TYPE_POINTER); /* internal download list ptr */
518 G_TYPE_STRING, /* uri as string */ 497 gtk_tree_view_set_model (downloadList, GTK_TREE_MODEL (download_summary));
519 G_TYPE_POINTER); /* internal download list ptr */ 498 gtk_tree_selection_set_mode (gtk_tree_view_get_selection (downloadList),
520 gtk_tree_view_set_model(downloadList, 499 GTK_SELECTION_MULTIPLE);
521 GTK_TREE_MODEL(download_summary)); 500 g_signal_connect_data (gtk_tree_view_get_selection (downloadList),
522 gtk_tree_selection_set_mode(gtk_tree_view_get_selection(downloadList), 501 "changed",
523 GTK_SELECTION_MULTIPLE); 502 G_CALLBACK (&on_download_summary_selection_changed),
524 g_signal_connect_data(gtk_tree_view_get_selection(downloadList), 503 NULL, NULL, 0);
525 "changed", 504
526 G_CALLBACK(&on_download_summary_selection_changed), 505 renderer = gtk_cell_renderer_text_new ();
527 NULL,
528 NULL,
529 0);
530
531 renderer = gtk_cell_renderer_text_new();
532 g_object_set (renderer, "xalign", 1.00, NULL); 506 g_object_set (renderer, "xalign", 1.00, NULL);
533 col = gtk_tree_view_insert_column_with_attributes(downloadList, 507 col = gtk_tree_view_insert_column_with_attributes (downloadList,
534 -1, 508 -1,
535 _("Size"), 509 _("Size"),
536 renderer, 510 renderer,
537 "text", DOWNLOAD_HSIZE, 511 "text", DOWNLOAD_HSIZE,
538 NULL); 512 NULL);
539 513
540 column = gtk_tree_view_get_column(downloadList, 514 column = gtk_tree_view_get_column (downloadList, col - 1);
541 col - 1); 515 gtk_tree_view_column_set_resizable (column, TRUE);
542 gtk_tree_view_column_set_resizable(column, TRUE); 516 gtk_tree_view_column_set_clickable (column, TRUE);
543 gtk_tree_view_column_set_clickable(column, TRUE); 517 gtk_tree_view_column_set_reorderable (column, TRUE);
544 gtk_tree_view_column_set_reorderable(column, TRUE); 518 gtk_tree_view_column_set_sort_column_id (column, DOWNLOAD_SIZE);
545 gtk_tree_view_column_set_sort_column_id(column, DOWNLOAD_SIZE); 519 gtk_tree_view_column_set_resizable (column, TRUE);
546 gtk_tree_view_column_set_resizable(column, TRUE); 520
547 521 renderer = gtk_cell_renderer_progress_new ();
548 renderer = gtk_cell_renderer_progress_new(); 522 col = gtk_tree_view_insert_column_with_attributes (downloadList,
549 col = gtk_tree_view_insert_column_with_attributes(downloadList, 523 -1,
550 -1, 524 _("Name"),
551 _("Name"), 525 renderer,
552 renderer, 526 "value",
553 "value", DOWNLOAD_PROGRESS, 527 DOWNLOAD_PROGRESS,
554 "text", DOWNLOAD_SHORTNAME, 528 "text",
555 NULL); 529 DOWNLOAD_SHORTNAME,
556 g_object_set(G_OBJECT(renderer), 530 NULL);
557 "width", 400, 531 g_object_set (G_OBJECT (renderer), "width", 400, NULL);
558 NULL); 532 column = gtk_tree_view_get_column (downloadList, col - 1);
559 column = gtk_tree_view_get_column(downloadList, 533 gtk_tree_view_column_set_resizable (column, TRUE);
560 col - 1); 534 gtk_tree_view_column_set_clickable (column, TRUE);
561 gtk_tree_view_column_set_resizable(column, TRUE); 535 gtk_tree_view_column_set_reorderable (column, TRUE);
562 gtk_tree_view_column_set_clickable(column, TRUE); 536 gtk_tree_view_column_set_sort_column_id (column, DOWNLOAD_PROGRESS);
563 gtk_tree_view_column_set_reorderable(column, TRUE); 537 gtk_tree_view_column_set_resizable (column, TRUE);
564 gtk_tree_view_column_set_sort_column_id(column, DOWNLOAD_PROGRESS); 538
565 gtk_tree_view_column_set_resizable(column, TRUE); 539 renderer = gtk_cell_renderer_text_new ();
566 540 col = gtk_tree_view_insert_column_with_attributes (downloadList,
567 renderer = gtk_cell_renderer_text_new(); 541 -1,
568 col = gtk_tree_view_insert_column_with_attributes(downloadList, 542 _("URI"),
569 -1, 543 renderer,
570 _("URI"), 544 "text",
571 renderer, 545 DOWNLOAD_URISTRING,
572 "text", DOWNLOAD_URISTRING, 546 NULL);
573 NULL); 547 g_object_set (G_OBJECT (renderer), "wrap-width", 30, "width-chars", 30,
574 g_object_set(G_OBJECT(renderer), 548 "ellipsize", PANGO_ELLIPSIZE_END, NULL);
575 "wrap-width", 30, 549 column = gtk_tree_view_get_column (downloadList, col - 1);
576 "width-chars", 30, 550 gtk_tree_view_column_set_resizable (column, TRUE);
577 "ellipsize", PANGO_ELLIPSIZE_END, 551 gtk_tree_view_column_set_reorderable (column, TRUE);
578 NULL); 552 gtk_tree_view_column_set_resizable (column, TRUE);
579 column = gtk_tree_view_get_column(downloadList,
580 col - 1);
581 gtk_tree_view_column_set_resizable(column, TRUE);
582 gtk_tree_view_column_set_reorderable(column, TRUE);
583 gtk_tree_view_column_set_resizable(column, TRUE);
584 553
585 /* upload summary setup */ 554 /* upload summary setup */
586 uploadList = GTK_TREE_VIEW(glade_xml_get_widget(getMainXML(), 555 uploadList = GTK_TREE_VIEW (glade_xml_get_widget (getMainXML (),
587 "activeUploadsList")); 556 "activeUploadsList"));
588 g_signal_connect_swapped (uploadList, 557 g_signal_connect_swapped (uploadList,
589 "button-press-event", 558 "button-press-event",
590 G_CALLBACK(upload_click_handler), 559 G_CALLBACK (upload_click_handler), uploadList);
591 uploadList); 560 upload_summary = gtk_tree_store_new (UPLOAD_NUM, G_TYPE_STRING, /* filename */
592 upload_summary = 561 G_TYPE_INT, /* progress */
593 gtk_tree_store_new(UPLOAD_NUM, 562 G_TYPE_STRING, /* URI as string */
594 G_TYPE_STRING, /* filename */ 563 G_TYPE_POINTER); /* UploadList */
595 G_TYPE_INT, /* progress */ 564 gtk_tree_view_set_model (uploadList, GTK_TREE_MODEL (upload_summary));
596 G_TYPE_STRING, /* URI as string */ 565 gtk_tree_selection_set_mode (gtk_tree_view_get_selection (uploadList),
597 G_TYPE_POINTER); /* UploadList */ 566 GTK_SELECTION_MULTIPLE);
598 gtk_tree_view_set_model(uploadList, 567 g_signal_connect_data (gtk_tree_view_get_selection (uploadList),
599 GTK_TREE_MODEL(upload_summary)); 568 "changed",
600 gtk_tree_selection_set_mode(gtk_tree_view_get_selection(uploadList), 569 G_CALLBACK (&on_upload_summary_selection_changed),
601 GTK_SELECTION_MULTIPLE); 570 NULL, NULL, 0);
602 g_signal_connect_data(gtk_tree_view_get_selection(uploadList), 571
603 "changed", 572 renderer = gtk_cell_renderer_progress_new ();
604 G_CALLBACK(&on_upload_summary_selection_changed), 573 col = gtk_tree_view_insert_column_with_attributes (uploadList,
605 NULL, 574 -1,
606 NULL, 575 _("Filename"),
607 0); 576 renderer,
608 577 "text", UPLOAD_FILENAME,
609 renderer = gtk_cell_renderer_progress_new(); 578 "value", UPLOAD_PROGRESS,
610 col = gtk_tree_view_insert_column_with_attributes(uploadList, 579 NULL);
611 -1, 580 gtk_tree_view_column_set_resizable (gtk_tree_view_get_column (uploadList,
612 _("Filename"), 581 col - 1),
613 renderer, 582 TRUE);
614 "text", UPLOAD_FILENAME, 583
615 "value", UPLOAD_PROGRESS, 584 renderer = gtk_cell_renderer_text_new ();
616 NULL); 585 col = gtk_tree_view_insert_column_with_attributes (uploadList,
617 gtk_tree_view_column_set_resizable(gtk_tree_view_get_column(uploadList, 586 -1,
618 col - 1), 587 _("URI"),
619 TRUE); 588 renderer,
620 589 "text", UPLOAD_URISTRING,
621 renderer = gtk_cell_renderer_text_new(); 590 NULL);
622 col = gtk_tree_view_insert_column_with_attributes(uploadList, 591 gtk_tree_view_column_set_resizable (gtk_tree_view_get_column (uploadList,
623 -1, 592 col - 1),
624 _("URI"), 593 TRUE);
625 renderer,
626 "text", UPLOAD_URISTRING,
627 NULL);
628 gtk_tree_view_column_set_resizable(gtk_tree_view_get_column(uploadList,
629 col - 1),
630 TRUE);
631 /* upload entry setup */ 594 /* upload entry setup */
632 uploadEntry 595 uploadEntry
633 = glade_xml_get_widget(getMainXML(), 596 = glade_xml_get_widget (getMainXML (), "uploadFilenameComboBoxEntry");
634 "uploadFilenameComboBoxEntry"); 597
635 598 model = gtk_list_store_new (1, G_TYPE_STRING);
636 model = gtk_list_store_new(1, G_TYPE_STRING); 599 gtk_combo_box_set_model (GTK_COMBO_BOX (uploadEntry),
637 gtk_combo_box_set_model(GTK_COMBO_BOX(uploadEntry), 600 GTK_TREE_MODEL (model));
638 GTK_TREE_MODEL(model)); 601 gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (uploadEntry), 0);
639 gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(uploadEntry),
640 0);
641} 602}
642 603
643/** 604/**
644 * Shutdown the summary dialogs. 605 * Shutdown the summary dialogs.
645 */ 606 */
646static void fs_summary_stop() { 607static void
647 struct ECRS_MetaData * meta; 608fs_summary_stop ()
648 GtkComboBox * searchCB; 609{
649 GtkTreeModel * model; 610 struct ECRS_MetaData *meta;
611 GtkComboBox *searchCB;
612 GtkTreeModel *model;
650 GtkTreeIter iter; 613 GtkTreeIter iter;
651 614
652 searchCB 615 searchCB
653 = GTK_COMBO_BOX(glade_xml_get_widget(getMainXML(), 616 = GTK_COMBO_BOX (glade_xml_get_widget (getMainXML (),
654 "searchNamespaceComboBoxEntry")); 617 "searchNamespaceComboBoxEntry"));
655 model = gtk_combo_box_get_model(searchCB); 618 model = gtk_combo_box_get_model (searchCB);
656 if (gtk_tree_model_get_iter_first(model, 619 if (gtk_tree_model_get_iter_first (model, &iter))
657 &iter)) { 620 {
658 do { 621 do
659 gtk_tree_model_get(model, 622 {
660 &iter, 623 gtk_tree_model_get (model, &iter, NS_SEARCH_METADATA, &meta, -1);
661 NS_SEARCH_METADATA, &meta, 624 gtk_list_store_set (GTK_LIST_STORE (model),
662 -1); 625 &iter, NS_SEARCH_METADATA, NULL, -1);
663 gtk_list_store_set(GTK_LIST_STORE(model), 626 if (meta != NULL)
664 &iter, 627 ECRS_freeMetaData (meta);
665 NS_SEARCH_METADATA, NULL, 628 }
666 -1); 629 while (gtk_list_store_remove (GTK_LIST_STORE (model), &iter));
667 if (meta != NULL) 630 }
668 ECRS_freeMetaData(meta);
669 } while (gtk_list_store_remove(GTK_LIST_STORE(model),
670 &iter));
671 }
672 631
673} 632}
674 633
675void init_fs(struct GE_Context * e, 634void
676 struct GC_Configuration * c) { 635init_fs (struct GE_Context *e, struct GC_Configuration *c)
677 GtkWidget * tab; 636{
678 GtkWidget * book; 637 GtkWidget *tab;
638 GtkWidget *book;
679 gint num; 639 gint num;
680 640
681 ectx = e; 641 ectx = e;
682 cfg = c; 642 cfg = c;
683 CO_init(ectx, cfg); 643 CO_init (ectx, cfg);
684 tab 644 tab = glade_xml_get_widget (getMainXML (), "fsnotebook");
685 = glade_xml_get_widget(getMainXML(), 645 gtk_widget_show (tab);
686 "fsnotebook"); 646 book = glade_xml_get_widget (getMainXML (), "mainnotebook");
687 gtk_widget_show(tab); 647 num = gtk_notebook_get_current_page (GTK_NOTEBOOK (book));
688 book 648 gtk_notebook_set_current_page (GTK_NOTEBOOK (book), 1);
689 = glade_xml_get_widget(getMainXML(), "mainnotebook"); 649 gtk_notebook_set_current_page (GTK_NOTEBOOK (book), num);
690 num = gtk_notebook_get_current_page(GTK_NOTEBOOK(book)); 650 fs_summary_start ();
691 gtk_notebook_set_current_page(GTK_NOTEBOOK(book), 1); 651 fs_collection_start ();
692 gtk_notebook_set_current_page(GTK_NOTEBOOK(book), num); 652 fs_namespace_start ();
693 fs_summary_start(); 653 ctx = FSUI_start (ectx, cfg, "gnunet-gtk", 8, /* FIXME: allow user to configure download parallelism */
694 fs_collection_start(); 654 YES, &eventProcessor, NULL);
695 fs_namespace_start();
696 ctx = FSUI_start(ectx,
697 cfg,
698 "gnunet-gtk",
699 8, /* FIXME: allow user to configure download parallelism */
700 YES,
701 &eventProcessor,
702 NULL);
703} 655}
704 656
705static void * hide_save_call(void * arg) { 657static void *
706 GtkWidget * tab; 658hide_save_call (void *arg)
659{
660 GtkWidget *tab;
707 661
708 tab 662 tab = glade_xml_get_widget (getMainXML (), "fsnotebook");
709 = glade_xml_get_widget(getMainXML(), 663 gtk_widget_hide (tab);
710 "fsnotebook");
711 gtk_widget_hide(tab);
712 return NULL; 664 return NULL;
713} 665}
714 666
715static void * cleanup_save_call(void * arg) { 667static void *
716 fs_summary_stop(); 668cleanup_save_call (void *arg)
717 fs_namespace_stop(); 669{
670 fs_summary_stop ();
671 fs_namespace_stop ();
718 return NULL; 672 return NULL;
719} 673}
720 674
721void done_fs() { 675void
722 gtkSaveCall(&hide_save_call, NULL); 676done_fs ()
723 FSUI_stop(ctx); 677{
724 gtkSaveCall(&cleanup_save_call, NULL); 678 gtkSaveCall (&hide_save_call, NULL);
725 CO_done(); 679 FSUI_stop (ctx);
680 gtkSaveCall (&cleanup_save_call, NULL);
681 CO_done ();
726} 682}
727 683
728 684
729const char * getColorCode(enum URITRACK_STATE state) { 685const char *
686getColorCode (enum URITRACK_STATE state)
687{
730 if (state & (URITRACK_DIRECTORY_ADDED)) 688 if (state & (URITRACK_DIRECTORY_ADDED))
731 return "blue"; 689 return "blue";
732 if (state & (URITRACK_INSERTED || URITRACK_INDEXED)) 690 if (state & (URITRACK_INSERTED || URITRACK_INDEXED))
733 return "cyan"; 691 return "cyan";
734 if ( (state & URITRACK_DOWNLOAD_STARTED) && 692 if ((state & URITRACK_DOWNLOAD_STARTED) &&
735 (0 == (state & 693 (0 == (state &
736 (URITRACK_DOWNLOAD_COMPLETED | 694 (URITRACK_DOWNLOAD_COMPLETED | URITRACK_DOWNLOAD_ABORTED))))
737 URITRACK_DOWNLOAD_ABORTED)) ) )
738 return "yellow"; 695 return "yellow";
739 if (state & URITRACK_DOWNLOAD_COMPLETED) 696 if (state & URITRACK_DOWNLOAD_COMPLETED)
740 return "springgreen"; 697 return "springgreen";
741 if (state & URITRACK_DOWNLOAD_ABORTED) 698 if (state & URITRACK_DOWNLOAD_ABORTED)
742 return "red"; 699 return "red";
743 if (state & (URITRACK_SEARCH_RESULT | 700 if (state & (URITRACK_SEARCH_RESULT | URITRACK_DIRECTORY_FOUND))
744 URITRACK_DIRECTORY_FOUND) )
745 return "gray"; 701 return "gray";
746 return "white"; 702 return "white";
747} 703}