Commit Graph

82 Commits

Author SHA1 Message Date
Will Thompson
0892b5dcdb
endSessionDialog: squash "reference to undefined property" warning
dialogContent is set to one of the elements of the list DialogContent,
but not all of those have a checkBoxText property. When logging out (as
opposed to shutting down), this causes a warning:

    JS WARNING: [resource:///org/gnome/shell/ui/endSessionDialog.js
    763]: reference to undefined property "checkBoxText"

(The line number corresponds to this line in 3.28.3.)

The warning is apparently not triggered if the undefined property is
used as part of a boolean expression:

    gjs> var x = {};
    gjs> x.a;
    typein:2:1 strict warning: reference to undefined property "a"
    gjs> if (x.b) { log('oh no'); }
    gjs> x.c || ''
    ""
_setCheckBoxLabel() just checks the truthiness of its 'text' argument,
and the empty string is false-y, so passing '' rather than undefined has
no functional effect.
2018-09-25 21:28:35 +01:00
Florian Müllner
94423151b2 dbus: Move all interface descriptions into the resource
https://gitlab.gnome.org/GNOME/gnome-shell/issues/537
2018-09-17 07:34:49 +00:00
Marco Trevisan (Treviño)
dbf993300a js: use ES6 template strings for dbus interfaces
Use multiline template strings for dbus interfaces as they're easier to maintain
2018-08-27 19:23:00 +02:00
Iain Lane
22392d1328 loginManager: Get the session ID from logind if XDG_SESSION_ID unset
If we're started by systemd, we won't be in the user's display session.
However, this is still the session that will get locked & unlocked. Ask
logind what the 'display' or 'greeter' session is, and watch for the
Unlock signal for that session to know when to unlock.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/137
2018-07-17 17:44:18 +02:00
Florian Müllner
3b1330880f cleanup: Use Function.prototype.bind()
When not using arrow notation with anonymous functions, we use Lang.bind()
to bind `this` to named callbacks. However since ES5, this functionality
is already provided by Function.prototype.bind() - in fact, Lang.bind()
itself uses it when no extra arguments are specified. Just use the built-in
function directly where possible, and use arrow notation in the few places
where we pass additional arguments.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:55:02 +00:00
Florian Müllner
213e38c2ef cleanup: Use arrow notation for anonymous functions
Arrow notation is great, use it consistently through-out the code base
to bind `this` to anonymous functions, replacing the more overbose
Lang.bind(this, function() {}).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:55:00 +00:00
Florian Müllner
76f09b1e49 cleanup: Use method syntax
Modern javascript has a short-hand for function properties, embrace
it for better readability and to prepare for an eventual port to
ES6 classes.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:54:58 +00:00
Florian Müllner
033277b68f Define externally accessible contants with 'var' instead of 'const'
Just as we did with classes, define other constants that are (or
may be) used from other modules with 'var' to cut down on warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=785084
2017-07-18 21:52:06 +02:00
Florian Müllner
2582d16ca7 Define classes with 'var' instead of 'const'
Any symbols (including class properties) that should be visible
outside the module it's defined in need to be defined as global.
For now gjs still allows the access for 'const', but get rid of
the warnings spill now by changing it.

https://bugzilla.gnome.org/show_bug.cgi?id=785084
2017-07-18 21:52:06 +02:00
Philip Chimento
aefd61c3db js: Avoid double declarations with let
The following code is a syntax error in ES6:

    let a = 'something';
    let a = 'other thing';

Previously GJS would silently accept this code, but in the next release the
SpiderMonkey JS engine will be more ES6-compliant.

https://bugzilla.gnome.org/show_bug.cgi?id=778425
2017-02-10 13:35:50 -08:00
Kalev Lember
ab68360d53 endSessionDialog: Add support for system upgrades
https://bugzilla.gnome.org/show_bug.cgi?id=763611
2016-06-30 11:42:11 +02:00
Kalev Lember
58a733dc93 endSessionDialog: Use new PackageKit DBus API
https://bugzilla.gnome.org/show_bug.cgi?id=763611
2016-06-30 11:33:07 +02:00
Kalev Lember
db8f6b4848 endSessionDialog: Rename a variable
https://bugzilla.gnome.org/show_bug.cgi?id=763611
2016-06-30 11:33:06 +02:00
Florian Müllner
a4c1b55111 endSessionDialog: Fix DialogContent const
Fallout from commit 0258c7a518 ...
2014-09-11 17:05:48 +01:00
Kalev Lember
ec3f8d4b85 endSessionDialog: Port offline updates to PackageKit's dbus interface
https://bugzilla.gnome.org/show_bug.cgi?id=736337
2014-09-11 16:13:42 +02:00
Florian Müllner
0258c7a518 endSessionDialog: Use DialogType constants instead of magic numbers 2014-09-11 15:04:46 +01:00
Bastien Nocera
cd2bd7685a js: Name all the timeouts and idles
With very uninventive names. Names now, good names later.

