Merge lp:~philip.scott/audience/refresh-welcome into lp:~audience-members/audience/trunk

Proposed by Felipe Escoto
Status: Merged
Merged at revision: 634
Proposed branch: lp:~philip.scott/audience/refresh-welcome
Merge into: lp:~audience-members/audience/trunk
Diff against target: 65 lines (+22/-1)
4 files modified
src/Widgets/PlayerPage.vala (+1/-0)
src/Widgets/Playlist.vala (+0/-1)
src/Widgets/WelcomePage.vala (+20/-0)
src/Window.vala (+1/-0)
To merge this branch: bzr merge lp:~philip.scott/audience/refresh-welcome
Reviewer Review Type Date Requested Status
Audience Members Pending
Review via email: mp+303444@code.launchpad.net

Commit message

Refresh WelcomePage after playback

Description of the change

Adds a way to refresh the Welcome screen when the video is done playing and the stack switches back to it.

Prevent's having a wrong video on the WelcomeScreen as the last played

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Widgets/PlayerPage.vala'
2--- src/Widgets/PlayerPage.vala 2016-08-07 00:33:53 +0000
3+++ src/Widgets/PlayerPage.vala 2016-08-19 16:36:35 +0000
4@@ -261,6 +261,7 @@
5 bottom_bar.preferences_popover.is_setup = false;
6
7 Audience.Services.Inhibitor.get_instance ().inhibit ();
8+ settings.current_video = uri;
9 }
10
11 public string get_played_uri () {
12
13=== modified file 'src/Widgets/Playlist.vala'
14--- src/Widgets/Playlist.vala 2016-07-30 17:06:42 +0000
15+++ src/Widgets/Playlist.vala 2016-08-19 16:36:35 +0000
16@@ -220,7 +220,6 @@
17 }
18
19 settings.last_played_videos = videos;
20- settings.current_video = videos[current];
21 }
22
23 private void restore_playlist () {
24
25=== modified file 'src/Widgets/WelcomePage.vala'
26--- src/Widgets/WelcomePage.vala 2016-07-29 05:02:48 +0000
27+++ src/Widgets/WelcomePage.vala 2016-08-19 16:36:35 +0000
28@@ -52,5 +52,25 @@
29 }
30 });
31 }
32+
33+ public void refresh () {
34+ var replay_button = get_button_from_index (1);
35+ var disk_button = get_button_from_index (2);
36+
37+ var filename = settings.current_video;
38+ var last_file = File.new_for_uri (filename);
39+
40+ replay_button.title = _("Replay last video");
41+ replay_button.description = get_title (last_file.get_basename ());
42+ replay_button.icon.icon_name = ("media-playlist-repeat");
43+
44+ bool show_last_file = settings.current_video != "";
45+ if (last_file.query_exists () == false) {
46+ show_last_file = false;
47+ }
48+
49+ set_item_visible (1, show_last_file);
50+ set_item_visible (2, disk_manager.has_media_volumes ());
51+ }
52 }
53 }
54
55=== modified file 'src/Window.vala'
56--- src/Window.vala 2016-08-08 17:08:44 +0000
57+++ src/Window.vala 2016-08-19 16:36:35 +0000
58@@ -322,6 +322,7 @@
59
60 private void on_player_ended () {
61 main_stack.set_visible_child (welcome_page);
62+ welcome_page.refresh ();
63 title = App.get_instance ().program_name;
64 get_window ().set_cursor (null);
65 unfullscreen ();

Subscribers

People subscribed via source and target branches