Merge lp:~artem-anufrij/audience/return-to-library into lp:~audience-members/audience/trunk

Proposed by Artem Anufrij
Status: Merged
Approved by: Danielle Foré
Approved revision: 662
Merged at revision: 660
Proposed branch: lp:~artem-anufrij/audience/return-to-library
Merge into: lp:~audience-members/audience/trunk
Diff against target: 82 lines (+26/-23)
2 files modified
src/Widgets/PlayerPage.vala (+1/-1)
src/Window.vala (+25/-22)
To merge this branch: bzr merge lp:~artem-anufrij/audience/return-to-library
Reviewer Review Type Date Requested Status
Danielle Foré Approve
Review via email: mp+306627@code.launchpad.net

Commit message

* Return to library when playback ends
* Fix a crash when playback ends

To post a comment you must log in.
661. By Artem Anufrij

fixed chrash

662. By Artem Anufrij

set uri to an empty string instead null

Revision history for this message
Danielle Foré (danrabbit) wrote :

Works for me. Navigates to the correct page, no crash, navigation buttons behave correctly.

review: Approve

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-09-21 17:31:49 +0000
3+++ src/Widgets/PlayerPage.vala 2016-09-23 16:17:36 +0000
4@@ -273,7 +273,7 @@
5 }
6
7 public void reset_played_uri () {
8- playback.uri = null;
9+ playback.uri = "";
10 }
11
12 public void next () {
13
14=== modified file 'src/Window.vala'
15--- src/Window.vala 2016-09-22 18:15:07 +0000
16+++ src/Window.vala 2016-09-23 16:17:36 +0000
17@@ -52,24 +52,7 @@
18
19 navigation_button = new NavigationButton ();
20 navigation_button.clicked.connect (() => {
21- double progress = player_page.get_progress ();
22- if (progress > 0) {
23- settings.last_stopped = progress;
24- }
25- player_page.playing = false;
26- player_page.reset_played_uri ();
27- title = App.get_instance ().program_name;
28- get_window ().set_cursor (null);
29-
30- if (navigation_button.label == navigation_button_library) {
31- navigation_button.label = navigation_button_welcomescreen;
32- main_stack.set_visible_child_full ("library", Gtk.StackTransitionType.SLIDE_RIGHT);
33- } else {
34- navigation_button.hide ();
35- main_stack.set_visible_child (welcome_page);
36- }
37-
38- welcome_page.refresh ();
39+ navigate_back ();
40 });
41
42 header.pack_start (navigation_button);
43@@ -370,10 +353,7 @@
44 }
45
46 private void on_player_ended () {
47- main_stack.set_visible_child (welcome_page);
48- welcome_page.refresh ();
49- title = App.get_instance ().program_name;
50- get_window ().set_cursor (null);
51+ navigate_back ();
52 unfullscreen ();
53 }
54
55@@ -397,4 +377,27 @@
56
57 welcome_page.refresh ();
58 }
59+
60+ public void navigate_back () {
61+ double progress = player_page.get_progress ();
62+ if (progress > 0) {
63+ settings.last_stopped = progress;
64+ }
65+ if (player_page.playing) {
66+ player_page.playing = false;
67+ player_page.reset_played_uri ();
68+ }
69+ title = App.get_instance ().program_name;
70+ get_window ().set_cursor (null);
71+
72+ if (navigation_button.label == navigation_button_library) {
73+ navigation_button.label = navigation_button_welcomescreen;
74+ main_stack.set_visible_child_full ("library", Gtk.StackTransitionType.SLIDE_RIGHT);
75+ } else {
76+ navigation_button.hide ();
77+ main_stack.set_visible_child (welcome_page);
78+ }
79+
80+ welcome_page.refresh ();
81+ }
82 }

Subscribers

People subscribed via source and target branches