Merge lp:~elementary-pantheon/pantheon-greeter/time-label-file into lp:~elementary-pantheon/pantheon-greeter/trunk

Proposed by Danielle Foré
Status: Merged
Merged at revision: 424
Proposed branch: lp:~elementary-pantheon/pantheon-greeter/time-label-file
Merge into: lp:~elementary-pantheon/pantheon-greeter/trunk
Diff against target: 150 lines (+55/-66)
2 files modified
src/ShadowedLabel.vala (+5/-66)
src/TimeLabel.vala (+50/-0)
To merge this branch: bzr merge lp:~elementary-pantheon/pantheon-greeter/time-label-file
Reviewer Review Type Date Requested Status
elementary Pantheon team Pending
Review via email: mp+291697@code.launchpad.net

Commit message

ShadowedLabel:
* Remove Using Clutter

TimeLabel:
* Remove get_english_number_suffix

To post a comment you must log in.
423. By Danielle Foré

merge trunk

Revision history for this message
Corentin Noël (tintou) wrote :

I know it's just copy/paste, but note to translators are handled with ///

424. By Danielle Foré

merge trunk

425. By Danielle Foré

fix translator notes

426. By Danielle Foré

fix spacing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ShadowedLabel.vala'
2--- src/ShadowedLabel.vala 2016-04-04 23:01:22 +0000
3+++ src/ShadowedLabel.vala 2016-04-14 18:03:49 +0000
4@@ -19,9 +19,7 @@
5 END LICENSE
6 ***/
7
8-using Clutter;
9-
10-public class ShadowedLabel : Actor {
11+public class ShadowedLabel : Clutter.Actor {
12 Granite.Drawing.BufferSurface buffer;
13
14 string _label = "";
15@@ -46,13 +44,13 @@
16 }
17
18 public ShadowedLabel (string _label) {
19- content = new Canvas ();
20- (content as Canvas).draw.connect (draw);
21+ content = new Clutter.Canvas ();
22+ (content as Clutter.Canvas).draw.connect (draw);
23
24 reactive = false;
25
26- notify["width"].connect (() => {(content as Canvas).set_size ((int) width, (int) height); buffer = null;});
27- notify["height"].connect (() => {(content as Canvas).set_size ((int) width, (int) height); buffer = null;});
28+ notify["width"].connect (() => {(content as Clutter.Canvas).set_size ((int) width, (int) height); buffer = null;});
29+ notify["height"].connect (() => {(content as Clutter.Canvas).set_size ((int) width, (int) height); buffer = null;});
30
31 label = _label;
32 }
33@@ -84,62 +82,3 @@
34 return true;
35 }
36 }
37-
38-public class TimeLabel : ShadowedLabel {
39-
40- public TimeLabel () {
41- base ("");
42-
43- update_time ();
44- Clutter.Threads.Timeout.add (5000, update_time);
45- }
46-
47- bool update_time () {
48- var date = new GLib.DateTime.now_local ();
49-
50- /*Date display, see http://unstable.valadoc.org/#!api=glib-2.0/GLib.DateTime.format for more details.
51- %v is added here to provide the English date suffixes th, nd and so on*/
52- var day_format = _("%A, %B %e");
53- /*Time display, see http://unstable.valadoc.org/#!api=glib-2.0/GLib.DateTime.format for more details*/
54- var time_format = _("%l:%M");
55- /*AM/PM display, see http://unstable.valadoc.org/#!api=glib-2.0/GLib.DateTime.format for more details.
56- If you translate in a language that has no equivalent for AM/PM, keep the original english string.*/
57- var meridiem_format = _(" %p");
58-
59- label = date.format (
60- "<span face='Open Sans Light' font='24'>"+
61- day_format+
62- "</span>\n<span face='Raleway' weight='100' font='72'>"+
63- time_format+
64- "</span><span face='Raleway' weight='100' font='50'>"+
65- meridiem_format+
66- "</span>");
67- return true;
68- }
69-
70- /**
71- * Utility to get the English number suffix
72- * @param number The number to find the the suffix for
73- * @return The according English suffix
74- **/
75- string get_english_number_suffix (int number) {
76- number %= 100;
77-
78- if (number > 20)
79- number %= 10;
80-
81- switch (number) {
82- case 1:
83- return "st";
84- case 2:
85- return "nd";
86- case 3:
87- return "rd";
88- case 11:
89- case 12:
90- case 13:
91- default:
92- return "th";
93- }
94- }
95-}
96
97=== added file 'src/TimeLabel.vala'
98--- src/TimeLabel.vala 1970-01-01 00:00:00 +0000
99+++ src/TimeLabel.vala 2016-04-14 18:03:49 +0000
100@@ -0,0 +1,50 @@
101+/*
102+* Copyright (c) 2011-2016 elementary LLC (http://launchpad.net/pantheon-greeter)
103+*
104+* This program is free software; you can redistribute it and/or
105+* modify it under the terms of the GNU General Public
106+* License as published by the Free Software Foundation; either
107+* version 2 of the License, or (at your option) any later version.
108+*
109+* This program is distributed in the hope that it will be useful,
110+* but WITHOUT ANY WARRANTY; without even the implied warranty of
111+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
112+* General Public License for more details.
113+*
114+* You should have received a copy of the GNU General Public
115+* License along with this program; if not, write to the
116+* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
117+* Boston, MA 02111-1307, USA.
118+*
119+*/
120+
121+public class TimeLabel : ShadowedLabel {
122+
123+ public TimeLabel () {
124+ base ("");
125+
126+ update_time ();
127+ Clutter.Threads.Timeout.add (5000, update_time);
128+ }
129+
130+ bool update_time () {
131+ var date = new GLib.DateTime.now_local ();
132+
133+ /// Date display, see http://valadoc.org/#!api=glib-2.0/GLib.DateTime.format for more details
134+ var day_format = _("%A, %B %e");
135+ /// Time display, see http://valadoc.org/#!api=glib-2.0/GLib.DateTime.format for more details
136+ var time_format = _("%l:%M");
137+ /// AM/PM display, see http://valadoc.org/#!api=glib-2.0/GLib.DateTime.format for more details. If you translate in a language that has no equivalent for AM/PM, keep the original english string.
138+ var meridiem_format = _(" %p");
139+
140+ label = date.format (
141+ "<span face='Open Sans Light' font='24'>"+
142+ day_format+
143+ "</span>\n<span face='Raleway' weight='100' font='72'>"+
144+ time_format+
145+ "</span><span face='Raleway' weight='100' font='50'>"+
146+ meridiem_format+
147+ "</span>");
148+ return true;
149+ }
150+}

Subscribers

People subscribed via source and target branches