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

« back to all changes in this revision

Viewing changes to src/main/url.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:
18
18
 * along with this program; if not, write to the Free Software
19
19
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20
20
 */
21
 
 
 
21
 
22
22
#ifdef HAVE_CONFIG_H
23
23
#  include <config.h>
24
24
#endif
26
26
#include <sys/types.h>
27
27
#include <sys/stat.h>
28
28
#include <unistd.h>
29
 
#include <string.h>     
 
29
#include <string.h>
30
30
#include <ctype.h>
31
31
#include <url.h>
32
32
 
37
37
 
38
38
#include <gtk/gtk.h>
39
39
 
40
 
#ifdef USE_GTKHTML3_14_23
41
40
#include "editor/slib-editor.h"
42
 
#else
43
 
#include "editor/bonobo-editor.h"
44
 
#endif
45
41
 
46
42
#include "gui/about_modules.h"
47
43
#include "gui/xiphos.h"
75
71
 
76
72
/******************************************************************************
77
73
 * Name
78
 
 *   
 
74
 *
79
75
 *
80
76
 * Synopsis
81
77
 *   #include "main/url.hh"
82
78
 *
83
 
 *   
 
79
 *
84
80
 *
85
81
 * Description
86
 
 *  
 
82
 *
87
83
 *
88
84
 * Return value
89
 
 *   
 
85
 *
90
86
 */
91
 
 
 
87
 
92
88
static void alert_url_not_found(const gchar * url)
93
89
{
94
90
        GS_DIALOG *dialog;
111
107
 
112
108
/******************************************************************************
113
109
 * Name
114
 
 *   
 
110
 *
115
111
 *
116
112
 * Synopsis
117
113
 *   #include "main/url.hh"
119
115
 *   gint (const gchar * filename, gboolean clicked)
120
116
 *
121
117
 * Description
122
 
 *  
 
118
 *
123
119
 *
124
120
 * Return value
125
121
 *   gint
126
122
 */
127
 
 
 
123
 
128
124
 static gint show_studypad(const gchar * filename, gboolean clicked)
129
125
{
130
126
        editor_create_new(filename, NULL, STUDYPAD_EDITOR);
222
218
 *                                              gboolean clicked)
223
219
 *
224
220
 * Description
225
 
 *  
 
221
 *
226
222
 *
227
223
 * Return value
228
224
 *   gint
229
225
 */
230
 
 
 
226
 
231
227
 static gint show_mod_info(const gchar * module, const gchar * description,
232
228
                                                gboolean clicked)
233
229
{
234
230
        if (clicked) {
235
231
                GS_print(("module = %s\n",module));
236
 
                gui_display_about_module_dialog((gchar*)module);                
 
232
                gui_display_about_module_dialog((gchar*)module);
237
233
        } else {
238
234
                /* some mod descriptions contain fun(ny) characters */
239
235
                GString *desc_clean = hex_decode(description);
255
251
 *   gint show_parallel(const gchar * value, const gchar * type,gboolean clicked)
256
252
 *
257
253
 * Description
258
 
 *  
 
254
 *
259
255
 *
260
256
 * Return value
261
257
 *   gint
262
258
 */
263
 
 
264
 
 static gint show_parallel(const gchar * svalue, const gchar * stype, 
 
259
 
 
260
 static gint show_parallel(const gchar * svalue, const gchar * stype,
265
261
                                                        gboolean clicked)
266
262
{
267
 
        if(!strcmp(stype,"swap")) {
268
 
                if(clicked) {
269
 
                        main_swap_parallel_with_main((gchar *) svalue);         
 
263
        if (!strcmp(stype,"swap")) {
 
264
                if (clicked) {
 
265
                        main_swap_parallel_with_main((gchar *) svalue);
270
266
                } else {
271
 
                        gchar *buf = g_strdup_printf( 
 
267
                        gchar *buf = g_strdup_printf(
272
268
                                _("Show %s in main window"), svalue);
273
269
                        gui_set_statusbar (buf);
274
270
                        g_free(buf);
275
271
                }
276
272
        }
277
 
        if(!strcmp(stype,"verse")) {
278
 
                if(clicked) {
 
273
        if (!strcmp(stype,"verse")) {
 
274
                if (clicked) {
279
275
                        gtk_entry_set_text(GTK_ENTRY(navbar_parallel.lookup_entry),svalue);
280
276
                        gtk_widget_activate(navbar_parallel.lookup_entry);
281
 
                } 
 
277
                }
282
278
        }
283
279
        return 1;
284
280
}
294
290
 *   gint show_morph(const gchar * type, const gchar * value, gboolean clicked)
295
291
 *
296
292
 * Description
297
 
 *  
 
293
 *
298
294
 *
299
295
 * Return value
300
296
 *   gint
301
297
 */
302
 
 
303
 
 static gint show_morph(const gchar * stype, const gchar * svalue, 
 
298
 
 
299
 static gint show_morph(const gchar * stype, const gchar * svalue,
304
300
                                gboolean clicked)
305
 
{       
 
301
{
306
302
        const gchar *modbuf = NULL;
307
303
        gchar *mybuf = NULL;
308
 
        
 
304
 
309
305
        if (!strcmp(stype,"Greek") ||
310
306
             strstr(stype,"x-Robinson") ||
311
307
             strstr(stype,"robinson") ||
312
308
             strstr(stype,"Robinson")) {
313
309
                if (backend->get_key_testament(settings.currentverse) == 2) {
314
 
                        if (backend->is_module("Robinson")) 
 
310
                        if (backend->is_module("Robinson"))
315
311
                                modbuf = "Robinson";
316
312
                } else {
317
 
                        if (backend->is_module("Packard")) 
 
313
                        if (backend->is_module("Packard"))
318
314
                                modbuf = "Packard";
319
315
                }
320
316
        }
321
317
        //GS_message(("modbuf = %s", modbuf));
322
318
        if (clicked) {
323
 
                main_display_dictionary(modbuf, (gchar*)svalue);                
 
319
                main_display_dictionary(modbuf, (gchar*)svalue);
324
320
        } else {
325
321
                mybuf = main_get_rendered_text(modbuf, (gchar*)svalue);
326
322
                //GS_message(("mybuf = %s", mybuf));
349
345
 *   gint show_strongs(const gchar * type, const gchar * value, gboolean clicked)
350
346
 *
351
347
 * Description
352
 
 *  
 
348
 *
353
349
 *
354
350
 * Return value
355
351
 *   gint
356
 
 */ 
357
 
 
358
 
static gint show_strongs(const gchar * stype, const gchar * svalue, 
 
352
 */
 
353
 
 
354
static gint show_strongs(const gchar * stype, const gchar * svalue,
359
355
                        gboolean clicked)
360
 
{       
 
356
{
361
357
        const gchar *modbuf = NULL;
362
358
        gchar *mybuf = NULL;
363
359
        gchar *val = NULL;
364
360
 
365
361
        val = g_strdup(svalue);
366
 
        /*if((val1 = strchar(val,'|')) != NULL) {
 
362
        /*if ((val1 = strchar(val,'|')) != NULL)        {
367
363
                val1 = (val1) ? (val1 + 1) : val;
368
 
                
 
364
 
369
365
        }*/
370
 
        
371
 
        if(!strcmp(settings.MainWindowModule,"NASB")) {
372
 
                if(!strcmp(stype,"Greek")) 
 
366
 
 
367
        if (!strcmp(settings.MainWindowModule,"NASB")) {
 
368
                if (!strcmp(stype,"Greek"))
373
369
                        modbuf = "NASGreek";
374
 
                else 
 
370
                else
375
371
                        modbuf = "NASHebrew";
376
372
        } else {
377
373
                if (stype && (*stype != '\0')) {
378
 
                        if(!strcmp(stype,"Greek")) 
 
374
                        if (!strcmp(stype,"Greek"))
379
375
                                modbuf = settings.lex_greek;
380
 
                        else  
 
376
                        else
381
377
                                modbuf = settings.lex_hebrew;
382
378
                } else
383
379
                        modbuf = "InvStrongsRealGreek";
384
380
        }
385
 
        
 
381
 
386
382
        if (clicked) {
387
 
                main_display_dictionary(modbuf, (gchar*)svalue);                
 
383
                main_display_dictionary(modbuf, (gchar*)svalue);
388
384
        } else {
389
385
                mybuf = main_get_rendered_text(modbuf, (gchar*)svalue);
390
386
                if (mybuf) {
391
 
                        main_information_viewer(  
392
 
                                        modbuf, 
393
 
                                        mybuf, 
394
 
                                        (gchar*)svalue, 
 
387
                        main_information_viewer(
 
388
                                        modbuf,
 
389
                                        mybuf,
 
390
                                        (gchar*)svalue,
395
391
                                        "showStrongs",
396
392
                                        (gchar*)stype,
397
393
                                        NULL,
414
410
 *   gint note_uri(const gchar * url)
415
411
 *
416
412
 * Description
417
 
 *  
 
413
 *
418
414
 *
419
415
 * Return value
420
416
 *   gint
421
417
 */
422
 
 
423
 
static gint show_note(const gchar * module, const gchar * passage, 
 
418
 
 
419
static gint show_note(const gchar * module, const gchar * passage,
424
420
                const gchar * stype, const gchar * svalue, gboolean clicked)
425
 
{       
 
421
{
426
422
        gchar *tmpbuf = NULL;
427
423
        gchar *buf = NULL;
428
424
        gchar *work_buf = NULL;
429
425
        GString *str = g_string_new(NULL);
430
426
        GList *tmp = NULL;
431
427
        RESULTS *list_item;
432
 
        
 
428
 
433
429
        if (!in_url)
434
430
                return 1;
435
 
        
436
 
        if (!backend->is_module((gchar*)module)) 
 
431
 
 
432
        if (!backend->is_module((gchar*)module))
437
433
                module = settings.MainWindowModule;
438
 
        
 
434
 
439
435
        if (passage && (strlen(passage) < 5))
440
436
                passage = settings.currentverse;
441
 
        
 
437
 
442
438
        //
443
439
        // if we are asking for a note/xref in n:0,
444
440
        // we must stop autonormalization for a moment.
459
455
        } else
460
456
                backend->set_module_key((gchar*)module, (gchar*)passage);
461
457
 
462
 
        if(strchr(stype,'x') && clicked) {
 
458
        if (strchr(stype,'x') && clicked) {
463
459
                tmpbuf = backend->get_entry_attribute("Footnote",
464
460
                                                      (gchar*)svalue,
465
461
                                                      "refList");
470
466
                                                           tmpbuf);
471
467
                        g_free(tmpbuf);
472
468
                }
473
 
        } else if(strchr(stype,'n') && !clicked) {
 
469
        } else if (strchr(stype,'n') && !clicked) {
474
470
                tmpbuf = backend->get_entry_attribute("Footnote",
475
471
                                                      (gchar*)svalue,
476
472
                                                      "body");
477
473
                buf = backend->render_this_text((gchar*)module,(gchar*)tmpbuf);
478
 
                if(tmpbuf) g_free(tmpbuf);
 
474
                if (tmpbuf) g_free(tmpbuf);
479
475
                if (buf) {
480
476
                        main_information_viewer((gchar*)module,
481
477
                                                buf,
484
480
                                                (gchar*)stype,
485
481
                                                NULL,
486
482
                                                NULL);
487
 
                        if(buf) g_free(buf);
 
483
                        if (buf) g_free(buf);
488
484
                }
489
 
        } else if(strchr(stype,'x') && !clicked) {
 
485
        } else if (strchr(stype,'x') && !clicked) {
490
486
                tmpbuf = backend->get_entry_attribute("Footnote",
491
487
                                                      (gchar*)svalue,
492
488
                                                      "refList");
514
510
                                settings.bible_text_color,
515
511
                                (const char *) tmp->data);
516
512
                        str = g_string_append(str,buf);
517
 
                        if(buf) g_free(buf);
 
513
                        if (buf) g_free(buf);
518
514
                        buf = NULL;
519
515
                        //++i;
520
516
                        g_free((char *) tmp->data);
530
526
                                      _("Back to "),
531
527
                                      settings.currentverse);
532
528
                str = g_string_append(str,buf);
533
 
                if(buf) g_free(buf);
 
529
                if (buf) g_free(buf);
534
530
 
535
 
                if(tmpbuf) g_free(tmpbuf);
 
531
                if (tmpbuf) g_free(tmpbuf);
536
532
                if (str) {
537
533
                        main_information_viewer((gchar*)module,
538
534
                                                str->str,
546
542
 
547
543
        if (stop_autonorm && vkey)
548
544
                vkey->AutoNormalize(oldAutoNorm);
549
 
        if(work_buf)
 
545
        if (work_buf)
550
546
                g_free(work_buf);
551
547
        g_string_free(str, 1);
552
548
        return 1;
563
559
 *   gint reference_uri(const gchar * url)
564
560
 *
565
561
 * Description
566
 
 *  
 
562
 *
567
563
 *
568
564
 * Return value
569
565
 *   gint
570
566
 */
571
 
 
 
567
 
572
568
static gint show_ref(const gchar * module, const gchar * list, gboolean clicked)
573
 
{       
 
569
{
574
570
        if (!clicked)
575
571
                return 1;
576
 
        
577
 
        if (!backend->is_module(module)) 
 
572
 
 
573
        if (!backend->is_module(module))
578
574
                module = settings.MainWindowModule;
579
575
        main_display_verse_list_in_sidebar(settings.currentverse,
580
576
                                                  (gchar*)module,
581
 
                                                  (gchar*)list); 
 
577
                                                  (gchar*)list);
582
578
        return 1;
583
579
}
584
580
 
591
587
 * Synopsis
592
588
 *   #include "main/url.hh"
593
589
 *
594
 
 *   gint show_module_and_key(const gchar * module, const gchar * key, 
 
590
 *   gint show_module_and_key(const gchar * module, const gchar * key,
595
591
                                        const gchar * type, gboolean clicked)
596
592
 *
597
593
 * Description
598
 
 *   
599
 
 *   
 
594
 *
 
595
 *
600
596
 *
601
597
 * Return value
602
598
 *   gint
603
599
 */
604
600
 
605
 
static int show_module_and_key(const char * module, const char * key, 
 
601
static int show_module_and_key(const char * module, const char * key,
606
602
                                        const char * stype, gboolean clicked)
607
603
{
608
604
        gchar *tmpkey = NULL;
609
605
        gint mod_type;
610
 
        
611
 
        if (module && (strlen((char*)module) < 3) && 
 
606
 
 
607
        if (module && (strlen((char*)module) < 3) &&
612
608
            backend->is_Bible_key(key, settings.currentverse)) {
613
609
                module = settings.MainWindowModule;
614
610
        }
615
611
        if (!clicked) {
616
612
                return 1;
617
613
        }
618
 
        
 
614
 
619
615
        if (backend->is_module(module)) {
620
616
                if (!strcmp(stype,"newTab")) {
621
 
                        main_open_bookmark_in_new_tab((gchar*)module, 
 
617
                        main_open_bookmark_in_new_tab((gchar*)module,
622
618
                                        (gchar*)key);
623
619
                        return 1;
624
620
                }
625
621
                if (!strcmp(stype,"newDialog"))  {
626
 
                        if(module && (main_get_mod_type((gchar*)module) == PERCOM_TYPE)) {                      
 
622
                        if (module && (main_get_mod_type((gchar*)module) == PERCOM_TYPE)) {
627
623
                                editor_create_new(module,key,TRUE);
628
624
                                return 1;
629
625
                        }
634
630
                mod_type = backend->module_type((gchar*)module);
635
631
                switch (mod_type) {
636
632
                        case TEXT_TYPE:
637
 
                                if (strpbrk(key, "-;,")) {      // >1 verse marked
638
 
                                        main_display_verse_list_in_sidebar
639
 
                                            (settings.currentverse,
640
 
                                             (gchar*)module, (gchar*)key);
641
 
                                } else {
642
 
                                        tmpkey = main_update_nav_controls(key);
643
 
                                        main_display_bible(module, tmpkey);
644
 
                                        main_display_commentary(NULL, tmpkey);
645
 
                                        main_keep_bibletext_dialog_in_sync((gchar*)tmpkey);
646
 
                                        if (tmpkey) g_free((gchar*)tmpkey);
647
 
                                        editor_sync_with_main();
648
 
                                }
649
 
                                break;
650
633
                        case COMMENTARY_TYPE:
651
634
                        case PERCOM_TYPE:
652
635
                                if (strpbrk(key, "-;,")) {      // >1 verse marked
654
637
                                            (settings.currentverse,
655
638
                                             (gchar*)module, (gchar*)key);
656
639
                                } else {
657
 
                                        tmpkey = main_update_nav_controls(key);
658
 
                                        main_display_bible(NULL, tmpkey);
659
 
                                        main_display_commentary(module, tmpkey);
660
 
                                        main_keep_bibletext_dialog_in_sync((gchar*)tmpkey);
661
 
                                        if (tmpkey) g_free((gchar*)tmpkey);
662
 
                                        if (gtk_notebook_get_current_page
663
 
                                            (GTK_NOTEBOOK
664
 
                                             (widgets.notebook_comm_book)) != 0)
665
 
                                            gtk_notebook_set_current_page(
666
 
                                                GTK_NOTEBOOK (widgets.
667
 
                                                              notebook_comm_book), 0);
 
640
                                        gchar *url =
 
641
                                            g_strdup_printf("sword://%s/%s",
 
642
                                                            (module ? module : ""),
 
643
                                                            key);
 
644
                                        sword_uri(url, TRUE);
 
645
                                        g_free(url);
668
646
                                }
669
647
                                break;
670
648
                        case DICTIONARY_TYPE:
673
651
                                break;
674
652
                        case BOOK_TYPE:
675
653
                        case PRAYERLIST_TYPE:
676
 
                                main_display_book((gchar*)module, (gchar*)key); 
677
 
                                if(gtk_notebook_get_current_page (GTK_NOTEBOOK 
678
 
                                                (widgets.notebook_comm_book)) 
 
654
                                main_display_book((gchar*)module, (gchar*)key);
 
655
                                if (gtk_notebook_get_current_page (GTK_NOTEBOOK
 
656
                                                (widgets.notebook_comm_book))
679
657
                                                != 1)
680
658
                                        gtk_notebook_set_current_page(
681
659
                                                        GTK_NOTEBOOK (widgets.
691
669
 
692
670
 /******************************************************************************
693
671
 * Name
694
 
 *   
 
672
 *
695
673
 *
696
674
 * Synopsis
697
675
 *   #include "main/url.hh"
698
676
 *
699
 
 *   gint (const gchar * type, const gchar * value, 
 
677
 *   gint (const gchar * type, const gchar * value,
700
678
                        gboolean clicked)
701
679
 *
702
680
 * Description
703
 
 *  
 
681
 *
704
682
 *
705
683
 * Return value
706
684
 *   gint
707
 
 */ 
708
 
 
 
685
 */
 
686
 
709
687
static gint show_in_previewer(const gchar * url)
710
 
{       
711
 
        
712
 
        gchar **work_buf = NULL;       
 
688
{
 
689
 
 
690
        gchar **work_buf = NULL;
713
691
        gchar *mybuf = NULL;
714
692
 
715
693
        work_buf = g_strsplit (url,"/",4);
716
 
        
 
694
 
717
695
        mybuf = main_get_rendered_text(work_buf[MODULE], work_buf[KEY]);
718
 
        
 
696
 
719
697
        if (mybuf) {
720
 
                main_information_viewer(  
721
 
                                (gchar*)work_buf[MODULE], 
722
 
                                mybuf, 
723
 
                                (gchar*)work_buf[KEY], 
 
698
                main_information_viewer(
 
699
                                (gchar*)work_buf[MODULE],
 
700
                                mybuf,
 
701
                                (gchar*)work_buf[KEY],
724
702
                                NULL,
725
703
                                NULL,
726
704
                                NULL,
757
735
        gchar *tmpkey = NULL;
758
736
        gint mod_type;
759
737
        gint verse_count;
760
 
        gchar **work_buf = NULL;                                                  
761
 
                
 
738
        gchar **work_buf = NULL;
 
739
 
762
740
        // don't recurse between paratab and here.
763
741
        static gboolean handling_uri = FALSE;
764
742
 
777
755
                        int mod_type = backend->module_type(name);
778
756
                        if (slash)
779
757
                                *slash = '/';
780
 
                        
 
758
 
781
759
                        if (mod_type == DICTIONARY_TYPE)
782
 
                                show_in_previewer(url);                 
 
760
                                show_in_previewer(url);
783
761
                        else
784
762
                                gui_set_statusbar (url);
785
763
                }
786
764
                handling_uri = FALSE;
787
765
                return 1;
788
766
        }
789
 
        
 
767
 
790
768
        work_buf = g_strsplit (url,"/",4);
791
769
        if (!work_buf[MODULE] && !work_buf[KEY]) {
792
770
                alert_url_not_found(url);
794
772
                handling_uri = FALSE;
795
773
                return 0;
796
774
        }
797
 
        if(!work_buf[KEY]) {
798
 
                tmpkey = work_buf[MODULE];              
 
775
        if (!work_buf[KEY]) {
 
776
                tmpkey = work_buf[MODULE];
799
777
        } else
800
778
                tmpkey = work_buf[KEY];
801
 
        
 
779
        if ((settings.special_anchor = strchr(tmpkey, '#')) ||
 
780
            (settings.special_anchor = strchr(tmpkey, '!')))
 
781
                *(settings.special_anchor++) = '\0';
 
782
 
802
783
        GS_message(("work_buf: %s, %s",
803
784
                    work_buf[MODULE],
804
785
                    (work_buf[KEY] ? work_buf[KEY] : "-null-")));
805
 
        
 
786
 
806
787
        verse_count = 1; //backend->is_Bible_key(mykey, settings.currentverse);
807
 
        if(backend->is_module(work_buf[MODULE])) {
 
788
        if (backend->is_module(work_buf[MODULE])) {
808
789
                mod_type = backend->module_type(work_buf[MODULE]);
809
 
                switch(mod_type) {
 
790
                switch (mod_type) {
810
791
                        case TEXT_TYPE:
811
792
                                key = main_update_nav_controls(tmpkey);
 
793
                                main_display_bible(work_buf[MODULE], key);
812
794
                                if (settings.comm_showing)
813
795
                                        main_display_commentary(NULL, key);
814
 
                                main_display_bible(work_buf[MODULE], key);
815
796
                                main_keep_bibletext_dialog_in_sync((gchar*)key);
816
797
                                editor_sync_with_main();
817
 
                                
818
 
                                if(key) g_free((gchar*)key);
819
 
                        break;                          
820
 
                        case COMMENTARY_TYPE:   
 
798
 
 
799
                                if (key) g_free((gchar*)key);
 
800
                        break;
 
801
                        case COMMENTARY_TYPE:
 
802
                                if (gtk_notebook_get_current_page
 
803
                                    (GTK_NOTEBOOK
 
804
                                     (widgets.notebook_comm_book)) != 0) {
 
805
                                        gchar *save = settings.special_anchor;
 
806
                                        gtk_notebook_set_current_page(
 
807
                                            GTK_NOTEBOOK (widgets.
 
808
                                                          notebook_comm_book), 0);
 
809
                                        settings.special_anchor = save;
 
810
                                }
 
811
                                settings.comm_showing = TRUE;
821
812
                                key = main_update_nav_controls(tmpkey);
822
813
                                main_display_commentary(work_buf[MODULE],key);
823
814
                                main_display_bible(NULL, key);
824
815
                                main_keep_bibletext_dialog_in_sync((gchar*)key);
825
 
                                if(key) g_free((gchar*)key);
 
816
                                if (key) g_free((gchar*)key);
826
817
                        break;
827
818
                        case DICTIONARY_TYPE:
828
819
                                main_display_dictionary(work_buf[MODULE],
829
820
                                                        tmpkey);
830
821
                        break;
831
822
                        case BOOK_TYPE:
832
 
                                main_display_book(work_buf[MODULE], tmpkey); 
 
823
                                if (gtk_notebook_get_current_page
 
824
                                    (GTK_NOTEBOOK
 
825
                                     (widgets.notebook_comm_book)) != 1) {
 
826
                                        gchar *save = settings.special_anchor;
 
827
                                        gtk_notebook_set_current_page(
 
828
                                            GTK_NOTEBOOK (widgets.
 
829
                                                          notebook_comm_book), 1);
 
830
                                        settings.special_anchor = save;
 
831
                                }
 
832
                                settings.comm_showing = FALSE;
 
833
                                main_display_book(work_buf[MODULE], tmpkey);
833
834
                        break;
834
835
                }
835
836
        } else { /* module name not found or not given */
836
 
                if(verse_count) { 
 
837
                if (verse_count) {
837
838
                        key = main_update_nav_controls(tmpkey);
838
839
                        /* display in current Bible and Commentary */
839
840
                        main_display_commentary(NULL, key);
840
841
                        main_display_bible(NULL, key);
841
842
                        main_keep_bibletext_dialog_in_sync((gchar*)key);
842
 
                        
 
843
 
843
844
                        editor_sync_with_main();
844
 
                        
845
 
                        if(key) g_free((gchar*)key);
 
845
 
 
846
                        if (key) g_free((gchar*)key);
846
847
                } else {
847
848
                        alert_url_not_found(url);
848
849
                }
849
 
        } 
 
850
        }
850
851
        g_strfreev(work_buf);
851
852
        settings.addhistoryitem = TRUE;
852
853
        handling_uri = FALSE;
887
888
            strstr(url, "bible://")) {
888
889
                GString *url_clean = hex_decode(url);
889
890
                GS_message(("url_clean = %s", url_clean->str));
890
 
                
 
891
 
891
892
                retval = sword_uri(url_clean->str, clicked);
892
893
                g_string_free(url_clean, TRUE);
893
894
        }
923
924
                strongs = g_strdup((gchar*)m_url.getParameterValue("lemma"));
924
925
                stype = g_strdup((gchar*)m_url.getParameterValue("type"));
925
926
                svalue = g_strdup((gchar*)m_url.getParameterValue("value"));
926
 
                
 
927
 
927
928
                // XXX gross hack-fix
928
929
                // AraSVD is named "Smith & Van Dyke", using a literal '&'.
929
930
                // this is technically a Sword bug: Sword should encode it.
930
931
                // we work around it here: replace '&' with '+'.  *sigh*
931
932
                //if (svalue = strstr(, " & "))
932
933
                //      *(svalue+1) = '-';
933
 
                         
 
934
 
934
935
                GS_message(("action = %s", action));
935
936
                GS_message(("type = %s", stype));
936
937
                GS_message(("value = %s", svalue));
1050
1051
        else
1051
1052
                return g_strdup("");
1052
1053
}
1053
 
 
 
1054
 
1054
1055
/******************************************************************************
1055
1056
 * Name
1056
1057
 *   hex_decode