The Birdfont Source Code


All Repositories / birdfont.git / blob – RSS feed

LanguageSelectionTab.vala in /libbirdfont

This file is a part of the Birdfont project.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
Circle boundaries heads/master
1 /* 2 Copyright (C) 2013 Johan Mattsson 3 4 This library is free software; you can redistribute it and/or modify 5 it under the terms of the GNU Lesser General Public License as 6 published by the Free Software Foundation; either version 3 of the 7 License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, but 10 WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 */ 14 using Cairo; 15 using Math; 16 17 namespace BirdFont { 18 19 public class LanguageSelectionTab : Table { 20 21 public LanguageSelectionTab () { 22 } 23 24 public override Gee.ArrayList<Row> get_rows () { 25 Gee.ArrayList<Row> rows = new Gee.ArrayList<Row> (); 26 int i = 0; 27 28 rows.add (new Row.headline (t_("Character Sets"))); 29 30 foreach (string language in DefaultLanguages.names) { 31 Row r = new Row.columns_1 (language, i, false); 32 rows.add (r); 33 i++; 34 } 35 36 return rows; 37 } 38 39 public override void update_rows () { 40 redraw_area (0, 0, allocation.width, allocation.height); 41 } 42 43 public override void selected_row (Row row, int column, bool delete_button) { 44 select_language (row.get_index ()); 45 } 46 47 void select_language (int row) { 48 string iso_code; 49 OverView overview; 50 GlyphRange gr; 51 TabBar tb = MainWindow.get_tab_bar (); 52 53 return_if_fail (0 <= row < DefaultLanguages.codes.size); 54 55 iso_code = DefaultLanguages.codes.get (row); 56 Preferences.set ("language", iso_code); 57 tb.close_display (this); 58 59 overview = MainWindow.get_overview (); 60 gr = new GlyphRange (); 61 DefaultCharacterSet.use_default_range (gr); 62 overview.set_current_glyph_range (gr); 63 OverviewTools.update_overview_characterset (); 64 FontDisplay.dirty_scrollbar = true; 65 } 66 67 public override string get_label () { 68 return t_("Character Set"); 69 } 70 71 public override string get_name () { 72 return "Character Set"; 73 } 74 } 75 76 } 77