aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/fs/search.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/fs/search.c')
-rw-r--r--src/plugins/fs/search.c53
1 files changed, 34 insertions, 19 deletions
diff --git a/src/plugins/fs/search.c b/src/plugins/fs/search.c
index d8521179..6d7504c1 100644
--- a/src/plugins/fs/search.c
+++ b/src/plugins/fs/search.c
@@ -511,6 +511,22 @@ void on_fssearchKeywordComboBoxEntry_changed_fs(gpointer dummy2,
511 strlen(searchString) > 0); 511 strlen(searchString) > 0);
512} 512}
513 513
514typedef struct {
515 unsigned int anonymity;
516 unsigned int max;
517 cron_t delay;
518 struct ECRS_URI * uri;
519} FSSS;
520
521static void * search_start_helper(void * cls) {
522 FSSS * fsss;
523 FSUI_startSearch(ctx,
524 fsss->anonymity,
525 fsss->max,
526 fsss->delay,
527 fsss->uri);
528 return NULL;
529}
514 530
515/** 531/**
516 * The user has clicked the "SEARCH" button. 532 * The user has clicked the "SEARCH" button.
@@ -518,7 +534,7 @@ void on_fssearchKeywordComboBoxEntry_changed_fs(gpointer dummy2,
518 */ 534 */
519void on_fssearchbutton_clicked_fs(gpointer dummy2, 535void on_fssearchbutton_clicked_fs(gpointer dummy2,
520 GtkWidget * searchButton) { 536 GtkWidget * searchButton) {
521 struct ECRS_URI * uri; 537 FSSS fsss;
522 const char * searchString; 538 const char * searchString;
523 gint pages; 539 gint pages;
524 gint i; 540 gint i;
@@ -554,7 +570,7 @@ void on_fssearchbutton_clicked_fs(gpointer dummy2,
554 0, searchString, 570 0, searchString,
555 -1); 571 -1);
556 } 572 }
557 uri = NULL; 573 fsss.uri = NULL;
558 /* check for namespace search */ 574 /* check for namespace search */
559 searchNamespaceGtkCB 575 searchNamespaceGtkCB
560 = glade_xml_get_widget(getMainXML(), 576 = glade_xml_get_widget(getMainXML(),
@@ -593,8 +609,8 @@ void on_fssearchbutton_clicked_fs(gpointer dummy2,
593 strcat(ustring, ns); 609 strcat(ustring, ns);
594 strcat(ustring, "/"); 610 strcat(ustring, "/");
595 strcat(ustring, searchString); 611 strcat(ustring, searchString);
596 uri = ECRS_stringToUri(ectx, ustring); 612 fsss.uri = ECRS_stringToUri(ectx, ustring);
597 if (uri == NULL) { 613 if (fsss.uri == NULL) {
598 GE_LOG(ectx, 614 GE_LOG(ectx,
599 GE_ERROR | GE_BULK | GE_USER, 615 GE_ERROR | GE_BULK | GE_USER,
600 _("Failed to create namespace URI from `%s'.\n"), 616 _("Failed to create namespace URI from `%s'.\n"),
@@ -607,9 +623,9 @@ void on_fssearchbutton_clicked_fs(gpointer dummy2,
607 if (ns != NULL) 623 if (ns != NULL)
608 free(ns); 624 free(ns);
609 } 625 }
610 if (uri == NULL) 626 if (fsss.uri == NULL)
611 uri = ECRS_parseCharKeywordURI(ectx, searchString); 627 fsss.uri = ECRS_parseCharKeywordURI(ectx, searchString);
612 if (uri == NULL) { 628 if (fsss.uri == NULL) {
613 GE_BREAK(ectx, 0); 629 GE_BREAK(ectx, 0);
614 return; 630 return;
615 } 631 }
@@ -621,14 +637,14 @@ void on_fssearchbutton_clicked_fs(gpointer dummy2,
621 list = search_head; 637 list = search_head;
622 while (list != NULL) { 638 while (list != NULL) {
623 if (ECRS_equalsUri(list->uri, 639 if (ECRS_equalsUri(list->uri,
624 uri)) { 640 fsss.uri)) {
625 for (i=0;i<pages;i++) { 641 for (i=0;i<pages;i++) {
626 if (gtk_notebook_get_nth_page(notebook, 642 if (gtk_notebook_get_nth_page(notebook,
627 i) 643 i)
628 == list->searchpage) { 644 == list->searchpage) {
629 gtk_notebook_set_current_page(notebook, 645 gtk_notebook_set_current_page(notebook,
630 i); 646 i);
631 ECRS_freeUri(uri); 647 ECRS_freeUri(fsss.uri);
632 return; 648 return;
633 } 649 }
634 } 650 }
@@ -636,16 +652,15 @@ void on_fssearchbutton_clicked_fs(gpointer dummy2,
636 } 652 }
637 list = list->next; 653 list = list->next;
638 } 654 }
639 /* FIXME: deadlock! */ 655 fsss.anonymity = getSpinButtonValue(getMainXML(),
640 FSUI_startSearch(ctx, 656 "searchAnonymitySelectionSpinButton");
641 getSpinButtonValue(getMainXML(), 657 fsss.max = getSpinButtonValue(getMainXML(),
642 "searchAnonymitySelectionSpinButton"), 658 "maxResultsSpinButton");
643 getSpinButtonValue(getMainXML(), 659 fsss.delay = getSpinButtonValue(getMainXML(),
644 "maxResultsSpinButton"), 660 "searchDelaySpinButton") * cronSECONDS;
645 getSpinButtonValue(getMainXML(), 661 run_with_save_calls(search_start_helper,
646 "searchDelaySpinButton") * cronSECONDS, 662 &fsss);
647 uri); 663 ECRS_freeUri(fsss.uri);
648 ECRS_freeUri(uri);
649} 664}
650 665
651struct FCBC { 666struct FCBC {