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

« back to all changes in this revision

Viewing changes to src/gnome2/main_menu.c

  • 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:
23
23
#include <config.h>
24
24
#endif
25
25
 
26
 
#ifndef WITHOUT_GNOME
27
 
#include <gnome.h>
28
 
#else
29
26
#include <gtk/gtk.h>
30
27
#include <unistd.h>
31
 
#endif
32
28
 
33
29
#include <glade/glade-xml.h>
34
30
 
35
 
#ifdef USE_GTKHTML3_14_23
36
31
#include "editor/slib-editor.h"
37
 
#else
38
 
#include "editor/bonobo-editor.h"
39
 
#endif
40
32
 
41
33
#include "gui/about_xiphos.h"
42
34
#include "gui/about_sword.h"
82
74
 * Synopsis
83
75
 *   #include "gui/main_menu.h"
84
76
 *
85
 
 *   void on_help_contents_activate(GtkMenuItem * menuitem, 
86
 
 *                                              gpointer user_data)     
 
77
 *   void on_help_contents_activate(GtkMenuItem * menuitem,
 
78
 *                                              gpointer user_data)
87
79
 *
88
80
 * Description
89
81
 *   display the help contents file
93
85
 */
94
86
G_MODULE_EXPORT void
95
87
on_help_contents_activate(GtkMenuItem * menuitem, gpointer user_data)
96
 
{       
 
88
{
97
89
        GError *error = NULL;
98
90
#ifdef WIN32
99
91
        const char *lang = g_getenv("LANG");
108
100
        xiphos_open_default(help_file);
109
101
        g_free(help_file);
110
102
#else
111
 
#ifndef WITHOUT_GNOME
112
 
        if (gnome_help_display((const gchar*)"xiphos.xml", 
113
 
                               NULL, &error) == FALSE) {
114
 
                GS_warning(("%s",error->message));
115
 
                g_error_free(error);        
116
 
        }
117
 
#else
118
103
        gtk_show_uri (NULL, "ghelp:xiphos", gtk_get_current_event_time(), &error);
119
104
        if (error != NULL) {
120
105
                GS_warning(("%s", error->message));
121
106
                g_error_free(error);
122
107
        }
123
 
#endif /* WITHOUT_GNOME */
124
108
 
125
109
#endif /* WIN32 */
126
110
}
132
116
 * Synopsis
133
117
 *   #include "gui/main_menu.h"
134
118
 *
135
 
 *   void on_mailing_list_activate(GtkMenuItem * menuitem, 
136
 
 *                                              gpointer user_data)     
 
119
 *   void on_mailing_list_activate(GtkMenuItem * menuitem,
 
120
 *                                              gpointer user_data)
137
121
 *
138
122
 * Description
139
123
 *   open web browser to the mailing list signup page
155
139
 * Synopsis
156
140
 *   #include "gui/main_menu.h"
157
141
 *
158
 
 *   void on_live_chat_activate(GtkMenuItem * menuitem, 
159
 
 *                                              gpointer user_data)     
 
142
 *   void on_live_chat_activate(GtkMenuItem * menuitem,
 
143
 *                                              gpointer user_data)
160
144
 *
161
145
 * Description
162
146
 *   open web browser to freenode irc chat
185
169
 * Synopsis
186
170
 *   #include "gui/main_menu.h"
187
171
 *
188
 
 *   void on_report_bug_activate(GtkMenuItem * menuitem, 
189
 
 *                                              gpointer user_data)     
 
172
 *   void on_report_bug_activate(GtkMenuItem * menuitem,
 
173
 *                                              gpointer user_data)
190
174
 *
191
175
 * Description
192
176
 *   open web browser to sourceforge bug tracker
209
193
 *   #include "gui/main_menu.h"
210
194
 *
211
195
 *   void on_about_the_sword_project1_activate(GtkMenuItem * menuitem,
212
 
 *                                              gpointer user_data)     
 
196
 *                                              gpointer user_data)
213
197
 *
214
198
 * Description
215
199
 *   display - The SWORD Project - about information
234
218
 *   #include "gui/main_menu.h"
235
219
 *
236
220
 *   void on_about_translation_activate(GtkMenuItem * menuitem,
237
 
 *                                      gpointer user_data)     
 
