Merge lp:~voldyman/audience/subtitle-font into lp:~audience-members/audience/trunk

Proposed by Akshay Shekher on 2015-05-16
Status: Merged
Merged at revision: 523
Proposed branch: lp:~voldyman/audience/subtitle-font
Merge into: lp:~audience-members/audience/trunk
Diff against target: 84 lines (+34/-2)
3 files modified
data/org.pantheon.audience.gschema.xml (+6/-2)
src/Settings.vala (+1/-0)
src/Widgets/VideoPlayer.vala (+27/-0)
To merge this branch: bzr merge lp:~voldyman/audience/subtitle-font
Reviewer Review Type Date Requested Status
Audience Members 2015-05-16 Pending
Review via email: mp+259311@code.launchpad.net

Description of the change

Audience will now use either the default system font for subtitles or the one set using dconf

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/org.pantheon.audience.gschema.xml'
2--- data/org.pantheon.audience.gschema.xml 2014-08-06 19:13:49 +0000
3+++ data/org.pantheon.audience.gschema.xml 2015-05-16 10:15:39 +0000
4@@ -1,5 +1,9 @@
5 <schemalist>
6- <schema path="/org/pantheon/audience/" id="org.pantheon.audience" gettext-domain="audience">
7+ <schema path="/org/pantheon/audience/" id="org.pantheon.audience" gettext-domain="audience">
8+ <key name="subtitle-font" type="s">
9+ <default>""</default>
10+ <summary>Set the default font of video subtitles</summary>
11+ </key>
12 <key name="move-window" type="b">
13 <default>true</default>
14 <summary>Move the window</summary>
15@@ -51,4 +55,4 @@
16 <description>Hide the window decorations. You can close the window with escape</description>
17 </key>
18 </schema>
19-</schemalist>
20\ No newline at end of file
21+</schemalist>
22
23=== modified file 'src/Settings.vala'
24--- src/Settings.vala 2014-08-06 19:13:49 +0000
25+++ src/Settings.vala 2015-05-16 10:15:39 +0000
26@@ -29,6 +29,7 @@
27 public bool playback_wait {get; set;}
28 public bool stay_on_top {get; set;}
29 public bool show_window_decoration {get; set;}
30+ public string subtitle_font {get; set; }
31
32 public Settings () {
33 base ("org.pantheon.audience");
34
35=== modified file 'src/Widgets/VideoPlayer.vala'
36--- src/Widgets/VideoPlayer.vala 2014-11-25 14:34:08 +0000
37+++ src/Widgets/VideoPlayer.vala 2015-05-16 10:15:39 +0000
38@@ -158,6 +158,17 @@
39 }
40 }
41
42+ private string _subtitle_font;
43+ public string subtitle_font {
44+ get {
45+ return _subtitle_font;
46+ }
47+ set {
48+ _subtitle_font = value;
49+ playbin.set ("subtitle-font-desc", _subtitle_font);
50+ }
51+ }
52+
53 public dynamic Gst.Element playbin;
54 Clutter.Texture video;
55
56@@ -198,6 +209,11 @@
57 return true;
58 });
59
60+ update_subtitle_font ();
61+ settings.changed.connect (() => {
62+ update_subtitle_font ();
63+ });
64+
65 playbin.about_to_finish.connect (() => {
66 if (!at_end) {
67 at_end = true;
68@@ -476,5 +492,16 @@
69 }
70 return num / (double)denom;
71 }
72+
73+ void update_subtitle_font () {
74+ debug ("Updating subtitle font");
75+ var font = settings.subtitle_font;
76+
77+ if (font == "") {
78+ var gnome_settings = new GLib.Settings ("org.gnome.desktop.interface");
79+ font = gnome_settings.get_string ("font-name");
80+ }
81+ subtitle_font = font;
82+ }
83 }
84 }

Subscribers

People subscribed via source and target branches