~ubuntu-branches/debian/jessie/xiphos/jessie

« back to all changes in this revision

Viewing changes to src/main/search_dialog.cc

  • Committer: Bazaar Package Importer
  • Author(s): Dmitrijs Ledkovs
  • Date: 2010-03-22 18:15:54 UTC
  • mfrom: (4.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100322181554-qlqchymwhcw28c0c
* New upstream release:
  + Bugfix only
  + Compatible with xulrunner 1.9.2
  + Update translations

* Revert changes introduced in 3.1.2-1ubuntu1. Thank you Chris Coulson
  for temporary fix.
* debian/xiphos.1 - spelling mistake
* waf is now default buildsystem
* help is now licensed under GPL
* Bumped standards version no changes required
* Changed email to @ubuntu.com

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
}
43
43
#endif
44
44
#endif
45
 
        
 
45
 
46
46
#include "main/previewer.h"
47
47
#include "main/search_dialog.h"
48
48
#include "main/settings.h"
49
49
#include "main/sword.h"
50
50
#include "main/xml.h"
51
51
#include "main/url.hh"
52
 
 
 
52
 
53
53
#include "gui/search_dialog.h"
54
54
#include "gui/bookmark_dialog.h"
55
55
#include "gui/bookmarks_treeview.h"
65
65
 
66
66
#define SEARCHING _("Searching the ")
67
67
#define SMODULE _(" Module")
68
 
#define FINDS _("found in ")            
 
68
#define FINDS _("found in ")
69
69
#define HTML_START "<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"></head>"
70
70
 
71
71
static BackEnd *backendSearch = NULL;
99
99
 *
100
100
 * Description
101
101
 *   exports search results to html or plain text
102
 
 *   
 
102
 *
103
103
 *
104
104
 * Return value
105
105
 *   void
106
106
 */
107
107
 
108
108
gboolean main_export_current_adv_search (GString * str, gboolean html, gboolean with_scripture)
109
 
{       
 
109
{
110
110
        GList *verses = NULL;
111
111
        GList *tmp = NULL;
112
112
        RESULTS *list_item;
113
113
        gboolean ret = FALSE;
114
114
        gchar *desc;
115
 
        
 
115
 
116
116
        tmp = g_list_first(list_for_bookmarking);
117
117
        if (html)
118
118
                str = g_string_append(str, "<html><body>");
119
119
        while (tmp) {
120
120
                verses = (GList*) tmp->data;
121
 
                
 
121
 
122
122
                GString *verse_string = g_string_new("");
123
123
                gboolean first_entry = TRUE;
124
 
                
 
124
 
125
125
                while (verses) {
126
126
                        list_item = (RESULTS *) verses->data;
127
127
                        if (main_is_Bible_key(list_item->key)) {
128
128
                                ret = TRUE;
129
 
                                if (first_entry) {                                      
 
129
                                if (first_entry) {
130
130
                                        if (html)
131
131
                                                g_string_printf(verse_string, "<ul><b>%s</b>", list_item->module);
132
132
                                        else
137
137
                                        desc = g_strdup_printf("%s %s",
138
138
                                                                list_item->key,
139
139
                                                                list_item->module);
140
 
                                        if (html) 
 
140
                                        if (html)
141
141
                                                gui_set_html_item ( str,
142
142
                                                                desc,
143
 
                                                                list_item->module, 
 
143
                                                                list_item->module,
144
144
                                                                list_item->key,
145
145
                                                                with_scripture);
146
 
                                        else 
147
 
                                                gui_set_plain_text_item ( str, 
 
146
                                        else
 
147
                                                gui_set_plain_text_item ( str,
148
148
                                                                desc,
149
 
                                                                list_item->module, 
 
149
                                                                list_item->module,
150
150
                                                                list_item->key,
151
151
                                                                with_scripture);
152
 
                                                                                                
 
152
 
153
153
                                }
154
154
                        }
155
155
                        verses = g_list_next(verses);
174
174
 *
175
175
 * Description
176
176
 *   saves search results as bookmarks - single bookmark per module
177
 
 *   
 
177
 *
178
178
 *
179
179
 * Return value
180
180
 *   void
181
181
 */
182
182
 
183
183
void main_save_current_adv_search_as_bookmarks (void)
184
 
{       
 
184
{
185
185
        GList *verses = NULL;
186
186
        RESULTS *list_item;
187
187
        gchar *module_name = NULL;
188
 
        
 
188
 
189
189
        list_for_bookmarking = g_list_first(list_for_bookmarking);
190
190
        while (list_for_bookmarking) {
191
191
                verses = (GList*) list_for_bookmarking->data;
192
 
                
 
192
 
193
193
                GString *name = g_string_new(NULL);
194
194
                GString *verse_string = g_string_new("");
195
195
                gboolean first_entry = TRUE;
296
296
 *   void set_search_global_option(gchar * option, gchar * choice)
297
297
 *
298
298
 * Description
299
 
 *   
 
299
 *
300
300
 *
301
301
 * Return value
302
302
 *   void
303
303
 */
304
304
 
305
305
static void set_search_global_option(const gchar * option, gboolean choice)
306
 
{       
 
306
{
307
307
        const char *on_off;
308
308
        SWMgr *mgr = backendSearch->get_mgr();
309
309
 
464
464
 * Synopsis
465
465
 *   #include "gui/search_dialog.h"
466
466
 *
467
 
 *   void 
 
467
 *   void
468
468
 *
469
469
 * Description
470
 
 *   
 
470
 *
471
471
 *
472
472
 * Return value
473
473
 *   void
480
480
        GtkListStore *list_store;
481
481
        GtkTreeIter iter;
482
482
        GList *tmp = g_list_first(versekeys);
483
 
        
 
483
 
484
484
        model =
485
485
            gtk_tree_view_get_model(GTK_TREE_VIEW
486
486
                                    (search1.listview_verses));
488
488
 
489
489
        gtk_list_store_clear(list_store);
490
490
 
491
 
        while (tmp) {   
 
491
        while (tmp) {
492
492
                buf =  (char*) tmp->data;
493
493
                gtk_list_store_append(list_store, &iter);
494
 
                gtk_list_store_set(list_store, 
 
494
                gtk_list_store_set(list_store,
495
495
                                   &iter,
496
 
                                   0,buf, 
 
496
                                   0,buf,
497
497
                                   -1);
498
498
                tmp = g_list_next(tmp);
499
499
        }
536
536
                        buf[1] = xml_get_list();
537
537
 
538
538
                        gtk_list_store_append(list_store, &iter);
539
 
                        gtk_list_store_set(list_store, 
 
539
                        gtk_list_store_set(list_store,
540
540
                                           &iter,
541
 
                                           0, buf[0], 
542
 
                                           1, buf[1], 
 
541
                                           0, buf[0],
 
542
                                           1, buf[1],
543
543
                                           -1);
544
544
                        g_free(buf[0]);
545
545
                        g_free(buf[1]);
546
546
                }
547
 
                
 
547
 
548
548
                gui_clear_combo(search1.combo_range);
549
549
                while (xml_next_item()) {
550
550
                        if (xml_get_label()) {
552
552
                                buf[1] = xml_get_list();
553
553
 
554
554
                                gtk_list_store_append(list_store, &iter);
555
 
                                gtk_list_store_set(list_store, 
556
 
                                                   &iter, 
557
 
                                                   0, buf[0], 
 
555
                                gtk_list_store_set(list_store,
 
556
                                                   &iter,
 
557
                                                   0, buf[0],
558
558
                                                   1, buf[1],
559
559
                                                   -1);
560
560
                                gui_add_item_to_combo(search1.combo_range,
602
602
                        buf[1] = xml_get_list();
603
603
 
604
604
                        gtk_list_store_append(list_store, &iter);
605
 
                        gtk_list_store_set(list_store, 
 
605
                        gtk_list_store_set(list_store,
606
606
                                           &iter,
607
 
                                           0, buf[0], 
608
 
                                           1, buf[1], 
 
607
                                           0, buf[0],
 
608
                                           1, buf[1],
609
609
                                           -1);
610
610
                        g_free(buf[0]);
611
611
                        g_free(buf[1]);
618
618
                                buf[1] = xml_get_list();
619
619
 
620
620
                                gtk_list_store_append(list_store, &iter);
621
 
                                gtk_list_store_set(list_store, 
622
 
                                                   &iter, 
623
 
                                                   0, buf[0], 
 
621
                                gtk_list_store_set(list_store,
 
622
                                                   &iter,
 
623
                                                   0, buf[0],
624
624
                                                   1, buf[1],
625
625
                                                   -1);
626
626
                                gui_add_item_to_combo(search1.combo_list,
654
654
void main_change_mods_select_label(char *mod_name)
655
655
{
656
656
        gchar *str;
657
 
        
 
657
 
658
658
        if (GTK_TOGGLE_BUTTON(search1.rb_current_module)->active) {
659
659
                str = g_strdup_printf("<b>%s</b>%s",Q_("Search: "),mod_name);
660
660
                gtk_label_set_markup(GTK_LABEL(search1.label_mod_select), str);
666
666
 
667
667
/******************************************************************************
668
668
 * Name
669
 
 *   
 
669
 *
670
670
 *
671
671
 * Synopsis
672
672
 *   #include "gui/search_dialog.h"
673
673
 *
674
 
 *   
 
674
 *
675
675
 *
676
676
 * Description
677
 
 *    
 
677
 *
678
678
 *
679
679
 * Return value
680
680
 *   void
740
740
        gchar *mod_list = NULL;
741
741
        GList *mods = NULL;
742
742
        GtkTreeSelection *selection_modules_lists;
743
 
        
 
743
 
744
744
        model_modules_lists =
745
745
            gtk_tree_view_get_model(GTK_TREE_VIEW(search1.module_lists));
746
746
        store_modules_lists = GTK_LIST_STORE(model_modules_lists);
747
747
 
748
748
        selection_modules_lists = gtk_tree_view_get_selection
749
749
            (GTK_TREE_VIEW(search1.module_lists));
750
 
            
 
750
 
751
751
        model_mods =
752
752
            gtk_tree_view_get_model(GTK_TREE_VIEW(tree_widget));
753
753
        list_store = GTK_LIST_STORE(model_mods);
762
762
 
763
763
                        if (mod_list) {
764
764
                                gtk_tree_selection_get_selected
765
 
                                       (selection_modules_lists, NULL, 
 
765
                                       (selection_modules_lists, NULL,
766
766
                                                  &selected_modules_lists);
767
 
                                
 
767
 
768
768
                                gtk_list_store_set(store_modules_lists,
769
769
                                                   &selected_modules_lists,
770
770
                                                   1, mod_list, -1);
792
792
 *                    GtkWidget * tree_widget)
793
793
 *
794
794
 * Description
795
 
 *   
 
795
 *
796
796
 *
797
797
 * Return value
798
798
 *   void
819
819
 
820
820
        if (!gtk_tree_selection_get_selected(selection, NULL, &selected))
821
821
                return;
822
 
        
 
822
 
823
823
        model_mods =
824
824
            gtk_tree_view_get_model(GTK_TREE_VIEW
825
825
                                    (search1.listview_modules));
833
833
        selection_modules_lists = gtk_tree_view_get_selection
834
834
            (GTK_TREE_VIEW(search1.module_lists));
835
835
 
836
 
        if (gtk_tree_model_iter_has_child(model, &selected)) 
 
836
        if (gtk_tree_model_iter_has_child(model, &selected))
837
837
                return;
838
838
 
839
839
        gtk_tree_model_get(model, &selected, 0, &mod, -1);
840
840
        if (mod) {
841
 
                mod_description = 
 
841
                mod_description =
842
842
                        backendSearch->module_description(mod);
843
843
 
844
844
                if (GTK_TOGGLE_BUTTON(search1.rb_current_module)->active) {
854
854
 
855
855
                        if (mod_list) {
856
856
                                gtk_tree_selection_get_selected
857
 
                                       (selection_modules_lists, NULL, 
 
857
                                       (selection_modules_lists, NULL,
858
858
                                                  &selected_modules_lists);
859
 
                                
 
859
 
860
860
                                gtk_list_store_set(store_modules_lists,
861
861
                                                   &selected_modules_lists,
862
862
                                                   1, mod_list, -1);
881
881
 *                                                       gpointer data)
882
882
 *
883
883
 * Description
884
 
 *   
 
884
 *
885
885
 *
886
886
 * Return value
887
887
 *   void
895
895
        GtkTreeModel *model;
896
896
        GtkTreeIter selected;
897
897
        GtkTreePath *path;
898
 
        
 
898
 
899
899
        if (!gtk_tree_selection_get_selected (selection,&model,&selected))
900
900
                return;
901
901
        gtk_tree_model_get(model, &selected, 0, &text, -1);
905
905
        tmp = g_list_nth(list_of_finds,atoi(path_str));
906
906
        tmp = (GList*)tmp->data;
907
907
        add_module_finds(tmp);
908
 
        
 
908
 
909
909
        if (text)
910
910
                g_free(text);
911
911
        if (path_str)
912
912
                g_free(path_str);
913
913
        gtk_tree_path_free(path);
914
 
        
 
914
 
915
915
}
916
916
 
917
917
 
926
926
 *                                                       gpointer data)
927
927
 *
928
928
 * Description
929
 
 *   
 
929
 *
930
930
 *
931
931
 * Return value
932
932
 *   void
933
933
 */
934
934
 
935
935
void main_finds_verselist_selection_changed(GtkTreeSelection * selection,
936
 
                                            GtkTreeModel * model, 
 
936
                                            GtkTreeModel * model,
937
937
                                            gboolean is_double_click)
938
938
{
939
939
        gchar *text, *buf, *module, *key;
955
955
 
956
956
        // key begins 2 chars after module.
957
957
        key = buf + 2;
958
 
                                             
 
958
 
959
959
        if (verse_selected)
960
960
                g_free(verse_selected);
961
961
        drag_module_type = backendSearch->module_type(module);
977
977
#ifdef USE_GTKMOZEMBED
978
978
        GString *html_text = g_string_new(HTML_START);
979
979
        g_string_append(html_text, text_str->str);
980
 
        g_string_append(html_text, "</html>");  
 
980
        g_string_append(html_text, "</html>");
981
981
        gecko_html_open_stream(GECKO_HTML(search1.preview_html), "text/html");
982
982
        gecko_html_write(GECKO_HTML(search1.preview_html),
983
983
                         html_text->str, html_text->len);
998
998
 
999
999
/******************************************************************************
1000
1000
 * Name
1001
 
 *   
 
1001
 *
1002
1002
 *
1003
1003
 * Synopsis
1004
1004
 *   #include "gui/search_dialog.h"
1007
1007
 *                                                       gpointer data)
1008
1008
 *
1009
1009
 * Description
1010
 
 *   
 
1010
 *
1011
1011
 *
1012
1012
 * Return value
1013
1013
 *   void
1067
1067
 
1068
1068
/******************************************************************************
1069
1069
 * Name
1070
 
 *   
 
1070
 *
1071
1071
 *
1072
1072
 * Synopsis
1073
1073
 *   #include "gui/search_dialog.h"
1074
1074
 *
1075
 
 *   
 
1075
 *
1076
1076
 *
1077
1077
 * Description
1078
 
 *   
 
1078
 *
1079
1079
 *
1080
1080
 * Return value
1081
 
 *   
 
1081
 *
1082
1082
 */
1083
1083
 
1084
1084
gchar *get_modlist_string(GList * mods)
1112
1112
 *   void add_modlist_to_label(void)
1113
1113
 *
1114
1114
 * Description
1115
 
 *   
 
1115
 *
1116
1116
 *
1117
1117
 * Return value
1118
1118
 *   void
1144
1144
        gchar *str = NULL;
1145
1145
        gchar *mod_list_str = NULL;
1146
1146
        const gchar *name = NULL;
1147
 
        
 
1147
 
1148
1148
        if (!GTK_TOGGLE_BUTTON(search1.rb_custom_list)->active)
1149
1149
                return;
1150
 
        name = gtk_entry_get_text(GTK_ENTRY(GTK_BIN(combobox)->child)); 
 
1150
        name = gtk_entry_get_text(GTK_ENTRY(GTK_BIN(combobox)->child));
1151
1151
        mod_list = get_custom_list_from_name(name);
1152
1152
        mod_list_str = get_modlist_string(mod_list);
1153
1153
        if (strlen(mod_list_str) > 60)
1164
1164
 
1165
1165
/******************************************************************************
1166
1166
 * Name
1167
 
 *   
 
1167
 *
1168
1168
 *
1169
1169
 * Synopsis
1170
1170
 *   #include "gui/search_dialog.h"
1171
1171
 *
1172
 
 *   
 
1172
 *
1173
1173
 *
1174
1174
 * Description
1175
 
 *   
 
1175
 *
1176
1176
 *
1177
1177
 * Return value
1178
1178
 *   void
1207
1207
 *   GList *get_current_search_mod(void)
1208
1208
 *
1209
1209
 * Description
1210
 
 *   
 
1210
 *
1211
1211
 *
1212
1212
 * Return value
1213
1213
 *   GList *
1233
1233
 *   GList *get_current_list(void)
1234
1234
 *
1235
1235
 * Description
1236
 
 *   
 
1236
 *
1237
1237
 *
1238
1238
 * Return value
1239
1239
 *   GList *
1374
1374
 * Synopsis
1375
1375
 *   #include "main/sword.h"
1376
1376
 *
1377
 
 *   char *main_get_rendered_text(char *module_name, char *key) 
 
1377
 *   char *main_get_rendered_text(char *module_name, char *key)
1378
1378
 *
1379
1379
 * Description
1380
 
 *   
 
1380
 *
1381
1381
 *
1382
1382
 * Return value
1383
1383
 *   char *
1394
1394
{
1395
1395
        GList *tmp = NULL;
1396
1396
        gchar *tmp_buf = NULL;
1397
 
        
 
1397
 
1398
1398
        list_of_finds = g_list_first(list_of_finds);
1399
1399
        while (list_of_finds) {
1400
1400
                tmp = (GList*) list_of_finds->data;
1416
1416
{
1417
1417
        GList *tmp = NULL;
1418
1418
        RESULTS *results;
1419
 
        
 
1419
 
1420
1420
        list_for_bookmarking = g_list_first(list_for_bookmarking);
1421
1421
        while (list_for_bookmarking) {
1422
1422
                tmp = (GList*) list_for_bookmarking->data;
1459
1459
        char *num;
1460
1460
        gchar msg[300];
1461
1461
        RESULTS *results;
1462
 
        
 
1462
 
1463
1463
        _clear_find_lists();
1464
1464
        _clear_bookmarking_lists();
1465
 
        
 
1465
 
1466
1466
        model =
1467
1467
            gtk_tree_view_get_model(GTK_TREE_VIEW
1468
1468
                                    (search1.listview_results));
1474
1474
                                    (search1.listview_verses));
1475
1475
        list_store2 = GTK_LIST_STORE(model2);
1476
1476
        gtk_list_store_clear(list_store2);
1477
 
        
 
1477
 
1478
1478
        search_string =
1479
1479
            gtk_entry_get_text(GTK_ENTRY(search1.search_entry));
1480
 
        
 
1480
 
1481
1481
        if (strlen(search_string) < 1)
1482
1482
                return;
1483
1483
        str = g_string_new("");
1484
1484
 
1485
1485
        gtk_notebook_set_current_page(GTK_NOTEBOOK(search1.notebook), 1);
1486
 
        search_type = 
 
1486
        search_type =
1487
1487
            GTK_TOGGLE_BUTTON(search1.rb_regexp)->active ? 0 :
1488
1488
            GTK_TOGGLE_BUTTON(search1.rb_exact_phrase)->active ? -1 :
1489
1489
            GTK_TOGGLE_BUTTON(search1.rb_words)->active ? -2 :
1495
1495
 
1496
1496
        // For attribute-based searches, e.g. "Word//Lemma/G140",
1497
1497
        // we must constrain the match to whole words.  Otherwise,
1498
 
        // we will inadvertently return e.g. 140 plus 1401 and 1404.            
1499
 
        if(search_type == -3) {
1500
 
                if(GTK_TOGGLE_BUTTON(search1.rb_strongs)->active) {
 
1498
        // we will inadvertently return e.g. 140 plus 1401 and 1404.
 
1499
        if (search_type == -3) {
 
1500
                if (GTK_TOGGLE_BUTTON(search1.rb_strongs)->active) {
1501
1501
                        search_params |= SEARCHFLAG_MATCHWHOLEENTRY;
1502
1502
                        attribute_search_string = g_strdup_printf(
1503
1503
#ifdef SWORD_MULTIVERSE
1506
1506
                                        "Word//Lemma/%s",
1507
1507
#endif
1508
1508
                                        search_string);
1509
 
                } else if(GTK_TOGGLE_BUTTON(search1.rb_morphs)->active) {
 
1509
                } else if (GTK_TOGGLE_BUTTON(search1.rb_morphs)->active) {
1510
1510
                        search_params |= SEARCHFLAG_MATCHWHOLEENTRY;
1511
1511
                        attribute_search_string = g_strdup_printf(
1512
1512
                                        "Word//Morph/%s",
1513
1513
                                        search_string);
1514
 
                } else if(GTK_TOGGLE_BUTTON(search1.rb_footnotes)->active) {
 
1514
                } else if (GTK_TOGGLE_BUTTON(search1.rb_footnotes)->active) {
1515
1515
                        attribute_search_string = g_strdup_printf(
1516
1516
                                        "Footnote//body/%s",
1517
1517
                                        search_string);
1583
1583
                        }
1584
1584
                }
1585
1585
                GS_message(("search_type = %d",search_type));
1586
 
                
1587
 
                finds = backendSearch->do_module_search(module, 
 
1586
 
 
1587
                finds = backendSearch->do_module_search(module,
1588
1588
                                        (attribute_search_string
1589
1589
                                         ? mgr->getModule(module)->
1590
1590
                                                StripText(attribute_search_string)
1591
1591
                                         : mgr->getModule(module)->
1592
1592
                                                StripText(search_string)),
1593
 
                                        search_type, 
1594
 
                                        search_params, 
 
1593
                                        search_type,
 
1594
                                        search_params,
1595
1595
                                        TRUE);
1596
 
                
 
1596
 
1597
1597
                tmp_list = g_list_first(tmp_list);
1598
1598
                tmp_list = NULL;
1599
1599
                tmp_bookmark_list = g_list_first(tmp_bookmark_list);
1600
1600
                tmp_bookmark_list = NULL;
1601
 
                
1602
 
                mod_type = backendSearch->module_type(module);  
 
1601
 
 
1602
                mod_type = backendSearch->module_type(module);
1603
1603
                while ((key_buf = backendSearch->get_next_listkey()) != NULL) {
1604
 
                        if (mod_type == TEXT_TYPE)                      
 
1604
                        if (mod_type == TEXT_TYPE)
1605
1605
                                g_string_printf(str, "%s: %s  %s", module,  key_buf, backendSearch->get_strip_text(module, key_buf));
1606
 
                        else                    
1607
 
                                g_string_printf(str, "%s: %s", module,  key_buf);                               
 
1606
                        else
 
1607
                                g_string_printf(str, "%s: %s", module,  key_buf);
1608
1608
                        tmp_list = g_list_append(tmp_list, (char*) g_strdup(str->str));
1609
 
                                                  
 
1609
 
1610
1610
                        results = g_new(RESULTS,1);
1611
1611
                        results->module = g_strdup(module);
1612
1612
                        results->key = g_strdup(key_buf);
1613
 
                        tmp_bookmark_list = g_list_append(tmp_bookmark_list, 
 
1613
                        tmp_bookmark_list = g_list_append(tmp_bookmark_list,
1614
1614
                                                        (RESULTS*) results);
1615
1615
                }
1616
1616
                list_of_finds = g_list_append(list_of_finds, (GList*)tmp_list);
1622
1622
                                num, FINDS, module);
1623
1623
                g_free(num);
1624
1624
                gtk_list_store_append(list_store, &iter);
1625
 
                gtk_list_store_set(list_store, 
 
1625
                gtk_list_store_set(list_store,
1626
1626
                                   &iter,
1627
 
                                   0, str->str, 
 
1627
                                   0, str->str,
1628
1628
                                   -1);
1629
1629
                ++x;
1630
1630
                if (x == 1) { // add verse list for hits in first module to verse listview
1638
1638
        }
1639
1639
        search_active = FALSE;
1640
1640
 
1641
 
        if(attribute_search_string)
 
1641
        if (attribute_search_string)
1642
1642
                g_free((gchar*)attribute_search_string);
1643
1643
        g_list_free(search_mods);
1644
1644
        gui_set_progressbar_text(search1.progressbar, _("Search finished"));
1671
1671
                        delete backendSearch;
1672
1672
 
1673
1673
                backendSearch = new BackEnd();
1674
 
                
 
1674
 
1675
1675
                /* create and show search dialog */
1676
1676
                gui_create_search_dialog();
1677
1677
                backendSearch->init_SWORD(2);
1678
 
                
1679
 
                
 
1678
 
 
1679
 
1680
1680
                /* initiate module count to 0 */
1681
1681
                search1.module_count = 0;
1682
1682
 
1714
1714
 * Synopsis
1715
1715
 *   #include "main/search.h"
1716
1716
 *
1717
 
 *   void search_percent_update(char percent, void *userData)   
 
1717
 *   void search_percent_update(char percent, void *userData)
1718
1718
 *
1719
1719
 * Description
1720
1720
 *    updates the progress bar during shortcut bar search
1721
1721
 *
1722
1722
 * Return value
1723
1723
 *   void
1724
 
 */ 
 
1724
 */
1725
1725
 
1726
1726
void main_dialog_search_percent_update(char percent, void *userData)
1727
1727
{
1728
1728
        char maxHashes = *((char *) userData);
1729
1729
        float num;
1730
1730
        static char printed = 0;
1731
 
        
 
1731
 
1732
1732
        if (terminate_search) {
1733
1733
                backendSearch->terminate_search();
1734
1734
                // this is WAY WRONG but at least it cleans up the dying window. */
1743
1743
                }
1744
1744
                printed = 0;
1745
1745
        }
1746
 
        while (gtk_events_pending())
1747
 
                gtk_main_iteration();
 
1746
        sync_windows();
1748
1747
}