221
 *                                      gpointer user_data)
238
222
 *
239
223
 * Description
240
224
 *   display - The SWORD Project - about information
258
242
 * Synopsis
259
243
 *   #include "gui/main_menu.h"
260
244
 *
261
 
 *   void on_daily_devotion_activate(GtkMenuItem *menuitem, 
262
 
 *                                              gpointer user_data)     
 
245
 *   void on_daily_devotion_activate(GtkMenuItem *menuitem,
 
246
 *                                              gpointer user_data)
263
247
 *
264
248
 * Description
265
249
 *   display daily devotion in shortcut bar viewer
280
264
 * Synopsis
281
265
 *   #include "gui/main_menu.h"
282
266
 *
283
 
 *   void on_preferences_activate(GtkMenuItem *menuitem, gpointer user_data)    
 
267
 *   void on_preferences_activate(GtkMenuItem *menuitem, gpointer user_data)
284
268
 *
285
269
 * Description
286
270
 *   open preferences dialog
301
285
 * Synopsis
302
286
 *   #include "gui/main_menu.h"
303
287
 *
304
 
 *   void on_search_activate(GtkMenuItem * menuitem, gpointer user_data)        
 
288
 *   void on_search_activate(GtkMenuItem * menuitem, gpointer user_data)
305
289
 *
306
290
 * Description
307
291
 *   display search group in shortcut bar
311
295
 */
312
296
G_MODULE_EXPORT void on_search_activate(GtkMenuItem * menuitem, gpointer user_data)
313
297
{
314
 
        if (!settings.showshortcutbar) 
 
298
        if (!settings.showshortcutbar)
315
299
                gui_sidebar_showhide();
316
300
        gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets.notebook_sidebar),2);
317
301
}
323
307
 * Synopsis
324
308
 *   #include "gui/main_menu.h"
325
309
 *
326
 
 *   void on_verse_style_activate(GtkMenuItem *menuitem, gpointer user_data)    
 
310
 *   void on_verse_style_activate(GtkMenuItem *menuitem, gpointer user_data)
327
311
 *
328
312
 * Description
329
313
 *   toggle between verse and paragraph style
