Verified Commit d9d007db authored by Todd Weaver's avatar Todd Weaver
Browse files

Adding application inhibiting/uninhibiting screensaver and lockscreen and logout on playing/pausing

parent 8fab7cae
...@@ -266,7 +266,9 @@ class ResultsBox(Gtk.Box): ...@@ -266,7 +266,9 @@ class ResultsBox(Gtk.Box):
flags = Gio.FileCopyFlags flags = Gio.FileCopyFlags
dl_stream.copy_async(dest, dl_stream.copy_async(dest,
# bitwise or (not tuple) for multiple flags # bitwise or (not tuple) for multiple flags
Gio.FileCopyFlags.OVERWRITE|Gio.FileCopyFlags.ALL_METADATA|Gio.FileCopyFlags.TARGET_DEFAULT_PERMS, Gio.FileCopyFlags.OVERWRITE |
Gio.FileCopyFlags.ALL_METADATA |
Gio.FileCopyFlags.TARGET_DEFAULT_PERMS,
GLib.PRIORITY_LOW, None, GLib.PRIORITY_LOW, None,
self.progress_video_cb, (), self.progress_video_cb, (),
self.ready_video_cb, None) self.ready_video_cb, None)
...@@ -332,8 +334,9 @@ class ResultsBox(Gtk.Box): ...@@ -332,8 +334,9 @@ class ResultsBox(Gtk.Box):
self.play.set_visible(False) self.play.set_visible(False)
self.pause.set_visible(True) self.pause.set_visible(True)
self.player.set_state(Gst.State.PLAYING)
self.app_window.is_playing = True self.app_window.is_playing = True
self.app_window.inhibit_app()
self.player.set_state(Gst.State.PLAYING)
# hide the poster, show the video # hide the poster, show the video
self.player_box.show_all() self.player_box.show_all()
...@@ -348,17 +351,19 @@ class ResultsBox(Gtk.Box): ...@@ -348,17 +351,19 @@ class ResultsBox(Gtk.Box):
GLib.timeout_add_seconds(1, self.update_slider) GLib.timeout_add_seconds(1, self.update_slider)
def null_out_player(self): def null_out_player(self):
self.play.set_visible(True) self.inactivate_player()
self.pause.set_visible(False)
self.player.set_state(Gst.State.NULL) self.player.set_state(Gst.State.NULL)
self.app_window.is_playing = False
@Gtk.Template.Callback() @Gtk.Template.Callback()
def pause_button(self, button): def pause_button(self, button):
self.inactivate_player()
self.player.set_state(Gst.State.PAUSED)
def inactivate_player(self):
self.play.set_visible(True) self.play.set_visible(True)
self.pause.set_visible(False) self.pause.set_visible(False)
self.player.set_state(Gst.State.PAUSED)
self.app_window.is_playing = False self.app_window.is_playing = False
self.app_window.uninhibit_app()
@Gtk.Template.Callback() @Gtk.Template.Callback()
def speed_button(self, button): def speed_button(self, button):
......
...@@ -184,6 +184,18 @@ class StreamWindow(Handy.ApplicationWindow): ...@@ -184,6 +184,18 @@ class StreamWindow(Handy.ApplicationWindow):
for flowbox in flowboxes: for flowbox in flowboxes:
flowbox.get_child().null_out_player() flowbox.get_child().null_out_player()
def inhibit_app(self):
self.application.inhibit(self,
Gtk.ApplicationInhibitFlags.IDLE |
Gtk.ApplicationInhibitFlags.LOGOUT,
"Stream-ing Video")
def uninhibit_app(self):
self.application.inhibit(self,
Gtk.ApplicationInhibitFlags.IDLE |
Gtk.ApplicationInhibitFlags.LOGOUT,
"Stream-ing Video")
def hide_error_box(self): def hide_error_box(self):
self.error_box.set_visible(False) self.error_box.set_visible(False)
self.error_heading.set_label("Error") self.error_heading.set_label("Error")
...@@ -197,6 +209,7 @@ class StreamWindow(Handy.ApplicationWindow): ...@@ -197,6 +209,7 @@ class StreamWindow(Handy.ApplicationWindow):
def __init__(self, **kwargs): def __init__(self, **kwargs):
super().__init__(**kwargs) super().__init__(**kwargs)
self.application = kwargs.get('application', None)
self.is_playing = False self.is_playing = False
self.is_fullscreen = False self.is_fullscreen = False
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment