Merge lp:~artem-anufrij/audience/dont-autoplay-on-startup into lp:~audience-members/audience/trunk
- dont-autoplay-on-startup
- Merge into trunk
Proposed by
Artem Anufrij
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | xapantu | ||||
Approved revision: | 537 | ||||
Merged at revision: | 538 | ||||
Proposed branch: | lp:~artem-anufrij/audience/dont-autoplay-on-startup | ||||
Merge into: | lp:~audience-members/audience/trunk | ||||
Diff against target: |
219 lines (+25/-31) 2 files modified
src/Audience.vala (+12/-18) src/Widgets/VideoPlayer.vala (+13/-13) |
||||
To merge this branch: | bzr merge lp:~artem-anufrij/audience/dont-autoplay-on-startup | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
xapantu (community) | fixed | Needs Fixing | |
Cody Garver | Pending | ||
Review via email: mp+270737@code.launchpad.net |
This proposal supersedes a proposal from 2015-06-08.
Commit message
Don't autoplay on startup
Description of the change
Don't autoplay on startup
To post a comment you must log in.
Revision history for this message
Cody Garver (codygarver) wrote : Posted in a previous version of this proposal | # |
review:
Needs Fixing
Revision history for this message
Cody Garver (codygarver) wrote : Posted in a previous version of this proposal | # |
No controls visible when Audience starts paused
review:
Needs Fixing
Revision history for this message
Artem Anufrij (artem-anufrij) wrote : | # |
added a menu item 'Resume last video' if last video wasn't finished
Revision history for this message
xapantu (xapantu) wrote : | # |
Please don't fix style issues when you try to fix a bug, it is just more annoying to read the diff ;)
Revision history for this message
xapantu (xapantu) wrote : | # |
See inline comment.
review:
Needs Fixing
- 537. By Artem Anufrij
-
playbin.set_state (Gst.State.PAUSED); -> playing = false;
Revision history for this message
Artem Anufrij (artem-anufrij) wrote : | # |
fixed:
playbin.set_state (Gst.State.PAUSED); -> playing = false;
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/Audience.vala' | |||
2 | --- src/Audience.vala 2015-07-28 06:24:05 +0000 | |||
3 | +++ src/Audience.vala 2015-09-11 13:53:33 +0000 | |||
4 | @@ -128,7 +128,7 @@ | |||
5 | 128 | settings = new Settings (); | 128 | settings = new Settings (); |
6 | 129 | mainwindow = new Gtk.Window (); | 129 | mainwindow = new Gtk.Window (); |
7 | 130 | video_player = Widgets.VideoPlayer.get_default (); | 130 | video_player = Widgets.VideoPlayer.get_default (); |
9 | 131 | video_player.notify["playing"].connect (() => {bottom_bar.toggle_play_pause ();}); | 131 | video_player.notify["playing"].connect (() => { bottom_bar.toggle_play_pause (); }); |
10 | 132 | 132 | ||
11 | 133 | clutter = new GtkClutter.Embed (); | 133 | clutter = new GtkClutter.Embed (); |
12 | 134 | 134 | ||
13 | @@ -339,7 +339,7 @@ | |||
14 | 339 | }); | 339 | }); |
15 | 340 | 340 | ||
16 | 341 | //save position in video when not finished playing | 341 | //save position in video when not finished playing |
18 | 342 | mainwindow.destroy.connect (() => {on_destroy ();}); | 342 | mainwindow.destroy.connect (() => { on_destroy (); }); |
19 | 343 | 343 | ||
20 | 344 | //playlist wants us to open a file | 344 | //playlist wants us to open a file |
21 | 345 | playlist.play.connect ((file) => { | 345 | playlist.play.connect ((file) => { |
22 | @@ -354,7 +354,7 @@ | |||
23 | 354 | } | 354 | } |
24 | 355 | }); | 355 | }); |
25 | 356 | 356 | ||
27 | 357 | stage.notify["allocation"].connect (() => {allocate_bottombar ();}); | 357 | stage.notify["allocation"].connect (() => { allocate_bottombar (); }); |
28 | 358 | } | 358 | } |
29 | 359 | 359 | ||
30 | 360 | private void allocate_bottombar () { | 360 | private void allocate_bottombar () { |
31 | @@ -412,7 +412,7 @@ | |||
32 | 412 | restore_playlist (); | 412 | restore_playlist (); |
33 | 413 | open_file (filename); | 413 | open_file (filename); |
34 | 414 | video_player.playing = false; | 414 | video_player.playing = false; |
36 | 415 | Idle.add (() => {video_player.progress = settings.last_stopped; return false;}); | 415 | Idle.add (() => { video_player.progress = settings.last_stopped; return false; }); |
37 | 416 | video_player.playing = true; | 416 | video_player.playing = true; |
38 | 417 | break; | 417 | break; |
39 | 418 | case 2: | 418 | case 2: |
40 | @@ -420,7 +420,7 @@ | |||
41 | 420 | clutter.show_all (); | 420 | clutter.show_all (); |
42 | 421 | open_file (playlist.get_first_item ().get_path ()); | 421 | open_file (playlist.get_first_item ().get_path ()); |
43 | 422 | video_player.playing = false; | 422 | video_player.playing = false; |
45 | 423 | Idle.add (() => {video_player.progress = 0; return false;}); | 423 | Idle.add (() => { video_player.progress = 0; return false; }); |
46 | 424 | video_player.playing = true; | 424 | video_player.playing = true; |
47 | 425 | break; | 425 | break; |
48 | 426 | case 3: | 426 | case 3: |
49 | @@ -445,7 +445,6 @@ | |||
50 | 445 | 445 | ||
51 | 446 | if (d.run () == Gtk.ResponseType.OK) { | 446 | if (d.run () == Gtk.ResponseType.OK) { |
52 | 447 | open_file (entry.text, true); | 447 | open_file (entry.text, true); |
53 | 448 | video_player.playing = !settings.playback_wait; | ||
54 | 449 | welcome.hide (); | 448 | welcome.hide (); |
55 | 450 | clutter.show_all (); | 449 | clutter.show_all (); |
56 | 451 | } | 450 | } |
57 | @@ -760,7 +759,6 @@ | |||
58 | 760 | 759 | ||
59 | 761 | var root = volume.get_mount ().get_default_location (); | 760 | var root = volume.get_mount ().get_default_location (); |
60 | 762 | open_file (root.get_uri (), true); | 761 | open_file (root.get_uri (), true); |
61 | 763 | video_player.playing = !settings.playback_wait; | ||
62 | 764 | 762 | ||
63 | 765 | welcome.hide (); | 763 | welcome.hide (); |
64 | 766 | clutter.show_all (); | 764 | clutter.show_all (); |
65 | @@ -782,7 +780,7 @@ | |||
66 | 782 | return (event.state & modifier) == modifier; | 780 | return (event.state & modifier) == modifier; |
67 | 783 | } | 781 | } |
68 | 784 | 782 | ||
70 | 785 | internal void open_file (string filename, bool dont_modify = false) { | 783 | internal void open_file (string filename, bool play = true) { |
71 | 786 | var file = File.new_for_commandline_arg (filename); | 784 | var file = File.new_for_commandline_arg (filename); |
72 | 787 | 785 | ||
73 | 788 | if (file.query_file_type (0) == FileType.DIRECTORY) { | 786 | if (file.query_file_type (0) == FileType.DIRECTORY) { |
74 | @@ -791,12 +789,12 @@ | |||
75 | 791 | }); | 789 | }); |
76 | 792 | 790 | ||
77 | 793 | file = playlist.get_first_item (); | 791 | file = playlist.get_first_item (); |
79 | 794 | play_file (file.get_uri ()); | 792 | play_file (file.get_uri (), play); |
80 | 795 | } else if (is_subtitle (filename) && video_player.playing) { | 793 | } else if (is_subtitle (filename) && video_player.playing) { |
81 | 796 | video_player.set_subtitle_uri (filename); | 794 | video_player.set_subtitle_uri (filename); |
82 | 797 | } else { | 795 | } else { |
83 | 798 | playlist.add_item (file); | 796 | playlist.add_item (file); |
85 | 799 | play_file (file.get_uri ()); | 797 | play_file (file.get_uri (), play); |
86 | 800 | } | 798 | } |
87 | 801 | } | 799 | } |
88 | 802 | 800 | ||
89 | @@ -830,7 +828,7 @@ | |||
90 | 830 | return false; | 828 | return false; |
91 | 831 | } | 829 | } |
92 | 832 | 830 | ||
94 | 833 | public void play_file (string uri) { | 831 | public void play_file (string uri, bool play = true) { |
95 | 834 | debug ("Opening %s", uri); | 832 | debug ("Opening %s", uri); |
96 | 835 | video_player.uri = uri; | 833 | video_player.uri = uri; |
97 | 836 | playlist.set_current (uri); | 834 | playlist.set_current (uri); |
98 | @@ -841,7 +839,7 @@ | |||
99 | 841 | video_player.set_subtitle_uri (sub_uri); | 839 | video_player.set_subtitle_uri (sub_uri); |
100 | 842 | 840 | ||
101 | 843 | mainwindow.title = get_title (uri); | 841 | mainwindow.title = get_title (uri); |
103 | 844 | video_player.playing = !settings.playback_wait; | 842 | video_player.playing = play; |
104 | 845 | 843 | ||
105 | 846 | Gtk.RecentManager recent_manager = Gtk.RecentManager.get_default (); | 844 | Gtk.RecentManager recent_manager = Gtk.RecentManager.get_default (); |
106 | 847 | recent_manager.add_item (uri); | 845 | recent_manager.add_item (uri); |
107 | @@ -861,12 +859,8 @@ | |||
108 | 861 | restore_playlist (); | 859 | restore_playlist (); |
109 | 862 | 860 | ||
110 | 863 | if (settings.last_stopped > 0) { | 861 | if (settings.last_stopped > 0) { |
117 | 864 | welcome.hide (); | 862 | open_file (settings.current_video, false); |
118 | 865 | clutter.show_all (); | 863 | Idle.add (() => { video_player.progress = settings.last_stopped; return false; }); |
113 | 866 | open_file (settings.current_video); | ||
114 | 867 | video_player.playing = false; | ||
115 | 868 | Idle.add (() => {video_player.progress = settings.last_stopped; return false;}); | ||
116 | 869 | video_player.playing = !settings.playback_wait; | ||
119 | 870 | } | 864 | } |
120 | 871 | } | 865 | } |
121 | 872 | } | 866 | } |
122 | 873 | 867 | ||
123 | === modified file 'src/Widgets/VideoPlayer.vala' | |||
124 | --- src/Widgets/VideoPlayer.vala 2015-05-16 10:13:38 +0000 | |||
125 | +++ src/Widgets/VideoPlayer.vala 2015-09-11 13:53:33 +0000 | |||
126 | @@ -120,7 +120,7 @@ | |||
127 | 120 | at_end = false; | 120 | at_end = false; |
128 | 121 | 121 | ||
129 | 122 | relayout (); | 122 | relayout (); |
131 | 123 | playing = true; | 123 | playing = false; |
132 | 124 | } | 124 | } |
133 | 125 | } | 125 | } |
134 | 126 | 126 | ||
135 | @@ -187,7 +187,7 @@ | |||
136 | 187 | public signal void configure_window (uint video_w, uint video_h); | 187 | public signal void configure_window (uint video_w, uint video_h); |
137 | 188 | public signal void progression_changed (double current_time, double total_time); | 188 | public signal void progression_changed (double current_time, double total_time); |
138 | 189 | public signal void external_subtitle_changed (string? uri); | 189 | public signal void external_subtitle_changed (string? uri); |
140 | 190 | 190 | ||
141 | 191 | private VideoPlayer () { | 191 | private VideoPlayer () { |
142 | 192 | video = new Clutter.Texture (); | 192 | video = new Clutter.Texture (); |
143 | 193 | 193 | ||
144 | @@ -255,9 +255,9 @@ | |||
145 | 255 | GLib.Error e; string detail; | 255 | GLib.Error e; string detail; |
146 | 256 | msg.parse_error (out e, out detail); | 256 | msg.parse_error (out e, out detail); |
147 | 257 | playbin.set_state (Gst.State.NULL); | 257 | playbin.set_state (Gst.State.NULL); |
149 | 258 | 258 | ||
150 | 259 | warning (detail); | 259 | warning (detail); |
152 | 260 | 260 | ||
153 | 261 | show_error (e.message); | 261 | show_error (e.message); |
154 | 262 | break; | 262 | break; |
155 | 263 | case Gst.MessageType.EOS: | 263 | case Gst.MessageType.EOS: |
156 | @@ -266,19 +266,19 @@ | |||
157 | 266 | case Gst.MessageType.ELEMENT: | 266 | case Gst.MessageType.ELEMENT: |
158 | 267 | if (msg.get_structure () == null) | 267 | if (msg.get_structure () == null) |
159 | 268 | break; | 268 | break; |
161 | 269 | 269 | ||
162 | 270 | if (Gst.PbUtils.is_missing_plugin_message (msg)) { | 270 | if (Gst.PbUtils.is_missing_plugin_message (msg)) { |
163 | 271 | error (); | 271 | error (); |
164 | 272 | playbin.set_state (Gst.State.NULL); | 272 | playbin.set_state (Gst.State.NULL); |
166 | 273 | 273 | ||
167 | 274 | handle_missing_plugin (msg); | 274 | handle_missing_plugin (msg); |
168 | 275 | /*TODO } else { //may be navigation command | 275 | /*TODO } else { //may be navigation command |
169 | 276 | var nav_msg = Gst.Navigation.message_get_type (msg); | 276 | var nav_msg = Gst.Navigation.message_get_type (msg); |
171 | 277 | 277 | ||
172 | 278 | if (nav_msg == Gst.NavigationMessageType.COMMANDS_CHANGED) { | 278 | if (nav_msg == Gst.NavigationMessageType.COMMANDS_CHANGED) { |
173 | 279 | var q = Gst.Navigation.query_new_commands (); | 279 | var q = Gst.Navigation.query_new_commands (); |
174 | 280 | pipeline.query (q); | 280 | pipeline.query (q); |
176 | 281 | 281 | ||
177 | 282 | uint n; | 282 | uint n; |
178 | 283 | gst_navigation_query_parse_commands_length (q, out n); | 283 | gst_navigation_query_parse_commands_length (q, out n); |
179 | 284 | for (var i=0;i<n;i++) { | 284 | for (var i=0;i<n;i++) { |
180 | @@ -379,10 +379,10 @@ | |||
181 | 379 | var grid = new Gtk.Grid (); | 379 | var grid = new Gtk.Grid (); |
182 | 380 | var err = new Gtk.Image.from_icon_name ("dialog-error", Gtk.IconSize.DIALOG); | 380 | var err = new Gtk.Image.from_icon_name ("dialog-error", Gtk.IconSize.DIALOG); |
183 | 381 | err.margin_right = 12; | 381 | err.margin_right = 12; |
185 | 382 | 382 | ||
186 | 383 | var err_label = new Gtk.Label (""); | 383 | var err_label = new Gtk.Label (""); |
187 | 384 | err_label.set_markup ("<b>%s</b>".printf (_("Oops! Audience can't play this file!"))); | 384 | err_label.set_markup ("<b>%s</b>".printf (_("Oops! Audience can't play this file!"))); |
189 | 385 | 385 | ||
190 | 386 | grid.margin = 12; | 386 | grid.margin = 12; |
191 | 387 | grid.attach (err, 0, 0, 1, 1); | 387 | grid.attach (err, 0, 0, 1, 1); |
192 | 388 | grid.attach (err_label, 1, 0, 1, 1); | 388 | grid.attach (err_label, 1, 0, 1, 1); |
193 | @@ -448,7 +448,7 @@ | |||
194 | 448 | //prevent screenlocking in Gnome 3 using org.gnome.SessionManager | 448 | //prevent screenlocking in Gnome 3 using org.gnome.SessionManager |
195 | 449 | void set_screenlock (bool enable) { | 449 | void set_screenlock (bool enable) { |
196 | 450 | try { | 450 | try { |
198 | 451 | session_manager = Bus.get_proxy_sync (BusType.SESSION, | 451 | session_manager = Bus.get_proxy_sync (BusType.SESSION, |
199 | 452 | "org.gnome.SessionManager", "/org/gnome/SessionManager"); | 452 | "org.gnome.SessionManager", "/org/gnome/SessionManager"); |
200 | 453 | if (enable) { | 453 | if (enable) { |
201 | 454 | session_manager.Uninhibit (inhibit_cookie); | 454 | session_manager.Uninhibit (inhibit_cookie); |
202 | @@ -471,7 +471,7 @@ | |||
203 | 471 | playbin.seek_simple (Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.ACCURATE, int64.max (new_position, 1)); | 471 | playbin.seek_simple (Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.ACCURATE, int64.max (new_position, 1)); |
204 | 472 | return; | 472 | return; |
205 | 473 | } | 473 | } |
207 | 474 | 474 | ||
208 | 475 | playbin.seek_simple (Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.ACCURATE, new_position); | 475 | playbin.seek_simple (Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.ACCURATE, new_position); |
209 | 476 | } | 476 | } |
210 | 477 | 477 | ||
211 | @@ -500,7 +500,7 @@ | |||
212 | 500 | if (font == "") { | 500 | if (font == "") { |
213 | 501 | var gnome_settings = new GLib.Settings ("org.gnome.desktop.interface"); | 501 | var gnome_settings = new GLib.Settings ("org.gnome.desktop.interface"); |
214 | 502 | font = gnome_settings.get_string ("font-name"); | 502 | font = gnome_settings.get_string ("font-name"); |
216 | 503 | } | 503 | } |
217 | 504 | subtitle_font = font; | 504 | subtitle_font = font; |
218 | 505 | } | 505 | } |
219 | 506 | } | 506 | } |
Controls are hidden until you mouse hover, it's supposed to always show while paused