[chronojump/optimizeRFD] new products: website is opened and better management of no news
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump/optimizeRFD] new products: website is opened and better management of no news
- Date: Sun, 3 Jan 2021 17:07:56 +0000 (UTC)
commit ee109e73892a9c63b5a5e97bce7eeb8964dba5c1
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Dec 30 10:55:39 2020 +0100
new products: website is opened and better management of no news
glade/app1.glade | 104 +++++++++++++++++++++++++++++++++++++++------
src/constants.cs | 2 +-
src/gui/app1/chronojump.cs | 9 +++-
src/gui/app1/menu.cs | 11 ++++-
src/gui/app1/news.cs | 37 ++++++++++------
5 files changed, 134 insertions(+), 29 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index ec2232901..b2c40057f 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -300,6 +300,7 @@
<child>
<widget class="GtkButton" id="button_menu_news1">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip" translatable="yes">New products</property>
@@ -968,6 +969,7 @@
<child>
<widget class="GtkButton" id="button_menu_news">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked"
handler="on_button_menu_news_clicked" swapped="no"/>
@@ -23583,6 +23585,9 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -28429,6 +28434,18 @@ Concentric</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
+ <widget class="GtkLabel"
id="label_video_encoder_tests_will_be_filmed">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Tests
will be filmed</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkHBox"
id="hbox_video_encoder_capturing">
<property name="can_focus">False</property>
<property name="spacing">4</property>
@@ -28465,18 +28482,6 @@ Concentric</property>
</packing>
</child>
<child>
- <widget class="GtkLabel"
id="label_video_encoder_tests_will_be_filmed">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Tests
will be filmed</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
<widget class="GtkHBox"
id="hbox_video_encoder_no_capturing">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -36723,6 +36728,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -42694,6 +42702,15 @@ then click this button.</property>
<property name="can_focus">False</property>
<property name="spacing">16</property>
<child>
+ <widget class="GtkVBox" id="vbox239">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkVBox" id="vbox240">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
<widget class="GtkLabel"
id="label_news_description_and_link">
<property name="width_request">300</property>
<property name="visible">True</property>
@@ -42708,6 +42725,69 @@ then click this button.</property>
</packing>
</child>
<child>
+ <widget class="GtkVBox" id="vbox241">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox11">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">center</property>
+ <child>
+ <widget class="GtkButton"
id="button_new_open_browser">
+ <property name="label" translatable="yes">Open
in browser</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_new_open_browser_clicked" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_news_open_error">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Sorry,
cannot open website.</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkImage" id="image_news">
<property name="width_request">400</property>
<property name="visible">True</property>
diff --git a/src/constants.cs b/src/constants.cs
index 7f1a63a0c..f480eaded 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -875,7 +875,7 @@ public class Constants
}
public static string WebsiteNotFoundStr()
{
- return Catalog.GetString("Sorry, cannot open website.");
+ return Catalog.GetString("Sorry, cannot open website."); //note this message is also in Glade
}
public static string DirectoryCannotOpenStr()
{
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 7a09493c2..5c105a612 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -6792,7 +6792,14 @@ LogB.Debug("mc finished 5");
// 2) update newsAtDB_l
newsAtDB_l = SqliteNews.Select(false, -1);
- // 3) end this pulse
+ // 3) if there are news (locally is not 0), make it sensitive
+ if(newsAtDB_l.Count > 0)
+ {
+ button_menu_news.Sensitive = true;
+ button_menu_news1.Sensitive = true;
+ }
+
+ // 4) end this pulse
LogB.Information("pulsePingAndNews ending here");
LogB.ThreadEnded();
return false;
diff --git a/src/gui/app1/menu.cs b/src/gui/app1/menu.cs
index 62881a247..d758a6939 100644
--- a/src/gui/app1/menu.cs
+++ b/src/gui/app1/menu.cs
@@ -309,8 +309,15 @@ public partial class ChronoJumpWindow
private void on_button_menu_news_clicked (object o, EventArgs args)
{
- //fill the widget
- news_fill(preferences.newsLanguageEs);
+ /*
+ * this will not happen because button will be unresponsive
+ if(newsAtDB_l.Count == 0)
+ return;
+ */
+
+ news_setup(); //setup radios: language and arrows
+ news_fill(0, true); //fill the widget
+ alignment_news.Show(); // is hidden at beginning to allow being well shown when filled
//sensitivity and notebook management
menus_and_mode_sensitive(false);
diff --git a/src/gui/app1/news.cs b/src/gui/app1/news.cs
index 24a502853..2821d3124 100644
--- a/src/gui/app1/news.cs
+++ b/src/gui/app1/news.cs
@@ -34,26 +34,33 @@ public partial class ChronoJumpWindow
[Widget] Gtk.RadioButton radio_news_language_spanish;
[Widget] Gtk.Label label_news_title;
[Widget] Gtk.Label label_news_description_and_link;
+ [Widget] Gtk.Label label_news_open_error;
[Widget] Gtk.Image image_news;
Pixbuf image_news_pixbuf;
+ private int currentNewsPos;
- private void news_fill (bool langEs)
+ private void news_setup()
{
- if(newsAtDB_l.Count == 0)
- return;
-
- if(langEs)
+ if(preferences.newsLanguageEs)
radio_news_language_spanish.Active = true;
else
radio_news_language_english.Active = true;
+ }
+
+ private void news_fill (int currentPos, bool textAndVideo)
+ {
+ currentNewsPos = currentPos;
- News news = newsAtDB_l[0];
+ News news = newsAtDB_l[currentNewsPos];
- news_setLabels(news, langEs);
- news_loadImage(news);
+ news_setLabels(news, preferences.newsLanguageEs);
- alignment_news.Show(); // is hidden at beginning to allow being well shown when filled
+ if(textAndVideo)
+ news_loadImage(news);
+
+ //hide the error opening web (if it is visible)
+ label_news_open_error.Visible = false;
}
private void news_setLabels(News news, bool langEs)
@@ -100,10 +107,14 @@ public partial class ChronoJumpWindow
Sqlite.Close();
// 2) rewrite the labels
- if(newsAtDB_l.Count == 0)
- return;
+ news_fill (currentNewsPos, false);
+ }
+
+ private void on_button_new_open_browser_clicked (object o, EventArgs args)
+ {
+ string link = newsAtDB_l[currentNewsPos].GetLink(preferences.newsLanguageEs);
- News news = newsAtDB_l[0];
- news_setLabels(news, langEs);
+ LogB.Information("Opening browser (r mac install) to: " + link);
+ label_news_open_error.Visible = ! Util.OpenFolder(link);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]