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

« back to all changes in this revision

Viewing changes to src/main/navbar.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
49
49
 
50
50
 
51
51
void main_navbar_set(NAVBAR navbar, const char * key)
52
 
{       
 
52
{
53
53
        char *gkey = NULL;
54
54
        int book;
55
55
        GtkTreeIter iter;
56
 
        gint i,x;       
57
 
        VerseKey vkey; 
58
 
        
59
 
        if(!navbar.module_name)
 
56
        gint i,x;
 
57
        VerseKey vkey;
 
58
 
 
59
        if (!navbar.module_name)
60
60
                return;
61
 
        
 
61
 
62
62
        navbar.key = backend->get_valid_key(key);
63
 
        if(!navbar.is_dialog) {
64
 
                
65
 
                
 
63
        if (!navbar.is_dialog) {
 
64
 
 
65
 
66
66
        }
67
67
        GtkTreeModel* chapter_store = gtk_combo_box_get_model(
68
68
                        GTK_COMBO_BOX(navbar.comboboxentry_chapter));
69
69
        GtkTreeModel* verse_store = gtk_combo_box_get_model(
70
70
                        GTK_COMBO_BOX(navbar.comboboxentry_verse));
71
 
        
 
71
 
72
72
        do_display = FALSE;
73
 
        
 
73
 
74
74
        vkey.AutoNormalize(1);
75
75
        vkey = key;
76
 
        
77
 
        if((backend->module_has_testament(navbar.module_name, 1))
 
76
 
 
77
        if ((backend->module_has_testament(navbar.module_name, 1))
78
78
                                && (vkey.Testament() == 2))
79
79
                book = 39 + vkey.Book();
80
 
        else 
 
80
        else
81
81
                book = vkey.Book();
82
 
        
 
82
 
83
83
        gtk_combo_box_set_active((GtkComboBox *)navbar.comboboxentry_book,
84
84
                                             book-1);
85
 
        
 
85
 
86
86
        gtk_list_store_clear(GTK_LIST_STORE(chapter_store));
87
87
        char xtestament = vkey.Testament() ;
88
88
        char xbook = vkey.Book();
96
96
        for(i=1; i <= x; i++) {
97
97
                char *num = main_format_number(i);
98
98
                gtk_list_store_append (GTK_LIST_STORE(chapter_store), &iter);
99
 
                gtk_list_store_set(GTK_LIST_STORE(chapter_store), 
100
 
                                   &iter, 
101
 
                                   0, 
102
 
                                   num, 
 
99
                gtk_list_store_set(GTK_LIST_STORE(chapter_store),
 
100
                                   &iter,
 
101
                                   0,
 
102
                                   num,
103
103
                                   -1);
104
104
                g_free(num);
105
105
        }
106
106
        gtk_combo_box_set_active((GtkComboBox *)navbar.comboboxentry_chapter,
107
107
                                             xchapter-1);
108
 
        
 
108
 
109
109
        gtk_list_store_clear(GTK_LIST_STORE(verse_store));
110
110
        xtestament = vkey.Testament() ;
111
111
        xbook = vkey.Book();
112
112
        xchapter = vkey.Chapter();
113
 
        xverse = vkey.Verse();  
 
113
        xverse = vkey.Verse();
114
114
#ifdef SWORD_MULTIVERSE
115
115
        x = (vkey.getVerseMax());
116
116
#else
119
119
        for(i=1; i <= x; i++) {
120
120
                char *num = main_format_number(i);
121
121
                gtk_list_store_append (GTK_LIST_STORE(verse_store), &iter);
122
 
                gtk_list_store_set(GTK_LIST_STORE(verse_store), 
123
 
                                   &iter, 
124
 
                                   0, 
125
 
                                   num, 
 
122
                gtk_list_store_set(GTK_LIST_STORE(verse_store),
 
123
                                   &iter,
 
124
                                   0,
 
125
                                   num,
126
126
                                   -1);
127
127
                g_free(num);
128
128
        }
131
131
        gtk_entry_set_text(GTK_ENTRY(navbar.lookup_entry),
132
132
                                navbar.key);
133
133
        do_display = TRUE;
134
 
        g_free(gkey);   
 
134
        g_free(gkey);
135
135
}
136
136
 
137
137
 
138
138
void main_navbar_fill_book_combo(NAVBAR navbar)
139
139
{
140
 
        VerseKey key; 
141
 
        VerseKey key_abrev; 
 
140
        VerseKey key;
 
141
        VerseKey key_abrev;
142
142
        char *book = NULL;
143
143
        GtkTreeIter iter;
144
144
        int i = 0;
145
 
        
146
 
        if(navbar.testaments == backend->module_get_testaments(navbar.module_name))
 
145
 
 
146
        if (navbar.testaments == backend->module_get_testaments(navbar.module_name))
147
147
                return;
148
 
        
 
148
 
149
149
        navbar.testaments = backend->module_get_testaments(navbar.module_name);
150
 
        
 
150
 
151
151
        do_display = FALSE;
152
 
        
 
152
 
153
153
        GtkTreeModel* book_model = gtk_combo_box_get_model(
154
154
                        GTK_COMBO_BOX(navbar.comboboxentry_book));
155
155
        gtk_list_store_clear(GTK_LIST_STORE(book_model));
156
156
        if (backend->module_has_testament(navbar.module_name, 1)) {
157
 
                while(i < key.BMAX[0]) {                
 
157
                while (i < key.BMAX[0]) {
158
158
#ifdef SWORD_MULTIVERSE
159
159
                        key.Testament(1);
160
160
                        key.Book(i+1);
163
163
                        book = strdup((const char *) key.books[0][i].name);
164
164
#endif
165
165
                        char *mykey = g_strdup_printf("%s 1:1",book);
166
 
                        if(!main_get_raw_text(navbar.module_name, mykey)){
 
166
                        if (!main_get_raw_text(navbar.module_name, mykey)){
167
167
                                GS_message(("book-out: %s",book));
168
168
                                g_free(book);
169
169
                                g_free(mykey);
171
171
                        }
172
172
                        GS_message(("book: %s",book));
173
173
                        gtk_list_store_append (GTK_LIST_STORE(book_model), &iter);
174
 
                        gtk_list_store_set(     GTK_LIST_STORE(book_model), 
175
 
                                                &iter, 
176
 
                                                0, 
177
 
                                                book, 
 
174
                        gtk_list_store_set(     GTK_LIST_STORE(book_model),
 
175
                                                &iter,
 
176
                                                0,
 
177
                                                book,
178
178
                                                -1);
179
179
                        ++i;
180
180
                        g_free(book);
182
182
        }
183
183
        i = 0;
184
184
        if (backend->module_has_testament(navbar.module_name, 2)) {
185
 
                while(i < key.BMAX[1]) {                        
 
185
                while (i < key.BMAX[1]) {
186
186
#ifdef SWORD_MULTIVERSE
187
187
                        key.Testament(2);
188
188
                        key.Book(i+1);
191
191
                        book = strdup((const char *) key.books[1][i].name);
192
192
#endif
193
193
                        char *mykey = g_strdup_printf("%s 1:1",book);
194
 
                        if(!main_get_raw_text(navbar.module_name, mykey)){
 
194
                        if (!main_get_raw_text(navbar.module_name, mykey)){
195
195
                                GS_message(("book-in: %s",book));
196
196
                                g_free(book);
197
197
                                g_free(mykey);
199
199
                        }
200
200
                        GS_message(("book: %s",book));
201
201
                        gtk_list_store_append (GTK_LIST_STORE(book_model), &iter);
202
 
                        gtk_list_store_set(     GTK_LIST_STORE(book_model), 
203
 
                                                &iter, 
204
 
                                                0, 
205
 
                                                book, 
 
202
                        gtk_list_store_set(     GTK_LIST_STORE(book_model),
 
203
                                                &iter,
 
204
                                                0,
 
205
                                                book,
206
206
                                                -1);
207
207
                        ++i;
208
208
                        g_free(book);
209
209
                }
210
 
        }       
 
210
        }
211
211
        main_navbar_set(navbar,navbar.key);
212
212
        do_display = TRUE;
213
213
}