https://bugzilla.gnome.org/show_bug.cgi?id=727983
2014-04-10 21:08:16 +02:00
Kalev Lember
0fa6be4614 endSessionDialog: Add extra strings for translation
Add two extra, currently unused strings in order to make the life easier
for translators and avoid breaking the upcoming string freezes.

https://bugzilla.gnome.org/show_bug.cgi?id=722898
2014-02-20 00:27:35 +01:00
Kalev Lember
46163a6607 endSessionDialog: Warn when trying to install updates on battery power
Interrupting update installation can mess up the package database quite
a bit and could lead to totally destroying the distro installtion. To
avoid running out of juice during an upgrade, warn when someone tries to
install updates on battery power.

https://bugzilla.gnome.org/show_bug.cgi?id=722898
2014-02-20 00:27:35 +01:00
Kalev Lember
645ef093f7 endSessionDialog: Offer offline updates in the shutdown dialog
This adds a checkbox for installing software updates to the shut down
dialog. The implementation relies on an already prepared offline update
and uses PackageKit's pk-trigger-offline-update helper to trigger the
installation.

https://bugzilla.gnome.org/show_bug.cgi?id=722898
2014-02-20 00:27:35 +01:00
Kalev Lember
7551e134da endSessionDialog: Fix the "Restart & Install" button
This moves the dialog type overriding that gnome-software uses to bring
up restartInstallDialogContent from _sync() to OpenAsync(), in order to
ensure the type is overridden early enough to show the correct buttons.

While at this, make sure the & symbol in the button's label is escaped
to avoid runtime warnings, now that the label actually gets used.

https://bugzilla.gnome.org/show_bug.cgi?id=722898
2014-02-20 00:27:35 +01:00
Kalev Lember
5bec5fb6cb endSessionDialog: Simplify CSS padding handling
... so that we add more items to messageLayout without having to
hardcode the same padding in each of the children.

https://bugzilla.gnome.org/show_bug.cgi?id=722898
2014-02-20 00:27:35 +01:00
Kalev Lember
c176af4da5 endSessionDialog: Use a 48px icon as per mockups
https://bugzilla.gnome.org/show_bug.cgi?id=722898
2014-02-20 00:27:35 +01:00
Andika Triwidada
f3dad3765e Changed obsolete FSF postal address.
https://bugzilla.gnome.org/show_bug.cgi?id=721507
2014-01-08 04:35:14 +07:00
Florian Müllner
751a3f0e94 js: Use SOURCE_CONTINUE/SOURCE_REMOVE constants in source functions
With support for boolean constants in g-i, we can finally use the
more readable constants instead of true/false.

https://bugzilla.gnome.org/show_bug.cgi?id=719567
2013-12-16 18:27:19 +01:00
Yosef Or Boczko
53b37e8d0c endSessionDialog: Align some strings to the right in RTL
https://bugzilla.gnome.org/show_bug.cgi?id=712600
2013-12-11 22:42:01 +02:00
Florian Müllner
554d5aeb7c More invalid source fixes
https://bugzilla.gnome.org/show_bug.cgi?id=711732
2013-11-09 17:58:59 +01:00
Sebastien Lafargue
d47ecf19f5 need space between item in endsession dialog session-list and app-list
https://bugzilla.gnome.org/show_bug.cgi?id=710543
2013-10-26 16:24:41 +02:00
Tim Lunn
b908a3d70a Stringify the xml definitions for E4X removal
https://bugzilla.gnome.org/show_bug.cgi?id=691409
2013-10-25 08:57:27 +11:00
Giovanni Campagna
407a340b2b EndSessionDialog: don't show other logged in users at log out
We're not killing their session, so it's pointless to show them.

https://bugzilla.gnome.org/show_bug.cgi?id=707124
2013-08-30 15:59:13 +02:00
Matthias Clasen
a0fa9937ba Add a variant of the Restart dialog for offline updates
Detect when an offline update is pending, and show a more
suitable message in the Restart dialog.

https://bugzilla.gnome.org/show_bug.cgi?id=706612
2013-08-26 10:46:45 -04:00
Jasper St. Pierre
dd8fd09470 endSessionDialog: Split into two sections
https://bugzilla.gnome.org/show_bug.cgi?id=706612
2013-08-26 10:02:44 -04:00
Jasper St. Pierre
a779e2aeca endSessionDialog: Don't stop the timer when we have inhibitors
https://bugzilla.gnome.org/show_bug.cgi?id=706612
2013-08-26 10:02:44 -04:00
Jasper St. Pierre
aaaf25d578 endSessionDialog: Convert to the standard _sync pattern
... for starting and stopping the timer. This helps clean up the
state transitions in the code when caring about multiple things.

https://bugzilla.gnome.org/show_bug.cgi?id=706612
2013-08-26 10:02:44 -04:00
Jasper St. Pierre
2e65c852c3 endSessionDialog: List other users and sessions in with the inhibitors
Instead of in a separate dialog. This does not meet the designs right
now, but it's a good first start.

