Commit Graph

98 Commits

Author SHA1 Message Date
Florian Müllner
71759a0769 cleanup: Mark unused (but useful) variables as ignored
While we aren't using those destructured variables, they are still useful
to document the meaning of those elements. We don't want eslint to keep
warning about them though, so mark them accordingly.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/627
2019-07-24 00:28:45 +02:00
Florian Müllner
2f97a1a55d cleanup: Mark unused arguments as unused
This will stop eslint from warning about them, while keeping their
self-documenting benefit.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/627
2019-07-24 00:28:45 +02:00
Florian Müllner
79cf3a6dd0 cleanup: Remove some unhelpful unused arguments
Those unused arguments aren't bugs - unbeknownst to eslint, they all
correspond to valid signal parameters - but they don't contribute
anything to clarity, so just remove them anyway.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/627
2019-07-24 00:28:45 +02:00
Florian Müllner
5473637736 cleanup: Fix style nits in last commit
Missing space after catch and wrong double quotes.
2019-07-08 20:15:15 +02:00
Mario Sanchez Prada
bb6d9734e4 endSessionDialog: Check for PackageKit before considering updates/upgrades
GNOME Shell is spitting out some errors in the journal due to its attempts
to speak to PackageKit, which is not present on Endless OS, so let's add
some runtime checks to make sure that PackageKit is actually available
before assuming so and using its proxy to decide which kind of UI to
show to the user when ending the session.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/369
2019-07-08 13:57:23 +02:00
Florian Müllner
1398aa6562 style: Fix indentation errors
While we have some style inconsistencies - mostly regarding split lines,
i.e. aligning to the first arguments vs. a four-space indent - there are
a couple of places where the spacing is simply wrong. Fix those.

Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00:00
Florian Müllner
6ed5bc2f6c cleanup: Use consistent switch indentation
We are currently inconsistent on whether case labels share the same
indentation level as the corresponding switch statement or not. gjs
goes with the default of no additional indentation, so go along with
that.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00:00
Florian Müllner
7ac35c644e style: Fix stray/missing spaces
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
2019-07-01 23:44:11 +02:00
Florian Müllner
f250643385 style: Use space after catch
We are currently inconsistent with whether or not to put a space
after catch clauses. While the predominant style is to omit it,
that's inconsistent with the style we use for any other statement.
There's not really a good reason to stick with it, so switch to
the style gjs/eslint default to.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
2019-07-01 23:44:11 +02:00
Florian Müllner
e56d7f5021 cleanup: Remove unused variables
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
2019-07-01 23:44:10 +02:00
Florian Müllner
f6b4b96737 cleanup: Use Array.includes() to check for element existence
We can use that newer method where we don't care about the actual position
of an element inside the array.

(Array.includes() and Array.indexOf() do behave differently in edge cases,
for example in the handling of NaN, but those don't matter to us)

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/152
2019-07-01 21:28:52 +00:00
Marco Trevisan (Treviño)
d25bcbc3a7 modalDialog: Inherit from St.Widget
Make the dialog a widget itself, removing the `_group` property used for
handling the actor.

Update all the inherited classes to be also GObject implementations, moving all
the signals to proper object ones.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/55
2019-05-24 16:27:25 -05:00
Florian Müllner
fd50b9a45e cleanup: Use destructuring for imports from GI
This is *much* nicer than repetitive "imports.gi" lines ...

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/399
2019-02-09 07:39:20 +01:00
Florian Müllner
a1534dab02 cleanup: Clean up unused imports
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/399
2019-02-09 05:05:07 +01:00
Carlos Garnacho
a977c1388a st: Add StPolicyType enum
In order to replace GTK+'s GtkPolicyType. It's bit-compatible with it, too.
All callers have been updated to use it.

This is a purely accessory change in terms of X11 Display usage cleanup,
but helps see better what is left.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/317
2019-01-30 22:50:01 +01:00
Florian Müllner
bacfdbbb03 cleanup: Port non-GObject classes to JS6 classes
ES6 finally adds standard class syntax to the language, so we can
replace our custom Lang.Class framework with the new syntax. Any
classes that inherit from GObject will need special treatment,
so limit the port to regular javascript classes for now.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/361
2019-01-25 14:02:44 +00:00
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