Permalink
Browse files

Make labels on "Add Dictionary" dialog translatable

  • Loading branch information...
1 parent 3a13252 commit 8eaeb656c7b0465abb14e246f256286a02b5d521 @ueno committed Mar 8, 2013
Showing with 47 additions and 14 deletions.
  1. +24 −7 src/ibus-skk-preferences.ui.in
  2. +23 −7 src/setup.vala
@@ -72,15 +72,10 @@
<property name="xalign">1</property>
<property name="xscale">0.5</property>
<child>
- <object class="GtkComboBoxText" id="dict_type_comboboxtext">
+ <object class="GtkComboBox" id="dict_type_combobox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="entry_text_column">0</property>
- <items>
- <item translatable="yes">System</item>
- <item translatable="yes">User</item>
- <item translatable="yes">SKK Server</item>
- </items>
+ <property name="model">dict_type_liststore</property>
</object>
</child>
</object>
@@ -166,6 +161,28 @@
</row>
</data>
</object>
+ <object class="GtkListStore" id="dict_type_liststore">
+ <columns>
+ <!-- column-name type -->
+ <column type="gchararray"/>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">System</col>
+ <col id="1">System</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">User</col>
+ <col id="1">User</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">SKK Server</col>
+ <col id="1">SKK Server</col>
+ </row>
+ </data>
+ </object>
<object class="GtkDialog" id="dialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
View
@@ -34,7 +34,7 @@ class Setup : Object {
// dict dialog
Gtk.Dialog dict_dialog;
- Gtk.ComboBoxText dict_type_comboboxtext;
+ Gtk.ComboBox dict_type_combobox;
Gtk.HBox dict_data_hbox;
Gtk.Widget dict_data_widget;
Gtk.FileChooserButton dict_filechooserbutton;
@@ -123,9 +123,9 @@ class Setup : Object {
assert (object != null);
dict_dialog = (Gtk.Dialog) object;
- object = builder.get_object ("dict_type_comboboxtext");
+ object = builder.get_object ("dict_type_combobox");
assert (object != null);
- dict_type_comboboxtext = (Gtk.ComboBoxText) object;
+ dict_type_combobox = (Gtk.ComboBox) object;
object = builder.get_object ("dict_data_hbox");
assert (object != null);
@@ -162,6 +162,10 @@ class Setup : Object {
initial_input_mode_combobox.pack_start (renderer, false);
initial_input_mode_combobox.set_attributes (renderer, "text", 0);
+ renderer = new Gtk.CellRendererText ();
+ dict_type_combobox.pack_start (renderer, false);
+ dict_type_combobox.set_attributes (renderer, "text", 0);
+
model = new Gtk.ListStore (2, typeof (string), typeof (string));
model.set_sort_column_id (1, Gtk.SortType.ASCENDING);
typing_rule_combobox.set_model (model);
@@ -198,11 +202,11 @@ class Setup : Object {
}
});
- dict_type_comboboxtext.changed.connect (() => {
- var text = dict_type_comboboxtext.get_active_text ();
+ dict_type_combobox.changed.connect (() => {
if (dict_data_widget != null) {
dict_data_hbox.remove (dict_data_widget);
}
+ string text = get_active_dict_type ();
if (text == "System") {
dict_filechooserbutton.set_current_folder (
Path.build_filename (Config.DATADIR, "skk"));
@@ -227,7 +231,7 @@ class Setup : Object {
dict_data_hbox.show_all ();
dict_data_hbox.sensitive = true;
});
- dict_type_comboboxtext.active = 0;
+ dict_type_combobox.active = 0;
}
void populate_dictionaries_treeview () {
@@ -249,10 +253,22 @@ class Setup : Object {
}
}
+ string get_active_dict_type () {
+ string text;
+ Gtk.TreeIter iter;
+ if (dict_type_combobox.get_active_iter (out iter)) {
+ var model = (Gtk.ListStore) dict_type_combobox.get_model ();
+ model.get (iter, 1, out text, -1);
+ } else {
+ assert_not_reached ();
+ }
+ return text;
+ }
+
void add_dict () {
if (dict_dialog.run () == Gtk.ResponseType.OK) {
PList? plist = null;
- var text = dict_type_comboboxtext.get_active_text ();
+ string text = get_active_dict_type ();
if (text == "System") {
string? file = dict_filechooserbutton.get_filename ();
if (file != null) {

0 comments on commit 8eaeb65

Please sign in to comment.