Merge lp:~vikoadi/audience/fix-1040729 into lp:~audience-members/audience/trunk

Proposed by Viko Adi Rahmawan
Status: Merged
Merged at revision: 270
Proposed branch: lp:~vikoadi/audience/fix-1040729
Merge into: lp:~audience-members/audience/trunk
Diff against target: 59 lines (+25/-0)
2 files modified
Audience/Utils.vala (+7/-0)
Audience/Widgets/VideoPlayer.vala (+18/-0)
To merge this branch: bzr merge lp:~vikoadi/audience/fix-1040729
Reviewer Review Type Date Requested Status
Cody Garver Approve
Tom Beckmann Approve
Review via email: mp+160981@code.launchpad.net

Description of the change

1. Create Utils.GnomeSessionManager
2. create VideoPlayer.set_screenlock method and call it from VideoPlayer.playing setter

To post a comment you must log in.
Revision history for this message
Cody Garver (codygarver) wrote :

I have been testing this and it works as advertised.

Just waiting on Tom Beckmann to get some time to check it out before merge.

Revision history for this message
Tom Beckmann (tombeckmann) wrote :

Code looks fine to me.

review: Approve
Revision history for this message
Cody Garver (codygarver) wrote :

Thanks Viko Adi!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Audience/Utils.vala'
--- Audience/Utils.vala 2013-04-06 11:45:41 +0000
+++ Audience/Utils.vala 2013-04-25 18:38:24 +0000
@@ -6,6 +6,13 @@
6 public signal void MediaPlayerKeyPressed (string application, string key);6 public signal void MediaPlayerKeyPressed (string application, string key);
7}7}
88
9[DBus (name = "org.gnome.SessionManager")]
10public interface GnomeSessionManager : GLib.Object {
11 public abstract bool isSessionRunning() throws GLib.IOError;
12 public abstract uint32 Inhibit (string app_id, uint32 toplevel_xid, string reason, uint32 flags) throws GLib.IOError;
13 public abstract void Uninhibit (uint32 inhibit_cookie) throws GLib.IOError;
14}
15
9namespace Audience {16namespace Audience {
10 public delegate void FuncOverDir (File file_under_dir);17 public delegate void FuncOverDir (File file_under_dir);
11 public static void recurse_over_dir (File file_to_process, FuncOverDir func) {18 public static void recurse_over_dir (File file_to_process, FuncOverDir func) {
1219
=== modified file 'Audience/Widgets/VideoPlayer.vala'
--- Audience/Widgets/VideoPlayer.vala 2013-04-07 18:53:17 +0000
+++ Audience/Widgets/VideoPlayer.vala 2013-04-25 18:38:24 +0000
@@ -36,6 +36,7 @@
36 playbin.set_state (value ? Gst.State.PLAYING : Gst.State.PAUSED);36 playbin.set_state (value ? Gst.State.PLAYING : Gst.State.PAUSED);
3737
38 set_screensaver (!value);38 set_screensaver (!value);
39 set_screenlock (!value);
3940
40 if (!value) {41 if (!value) {
41 paused = true;42 paused = true;
@@ -201,6 +202,9 @@
201 202
202 uint hiding_timer;203 uint hiding_timer;
203 204
205 public GnomeSessionManager session_manager;
206 uint32 inhibit_cookie;
207
204 public bool fullscreened { get; set; }208 public bool fullscreened { get; set; }
205 209
206 public signal void ended ();210 public signal void ended ();
@@ -624,5 +628,19 @@
624 dpy.get_screensaver (out timeout, out interval, out prefer_blanking, out allow_exposures);628 dpy.get_screensaver (out timeout, out interval, out prefer_blanking, out allow_exposures);
625 dpy.set_screensaver (enable ? timeout : 0, interval, prefer_blanking, allow_exposures);629 dpy.set_screensaver (enable ? timeout : 0, interval, prefer_blanking, allow_exposures);
626 }630 }
631
632 //prevent screenlocking in Gnome 3 using org.gnome.SessionManager
633 void set_screenlock (bool enable)
634 {
635 try{
636 session_manager = Bus.get_proxy_sync (BusType.SESSION,
637 "org.gnome.SessionManager", "/org/gnome/SessionManager");
638 if (enable) {
639 session_manager.Uninhibit (inhibit_cookie);
640 }else{
641 inhibit_cookie = session_manager.Inhibit ("audience", 0, "Playing Video using Audience", 12);
642 }
643 } catch (Error e) { warning (e.message); }
644 }
627 }645 }
628}646}

Subscribers

People subscribed via source and target branches