337
321
G_MODULE_EXPORT void
338
322
on_verse_style_activate(GtkCheckMenuItem * menuitem, gpointer user_data)
339
323
{
340
 
        if(style_display) {
341
 
                gchar *file = g_strdup_printf("%s/modops.conf", 
 
324
        if (style_display) {
 
325
                gchar *file = g_strdup_printf("%s/modops.conf",
342
326
                                              settings.gSwordDir);
343
327
                gchar *url = g_strdup_printf("sword://%s/%s",
344
328
                                             settings.MainWindowModule,
350
334
                                     ? "verse"
351
335
                                     : "paragraph"));
352
336
                if (settings.havebible) {
353
 
                        main_url_handler(url, TRUE);            
 
337
                        main_url_handler(url, TRUE);
354
338
                }
355
339
                g_free(url);
356
340
                g_free(file);
364
348
 * Synopsis
365
349
 *   #include "gui/main_menu.h"
366
350
 *
367
 
 *   void on_linked_tabs_activate(GtkMenuItem *menuitem, gpointer user_data)    
 
351
 *   void on_linked_tabs_activate(GtkMenuItem *menuitem, gpointer user_data)
368
352
 *
369
353
 * Description
370
354
 *   toggle linking tabs together.
389
373
 * Synopsis
390
374
 *   #include "gui/main_menu.h"
391
375
 *
392
 
 *   void on_read_aloud_activate(GtkMenuItem *menuitem, gpointer user_data)     
 
376
 *   void on_read_aloud_activate(GtkMenuItem *menuitem, gpointer user_data)
393
377
 *
394
378
 * Description
395
379
 *   toggle reading scripture out loud.
414
398
 * Synopsis
415
399
 *   #include "gui/main_menu.h"
416
400
 *
417
 
 *   void on_show_verse_numbers_activate(GtkMenuItem *menuitem, gpointer user_data)     
 
401
 *   void on_show_verse_numbers_activate(GtkMenuItem *menuitem, gpointer user_data)
418
402
 *
419
403
 * Description
420
404
 *   toggle showing verse numbers together.
438
422
 * Synopsis
439
423
 *   #include "gui/main_menu.h"
440
424
 *
441
 
 *   void on_versehighlight_activate(GtkMenuItem *menuitem, gpointer user_data) 
 
425
 *   void on_versehighlight_activate(GtkMenuItem *menuitem, gpointer user_data)
442
426
 *
443
427
 * Description
444
428
 *   toggle special current verse highlight.
462
446
 * Synopsis
463
447
 *   #include "gui/main_menu.h"
464
448
 *
465
 
 *   void gui_parallel_tab_activate(GtkMenuItem *menuitem, gpointer user_data)  
 
449
 *   void gui_parallel_tab_activate(GtkMenuItem *menuitem, gpointer user_data)
466
450
 *
467
451
 * Description
468
452
 *   toggle special current verse highlight.
473
457
G_MODULE_EXPORT void
474
458
gui_parallel_tab_activate(GtkCheckMenuItem * menuitem, gpointer user_data)
475
459
{
476
 
        if(!settings.browsing) return;
477
 
        if(!settings.showparatab && !menuitem->active) {
 
460
        if (!settings.browsing) return;
 
461
        if (!settings.showparatab && !menuitem->active) {
478
462
                xml_set_value("Xiphos", "misc", "showparatab", "0");
479
463
                return;
480
464
        }
481
 
                
 
465
 
482
466
        settings.showparatab = menuitem->active;
483
467
        xml_set_value("Xiphos", "misc", "showparatab",
484
468
                      (settings.showparatab ? "1" : "0"));
485
 
        if(settings.showparatab) {
 
469
        if (settings.showparatab) {
486
470
                gui_open_parallel_view_in_new_tab();
487
471
                gui_force_parallel_tab_sync();
488
 
        } else          
 
472
        } else
489
473
                gui_close_passage_tab  (gtk_notebook_page_num (
490
474
                                        GTK_NOTEBOOK (widgets.notebook_main),
491
475
                                        widgets.parallel_tab));
498
482
 * Synopsis
499
483
 *   #include "gui/main_menu.h"
500
484
 *
501
 
 *   void on_side_preview_activate(GtkMenuItem *menuitem, gpointer user_data)   
 
485
 *   void on_side_preview_activate(GtkMenuItem *menuitem, gpointer user_data)
502
486
 *
503
487
 * Description
504
488
 *   toggle special previewer in sidebar.
522
506
 * Synopsis
523
507
 *   #include "gui/main_menu.h"
524
508
 *
525
 
 *   void on_double_space_text_activate(GtkMenuItem *menuitem, gpointer user_data)      
 
509
 *   void on_double_space_text_activate(GtkMenuItem *menuitem, gpointer user_data)
526
510
 *
527
511
 * Description
528
512
 *   toggle double-spacing of text.
547
531
 * Synopsis
548
532
 *   #include "gui/main_menu.h"
549
533
 *
550
 
 *   void on_quit_activate(GtkMenuItem * menuitem, gpointer user_data)  
 
534
 *   void on_quit_activate(GtkMenuItem * menuitem, gpointer user_data)
551
535
 *
552
536
 * Description
553
537
 *   do a nice orderly shut down and exit xiphos
564
548
        /* shutdown the sword stuff */
565
549
        main_shutdown_backend();
566
550
        gtk_main_quit();
567
 
        gtk_exit(0);
568
551
        gtk_widget_destroy(widgets.app);
 
552
        exit(0);
569
553
}
570
554
 
571
555
 
576
560
 * Synopsis
577
561
 *   #include "gui/main_menu.h"
578
562
 *
579
 
 *   void on_about_xiphos_activate(GtkMenuItem * menuitem, 
580
 
 *                                      gpointer user_data)     
 
563
 *   void on_about_xiphos_activate(GtkMenuItem * menuitem,
 
564
 *                                      gpointer user_data)
581
565
 *
582
566
 * Description
583
 
 *   display xiphos about dialog 
 
567
 *   display xiphos about dialog
584
568
 *
585
569
 * Return value
586
570
 *   void
602
586
 * Synopsis
603
587
 *   #include "gui/main_menu.h"
604
588
 *
605
 
 *   void on_save_session_activate(GtkMenuItem * menuitem, gpointer user_data)  
 
589
 *   void on_save_session_activate(GtkMenuItem * menuitem, gpointer user_data)
606
590
 *
607
591
 * Description
608
592
 *   ask for a file name (with file-chooser) and save the current tabs to that file
617
601
        gchar *tabs_dir;
618
602
 
619
603
        tabs_dir = g_strdup_printf("%s/tabs/",settings.gSwordDir);
620
 
        
 
604
 
621
605
        if (g_access(tabs_dir, F_OK) == -1) {
622
606
                if ((g_mkdir(tabs_dir, S_IRWXU)) == -1) {
623
607
                        fprintf(stderr, "can't create tabs dir");
624
608
                        return;
625
609
                }
626
610
        }
627
 
        
 
611
 
628
612
        dialog = gtk_file_chooser_dialog_new ("Save Session",
629
613
                                      NULL,
630
614
                                      GTK_FILE_CHOOSER_ACTION_SAVE,
651
635
 *  redisplay_to_realign
652
636
 *
653
637
 * Synopsis
654
 
 *   void redisplay_to_realign()        
 
638
 *   void redisplay_to_realign()
655
639
 *
656
640
 * Description
657
641
 *    when en/disabling panes, we must redisplay in order that text
658
 
 *    (especially current verse) not suddenly find themselves out of view.
 
642
 *    (especially current verse) not suddenly find itself out of view.
659
643
 *
660
644
 * Return value
661
645
 *   void
670
654
        realign_busy = TRUE;
671
655
 
672
656
        /* first realize the pane size updates. */
673
 
        while (gtk_events_pending())
674
 
                gtk_main_iteration();
 
657
        sync_windows();
 
658
 
675
659
        /* then just redisplay everything as-is. */
676
660
        gchar *url = g_strdup_printf("sword://%s/%s",
677
661
                                     settings.MainWindowModule,
678
662
                                     settings.currentverse);
679
 
        main_url_handler(url, TRUE);            
 
663
        main_url_handler(url, TRUE);
680
664
        g_free(url);
681
665
        if (settings.DictWindowModule) {
682
666
                url = g_strdup_printf("sword://%s/%s",
683
667
                                      settings.DictWindowModule,
684
668
                                      settings.dictkey);
685
 
                main_url_handler(url, TRUE);            
 
669
                main_url_handler(url, TRUE);
686
670
                g_free(url);
687
671
        }
688
672
 
696
680
 * Synopsis
697
681
 *   #include "gui/main_menu.h"
698
682
 *
699
 
 *   void on_open_session_activate(GtkMenuItem * menuitem, gpointer user_data)  
 
683
 *   void on_open_session_activate(GtkMenuItem * menuitem, gpointer user_data)
700
684
 *
701
685
 * Description
702
686
 *   ask for file name (with file-chooser) and load tabs from that file
711
695
        gchar *tabs_dir;
712
696
 
713
697
        tabs_dir = g_strdup_printf("%s/tabs/",settings.gSwordDir);
714
 
        
 
698
 
715
699
        if (g_access(tabs_dir, F_OK) == -1) {
716
700
                if ((g_mkdir(tabs_dir, S_IRWXU)) == -1) {
717
701
                        fprintf(stderr, "can't create tabs dir");
748
732
 * Synopsis
749
733
 *   #include "gui/main_menu.h"
750
734
 *
751
 
 *   void on_show_bible_text_activate(GtkMenuItem * menuitem, gpointer user_data)       
 
735
 *   void on_show_bible_text_activate(GtkMenuItem * menuitem, gpointer user_data)
752
736
 *
753
737
 * Description
754
738
 *    toggle Bibletext window
763
747
        redisplay_to_realign();
764
748
}
765
749
 
766
 
 
 
750
 
767
751
G_MODULE_EXPORT void
768
752
on_preview_activate(GtkMenuItem * menuitem, gpointer user_data)
769
753
{
779
763
 * Synopsis
780
764
 *   #include "gui/main_menu.h"
781
765
 *
782
 
 *   void on_show_commentary_activate(GtkMenuItem * menuitem, gpointer user_data)       
 
766
 *   void on_show_commentary_activate(GtkMenuItem * menuitem, gpointer user_data)
783
767
 *
784
768
 * Description
785
769
 *    toggle commentary window *** we need to change the name of this
803
787
 * Synopsis
804
788
 *   #include "gui/main_menu.h"
805
789
 *
806
 
 *   void on_show_dictionary_lexicon_activate(GtkMenuItem * menuitem, gpointer user_data)       
 
790
 *   void on_show_dictionary_lexicon_activate(GtkMenuItem * menuitem, gpointer user_data)
807
791
 *
808
792
 * Description
809
793
 *    toggle lower_workbook view (on or off)
826
810
 * Synopsis
827
811
 *   #include "gui/main_menu.h"
828
812
 *
829
 
 *   void on_module_manager_activate(GtkMenuItem * menuitem, gpointer user_data)        
 
813
 *   void on_module_manager_activate(GtkMenuItem * menuitem, gpointer user_data)
830
814
 *
831
815
 * Description
832
 
 *    
 
816
 *
833
817
 *
834
818
 * Return value
835
819
 *   void
847
831
 * Synopsis
848
832
 *   #include "gui/main_menu.h"
849
833
 *
850
 
 *   void on_open_studypad_activate(GtkMenuItem * menuitem, gpointer user_data) 
 
834
 *   void on_open_studypad_activate(GtkMenuItem * menuitem, gpointer user_data)
851
835
 *
852
836
 * Description
853
837
 *    open studypad editor - if studypad dialog exist bring it to the
889
873
        gchar *glade_file;
890
874
        GladeXML *gxml;
891
875
 //     const gchar *mname = NULL;
892
 
        
 
876
 
893
877
        glade_file = gui_general_user_file ("xi-menus.glade", FALSE);
894
878
        g_return_val_if_fail (glade_file != NULL, NULL);
895
 
        
 
879
 
896
880
        gxml = glade_xml_new (glade_file, "menu_main", NULL);
897
 
                
 
881
 
898
882
        g_free (glade_file);
899
883
        g_return_val_if_fail (gxml != NULL, NULL);
900
 
        
 
884
 
901
885
        GtkWidget *menu         = glade_xml_get_widget (gxml, "menu_main");
902
 
        
 
886
 
903
887
        widgets.viewtexts_item = glade_xml_get_widget (gxml, "show_bible_text");
904
888
        widgets.viewpreview_item = glade_xml_get_widget (gxml, "preview");
905
889
        widgets.viewcomms_item = glade_xml_get_widget (gxml, "commentary");
911
895
        widgets.versehighlight_item = glade_xml_get_widget (gxml, "highlight_current_verse");
912
896
        widgets.parallel_tab_item = glade_xml_get_widget (gxml, "show_parallel_view_in_a_tab");
913
897
        widgets.side_preview_item = glade_xml_get_widget (gxml, "show_previewer_in_sidebar");
914
 
        
 
898
 
915
899
        widgets.doublespace_item = glade_xml_get_widget (gxml, "double_space_text");
916
900
#ifndef USE_GTKMOZEMBED
917
901
        gtk_widget_hide(widgets.doublespace_item);
918
902
#endif /* !USE_GTKMOZEMBED */
919
 
        
 
903
 
920
904
        /* map tab's show state into view menu. */
921
905
        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
922
906
                                       (widgets.viewtexts_item),
936
920
        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
937
921
                                       (widgets.side_preview_item),
938
922
                                       settings.show_previewer_in_sidebar);
939
 
                
 
923
 
940
924
        /* update other status toys */
941
925
        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
942
926
                                       (widgets.versestyle_item),
958
942
                                       (widgets.doublespace_item),
959
943
                                       settings.doublespace);
960
944
#endif /* USE_GTKMOZEMBED */
961
 
        
 
945
 
962
946
        /* connect signals and data */
963
947
        glade_xml_signal_autoconnect_full
964
948
                (gxml, (GladeXMLConnectFunc)gui_glade_signal_connect_func, NULL);
965
949
 
966
950
        //set up global function to handle all link buttons
967
951
        gtk_link_button_set_uri_hook (link_uri_hook, NULL, NULL);
968
 
        
 
952
 
969
953
        return menu;
970
954
}