diff --git a/data/inscriptions.gschema.xml.in b/data/inscriptions.gschema.xml.in
index aeed32f..bfe98d9 100644
--- a/data/inscriptions.gschema.xml.in
+++ b/data/inscriptions.gschema.xml.in
@@ -69,5 +69,10 @@
Whether to highlight both source and target
Highlights alternating colours on both source and target in the TextView
+
+ ["", "", "", "", ""]
+ Five last selected language code
+ A list of recent selected language codes to make obvious in the UI
+
\ No newline at end of file
diff --git a/data/meson.build b/data/meson.build
index 334999f..65eb1ab 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -73,6 +73,7 @@ if not windows_build
# Inject some variables into the metainfo file before merging in the translations
appstream_conf = configuration_data()
appstream_conf.set('APP_ID', app_id)
+ appstream_conf.set('APP_NAME', app_name)
appstream_conf.set('GETTEXT_PACKAGE', meson.project_name())
appstream_file_in = configure_file(
input: 'inscriptions.metainfo.xml.in.in',
diff --git a/src/Constants.vala b/src/Constants.vala
index 868a376..f1bb2fd 100644
--- a/src/Constants.vala
+++ b/src/Constants.vala
@@ -42,6 +42,7 @@ namespace Inscriptions {
public const string KEY_VERTICAL_LAYOUT = "vertical-layout";
public const string KEY_AUTO_TRANSLATE = "auto-translate";
public const string KEY_HIGHLIGHT = "highlight";
+ public const string KEY_HEATMAP = "language-heatmap";
// Backend
public const string KEY_SOURCE_LANGUAGE = "source-language";
diff --git a/src/Objects/DDModel.vala b/src/Objects/DDModel.vala
index 668c691..f8bb94c 100644
--- a/src/Objects/DDModel.vala
+++ b/src/Objects/DDModel.vala
@@ -10,7 +10,7 @@
*/
public class Inscriptions.DDModel : Object {
- static string[] heatmap {get; set;}
+ static string[] heatmap = Application.settings.get_strv (KEY_HEATMAP);
public GLib.ListStore model {get; set;}
public Gtk.SignalListItemFactory factory_header {get; set;}
@@ -20,6 +20,8 @@ public class Inscriptions.DDModel : Object {
public signal void selection_changed (string language_code_selected);
public DDModel () {
+ //heatmap = Application.settings.get_strv (KEY_HEATMAP);
+
// The Langs will populate this thing
model = new GLib.ListStore(typeof(Lang));
@@ -49,7 +51,29 @@ public class Inscriptions.DDModel : Object {
var item = list_item.get_child () as Gtk.Label;
item.label = item_language.name;
+ // We save up a heatmap. It is rebuilt from scratch to avoid redundant language codes
+ // We could check beforehand and gate this but it would affect lisibility
+ string[] temp_heatmap = {item_language.code};
+ foreach (var recent_language_code in heatmap) {
+ if (recent_language_code != item_language.code) {
+ temp_heatmap += recent_language_code;
+ }
+
+ if (temp_heatmap.length == 5) {
+ break;
+ }
+ }
+ heatmap = temp_heatmap;
+ Application.settings.set_strv (KEY_HEATMAP, heatmap);
+
+ //Application.settings.set_strv (KEY_HEATMAP, heatmap);
+ print ("\n");
+ foreach (var element in heatmap) {
+ print (element + " ");
+ }
+
// Tell everyone language changed
+ // Items are connected to this and get their shit together out of it
selection_changed (item_language.code);
//print ("switched to: %s %s\n".printf (item_language.name, item_language.code));
}
diff --git a/src/Widgets/LanguageDropDown.vala b/src/Widgets/LanguageDropDown.vala
index 5206cb8..5c5fd38 100644
--- a/src/Widgets/LanguageDropDown.vala
+++ b/src/Widgets/LanguageDropDown.vala
@@ -44,7 +44,7 @@ public class Inscriptions.LanguageDropDown : Granite.Bin {
private void on_selected_language () {
var selected_lang = dropdown.get_selected_item () as Lang;
- print ("\nSELECTED %s\n".printf (selected_lang.code));
+ //print ("\nSELECTED %s\n".printf (selected_lang.code));
language_changed (selected_lang.code);
}
diff --git a/src/Widgets/LanguageItem.vala b/src/Widgets/LanguageItem.vala
index caa9cc3..2ac3c30 100644
--- a/src/Widgets/LanguageItem.vala
+++ b/src/Widgets/LanguageItem.vala
@@ -28,7 +28,8 @@ public class Inscriptions.LanguageItem : Gtk.Box {
construct {
selected_emblem = new Gtk.Image.from_icon_name ("emblem-default-symbolic") {
visible = false,
- halign = Gtk.Align.END
+ halign = Gtk.Align.END,
+ margin_end = 15
};
selected_emblem.add_css_class (Granite.STYLE_CLASS_FLAT);
@@ -51,6 +52,7 @@ public class Inscriptions.LanguageItem : Gtk.Box {
}
public void on_position_changed (string language_code_selected) {
+ //print ("ADJUST! ");
if (language_code_selected == language_code) {
label_widget.add_css_class ("bold");
diff --git a/src/Widgets/LanguageSelectionBox.vala b/src/Widgets/LanguageSelectionBox.vala
index 19069b7..eb3f713 100644
--- a/src/Widgets/LanguageSelectionBox.vala
+++ b/src/Widgets/LanguageSelectionBox.vala
@@ -74,7 +74,7 @@ public class Inscriptions.LanguageSelectionBox : Gtk.Box {
dropdown_target.selected = code;
}
- print ("Set " + code + " Source?" + is_source.to_string () + "\n");
+ //print ("Set " + code + " Source?" + is_source.to_string () + "\n");
}
private string get_selected_language (bool is_source) {
diff --git a/src/Widgets/Panes/TargetPane.vala b/src/Widgets/Panes/TargetPane.vala
index 142b585..8b1a12c 100644
--- a/src/Widgets/Panes/TargetPane.vala
+++ b/src/Widgets/Panes/TargetPane.vala
@@ -24,7 +24,7 @@ public class Inscriptions.TargetPane : Inscriptions.Pane {
margin_end = MARGIN_MENU_HALF
};
- var placeholder = new Gtk.Label (_("Ready!")) {
+ var placeholder = new Gtk.Label (_("Ready to translate")) {
wrap = true
};
placeholder.add_css_class (Granite.STYLE_CLASS_H2_LABEL);