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

Proposed by Akshay Shekher
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 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
=== modified file 'data/org.pantheon.audience.gschema.xml'
--- data/org.pantheon.audience.gschema.xml 2014-08-06 19:13:49 +0000
+++ data/org.pantheon.audience.gschema.xml 2015-05-16 10:15:39 +0000
@@ -1,5 +1,9 @@
1<schemalist>1<schemalist>
2 <schema path="/org/pantheon/audience/" id="org.pantheon.audience" gettext-domain="audience">2 <schema path="/org/pantheon/audience/" id="org.pantheon.audience" gettext-domain="audience">
3 <key name="subtitle-font" type="s">
4 <default>""</default>
5 <summary>Set the default font of video subtitles</summary>
6 </key>
3 <key name="move-window" type="b">7 <key name="move-window" type="b">
4 <default>true</default>8 <default>true</default>
5 <summary>Move the window</summary>9 <summary>Move the window</summary>
@@ -51,4 +55,4 @@
51 <description>Hide the window decorations. You can close the window with escape</description>55 <description>Hide the window decorations. You can close the window with escape</description>
52 </key>56 </key>
53 </schema>57 </schema>
54</schemalist>
55\ No newline at end of file58\ No newline at end of file
59</schemalist>
5660
=== modified file 'src/Settings.vala'
--- src/Settings.vala 2014-08-06 19:13:49 +0000
+++ src/Settings.vala 2015-05-16 10:15:39 +0000
@@ -29,6 +29,7 @@
29 public bool playback_wait {get; set;}29 public bool playback_wait {get; set;}
30 public bool stay_on_top {get; set;}30 public bool stay_on_top {get; set;}
31 public bool show_window_decoration {get; set;}31 public bool show_window_decoration {get; set;}
32 public string subtitle_font {get; set; }
3233
33 public Settings () {34 public Settings () {
34 base ("org.pantheon.audience");35 base ("org.pantheon.audience");
3536
=== modified file 'src/Widgets/VideoPlayer.vala'
--- src/Widgets/VideoPlayer.vala 2014-11-25 14:34:08 +0000
+++ src/Widgets/VideoPlayer.vala 2015-05-16 10:15:39 +0000
@@ -158,6 +158,17 @@
158 }158 }
159 }159 }
160160
161 private string _subtitle_font;
162 public string subtitle_font {
163 get {
164 return _subtitle_font;
165 }
166 set {
167 _subtitle_font = value;
168 playbin.set ("subtitle-font-desc", _subtitle_font);
169 }
170 }
171
161 public dynamic Gst.Element playbin;172 public dynamic Gst.Element playbin;
162 Clutter.Texture video;173 Clutter.Texture video;
163174
@@ -198,6 +209,11 @@
198 return true;209 return true;
199 });210 });
200211
212 update_subtitle_font ();
213 settings.changed.connect (() => {
214 update_subtitle_font ();
215 });
216
201 playbin.about_to_finish.connect (() => {217 playbin.about_to_finish.connect (() => {
202 if (!at_end) {218 if (!at_end) {
203 at_end = true;219 at_end = true;
@@ -476,5 +492,16 @@
476 }492 }
477 return num / (double)denom;493 return num / (double)denom;
478 }494 }
495
496 void update_subtitle_font () {
497 debug ("Updating subtitle font");
498 var font = settings.subtitle_font;
499
500 if (font == "") {
501 var gnome_settings = new GLib.Settings ("org.gnome.desktop.interface");
502 font = gnome_settings.get_string ("font-name");
503 }
504 subtitle_font = font;
505 }
479 }506 }
480}507}

Subscribers

People subscribed via source and target branches