Merge lp:~artem-anufrij/audience/dont-autoplay-on-startup into lp:~audience-members/audience/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
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

Controls are hidden until you mouse hover, it's supposed to always show while paused

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
=== modified file 'src/Audience.vala'
--- src/Audience.vala 2015-07-28 06:24:05 +0000
+++ src/Audience.vala 2015-09-11 13:53:33 +0000
@@ -128,7 +128,7 @@
128 settings = new Settings ();128 settings = new Settings ();
129 mainwindow = new Gtk.Window ();129 mainwindow = new Gtk.Window ();
130 video_player = Widgets.VideoPlayer.get_default ();130 video_player = Widgets.VideoPlayer.get_default ();
131 video_player.notify["playing"].connect (() => {bottom_bar.toggle_play_pause ();});131 video_player.notify["playing"].connect (() => { bottom_bar.toggle_play_pause (); });
132132
133 clutter = new GtkClutter.Embed ();133 clutter = new GtkClutter.Embed ();
134134
@@ -339,7 +339,7 @@
339 });339 });
340340
341 //save position in video when not finished playing341 //save position in video when not finished playing
342 mainwindow.destroy.connect (() => {on_destroy ();});342 mainwindow.destroy.connect (() => { on_destroy (); });
343343
344 //playlist wants us to open a file344 //playlist wants us to open a file
345 playlist.play.connect ((file) => {345 playlist.play.connect ((file) => {
@@ -354,7 +354,7 @@
354 }354 }
355 });355 });
356356
357 stage.notify["allocation"].connect (() => {allocate_bottombar ();});357 stage.notify["allocation"].connect (() => { allocate_bottombar (); });
358 }358 }
359359
360 private void allocate_bottombar () {360 private void allocate_bottombar () {
@@ -412,7 +412,7 @@
412 restore_playlist ();412 restore_playlist ();
413 open_file (filename);413 open_file (filename);
414 video_player.playing = false;414 video_player.playing = false;
415 Idle.add (() => {video_player.progress = settings.last_stopped; return false;});415 Idle.add (() => { video_player.progress = settings.last_stopped; return false; });
416 video_player.playing = true;416 video_player.playing = true;
417 break;417 break;
418 case 2:418 case 2:
@@ -420,7 +420,7 @@
420 clutter.show_all ();420 clutter.show_all ();
421 open_file (playlist.get_first_item ().get_path ());421 open_file (playlist.get_first_item ().get_path ());
422 video_player.playing = false;422 video_player.playing = false;
423 Idle.add (() => {video_player.progress = 0; return false;});423 Idle.add (() => { video_player.progress = 0; return false; });
424 video_player.playing = true;424 video_player.playing = true;
425 break;425 break;
426 case 3:426 case 3:
@@ -445,7 +445,6 @@
445445
446 if (d.run () == Gtk.ResponseType.OK) {446 if (d.run () == Gtk.ResponseType.OK) {
447 open_file (entry.text, true);447 open_file (entry.text, true);
448 video_player.playing = !settings.playback_wait;
449 welcome.hide ();448 welcome.hide ();
450 clutter.show_all ();449 clutter.show_all ();
451 }450 }
@@ -760,7 +759,6 @@
760759
761 var root = volume.get_mount ().get_default_location ();760 var root = volume.get_mount ().get_default_location ();
762 open_file (root.get_uri (), true);761 open_file (root.get_uri (), true);
763 video_player.playing = !settings.playback_wait;
764762
765 welcome.hide ();763 welcome.hide ();
766 clutter.show_all ();764 clutter.show_all ();
@@ -782,7 +780,7 @@
782 return (event.state & modifier) == modifier;780 return (event.state & modifier) == modifier;
783 }781 }
784782
785 internal void open_file (string filename, bool dont_modify = false) {783 internal void open_file (string filename, bool play = true) {
786 var file = File.new_for_commandline_arg (filename);784 var file = File.new_for_commandline_arg (filename);
787785
788 if (file.query_file_type (0) == FileType.DIRECTORY) {786 if (file.query_file_type (0) == FileType.DIRECTORY) {
@@ -791,12 +789,12 @@
791 });789 });
792790
793 file = playlist.get_first_item ();791 file = playlist.get_first_item ();
794 play_file (file.get_uri ());792 play_file (file.get_uri (), play);
795 } else if (is_subtitle (filename) && video_player.playing) {793 } else if (is_subtitle (filename) && video_player.playing) {
796 video_player.set_subtitle_uri (filename);794 video_player.set_subtitle_uri (filename);
797 } else {795 } else {
798 playlist.add_item (file);796 playlist.add_item (file);
799 play_file (file.get_uri ());797 play_file (file.get_uri (), play);
800 }798 }
801 }799 }
802800
@@ -830,7 +828,7 @@
830 return false;828 return false;
831 }829 }
832830
833 public void play_file (string uri) {831 public void play_file (string uri, bool play = true) {
834 debug ("Opening %s", uri);832 debug ("Opening %s", uri);
835 video_player.uri = uri;833 video_player.uri = uri;
836 playlist.set_current (uri);834 playlist.set_current (uri);
@@ -841,7 +839,7 @@
841 video_player.set_subtitle_uri (sub_uri);839 video_player.set_subtitle_uri (sub_uri);
842840
843 mainwindow.title = get_title (uri);841 mainwindow.title = get_title (uri);
844 video_player.playing = !settings.playback_wait;842 video_player.playing = play;
845843
846 Gtk.RecentManager recent_manager = Gtk.RecentManager.get_default ();844 Gtk.RecentManager recent_manager = Gtk.RecentManager.get_default ();
847 recent_manager.add_item (uri);845 recent_manager.add_item (uri);
@@ -861,12 +859,8 @@
861 restore_playlist ();859 restore_playlist ();
862860
863 if (settings.last_stopped > 0) {861 if (settings.last_stopped > 0) {
864 welcome.hide ();862 open_file (settings.current_video, false);
865 clutter.show_all ();863 Idle.add (() => { video_player.progress = settings.last_stopped; return false; });
866 open_file (settings.current_video);
867 video_player.playing = false;
868 Idle.add (() => {video_player.progress = settings.last_stopped; return false;});
869 video_player.playing = !settings.playback_wait;
870 }864 }
871 }865 }
872 }866 }
873867
=== modified file 'src/Widgets/VideoPlayer.vala'
--- src/Widgets/VideoPlayer.vala 2015-05-16 10:13:38 +0000
+++ src/Widgets/VideoPlayer.vala 2015-09-11 13:53:33 +0000
@@ -120,7 +120,7 @@
120 at_end = false;120 at_end = false;
121121
122 relayout ();122 relayout ();
123 playing = true;123 playing = false;
124 }124 }
125 }125 }
126126
@@ -187,7 +187,7 @@
187 public signal void configure_window (uint video_w, uint video_h);187 public signal void configure_window (uint video_w, uint video_h);
188 public signal void progression_changed (double current_time, double total_time);188 public signal void progression_changed (double current_time, double total_time);
189 public signal void external_subtitle_changed (string? uri);189 public signal void external_subtitle_changed (string? uri);
190 190
191 private VideoPlayer () {191 private VideoPlayer () {
192 video = new Clutter.Texture ();192 video = new Clutter.Texture ();
193193
@@ -255,9 +255,9 @@
255 GLib.Error e; string detail;255 GLib.Error e; string detail;
256 msg.parse_error (out e, out detail);256 msg.parse_error (out e, out detail);
257 playbin.set_state (Gst.State.NULL);257 playbin.set_state (Gst.State.NULL);
258 258
259 warning (detail);259 warning (detail);
260 260
261 show_error (e.message);261 show_error (e.message);
262 break;262 break;
263 case Gst.MessageType.EOS:263 case Gst.MessageType.EOS:
@@ -266,19 +266,19 @@
266 case Gst.MessageType.ELEMENT:266 case Gst.MessageType.ELEMENT:
267 if (msg.get_structure () == null)267 if (msg.get_structure () == null)
268 break;268 break;
269 269
270 if (Gst.PbUtils.is_missing_plugin_message (msg)) {270 if (Gst.PbUtils.is_missing_plugin_message (msg)) {
271 error ();271 error ();
272 playbin.set_state (Gst.State.NULL);272 playbin.set_state (Gst.State.NULL);
273 273
274 handle_missing_plugin (msg);274 handle_missing_plugin (msg);
275 /*TODO } else { //may be navigation command275 /*TODO } else { //may be navigation command
276 var nav_msg = Gst.Navigation.message_get_type (msg);276 var nav_msg = Gst.Navigation.message_get_type (msg);
277 277
278 if (nav_msg == Gst.NavigationMessageType.COMMANDS_CHANGED) {278 if (nav_msg == Gst.NavigationMessageType.COMMANDS_CHANGED) {
279 var q = Gst.Navigation.query_new_commands ();279 var q = Gst.Navigation.query_new_commands ();
280 pipeline.query (q);280 pipeline.query (q);
281 281
282 uint n;282 uint n;
283 gst_navigation_query_parse_commands_length (q, out n);283 gst_navigation_query_parse_commands_length (q, out n);
284 for (var i=0;i<n;i++) {284 for (var i=0;i<n;i++) {
@@ -379,10 +379,10 @@
379 var grid = new Gtk.Grid ();379 var grid = new Gtk.Grid ();
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);
381 err.margin_right = 12;381 err.margin_right = 12;
382 382
383 var err_label = new Gtk.Label ("");383 var err_label = new Gtk.Label ("");
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!")));
385 385
386 grid.margin = 12;386 grid.margin = 12;
387 grid.attach (err, 0, 0, 1, 1);387 grid.attach (err, 0, 0, 1, 1);
388 grid.attach (err_label, 1, 0, 1, 1);388 grid.attach (err_label, 1, 0, 1, 1);
@@ -448,7 +448,7 @@
448 //prevent screenlocking in Gnome 3 using org.gnome.SessionManager448 //prevent screenlocking in Gnome 3 using org.gnome.SessionManager
449 void set_screenlock (bool enable) {449 void set_screenlock (bool enable) {
450 try {450 try {
451 session_manager = Bus.get_proxy_sync (BusType.SESSION, 451 session_manager = Bus.get_proxy_sync (BusType.SESSION,
452 "org.gnome.SessionManager", "/org/gnome/SessionManager");452 "org.gnome.SessionManager", "/org/gnome/SessionManager");
453 if (enable) {453 if (enable) {
454 session_manager.Uninhibit (inhibit_cookie);454 session_manager.Uninhibit (inhibit_cookie);
@@ -471,7 +471,7 @@
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));
472 return;472 return;
473 }473 }
474 474
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);
476 }476 }
477477
@@ -500,7 +500,7 @@
500 if (font == "") {500 if (font == "") {
501 var gnome_settings = new GLib.Settings ("org.gnome.desktop.interface");501 var gnome_settings = new GLib.Settings ("org.gnome.desktop.interface");
502 font = gnome_settings.get_string ("font-name");502 font = gnome_settings.get_string ("font-name");
503 } 503 }
504 subtitle_font = font;504 subtitle_font = font;
505 }505 }
506 }506 }

Subscribers

People subscribed via source and target branches