[chronojump] preferences.newsLanguageEs to manage language of the news



commit df60ed15e9ad054764bd5dac33cffc473f73ec29
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Dec 29 20:54:23 2020 +0100

    preferences.newsLanguageEs to manage language of the news

 src/gui/app1/menu.cs      | 2 +-
 src/gui/app1/news.cs      | 6 +++---
 src/preferences.cs        | 5 +++--
 src/sqlite/preferences.cs | 2 ++
 4 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/gui/app1/menu.cs b/src/gui/app1/menu.cs
index 63822dda..7963d7ba 100644
--- a/src/gui/app1/menu.cs
+++ b/src/gui/app1/menu.cs
@@ -310,7 +310,7 @@ public partial class ChronoJumpWindow
        private void on_button_menu_news_clicked (object o, EventArgs args)
        {
                //fill the widget
-               news_fill(newsAtDB_l);
+               news_fill(newsAtDB_l, preferences.newsLanguageEs);
 
                //sensitivity and notebook management
                menus_and_mode_sensitive(false);
diff --git a/src/gui/app1/news.cs b/src/gui/app1/news.cs
index 38e5f377..2d08eb41 100644
--- a/src/gui/app1/news.cs
+++ b/src/gui/app1/news.cs
@@ -36,16 +36,16 @@ public partial class ChronoJumpWindow
 
        Pixbuf image_news_pixbuf;
 
-       private void news_fill (List<News> news_l)
+       private void news_fill (List<News> news_l, bool langEs)
        {
                if(news_l.Count == 0)
                        return;
 
                News news = news_l[0];
 
-               label_news_title.Text = "<b>" + news.GetTitle(false) + "</b>";
+               label_news_title.Text = "<b>" + news.GetTitle(langEs) + "</b>";
                label_news_title.UseMarkup = true;
-               label_news_description_and_link.Text = news.GetDescription(false) + "\n\n" + 
news.GetLink(false);
+               label_news_description_and_link.Text = news.GetDescription(langEs) + "\n\n" + 
news.GetLink(langEs);
 
                news_loadImage(news);
                alignment_news.Show(); // is hidden at beginning to allow being well shown when filled
diff --git a/src/preferences.cs b/src/preferences.cs
index e1beff5c..3230f1a4 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -25,7 +25,7 @@ using System.Collections.Generic; //List<T>
 public class Preferences 
 {
        /*
-        * these are sent to preferences window
+        * these are managed on preferences window
         */
 
        //main tab
@@ -182,7 +182,7 @@ public class Preferences
        }
 
        /*
-        * these are NOT sent to preferences window
+        * these are NOT managed on preferences window
         */
        
        public bool allowFinishRjAfterTime;
@@ -193,6 +193,7 @@ public class Preferences
        public string machineID;
        public Constants.MultimediaStorage multimediaStorage;
        public string databaseVersion;
+       public bool newsLanguageEs;
 
        //jumps
        public bool jumpsFVProfileOnlyBestInWeight;
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index d63bc563..d720406f 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -449,6 +449,8 @@ class SqlitePreferences : Sqlite
                                else
                                        preferences.restTimeSeconds = 0;
                        }
+                       else if(reader[0].ToString() == NewsLanguageEs )
+                               preferences.newsLanguageEs = reader[1].ToString() == "True"; //bool
                        else if(reader[0].ToString() == UnitsStr)
                                preferences.units = (Preferences.UnitsEnum)
                                        Enum.Parse(typeof(Preferences.UnitsEnum), reader[1].ToString());


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]