[gnome-shell/gbsneto/new-lock-screen-part2: 11/41] screenShield: Move clock to Unlock Dialog
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/new-lock-screen-part2: 11/41] screenShield: Move clock to Unlock Dialog
- Date: Thu, 30 Jan 2020 18:25:13 +0000 (UTC)
commit a9887a7060baa162b42584928e16827023b526e9
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Nov 28 18:16:53 2019 -0300
screenShield: Move clock to Unlock Dialog
Move the Screen Shield clock to Unlock Dialog. Also adjust
the CSS style classes names to match the new owner.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/872
.../gnome-shell-sass/widgets/_screen-shield.scss | 6 +--
js/ui/screenShield.js | 47 +------------------
js/ui/unlockDialog.js | 52 +++++++++++++++++++++-
3 files changed, 54 insertions(+), 51 deletions(-)
---
diff --git a/data/theme/gnome-shell-sass/widgets/_screen-shield.scss
b/data/theme/gnome-shell-sass/widgets/_screen-shield.scss
index cc5bda9553..8401da193f 100644
--- a/data/theme/gnome-shell-sass/widgets/_screen-shield.scss
+++ b/data/theme/gnome-shell-sass/widgets/_screen-shield.scss
@@ -2,7 +2,7 @@
$_screenshield_shadow: 0px 0px 6px rgba(0, 0, 0, 0.726);
-.screen-shield-clock {
+.unlock-dialog-clock {
color: white;
text-shadow: $_screenshield_shadow;
font-weight: bold;
@@ -10,13 +10,13 @@ $_screenshield_shadow: 0px 0px 6px rgba(0, 0, 0, 0.726);
padding-bottom: 1.5em;
}
-.screen-shield-clock-time {
+.unlock-dialog-clock-time {
font-size: 72pt;
text-shadow: $_screenshield_shadow;
font-feature-settings: "tnum";
}
-.screen-shield-clock-date {
+.unlock-dialog-clock-date {
font-size: 28pt;
font-weight: normal;
}
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index 9d9d6fe794..48b735ad65 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -1,7 +1,7 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const { AccountsService, Clutter, Gio, GLib,
- GnomeDesktop, GObject, Graphene, Meta, Shell, St } = imports.gi;
+ GObject, Graphene, Meta, Shell, St } = imports.gi;
const Signals = imports.signals;
const Background = imports.ui.background;
@@ -41,46 +41,6 @@ var STANDARD_FADE_TIME = 10000;
var MANUAL_FADE_TIME = 300;
var CURTAIN_SLIDE_TIME = 300;
-var Clock = GObject.registerClass(
-class ScreenShieldClock extends St.BoxLayout {
- _init() {
- super._init({ style_class: 'screen-shield-clock', vertical: true });
-
- this._time = new St.Label({
- style_class: 'screen-shield-clock-time',
- x_align: Clutter.ActorAlign.CENTER,
- });
- this._date = new St.Label({
- style_class: 'screen-shield-clock-date',
- x_align: Clutter.ActorAlign.CENTER,
- });
-
- this.add_child(this._time);
- this.add_child(this._date);
-
- this._wallClock = new GnomeDesktop.WallClock({ time_only: true });
- this._wallClock.connect('notify::clock', this._updateClock.bind(this));
-
- this._updateClock();
-
- this.connect('destroy', this._onDestroy.bind(this));
- }
-
- _updateClock() {
- this._time.text = this._wallClock.clock;
-
- let date = new Date();
- /* Translators: This is a time format for a date in
- long format */
- let dateFormat = Shell.util_translate_time_string(N_("%A, %B %d"));
- this._date.text = date.toLocaleFormat(dateFormat);
- }
-
- _onDestroy() {
- this._wallClock.run_dispose();
- }
-});
-
var NotificationsBox = GObject.registerClass({
Signals: { 'wake-up-screen': {} },
}, class NotificationsBox extends St.BoxLayout {
@@ -961,8 +921,6 @@ var ScreenShield = class {
y_expand: true,
vertical: true,
style_class: 'screen-shield-contents-box' });
- this._clock = new Clock();
- this._lockScreenContentsBox.add_child(this._clock);
this._lockScreenContents.add_actor(this._lockScreenContentsBox);
@@ -979,9 +937,6 @@ var ScreenShield = class {
}
_clearLockScreen() {
- this._clock.destroy();
- this._clock = null;
-
if (this._notificationsBox) {
this._notificationsBox.disconnect(this._wakeUpScreenId);
this._notificationsBox.destroy();
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
index b0f5fcf649..beb20f5fed 100644
--- a/js/ui/unlockDialog.js
+++ b/js/ui/unlockDialog.js
@@ -1,8 +1,8 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported UnlockDialog */
-const { AccountsService, Atk, Clutter,
- Gdm, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
+const { AccountsService, Atk, Clutter, Gdm, Gio,
+ GnomeDesktop, GLib, GObject, Meta, Shell, St } = imports.gi;
const Layout = imports.ui.layout;
const Main = imports.ui.main;
@@ -12,6 +12,46 @@ const AuthPrompt = imports.gdm.authPrompt;
// The timeout before going back automatically to the lock screen (in seconds)
const IDLE_TIMEOUT = 2 * 60;
+var Clock = GObject.registerClass(
+class UnlockDialogClock extends St.BoxLayout {
+ _init() {
+ super._init({ style_class: 'unlock-dialog-clock', vertical: true });
+
+ this._time = new St.Label({
+ style_class: 'unlock-dialog-clock-time',
+ x_align: Clutter.ActorAlign.CENTER,
+ });
+ this._date = new St.Label({
+ style_class: 'unlock-dialog-clock-date',
+ x_align: Clutter.ActorAlign.CENTER,
+ });
+
+ this.add_child(this._time);
+ this.add_child(this._date);
+
+ this._wallClock = new GnomeDesktop.WallClock({ time_only: true });
+ this._wallClock.connect('notify::clock', this._updateClock.bind(this));
+
+ this._updateClock();
+
+ this.connect('destroy', this._onDestroy.bind(this));
+ }
+
+ _updateClock() {
+ this._time.text = this._wallClock.clock;
+
+ let date = new Date();
+ /* Translators: This is a time format for a date in
+ long format */
+ let dateFormat = Shell.util_translate_time_string(N_("%A, %B %d"));
+ this._date.text = date.toLocaleFormat(dateFormat);
+ }
+
+ _onDestroy() {
+ this._wallClock.run_dispose();
+ }
+});
+
var UnlockDialog = GObject.registerClass({
Signals: { 'failed': {} },
}, class UnlockDialog extends St.Widget {
@@ -37,6 +77,9 @@ var UnlockDialog = GObject.registerClass({
y_expand: true });
this.add_child(this._promptBox);
+ this._clock = new Clock();
+ this._promptBox.add_child(this._clock);
+
this._authPrompt = new AuthPrompt.AuthPrompt(new Gdm.Client(),
AuthPrompt.AuthPromptMode.UNLOCK_ONLY);
this._authPrompt.connect('failed', this._fail.bind(this));
this._authPrompt.connect('cancelled', this._fail.bind(this));
@@ -109,6 +152,11 @@ var UnlockDialog = GObject.registerClass({
}
_onDestroy() {
+ if (this._clock) {
+ this._clock.destroy();
+ this._clock = null;
+ }
+
this.popModal();
if (this._idleWatchId) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]