https://bugzilla.gnome.org/show_bug.cgi?id=706612
2013-08-26 10:02:44 -04:00
Jasper St. Pierre
e4d46aee97 endSessionDialog: Remove the interactivity of the end session dialog
This was always sort of a hidden feature, and with the new designs
it's going to get unclear about what's clickable, and what's not.

https://bugzilla.gnome.org/show_bug.cgi?id=706612
2013-08-23 13:25:11 -04:00
Jasper St. Pierre
9d2bc1142f endSessionDialog: Fix syntax error
That's what I get for not testing my changes before I push :(
2013-08-22 17:27:47 -04:00
Jasper St. Pierre
c44caa5c96 endSessionDialog: Don't error out if gnome-session hands us a dead inhibitor
Sometimes gnome-session hands us a bad object path for JIT inhibitors
it creates for XSMP clients. While this is a bug in gnome-session, we
shouldn't show an empty-looking dialog here.

https://bugzilla.gnome.org/show_bug.cgi?id=706612
2013-08-22 17:16:38 -04:00
Jasper St. Pierre
77dc587686 endSessionDialog: Fix a warning
If _timerId is undefined/null, as it is by default, we will take this
path, and fail when trying to remove a source ID for undefined.

https://bugzilla.gnome.org/show_bug.cgi?id=706612
2013-08-22 17:15:03 -04:00
Matthias Clasen
2af4925d95 logout dialog: Show the correct text right away
The end session dialog was waiting a second before updating
its text to display the timer. It is nicer to show the correct
message from the start.

https://bugzilla.gnome.org/show_bug.cgi?id=702056
2013-06-12 05:48:23 -04:00
Jasper St. Pierre
403540e8a1 userMenu: Move UserAvatarWidget into UserWidget
https://bugzilla.gnome.org/show_bug.cgi?id=701755
2013-06-06 14:00:37 -04:00
Ray Strode
7c21ab0985 Revert "Revert "modalDialog: Destroy dialogs on close""
This reverts commit 007820b7c1.

(I only meant to revert that in my local branch)
2013-04-06 10:53:11 -04:00
Ray Strode
007820b7c1 Revert "modalDialog: Destroy dialogs on close"
This reverts commit 3dd6113a0a.
2013-04-06 10:28:47 -04:00
Jasper St. Pierre
3dd6113a0a modalDialog: Destroy dialogs on close
It turns out that we never destroyed modal dialogs when closing
them, causing them to still linger in the scene graph even when
there were no references to them in the JS. The one case where
we don't want to destroy modal dialogs after being closed is
endSessionDialog, so provide a parameter that allows classes
to override this behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=697295
2013-04-04 15:04:14 -04:00
Ray Strode
b4b13b0cb9 endSessionDialog: don't process response until closed
Right now if a user logs out, they are thrown to the login screen
imediately, without even seeing the dialog close.

This commit fades the dialog out before processing the logout.

https://bugzilla.gnome.org/show_bug.cgi?id=694296
2013-02-20 14:16:54 -05:00
Ray Strode
e9f18c6d8d modalDialog: drop global.get_current_time() arguments to close
Modal dialogs take an optional timestamp in their close method.
If the timestamp is not passed in, then global.get_current_time()
is used.

Some callers of the close method pass in global.get_current_time()
unnecessarly (since it's the default).

This commit drops the argument for those cases.

https://bugzilla.gnome.org/show_bug.cgi?id=694296
2013-02-20 14:16:53 -05:00
Cosimo Cecchi
1c57c0e651 endSessionDialog: don't use Tweener for the timer
We want to make Tweener short-circuit animations when resources are
constrained, so this is not going to work.
Instead, use a one-second timeout until the seconds left reach zero.

https://bugzilla.gnome.org/show_bug.cgi?id=655746
2013-02-14 20:42:53 -05:00
Matthias Clasen
151c699f5c EndSessionDialog: Add a Close method
When there are multiple sessions, we may get a polkit dialog in
response to clicking 'Reboot' in the end session dialog. If the
polkit dialog gets canceled or otherwise ends unsuccessfully,
we are left with the lightbox that the end session dialog puts
up when 'Reboot' is clicked. To remove the lightbox and make the
session fully functional again, gnome-session will call Close.

https://bugzilla.gnome.org/show_bug.cgi?id=688915
2013-02-12 10:15:51 -05:00
Allan Day
348208617b Use the correct icon in the restart dialog
It currently uses system-shutdown-symbolic. view-refresh-symbolic
is a better fit in this case.

https://bugzilla.gnome.org/show_bug.cgi?id=670687
2012-11-01 16:21:52 +00:00
Giovanni Campagna
5e46abfa03 Use UserAvatarWidget to display user avatars
Replace duplicate custom code with a common widget.

https://bugzilla.gnome.org/show_bug.cgi?id=683137
2012-08-31 23:31:25 +02:00