Commit Graph

955 Commits

Author SHA1 Message Date
Florian Müllner
153b7d525d cleanup: Don't linebreak before closing parentheses
Otherwise recent versions of eslint want "dangling" commas,
which is at least ugly considering that most functions don't
allow adding arguments at leasure.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1177
2020-04-28 09:04:49 +00:00
Jonas Ådahl
772df91762 shell/global: Add 'backend' property
Replace all Meta.get_backend() with global.backend. Maybe sooner or
later we can further decrease the amount of singletons handled by
libmutter.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1210
2020-04-27 15:18:18 +00:00
Florian Müllner
21de88c3ba bluetooth: Do not update hadSetupDevices on adapter changes
While we now deal more gracefully with adapter removals, we can
still mess up the hadSetupDevices tracking:

As adapters become available before any devices, we'll always
reset the setting to false when Bluetooth is turned on. And if
no set up device happens to be in range, it will still be false
when Bluetooth is turned off again.

To address that, only update the setting if we have an adapter
(like we do now) and we had one before (so it wasn't the adapter
itself that changed).

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1174
2020-04-07 15:44:50 +02:00
Florian Müllner
456ca3d3e0 bluetooth: Do not sync() immediately on model changes
Our intended behavior when bluetooth is turned off is to keep
the menu visible if devices had been set up previously.

However since gnome-bluetooth@c437c729, devices are removed
first before removing the default adapter, so we now end up
always setting the property to false before checking for it.

Fix this by deferring all model changes to an idle, so that
we can process them as a unit. Do the same for proxy property
changes, as those may trigger a row-removal.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1174
2020-04-07 15:44:50 +02:00
Florian Müllner
f4ba3e4ab8 bluetooth: Fix showing menu when devices were set up
Since commit 26c2cb9f65, nDevices is always the actual number of
paired/trusted devices. So when bluetooth is turned off, it is
now 0 rather than forced to 1 if devices were set up previously.

Fix this by checking the property that tracks set up devices instead.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1174
2020-04-07 15:44:50 +02:00
Florian Müllner
5067bda61a bluetooth: Fix infinite loop
Bailing out early of the loop means the iter is never increased,
resulting in an infinite loop.

Fixes 26c2cb9f6.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1165
2020-04-02 12:08:00 +00:00
Mariana Picolo
9bc9d5165f bluetooth: Update bluetooth submenu title
- "Bluetooth" to "on/off" labels
  to match with other menus

- Display single connected device name
  to show more relevant information

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2340
2020-04-02 00:15:37 +00:00
Mariana Picolo
26c2cb9f65 bluetooth: Add getDeviceInfos function
In case where only one device is connected, we want to display its name
in the menu. For that we will need more than the number of known/connected
devices, so change the function to return an array of device infos instead.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2340
2020-04-02 00:15:37 +00:00
Florian Müllner
764527c8c9 js: Promisify async operations
Promises make asynchronous operations easier to manage, in particular
when used through the async/await syntax that allows for asynchronous
code to closely resemble synchronous one.

gjs has included a Gio._promisify() helper for a while now, which
monkey-patches methods that follow GIO's async pattern to return a
Promise when called without a callback argument.

Use that to get rid of all those GAsyncReadyCallbacks!

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1126
2020-03-31 05:43:40 +00:00
Florian Müllner
97fe4f761a volume: Cancel before checking state
Since commit 2894085c45 we omit sound feedback on volume changes
if something is already outputting sound. Unfortunately that
"something" may be our own feedback (from a previous volume
change).

In that case we do not want to omit the new feedback, so instead
cancel the previous one.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1147
2020-03-28 19:03:12 +01:00
Florian Müllner
36b8dcbe07 a11y: Change HC icon theme first
There are two ways for applications to provide a high contrast icon:

 1. install an icon into the HighContrast theme
 2. install a symbolic icon into the default hicolor theme

The latter is preferred nowadays, and implemented in the high-contrast
CSS variant by enforcing the symbolic icon style.

However together with the way we currently enable/disable high-contrast,
this can lead to the following race:
 1. the GTK theme is changed from HighContrast
 2. we reload the default stylesheet
 3. the icon style changes to "regular", so we request a
    new icon from the HighContrast icon theme
 4. the icon theme is changed from HighContrast
 5. we evict existing icons from the cache
 6. we reload icons for the new icon theme; however as we
    find a pending request (from 3), we re-use it
 7. the request from 3 finishes, and we end up with a
    wrong icon in the cache

The simplest fix is to change the icon theme before the GTK theme: Unlike the
theme name, the icon style is encoded in the cache key, so we won't re-use
an old (and incorrect) request in that case.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2414
2020-03-17 12:45:25 +01:00
Sebastian Keller
09a1e61c63 location: Update desktop file name for privacy settings
The location settings have been moved to their own panel with a
different desktop file:
https://gitlab.gnome.org/GNOME/gnome-control-center/-/commit/f92f6f5c

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/2316
2020-03-06 19:16:47 +00:00
Florian Müllner
ee6635282c status/keyboard: Check for monkey-patched property before using it
This avoid another "reference to undefined property" warning.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1035
2020-02-20 19:08:47 +00:00
Florian Müllner
9d941f8202 js: Don't use templates in files with translations
xgettext gained some support for template strings, and no longer
fails when encountering '/' somewhere between backticks.

Unfortunately its support is still buggy as hell, and it is now
silently dropping translatable strings, yay. I hate making the
code worse, but until xgettext really gets its shit together,
the only viable way forward seems to be to not use template
strings in any files listed in POTFILES.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1014
2020-02-17 23:20:40 +01:00
Florian Müllner
a205f4e249 status/system: Fix session submenu visibility
Commit 147a743d8d moved the suspend and power-off actions into
the submenu that contains the log-out and switch-user actions,
but did not update the submenu visibility logic to account for
the additional actions.

As a result, the submenu is hidden when log-out and switch-user
are unavailable (like on the login screen), even if suspend and
power-off are enabled.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2169
2020-02-04 14:40:44 +00:00
Carlos Garnacho
84d92bf65e ui: Use ClutterSeat for keyboard/pointer a11y
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/760
2020-01-30 17:49:08 +00:00
Jonas Dreßler
3f21c21532 status/system: Update text of orientation lock menu entry
Since the orientation lock menu entry is a proper menu entry instead of
a icon-only button now, we also show a description-text for that entry,
so update this text depending on whether orientation is locked or not to
better reflect what clicking the menu entry will do.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/964
2020-01-28 15:49:01 +00:00
Jonas Dreßler
2996d9d977 location: Adapt geolocation dialog to new design
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/962
2020-01-27 23:40:04 +01:00
Jonas Dreßler
2fc84e0fe3 dialog: Remove MessageDialogContent.body property
According to the new dialog design, dialogs generally only have a title
and a description, so the `body` property is no longer needed.

At the places where it's still used, we replace it with the description
property or a plain label we add to MessageDialogContent ourselves.

See https://gitlab.gnome.org/GNOME/gnome-shell/issues/1343

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/886
2020-01-15 00:17:25 +01:00
Jonas Dreßler
845c52797b dialog: Rename subtitle property to description
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/886
2020-01-15 00:12:54 +01:00
Jonas Dreßler
5d99bdbe5e dialog: Remove icons from dialogs
According to the new mockups, remove the icon from MessageDialogContent

See https://gitlab.gnome.org/GNOME/gnome-shell/issues/1343

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/886
2020-01-15 00:05:34 +01:00
Jonas Dreßler
aac01f1c9e status/network: Compare icon name to NULL instead of empty string
Since the last commit we set the gicon property of StIcon to NULL if an
empty string was given when setting the icon name, this means
`st_icon_get_icon_name()` will return NULL instead of an empty string.

When `getIndicatorIcon()` returns an empty string, the icon_name
property will now be set to NULL, so compare it to NULL here.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/888
2020-01-13 14:47:19 +01:00
Florian Müllner
42af514c51 keyboard: Fix input-source switcher alignment
More fallout from commit 104071acbd.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/916
2020-01-04 23:00:02 +00:00
Florian Müllner
2894085c45 volume: Skip volume-change feedback while playing
The audio feedback for volume changes is useful when nothing is outputting
sound, but only then. Skip the sound notification in that case.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/53
2019-11-23 15:16:51 +01:00
Florian Müllner
6c8eb1a18e volume: Only emit sound feedback after volume changes
gnome-settings-daemon doesn't play the volume change sound when
the volume stayed the same (that is, it is already at its maximum
or minimum). This looks like the right thing to do, so copy its
behavior.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/53
2019-11-23 15:08:54 +01:00
Florian Müllner
5af8bf2788 volume: Add back sound feedback on scroll
Commit 8d4855f100 accidentally removed the volume change feedback
for scroll events. Add it back to be consistent again with moving
the slider via arrow keys, slider drags/clicks and gsd's media keys
handling.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/53
2019-11-23 15:08:54 +01:00
Florian Müllner
a32c4f30d1 style: Allow lonely ifs where appropriate
We now have a lint rule to disallow lonely ifs, however there are
cases where the "lonely" part mirrors code from the preceding if
clause. Opt out of the lint rule in those cases.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/818
2019-11-11 23:51:17 +00:00
Florian Müllner
e44adb92cf cleanup: Avoid unnecessary parentheses
Extra parentheses usually add noise rather than clarity, so avoid
them.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +00:00
Florian Müllner
ebf77748a8 cleanup: Require "dangling" commas
Since ES5, trailing commas in arrays and object literals are valid.
We generally haven't used them so far, but they are actually a good
idea, as they make additions and removals in diffs much cleaner.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +00:00
Florian Müllner
07cc84f632 cleanup: Only omit braces for single-line blocks
Braces can be avoided when a block consists of a single statement,
but readability suffers when the statement spans more than a single
line.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +00:00
Florian Müllner
c860409da5 cleanup: Use object shorthand where possible
ES6 allows to omit property names where they match the name of the
assigned variable, which makes code less redunant and thus cleaner.
We will soon enforce that in our eslint rules, so make sure we use
the shorthand wherever possible.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +00:00
Florian Müllner
9eaa0089d0 cleanup: Fix missing/stray spaces
Those are wrong according to our style guidelines, but the previous
eslint ruleset didn't catch them.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +00:00
Florian Müllner
682bd7e97c cleanup: Don't shadow variables
Having variables that share the same name in overlapping scopes is
confusing and error-prone, and is best avoided.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +00:00
Florian Müllner
67ea424525 cleanup: Avoid unnecessary braces
Our coding style has always been to avoid braces when all blocks
are single-lines.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +00:00
Philip Chimento
5fd52e99d3 power: Handle "100% but charging" case
I've observed that UPower can occasionally report a charge level of 100%
while the state is still "charging". This usually doesn't last very long
but it is noticeable because the power icon changes to a "missing icon"
icon. This will handle that rare case correctly.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/814
2019-11-07 12:58:54 -08:00
Florian Müllner
d3d165243c cleanup: Use non-deprecated key symbols
Clutter originally cluttered its namespace with key symbols, before
prefixing all symbols with KEY. We still use the unprefixed symbols
occasionally, replace them so mutter can drop the deprecated symbols.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/808
2019-11-06 09:42:57 +01:00
Florian Müllner
147a743d8d system: Replace action icons with regular menu items
Besides making the menu a bit less special, it allows us to fit both
shutdown and suspend actions without any hidden alt-key Easter eggs.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/270
2019-11-05 13:05:59 +00:00
Florian Müllner
2c62e45168 st: Remove StBin's align properties
They are now completely unused, so remove them and stop the confusing
shadowing of ClutterActor's own x/y-align properties.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/803
2019-11-04 21:27:56 +01:00
Florian Müllner
104071acbd js: Replace child properties
Every since commit aa394754, StBoxLayout has supported ClutterActor's
expand/align properties in addition to the container-specific child
properties. Given that that's the only container left with a special
child meta, it's time to fully embrace the generic properties (and
eventually remove the child meta).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/780
2019-11-01 19:42:01 +00:00
Florian Müllner
284ace5b5f cleanup: Use (un)block_signal_handler() convenience wrapper
We now depend on a gjs version that is guaranteed to provide those
more idiomatic wrappers, so use them instead of the clunkier static
methods.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/795
2019-10-30 19:40:15 +00:00
Marco Trevisan (Treviño)
39e6fc9e9d js: Use Gjs GTypeName computation for all classes
As per previous commit we can remove the explicit GTypeName definitions
and use gjs auto computation for all the GObject registered classes.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/790
2019-10-29 18:38:35 +00:00
Marco Trevisan (Treviño)
55b57421dc cleanup: Replace signal connections with virtual functions
Inheriting from actors allows to use virtual functions instead of signal
connections for multiple cases, so just use them when possible.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559
2019-10-16 15:26:13 +00:00
Marco Trevisan (Treviño)
c4c5c4fd5c cleanup: Use inheritance for Actor classes instead of composition
Remove the `this.actor = ...` and `this.actor._delegate = this` patterns in most
of classes, by inheriting all the actor container classes.

Uses interfaces when needed for making sure that multiple classes will implement
some required methods or to avoid redefining the same code multiple times.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559
2019-10-16 15:26:13 +00:00
Marco Trevisan (Treviño)
b5676a2a5c messageTray: Inherit Notification, Source and NotificationPolicy from GObject
Register notifications, sources and policies as GObject gtypes so that they can
be passed in signals and use native properties and signals.

Reimplement all the extending classes.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559
2019-10-16 15:26:12 +00:00
Florian Müllner
6cad251187 volume: Show indicator when microphone is active
Devices like cameras and microphones are privacy sensitive, as they can
be used to spy on the user. We cannot prevent non-sandboxed apps from
doing that, but as we already track when the microphone is recording,
we can at least show an indicator to make sure it doesn't happen behind
the user's back.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/729
2019-10-16 13:08:20 +00:00
Florian Müllner
efed695eca cleanup: Don't add linebreak before operators
When breaking overly long conditions into multiple lines, the operator
should end the previous line instead of starting the new one.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731
2019-09-15 16:02:45 +02:00
Florian Müllner
b446667df6 cleanup: Disambiguate assignments in arrow functions
As arrow functions have an implicit return value, an assignment of
this.foo = bar could have been intended as a this.foo === bar
comparison. To catch those errors, we will disallow these kinds
of assignments unless they are marked explicitly by an extra pair
of parentheses.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731
2019-09-15 16:02:45 +02:00
Florian Müllner
133a1e7bef cleanup: Remove trailing spaces
We generally avoid these (not least because Linus hates them enough
to make git complain loudly), but some sneaked in over time ...

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731
2019-09-15 16:02:45 +02:00
Florian Müllner
a77377efe7 cleanup: Avoid useless return statements
Return statements are only useful if they return a value or break
the regular function flow (i.e. early returns). Remove all returns
that do neither.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731
2019-09-15 16:02:45 +02:00
Florian Müllner
1a32e3e74a volume: Clarify some code
We have more idiomatic ways to check whether any element fullfills
some condition than breaking out of a loop.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731
2019-09-15 16:02:45 +02:00
Florian Müllner
3a9eaa39ea cleanup: Switch some method calls to new indentation style
The legacy indent rule currently ignores arrow functions in parameters
to allow callbacks to not align with the other arguments:

    this._someFunctionWithFairlyLongishName(arg1, arg2, arg3,
        () => {
            this._someOtherFunctionWithLongName(arg1);
        });

But as ignoring entire nodes means we can end up with arbitrary
indentation, we should drop the exception. While this would make
the above "illegal" under the legacy config, it conforms with the
non-legacy style, so everything should be fine ...

... except that eslint starts to complain about some function args
that should be fine under the legacy config. Maybe it's thrown off
by the function-arg-in-arrow-function-in-function-arg structure, but
rather than figuring it out, let's just move those to the new style.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/725
2019-09-15 13:30:19 +00:00
Florian Müllner
af87bd8c87 cleanup: Use consistent style for ternary operator
We are currently inconsistent whether to put the operators in front
of the corresponding line or at the end of the preceding one. The
most dominant style for now is to put condition and first branch on
the same line, and then align the second branch:

  let foo = condition ? fooValue
                      : notFooValue;

Unfortunately that's a style that eslint doesn't support, so to account
for it, our legacy configuration currently plainly ignores all indentation
in conditionals.

In order to drop that exception and not let messed up indentation slip
through, change all ternary operators to the non-legacy style.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/725
2019-09-15 13:30:19 +00:00
Florian Müllner
451f4e3636 cleanup: "Only" use two indentation styles for object literals
We currently use no less than three different ways of indenting
object literals:

    let obj1 = {
        foo: 42,
        bar: 23,
    };

    let obj2 = { foo: 42,
                 bar: 23 };

    let obj3 = { foo: 42,
                 bar: 23
               };

The first is the one we want to use everywhere eventually, while the
second is the most commonly used "legacy" style.

It is the third one that is most problematic, as it throws off eslint
fairly badly: It violates both the rule to have consistent line breaks
in braces as well as the indentation style of both regular and legacy
configurations.

Fortunately the third style was mostly used for tween parameters, so
is quite rare after the Tweener purge. Get rid of the remaining ones
to cut down on pre-existing eslint errors.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/716
2019-09-12 23:18:24 +02:00
Florian Müllner
2fc4987c73 cleanup: Stop using Mainloop module
It is deprecated in favor of the regular GLib functions.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/718
2019-09-12 19:09:24 +02:00
Florian Müllner
a3267be192 network: Don't omit parens when constructing
While it is legal to omit parentheses when invoking a constructor
with no arguments, we generally avoid that in our coding style.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/710
2019-09-11 20:59:31 +00:00
Florian Müllner
52f85c9465 system: Properly separate statements
Whoops, that's some typo that sneaked into commit 9c3b3320f8 ...

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/710
2019-09-11 20:59:31 +00:00
Marco Trevisan (Treviño)
a497afe695 system: Track buttonGroup visibility using a group of actors
Cleanup the visibility check on actions by using an array of actors to
track, so that we don't repeat the same variables multiple times.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/700
2019-09-09 19:28:19 +00:00
Marco Trevisan (Treviño)
06317f4f6a status/keyboard: Make Input source types var
These are used by keyboard so they need to be readable outside the
status.keyboard module.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/700
2019-09-09 19:28:18 +00:00
Iain Lane
e6dec7a9dd
volume: Ignore slider changes we initiated ourselves
Commit 21e14bd46f fixed this for the
brightness slider, but we have the same problem for volume too. When the
volume is muted - for example in Settings or via a media key, we update
the slider to '0' to indicate this visually. But we also actually invoke
the slider's callback to *set* the volume to zero. That means that the
previous level is overwritten so it can't be restored when unmuting.

The fix is the same - when we update the slider internally ourselves,
don't call the signal handler.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1557
2019-09-05 11:30:33 +01:00
Florian Müllner
21e14bd46f brightness: Ignore slider changes we initiated ourselves
Since we set the proxy value when the slider changes and set the slider
value on proxy property changes, we run into a cycle.

Before commit 3d3dca4aa this was addressed by not notifying on all slider
changes, but only in reaction to direct user action. Given that since the
splitting out of the BarLevel class those events are handled in a subclass,
that approach is at least unconvential and fairly fragile.

Instead, make the brightness indicator ignore any changes to the slider it
initiated itself.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1500
2019-08-13 16:35:17 +02:00
Florian Müllner
79b54f65b4 volume: Fix overdrive in slider
When setting a maximum value above 1, we currently set a non-existant
maximum_level property instead of the actual 'maximum-value' one.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/670
2019-08-07 16:17:45 +00:00
Florian Müllner
3d3dca4aa2 js: Actorize animated objects
We have a couple of places where we don't tween the actor, but a
custom property on the delegate object. In order to move those
to Clutter animations, we will need an animatable, so turn those
objects into widget subclasses.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/666
2019-08-06 23:54:29 +02:00
verdre
cb0d28770f osdWindow: Use float values as input for osdWindow
Using the same type/interval as BarLevel means we can cut out the intermediate
LevelBar class in a follow-up cleanup.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/385
2019-07-28 17:27:53 +02:00
Florian Müllner
b970ee7293 barLevel: Use setters instead of methods
Switching to getters/setters make the code suitable for using
with Tweener and as GObject properties, both of which we'll
do soon enough.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/385
2019-07-28 17:27:53 +02:00
verdre
5545e84430 volume: Remove unused method
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/385
2019-07-28 17:27:53 +02:00
Florian Müllner
e357559582 cleanup: Mark globals used from other modules as exported
eslint cannot figure out that those symbols are used from other modules
via imports, so they trigger unused-variable errors. To fix, explicitly
mark those symbols as exported.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/627
2019-07-24 00:28:45 +02:00
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
bd5162105e power: Make sure we fall back to the correct icon
Commit bd18313d12 changed to a new naming scheme for battery icons,
and used to old icon names as fallback-icon-name for compatibility
with older/other icon themes.

However that fallback code isn't working correctly, as GThemedIcon's
default fallbacks will transform a name of `battery-level-90-symbolic`
to a list of names:
 - `battery-level-90-symbolic`
 - `battery-level-symbolic`
 - `battery-symbolic`

The last one frequently exists, so instead of the intended fallback,
we end up with a generic battery icon.

Address this by specifying the icon as GIcon instead of an icon-name,
where we have more control over how the icon is resolved.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1442
2019-07-19 19:11:37 +00:00
Florian Müllner
bd18313d12 power: Use more fine-grained battery levels
Adwaita-icon-theme added new battery icons which represent battery levels
in 10% steps[0]. Use these if they are available, otherwise fall back to
the existing icon names for compatibility with older icon themes.

[0] https://gitlab.gnome.org/GNOME/adwaita-icon-theme/issues/6

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/561
2019-07-12 23:24:35 +02:00
Florian Müllner
1b31fd5afe cleanup: Don't call method via a parent's prototype
We cannot disconnect a signal handler via the usual disconnect() as
nm_device_disconnect() shadows the GObject method, but we can use
g_signal_handler_disconnect().

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/626
2019-07-12 18:54:49 +00:00
Florian Müllner
0d035a4e53 cleanup: Prefer template strings
Template strings are much nicer than string concatenation, so use
them where possible; this excludes translatable strings and any
strings containing '/' (until we can depend on gettext >= 0.20[0]).

[0] https://savannah.gnu.org/bugs/?50920

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/612
2019-07-05 11:32:31 +00:00
Florian Müllner
14d7897a93 style: Stop using braces for single-line arrow functions
Braces are optional for single-line arrow functions, but there's a
subtle difference:
Without braces, the expression is implicitly used as return value; with
braces, the function returns nothing unless there's an explicit return.

We currently reflect that in our style by only omitting braces when the
function is expected to have a return value, but that's not very obvious,
not an important differentiation to make, and not easy to express in an
automatic rule.

So just omit braces consistently as mandated by gjs' coding style.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00: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
5ec4c2e43e cleanup: Use spaces for indentation
Our indentation style has always mandated spaces, but over the years
some tabs sneaked in. Fix up those places.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00:00
Florian Müllner
8c28f9a77d dwellClick: Reindent modes map
Using multiple spaces after property names in order to align the
values isn't something we do elsewhere.

Instead, align the values by using a fixed 4-space indent as preferred
by gjs nowadays.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00:00
Florian Müllner
4c5206954a style: Use camelCase for variable names
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
2019-07-01 23:44:11 +02:00
Florian Müllner
8fda3116f0 style: Fix brace style
Opening braces should be on the same line as the associated statement,
and only be omitted if both surrounding blocks are one-liners.

Partially spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
2019-07-01 23:44:11 +02: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
29b04fcbf2 style: Fix stray/missing semi-colons
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
2019-07-01 23:44:11 +02:00
Florian Müllner
55235c2552 style: Avoid trailing commas in array destructuring
When destructuring multiple return values, we often use trailing commas
to indicate that there are additional elements that we are ignoring.

There isn't anything inherently wrong with that, but it's a style that's
too confusing for eslint - on the one hand we require a space after a
comma, on the other hand we require no space before closing brackets.

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
0b08ee54bb cleanup: Clean up unused imports
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
Florian Müllner
b87455c089 keyboard: Remove unnecessary boolean cast
In contexts where a statement (like if or while) expects a condition,
any expression will be implicitly cast to boolean already without
C-isms like double negation.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/606
2019-07-01 21:09:49 +00:00
Florian Müllner
d4582491f5 system: Drop custom styling of user submenu icon
The default style we get from .popup-menu-icon actually works better,
as it ensures consistency with all the other submenu icons used in
the aggregate menu.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/591
2019-06-29 20:01:52 +00:00
Florian Müllner
2e070ab834 panel: Center-align menu arrows
Center alignment looks more balanced and makes it more likely that
the menu opens below the pointer position.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1351
2019-06-21 21:09:56 +00:00
Will Thompson
94ba52af0c
network: don't assume NMActiveConnection has a device
In practice this has been seen to fail:

    JS ERROR: TypeError: active.get_devices(...)[0] is undefined
    ensureActiveConnectionProps@resource:///org/gnome/shell/ui/status/network.js:73:22
    _getMainConnection@resource:///org/gnome/shell/ui/status/network.js:1791:13
    _syncMainConnection@resource:///org/gnome/shell/ui/status/network.js:1809:32

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1406
2019-06-21 11:26:53 +01:00
Olivier Fourdan
5ace4682bf accessibility: Add pointer accessibility support
Adds the UI part for the pointer accessibility features.

The various timeouts running are notified using a pie-timer showing
under the pointer.

For dwell-click type selection, we use a drop-down menu. Users can
use the dwell-click to select the next type of dwell click to be
emitted.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/474
2019-06-06 09:13:29 +02: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
Jonas Dreßler
9ca8433170 network: Make NMWirelessDialogItem a subclass of St.BoxLayout
In commit 41dd744b74 this item was
confused with a popup menu item. To fix this, make NMWirelessDialogItem
inherit from St.BoxLayout instead of adding the item.actor variable back
again.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/551
2019-05-22 19:55:49 +00:00
Veerasamy Sevagen
b197a1affb cleanup: Fix spelling errors
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/515
2019-05-15 19:32:29 +00:00
Marco Trevisan (Treviño)
9697c209c0 system: Just use buttonGroup instead of adding extra _actionsItem
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/499
2019-05-15 17:27:08 +00:00
Marco Trevisan (Treviño)
41dd744b74 js/status: Use menu items as actors
All menu items are actors now, so remove all the actor property usages.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/499
2019-05-15 17:27:07 +00:00
Fabrice Bellet
d9bfa16f05 network: Handle interface name changes
The interface name when a device is added may not be the final one. For
example when using USB tethering, it will first appear as 'usb0' before
being renamed to something like 'enp0s20f0u1' depending on the port the
phone is plugged in.

As a result, we will ignore the new interface name in that case and fail
to associate the correct connection with the device: Instead of the
correct "USB Ethernet" (or user-customized name), it will show up as
"Ethernet".

Fix this by updating names and connections when a device's interface
property changes.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/534
2019-05-07 15:21:09 +00:00
Marco Trevisan (Treviño)
bbd3275dad js: Check for this.constructor type instead of new.target
Use more ES6-inspired check for classes initializations.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/503
2019-04-26 20:48:52 -05:00
Jonas Dreßler
293f50e8e5 accessibility: Add settings changed signal handler after creating widget
Move the signal handlers for changed settings to be connected after the
creation of the menu items to make sure a reference to the item is set.

While it also worked fine before, this solution certainly looks cleaner.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/512
2019-04-26 18:47:45 +00:00
Marco Trevisan (Treviño)
fedb8e706a panelMenu: Remove usage of this.actor from Button
Remove this.actor = actor, since the class is now an actor itself.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/487
2019-04-17 21:32:18 +00:00
Florian Müllner
4fa5d701d5 network: Catch errors when reading devices
NetworkManager added support for a new device - NMDeviceWifiP2P - but
did not add the corresponding enum value in NMDeviceType. The return
value for nm_device_get_device_type() is therefore "illegal" for the
newly added device, and gjs throws an exception.

This should ultimately be fixed in libnm, but as errors when adding
one device shouldn't interfere with adding any other devices, catching
exception is a good idea anyway, so do just that.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1023
2019-03-27 15:06:49 +00:00
Florian Müllner
0089143d06 aggregateMenu: Include action buttons in width computation again
Commit 1b169655ac removed the system indicator from the list of children
that are considered for the overall menu width, because we do want the
log-out submenu to adapt to the available width.

However as a side effect, action buttons no longer contribute to the
width either, so if extensions add additional buttons, the menu is
likely to overflow.

Avoid this by only adding the button group to the list of size children.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1094
2019-03-21 10:08:29 +00:00
Florian Müllner
5f2bd70690 network: Don't destroy wireless dialog twice
The dialog doesn't change the `destroyOnClose` property from its default,
so it is already destroyed automatically on close. So if we also destroy
it explicitly, we end up (rightfully) with one of gjs' infamous "invalid
access" warnings.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/430
2019-03-02 22:09:20 +01:00
Florian Müllner
33e05f5912 system: Always use default avatar in switch-user submenu
It is too small to be really useful, and sticks out being the
only color icon.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/957
2019-02-10 10:33:23 +00: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
Christian Kellner
345a8fe748 thunderbolt: ensure failure msg is translatable
Swap the gettext() and format() calls to ensure that the message
is translatable.
2019-02-04 18:53:42 +00:00
Florian Müllner
c47e672eea a11y: Don't set WM theme
We've been using GTK to draw server-side decorations according to the
GTK theme for a long time, so no need to configure the HighContrast
theme for a setting we don't use.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/377
2019-01-31 08:29:15 +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
4f76e05058 keyboard: Fix undefined variable in fall-through message
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/375
2019-01-30 16:13:17 +00:00
Florian Müllner
e68dfed1f7 cleanup: Port GObject classes to JS6 classes
GJS added API for defining GObject classes with ES6 class syntax
last cycle, use it to port the remaining Lang.Class classes to
the new syntax.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/361
2019-01-25 14:02:44 +00: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
Philip Withnall
8bb9eb0fc9 keyboard: Disconnect from input source manager when destroying indicator
When an InputSourceIndicator is destroyed, the InputSourceManager it was
connected to could (and probably will) outlive it (since the manager is
a singleton). If the InputSourceManager emits any subsequent signals,
the callbacks from the finalised InputSourceIndicator could be invoked,
and will reference finalised objects.

This can be triggered by running `pkexec true` from a gnome-terminal
window, then calling `pkill pkexec` from another terminal (on a
different VT or via SSH). This causes the dialogue to be cancelled by
polkitd.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/357
2019-01-24 14:48:48 +00:00
Christian Kellner
1f864c905d thunderbolt: only try to enroll if we are allowed
Check via Polkit if the current user is actually allowed to enroll
devices before trying to do so. If not, show a notification that
explains that a system administrator needs to authorize the device.
Clicking on the notification will guide the user to the thunderbolt
control center panel. Before this patch, when the current user was
not allowed to enroll a device a polkit dialog would pop up which
is confusing because it did not contain any information why it was
shown. This patch implements the behavior as designed (see [1],
section "Multi-user environments").

[1] https://wiki.gnome.org/Design/Whiteboards/ThunderboltAccess
2019-01-18 22:10:23 +01:00
Florian Müllner
22e21ad7d1 animation: Add dedicated Spinner class
We use AnimatedIcon with the same resource all over the place, cut
down on the duplication by providing a dedicated class.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/316
2019-01-16 17:44:42 +00:00
Carlos Garnacho
a6002652d0 volume: Port to MetaSoundPlayer for emitting sounds
Move away from ShellGlobal API, which is too tightly coupled to
libcanberra-gtk.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/327
2019-01-09 23:09:18 +00:00
RyuzakiKK
616852cf2b thunderbolt: fix missing variable underscore for enrolling
The variable `this.enrolling` is a typo because it has not been defined
before and is also never used.
`this._enrolling` is what it was meant to be.
2018-12-07 11:19:57 +00:00
Florian Müllner
e77463b875 altSwitcher: Fix error when all alternatives are disabled
While we do consider the case that we don't have a child to show for the
visibility, we are still trying to move the click action unconditionally.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/783
2018-11-17 12:18:23 +00:00
João Paulo Rechi Vita
52c59ac0dd power: Label the PENDING_CHARGE state as "Not Charging"
The pending-charge state means AC power is on but the battery is not
being charged. This can happen because its charge is above a certain
threshold, to avoid short charging cycles and prolong the battery's
life, or because the PSU is not powerful enough to charge the batteries.

Instead of lying to the user about something being estimated, we should
simply tell the truth and set the label to "Not Charging".

Closes: #701.
2018-11-14 13:51:26 -08:00
Takao Fujiwara
551e827841 keyboard: Do not call KeyboardManager.holdKeyboard() with set-content-type
When gnome-shell receives the signal of 'set-content-type' from ibus,
gnome-shell calls KeyboardManager.holdKeyboard() and
KeyboardManager.releaseKeyboard() and the functions change the current
input focus in GNOME Xorg and it could result in closing a popup window
which has a password entry by focusing on the entry.
The solution is to stop to call the APIs on 'set-content-type' signal.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/391
2018-11-09 10:55:30 +00:00
Georges Basile Stavracas Neto
038f8b6ea5
keyboard: Stop using Shell.GenericContainer
This is the last remaining usage of Shell.GenericContainer
in the codebase, and posed small challenges compared to the
other removals.

A new St.Widget subclass called InputSourceIndicatorContainer
was added as a replacement to the Shell.GenericContainer. It
was needed because GNOME Shell needs to override the regular
size allocation functions, but InputSourceIndicator already
is a St.Widget with its own size allocation overrides.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:43:01 -03:00
Georges Basile Stavracas Neto
e82c68accd
switcherPopup: Rename destroy() to fadeAndDestroy()
In the process of purging all usages of Shell.GenericContainer
of GNOME Shell, one specific problematic situation that might
occur is when classes have functions that would clash with any
ClutterActor or StWidget function name.

One of such example is SwitcherPopup.destroy(). Right now, this
class is a pure JavaScript class that wraps a real actor, but
soon this will change, and it'll become a St.Widget subclass.

Another problem with functions that mimic the toolkit ones is
the predictability of them; after calling destroy(), that widget
is expected to not be available anymore. In SwitcherPopup case,
it is still available for a short while. In this case, that's not
a big problem, but the show() and hide() functions in other clases
are more problematic because the actor's visibility does not
follow that.

This commit is a first step in cleaning that up, and changes the
SwitcherPopup.destroy() to fadeAndDestroy().

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:23 -03:00
Adam Williamson
33ffdd6061 Fix connection to wifi APs from user menu (RH #1628263)
In recent Fedora 29, connecting to wifi access points from the
user menu (top-right menu) does not work. Clicking the 'Connect'
button just animates it but does nothing else. The logs show an
error "JS ERROR: Error: Expected type utf8 for Argument
'specific_object' but got type 'undefined'".

Looking into this, it seems the problem is these uses of the
`path` property of an NMAccessPoint. NMAccessPoint inherits
from NMObject, and NMObject *does* have a path property:

https://developer.gnome.org/libnm/stable/NMObject.html#NMObject--path

so at first glance this seems fine. But I poked around a bit
using libnm via Python (which goes via introspection, just like
this JS code does), and found that indeed AccessPoint objects
don't seem to have a `path` property there either.

Looking at the libnm code, this actually makes sense, because
the property is marked "(skip)":

https://github.com/NetworkManager/NetworkManager/blob/master/libnm/nm-object.c#L1291

and the introspection docs suggest that means it should be left
out of introspected output:

https://wiki.gnome.org/Projects/GObjectIntrospection/Annotations#Symbol_visibility

I'm a bit concerned that this was only found recently - whereas
the change to use `.path` in gnome-shell dates from October 2017
(d71af5e5) and the property has been marked (skip) in NM since
at least 2016 - but this all seems to add up. The obvious fix is
to replace use of `.path` with `.get_path()`, which returns the
path and is *not* marked (skip) and so *is* available via
introspection. I tested that this works in Python and also did
a test build of gnome-shell with this change and installed it on
an affected system, it does seem to fix the bug.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-09-18 16:15:32 -07: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
Iain Lane
5d61e2563d network: Don't assume the active connection has been processed first
`NMConnectionDevice._sync()` is responsible for setting up the active
connection that we'll end up displaying. It expects the active
connection to already be in a map `_connectionItems`. If it isn't in
there, we get a null dereference and the indicator can get into a weird
state where it doesn't display devices / connections properly.

Let's change this expectation. If there is an active connection,
`_deviceAdded()` will eventually get to it and call `_sync()` to set up
the active connection state. We make `_sync()` tolerate there being no
active connection when it's called.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/140
2018-09-03 23:31:17 +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
Didier Roche
6217c3b88d volume: Show overamplified icon when in overdrive
Show an overamplified volume icon if volume is louder the max normalized one.
Use a similar logic as gnome-settings-daemon to delimit values, restricted
to output.
The purpose is to help users remember that visiting some websites or
using some apps can get LOUD.

https://bugzilla.gnome.org/show_bug.cgi?id=790280.
2018-07-31 18:14:15 +00:00
Didier Roche
d2a97e7f1d volume: Allow volume above 100%
Depending on hardware and recorded volume level, turning up the speakers
to the maximum volume may not be enough and the user will want to amplify
the volume above 100%. Currently this requires opening the sound Settings
panel which gets cumbersome when required repeatedly.

To support this case better, allow raising the sound volume above 100%
directly from the system menu if the feature is enabled via the
`allow-volume-above-100-percent` key in `org.gnome.desktop.sound`.
2018-07-31 18:14:13 +00:00
Georges Basile Stavracas Neto
f433b12d6e system: Don't execute Settings
In a9ad91c831, a bug was introduced in the following code:

```c
            this._settingsAction.connect('clicked',
                                         this._onSettingsClicked().bind(this));
```

Notice that the callback is being executed! This commit
fixes that by removing the '()' from the callback.
2018-07-31 13:31:59 -03:00
Florian Müllner
a9ad91c831 system: Pick up Settings name and icon from app
The settings action button in the system menu simply launches
gnome-control-center, so we want its icon (and accessible name)
to always match the app. So instead of keeping the button in-sync
with Settings, just look up that information from the app itself.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/433
2018-07-31 16:52:47 +02:00
Florian Müllner
bd1c7774ee system: Enforce symbolic icons in action buttons
We can simply request the symbolic variant from CSS so that we don't
have to append '-symbolic' to all the names. This will always make
it easier to pick up that information from external sources (like
.desktop files).

https://gitlab.gnome.org/GNOME/gnome-shell/issues/433
2018-07-31 16:52:47 +02:00
Jonas Ådahl
879a81abeb remoteAccess: Make indicator orange
Make the indicator for active remote access use the warning color, to
indicate the severity of allowing remote access.

This only makes the indicator icon orange; the icon in the system menu
is still white.
2018-07-27 18:10:35 +02:00
Jonas Ådahl
0d5bae3844 Add remote access indication and control
Add an indicator for when there is something access the display server
remotely. This could be 1) remote desktop, 2) screen cast or 3) remote
control, but all effectively applications using
org.freedesktop.portal.ScreenCast or org.gnome.portal.RemoteDesktop as
well as gnome-remote-desktop using the corresponding org.gnome.Mutter
APIs directly.

As it is now, it'll simply show a single icon for when anything is
having an active session, and a single action "Turn off" that'll close
every active session.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/160
2018-07-23 14:03:26 +02:00
Jonas Ådahl
47ea10b7c9 Remove usage of MetaScreen
Remove any usage of MetaScreen, as it has been removed from libmutter
in the API version 3. The corresponding functionality has been moved
into three different places: MetaDisplay, MetaX11Display (for X11
specific functionality) and MetaWorkspaceManager.

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:56:19 +02:00
Florian Müllner
5fe349d5ba thunderbolt: Do not auto start boltd
The service is expected to be activated by systemd when a thunderbolt
device is plugged in, so no need to have it auto-started with the
session.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/54
2018-06-25 14:17:07 +00:00
Florian Müllner
b1dd746443 network: Keep key focus in dialog when removing networks
When the actor that has the key focus is destroyed, Clutter moves
the focus to the stage. In case the destroyed actor was inside a
ModalDialog, this breaks any keyboard interaction: keynav is broken
because the stage isn't in any focus chain, and access keys like
Escape because they are handled on the dialog's parent.

The only dialog that may destroy a child without recreating the dialog
buttons (and thus moving the key focus there) is the WirelessDialog,
fix it by keeping the key focus within the dialog when removing networks
from the list.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/76
2018-05-31 11:42:14 +00:00
Florian Müllner
c15e163eb1 network: Handle networks with no access points
This avoids a couple of warnings when encountering such a network.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/76
2018-05-31 11:42:14 +00:00
Mario Sanchez Prada
d8b9e23502 network: Update the icon in the panel whenever NM's state changes
Similar to what it's done when the main connection changes, we need
to make sure that the icon in the panel gets updated before calling
_syncConnectivity(), so that the icon gets always updated if needed,
regardless of whether there's an active connection or not.

This is needed because there's at least one case when an icon should
be shown when the computer is not connected to any network: when a
hotspot has been enabled, which can be useful even if there's not
an internet connection to share (e.g. to easily allow connecting
other devices to the computer.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/214
2018-05-15 09:15:43 +01:00
Christian Kellner
fb509dfc25 thunderbolt: sync D-Bus API with bolt changes
bolt 0.3 deprecated all AUTHORIZED_XXX status flags, but added
a CONNECTING one. Also AuthFlags got renamed to AuthCtrl.
2018-04-20 11:36:37 +02:00
Christian Kellner
874a91968f thunderbolt: remove gdbus error prefix, if present
If we get an error during device enrollment, the message might be
prefixed to indicate that the error came from the remote peer. We
are presenting that message to the user so strip that prefix away
if it was there.
2018-04-20 11:36:37 +02:00
Christian Kellner
0963ccddba thunderbolt: fix enroll-failed signal args order
The devices emitted (device, error) while the connected handler
was expecting (error, device). The former is more consistent
with the rest of the code (so change it to device, error).
2018-04-20 11:27:11 +02:00
Piotr Drąg
a198dfe3d8 thunderbolt: capitalize Thunderbolt in a translatable string 2018-04-13 21:52:32 +02:00
Christian Kellner
190a31dd5f thunderbolt: honor boltd's AuthMode property
boltd 0.2 gained a property that indicates if it is authorizing
devices or not. If it indeed is not authorizing then we wont
try to enroll new devices because that would otherwise lead to
and error.
2018-03-05 22:03:28 +01:00
Christian Kellner
cccfc7faca thunderbolt: adapt to bolt 0.2 interface changes
All enums are now strings on the bus. Also the Device.Security
property is gnome. Some new properties got added instead.
2018-03-05 22:03:11 +01: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
2bce1f1510 keyboard: Fix a warning
imports.misc.ibusManager.IBus is declared as const, so referencing it
from another module triggers a warning with recent mozjs. As of commit
083d11a032 IBus is mandatory, so just make it a regular import to avoid
the warning.
2018-02-21 13:19:15 +01:00
Christian Kellner
194040dcb2 thunderbolt: add policy provider and indicator
We will now basically act as "policy provider" for thunderbolt
peripherals by using org.freedesktop.bolt service: when new
devices are connect and session is a unlocked user session
we will automatically enroll (authorize and store in the database)
them.
If new devices are connected but the session is locked a message
will be shown informing the user that the device needs to be
reconnected to properly work.
The org.freedesktop.bolt service is provided by the "bolt" daemon.
2018-02-05 21:38:49 +01:00
Carlos Garnacho
82cecf2e36 keyboard: Add languages selection popup
Currently the language options displayed pretty much mirror those of the
top bar keyboard layout selection popup. It may make sense in the future
to only list languages, and automatically switch to the enabled IMs that
the OSK can benefit from (eg. by filling in suggestions).
2018-02-05 17:46:57 +01:00
Lubomir Rintel
d71af5e579 network: port to libnm
The libnm-glib is depreacted for a long time already.

https://bugzilla.gnome.org/show_bug.cgi?id=789811
2018-01-12 11:48:49 +01:00
Florian Müllner
f91fbd7728 network: Fix visibility of VPN section
Commit f2a9467f91 was too eager to simplify the code, and removed
the bits that hid the section in case no VPNs are set up - add them
back to fix the visibility.

https://bugzilla.gnome.org/show_bug.cgi?id=787845
2018-01-10 10:11:25 +01:00
Florian Müllner
723c49a8b7 location: Use translated reason string
Gio now has API to look up localized strings from desktop files,
so we can display a correctly translated reason where available.

https://bugzilla.gnome.org/show_bug.cgi?id=779413
2018-01-09 00:25:46 +01:00
Marco Trevisan (Treviño)
a46af9edf0 status/keyboard: Reset menuItems and Label objects on change
In the current code it could happen that we've menuItems and indicatorLabels
for sources that aren't anymore around, because in case a source is removed
we don't cleanup the their container objects.
Also, we should nullify InputManager's _currentSource when sources change
or it might point to some invalid data again.

So it could happen that we try to access an invalid menuitem or label
if a source change happens mentioning a source that has been deleted.

https://bugzilla.gnome.org/show_bug.cgi?id=788931
2017-11-21 02:16:38 -05:00
Florian Müllner
aa0858529e network: Spawn wifi panel for further WPA enterprise configuration
Settings recently split Wi-Fi configuration from the Network panel,
so launch that instead.

https://bugzilla.gnome.org/show_bug.cgi?id=789231
2017-10-20 18:03:33 +02:00
Mario Sanchez Prada
fb3070981c bluetooth: Add missing 'BluetoothHardwareAirplaneMode' to D-Bus interface
This D-Bus property was never been added here, which caused inconsistencies
under some scenarios (e.g. coming back from suspend) if some devices were
previously paired, since _sync() would then make the bluetooth menu visible
unconditially, because of the proxied property evaluating to 'false'.

Adding this to the D-Bus interface makes sure that it's no longer undefined
and returns the right value, fixing the bug.

https://bugzilla.gnome.org/show_bug.cgi?id=789110
2017-10-17 20:16:38 +01:00
Florian Müllner
01d8811913 gdm: Remove separate greeter universal access icon
The idea behind always showing the icon on the login screen is that
the users' needs aren't known at that point. However we can achieve
the same behavior by including the 'always-show-universal-access-status'
key in GDM's presets, so drop the special-case.

https://bugzilla.gnome.org/show_bug.cgi?id=788943
2017-10-13 16:53:54 +02:00
Rares Visalom
9c3b3320f8 system: Split out system actions to its own module
In anticipation of showing the system actions in
the search results, it is fit to move action
specific code to its own module in order to
reuse it.

https://bugzilla.gnome.org/show_bug.cgi?id=691900
2017-08-22 12:09:04 +02:00
Rares Visalom
7d95275076 system: Don't leave overview when activating most items
The current behavior wasn't designed, but was introduced in commit
84efaac52b to work around technical limitations when we were still
using external tools like gnome-screensaver or gnome-session-quit
to handle the actions. Those limitations are long gone, so it makes
sense to make the actions consistent with the corresponding keyboard
shortcuts: Leave the overview when launching an application, and leave
it alone otherwise.

https://bugzilla.gnome.org/show_bug.cgi?id=691900
2017-08-22 12:09:04 +02:00
Rui Matos
f2a9467f91 network: Simplify and fix VPN settings menu item
As in commit b2b2f65 and furthermore it doesn't make much sense to
change the menu item according to the number of connections since all
connections here are of the same type.

https://bugzilla.gnome.org/show_bug.cgi?id=786520
2017-08-21 12:12:52 +02:00
Florian Müllner
b2b2f65214 network: Launch the appropriate settings panels
The new control-center shell split wifi configuration from the network
panel, and moved all other devices into a flat list. So instead of
manually spawning the app with the 'show-device' subcommand, we can
now simply launch the appropriate settings panel.

https://bugzilla.gnome.org/show_bug.cgi?id=786520
2017-08-20 18:03:32 +02:00
Carlos Garnacho
1532ac3726 status/keyboard: Fix typo
Missing 't' in shortName, as it's used everywhere else.
2017-08-12 21:12:07 +02: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
Florian Müllner
593b4318a3 ui: Use MessageDialogContent where appropriate
The gros of our ModalDialogs follow a UI pattern that matches the
newly added widget, so port them over to cut down on duplication.

https://bugzilla.gnome.org/show_bug.cgi?id=784985
2017-07-16 18:15:00 +02:00
Florian Müllner
358133e82f Initialize properties in _init()
While we've always considered it good style to initialize JS properties,
some code that relies on uninitialized properties having an implicit
value of 'undefined' has slipped in over time. The updated SpiderMonkey
version used by gjs now warns when accessing those properties, so we
should make sure that they are properly initialized to avoid log spam,
even though all warnings addressed here occur in conditionals that
produce the correct result with 'undefined'.

https://bugzilla.gnome.org/show_bug.cgi?id=781471
2017-07-13 17:23:54 +02:00
Florian Müllner
79aa404c14 volume: Show OSD popup when changing volume via scroll
It is possible to use the scroll wheel to adjust the volume without
opening the system menu, but there is no feedback other than the
icon itself in that case. To provide a less coarse indication for
the volume level, display the OSD window when adjusting the volume
while the slider isn't visible.

https://bugzilla.gnome.org/show_bug.cgi?id=781028
2017-07-13 12:28:15 +02:00
Florian Müllner
2339c39ae6 system: Emulate click action button release
Since commit 2c070d38, we add a ClickAction to the visible AltSwitcher
button to track long-presses. As a result, we now have two components
that will grab and ungrab the pointer for the button, so to make sure
we don't end up with a stuck grab, we need to release the second's
component grab when the first activates.

Currently we only drop the StButton grab on long-press, we also need
to cancel any initiated long-press on click.

https://bugzilla.gnome.org/show_bug.cgi?id=781738
2017-07-13 12:27:47 +02:00
Cosimo Cecchi
6f473a4f29 network: don't assume the connection path is always non-NULL
It can be NULL according to the libnm-glib documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=780321
2017-03-20 18:43:50 +00:00
Carlos Garnacho
35d0ba4454 status/a11y: Fix typo
The idle ID being set and being checked didn't quite match up.
2017-03-20 18:16:56 +00:00
Florian Müllner
9cc1e6b85c location: Split out PermissionStore
It doesn't make sense to tie the proxy code for flatpak's permission
store to the location indicator, just because that was the first
component to use it, so split it into a separate module.

https://bugzilla.gnome.org/show_bug.cgi?id=780252
2017-03-20 19:02:08 +01:00
Florian Müllner
f97a3522e5 network: Close Wifi selection dialog when appropriate
Currently when the wifi selection dialog is open when the screen lock is
activated, the dialog remains visible above the shield. This is clearly
broken, so close the dialog automatically on session mode changes if the
mode doesn't allow settings (as changing the access point is arguably a
user setting).

https://bugzilla.gnome.org/show_bug.cgi?id=780054
2017-03-20 19:02:07 +01:00
Bastien Nocera
607b2efcce network: Don't start portal helper under GDM
https://bugzilla.gnome.org/show_bug.cgi?id=769546
2017-02-22 16:21:40 +01:00
Piotr Drąg
649d360289 Use Unicode in translatable strings
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772210
2017-02-16 02:07:14 +01:00
Florian Müllner
785c813771 status: Add nightLight indicator
The display configuration now exposes a setting to automatically
shift the display color at nighttime. As there are cases where
disabling the filtering temporarily is useful, it makes sense to
expose the feature in the system menu for quick access.

https://bugzilla.gnome.org/show_bug.cgi?id=741224
2017-02-15 23:20:14 +01:00
Florian Müllner
2c070d38fb system: Switch between alternatives on long-press
On systems that support both shutdown and suspend, the latter operation
is currently only accessible via pressing the Alt key. As using the
keyboard may be inconvenient or simply not possible (e.g. on touch),
allow switching between alternatives via long-press as well.

https://bugzilla.gnome.org/show_bug.cgi?id=721173
2017-02-15 23:20:14 +01:00
Florian Müllner
fa82af251f location: Initialize permissions
The permissions hash is initialized after consulting the permission
store, however the lookup is skipped for requests that cannot be
resolved to an application, resulting in an error when accessing
the uninitialized hash for saving. Just make sure that the property
is always initialized to avoid that error.

https://bugzilla.gnome.org/show_bug.cgi?id=778661
2017-02-15 23:20:14 +01:00
Benjamin Berg
30e17036e8 network: Ensure the connection list is sorted after rename
Items were inserted correctly but the synchronisation was lost if the
name of a connection was changed. Simply making sure the position is
correct after a connection is updated fixes the issue.

Reported-by: Oliver Haessler <ohaessle@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=778686
2017-02-15 22:49:07 +01:00
Michael Catanzaro
da7db509e7 network: Avoid JS error when activating VPN connection
If the call to settings.get_connection_by_path in
ensureActiveConnectionProps returns null, we'll hit a JS error here.
Seems to happen always when activating a VPN connection. Avoid that.

Giovanni says:

"I believe this is papering over an existing bug, but it's possible for
settings.get_connection_by_path() to legitimately return null (if the
connection is owned by a different user and invisible to the current
one), so the fix is correct anyway."

https://bugzilla.gnome.org/show_bug.cgi?id=759793
2016-12-27 12:14:19 -06:00
Florian Müllner
b6cd548186 network: Always show primary icon when connected
The top bar's network menu only supports a subset of device types
supported by NetworkManager. While not having lesser used options
in the menu itself is perfectly reasonable, not showing any network
icon at all in the top bar when the system is fully connected is
weird.

https://bugzilla.gnome.org/show_bug.cgi?id=773890
2016-11-10 14:32:07 +01:00
Florian Müllner
b3fabf11b1 network: Summarize sections with too many devices
Any network devices appear as top level items in the system status
menu, so on system with an unusually high number of devices, the
menu can end up exceeding the available screen height. While this
is a corner case, leaving important system actions unreachable is
bad. The system menu does not lend itself to scrolling, so handle
this case instead by summarizing sections ("n connections") where
the number of devices exceeds a threshold.

https://bugzilla.gnome.org/show_bug.cgi?id=773892
2016-11-10 14:32:07 +01:00
Bastien Nocera
39a840e2c3 shell-app: Add "discrete_gpu" option when launching apps
And adapt existing callers to the new API. This will allow us to
implement a way to launch applications on the discrete GPU for systems
where an "Optimus" system exists.

https://bugzilla.gnome.org/show_bug.cgi?id=773117
2016-10-21 19:26:49 +02:00
Bastien Nocera
9c6e68f3e7 bluetooth: Replace "Not In Use" status string with "On"
If Bluetooth is on but there aren't connected devices, the status in the
menu reads "Not in Use". This is potentially confusing: it's a negative
statement, even though Bluetooth is on. It also sits uneasily (and looks
even more confusing) next to the submenu item "Turn Off".

Changing the string to "On" is better.

https://bugzilla.gnome.org/show_bug.cgi?id=756432
2016-10-12 10:35:31 +02:00
Dan Williams
384e01b368 network: request periodic scans while the WiFi list is open
NM upstream would like to reduce periodic scanning, and that means
that clients should request scans themselves while their WiFi list
is open.  Similar to the Windows and macOS WiFi dialogs/lists.

https://bugzilla.gnome.org/show_bug.cgi?id=767918
2016-10-11 14:43:19 +02:00
Florian Müllner
d0bab1f7ac network: Initialize primary and VPN connections on startup
We only connect to the corresponding property notifications after both
Client and RemoteSettings are ready, so we may miss the initial signal
emission. Make sure to pick up the connections in this case to fix the
network indicator not showing up.

https://bugzilla.gnome.org/show_bug.cgi?id=772249
2016-09-30 13:50:30 +02:00
Cosimo Cecchi
2ea6ae05e5 keyboard: save the MRU input sources list when switching
And restore it when reloading the current list of sources, if
appropriate.

https://bugzilla.gnome.org/show_bug.cgi?id=766826
2016-05-27 10:46:58 -07:00
Cosimo Cecchi
5c0eba7d3b keyboard: add an interactive argument to input source activation
This is useful to differentiate between a change due to user interaction
or automatic loading.

https://bugzilla.gnome.org/show_bug.cgi?id=766826
2016-05-27 10:46:58 -07:00
Cosimo Cecchi
f81887772a keyboard: split out a function to udpate the MRU list
We're going to add saving of the MRU list in the function in a later
commit.

https://bugzilla.gnome.org/show_bug.cgi?id=766826
2016-05-27 10:46:58 -07:00
Cosimo Cecchi
9aa3d864dc keyboard: split out a function
We're going to use this in a later commit.

https://bugzilla.gnome.org/show_bug.cgi?id=766826
2016-05-27 10:46:58 -07:00
Florian Müllner
2425b11df6 system: Do not disable suspend action when locked
gnome-settings-daemon now allows the corresponding keybinding, so
for consistency it makes sense to show the button as well.

https://bugzilla.gnome.org/show_bug.cgi?id=725960
2016-05-27 17:04:47 +02:00
Florian Müllner
437256e0f1 location: Update for PermissionStore DBus API changes
As xdg-app has been renamed to Flatpak, the permission store's
bus name and interface name have been changes as well.

https://bugzilla.gnome.org/show_bug.cgi?id=766598
2016-05-27 15:31:50 +02:00
Florian Müllner
841e0132e9 network: Improve labels for Bluetooth devices
Bluetooth is not "Mobile Broadband", so rename the settings link
accordingly. Also use a more assertive connect label.

https://bugzilla.gnome.org/show_bug.cgi?id=757019
2016-05-27 01:03:25 +02:00
Florian Müllner
9c483dd9a6 system: Only show rotation lock when a builtin output is present
We currently show the orientation lock button when an accelerometer
is present, however gnome-settings-daemon's xrandr plugin only applies
rotation when a builtin monitor is present. Update the button's
visibility to match gnome-settings-daemon.

https://bugzilla.gnome.org/show_bug.cgi?id=765267
2016-04-21 21:16:50 +02:00
Zeeshan Ali (Khattak)
ff19e411a2 location: Style reason label
https://bugzilla.gnome.org/show_bug.cgi?id=762480
2016-03-10 15:24:21 +00:00
Zeeshan Ali (Khattak)
64741e41df location: Replace description w/ privacy note
https://bugzilla.gnome.org/show_bug.cgi?id=762480
2016-03-10 14:51:32 +00:00
Zeeshan Ali (Khattak)
3492121c3f location: Only ask user once
Let's make it really simple and ask user interactively, once. This
simplifies things for:

* Privacy panel of gnome-control-center as it doesn't have to filter
  applications.

* Apps: If they are denied access, they can simply point users to
  privacy panel of gnome-control-center since they can be sure location
  access for the app can be enabled in there.

Also it's less annoying to user. Before this patch, if they denied
access to application, they had to keep doing that at least each time
they launched the application.

https://bugzilla.gnome.org/show_bug.cgi?id=762559
2016-03-03 16:06:20 +00:00
Zeeshan Ali (Khattak)
4eb6c0c4ee location: Put app permission in GNOME table
Alex told me that since it's not geoclue but rather GNOME-components
storing/accessing app permissions, it's better if we put it under
'gnome' rather than generic 'desktop' table.
2016-02-22 22:55:09 +00:00
Florian Müllner
0edbdc529e location: Add translator comments
https://bugzilla.gnome.org/show_bug.cgi?id=762270
2016-02-18 17:37:29 +01:00
Zeeshan Ali (Khattak)
a1e8c79d38 location: Ask user to authorize applications
While we could have implemented this already a while ago, this would
have been a completely false security mechanism since we had no way of
reliably identifying applications. Since now with xdg-app, we can at least
reliably identify bundled applications, let's give users a choice of
which applications in particular they are OK with giving location data
to.

While we still can't reliably identify system (non-xdg-app) applications,
it seems extremely unlikely we'll ever be able to do that (at least not
in the near future) so we'll have to trust them to not lie about their
IDs.

Next release of geoclue will take the ID of bundled application directly
from corresponding xdg-app metadata so bundled applications can't simply
lie about their IDs.

https://bugzilla.gnome.org/show_bug.cgi?id=762119
2016-02-18 15:11:11 +00:00
Zeeshan Ali (Khattak)
34fc454764 location: Add AppAuthorizer class
This class will be responsible for authorizing applications that try to
access location information. Since this is mainly targetted for xdg-app
applications, we make use of xdg-app's D-Bus API to store
per-application authorization.

https://bugzilla.gnome.org/show_bug.cgi?id=762119
2016-02-18 15:11:11 +00:00
Zeeshan Ali (Khattak)
e98a434ede location: Add dialog to ask for location data access
Add a dialog that is used in a following patch, to ask user if they want
a requesting application to gain access to their location.

Co-author: Florian Müllner <fmuellner@gnome.org>

https://bugzilla.gnome.org/show_bug.cgi?id=762119
2016-02-18 15:11:10 +00:00
Zeeshan Ali (Khattak)
ccfd5e35d6 location: Better name for a field
_proxy -> _managerProxy.

https://bugzilla.gnome.org/show_bug.cgi?id=762119
2016-02-17 13:04:16 +00:00
Bastien Nocera
31201d9618 power: Add battery percentage label
An oft requested feature, available in 4 separate extensions to
gnome-shell, and in most mobile OSes.

https://bugzilla.gnome.org/show_bug.cgi?id=735771
2015-11-19 14:04:22 +01:00
Michael Biebl
d7401c8646 Revert "power: Stop making time estimates"
This reverts commit 6c08799c7b.

See https://bugzilla.gnome.org/show_bug.cgi?id=708472#c87
2015-11-17 13:16:45 +01:00
Bastien Nocera
a456d5eb19 bluetooth: Remove unused imports
https://bugzilla.gnome.org/show_bug.cgi?id=758220
2015-11-17 11:25:02 +01:00
Florian Müllner
6c08799c7b power: Stop making time estimates
Any time estimates we can come up with are notoriously unreliable;
even on devices that report correct (dis)charging rates, any change
in workload, screen brightness etc. can throw our estimate off by
a huge amount. This is further compounded by bad firmware and battery
firmware which reports inaccurate data as neither Windows nor Android do
not use that data.

So instead, limit ourselves to only showing the current percentage
and leave its interpretation to the user.

As an added bonus, we end up with shorter strings that are less likely
to cause problems with ellipsization when translated.

https://bugzilla.gnome.org/show_bug.cgi?id=708472
2015-11-17 10:58:45 +01:00
Bastien Nocera
9ba399bf18 power: Add thin space between digits and percentage sign
As mentioned by Matthias Clasen on IRC, we should have a thin space
between the percentage digits and the sign itself.

https://bugzilla.gnome.org/show_bug.cgi?id=757816
2015-11-12 16:19:30 +01:00
Bastien Nocera
8ceae3b054 bluetooth: Show the Bluetooth menu when there were setup devices
If we detected that Bluetooth devices were setup, show the Bluetooth
menu so that users can easily turn Bluetooth back on.

This is a bit of a hack, as we cannot detect whether there is a
Bluetooth adapter at all when it's disabled, so we cannot tell whether
there were any Bluetooth devices setup, at some point. This state is
saved in the gnome-shell GSettings in the had-bluetooth-devices-setup
key.

Checking whether we saw Bluetooth devices at one point is a good
enough guess of whether there will be some in the future.

https://bugzilla.gnome.org/show_bug.cgi?id=723848
2015-10-28 11:51:07 +01:00
Piotr Drąg
a0df3e7d1e network: Unify capitalization in newly changed strings
After fa0e54edbb some strings were inconsistent.
2015-08-20 17:07:46 +02:00
Florian Müllner
fa0e54edbb status: Refine system status menu
* switch to a one-column layout (and adjust strings/widths
   accordingly
 * remove separator before system menu
 * add link to account settings to user submenu for consistency

https://bugzilla.gnome.org/show_bug.cgi?id=751377
2015-08-20 13:53:36 +02:00
Carlos Soriano
0722c06275 modalDialog: Match gtk+ buttons style
Follow the design we have in gtk+ for buttons dialogs,
which are at the bottom and they expand full width, having
the same amount of space for each one.

Also, since this removes any space for non-button widgets
in the button area, move the spinner present in the auth prompt
dialog next to the password entry.

https://bugzilla.gnome.org/show_bug.cgi?id=746108
2015-08-05 14:44:47 +02:00
Jakub Steiner
27a7194634 spinner: use a 60fps spinner
- sync with gtk+ and provide a fluid spinner

https://bugzilla.gnome.org/show_bug.cgi?id=753064
2015-08-05 13:44:32 +02:00
Bastien Nocera
2e77f6b34b system: Use iio-sensor-proxy to detect accelerometer
Instead of using gnome-settings-daemon's D-Bus interface's presence.
iio-sensor-proxy now offers a D-Bus interface, which will exported
"HasAccelerometer = true" when an accelerometer is present.

https://bugzilla.gnome.org/show_bug.cgi?id=749671
2015-05-27 10:13:38 +02:00
Rui Matos
2f228e21da status/keyboard: Backup the whole MRU list while in password mode
Instead of saving only the current input source when entering password
mode, let's save the whole MRU list so that we can restore it when
returning to normal mode.

This is closer to user expectations since password mode is a transient
and short lived state.

https://bugzilla.gnome.org/show_bug.cgi?id=746605
2015-03-30 17:51:18 +02:00
Giovanni Campagna
8327dbd611 System: update lock screen at construction
Will make sure that change notifications are enabled by reading
the value at least once

https://bugzilla.gnome.org/show_bug.cgi?id=746509
2015-03-27 13:12:25 -07:00
Giovanni Campagna
e1b575dddc System: remove unused GSettings
https://bugzilla.gnome.org/show_bug.cgi?id=746509
2015-03-27 13:12:22 -07:00
Giovanni Campagna
49fe0335ee status/a11y: invert connection to changes and initial read
If there is no signal connected to changed, get_value() will
not subscribe to notifications and we might miss changes.

https://bugzilla.gnome.org/show_bug.cgi?id=746509
2015-03-27 13:11:22 -07:00
Rui Matos
4da2862f8f status/keyboard: Add a system settings concept to be used under GDM
g-s-d has been taking care of this for us but in a very hackish way
that causes dconf writes on every startup and also doesn't handle
dynamic updates to locale1's properties which has become a problem now
that GDM keeps its greeter session running in parallel with users'.

To take care of this properly, this commit introduces a settings
abstraction with both system and session implementations. The session
implementation just wraps access to the existing gsettings while the
system one gets its values from org.freedesktop.locale1's properties.

https://bugzilla.gnome.org/show_bug.cgi?id=746288
2015-03-17 18:13:02 +01:00
Rui Matos
4e52ed9df7 status/keyboard: When per-window, choose the first IS for new windows
This was libgnomekbd's behavior and seems to be prefered by users.

https://bugzilla.gnome.org/show_bug.cgi?id=746037
2015-03-12 17:55:47 +01:00
Florian Müllner
890a809022 Drop MESSAGE_TRAY action mode
The mode is never set after the removal of the bottom tray, so it
no longer makes sense to pass it to allowKeybinding(). We can also
safely remove it from the ActionModes flags altogether without
requiring a synchronized update with gnome-settings-daemon, as
the latter never used any flag value above LOGIN_SCREEN.
2015-02-26 01:41:18 +01:00
Florian Müllner
530e8273ff Adjust for renamed action mode
Commit c79d24b60e renamed the TOPBAR_POPUP mode to POPUP to
reflect its new usage, but did not update any code that used it.
Whoops.
2015-02-26 01:06:03 +01:00
Florian Müllner
f38263a67f status: Stop using .panel-status-button
This used to be the style-class for status icons (i.e. icon-only
top bar items). It got unused a while ago when the class used
by status icons stopped using it - except for the keyboard indicator,
which set the class manually to appear as status icon despite not
being a real icon.
Now that the button highlight is provided by the .panel-button class
on a parent, the obsolete class results in a double border on the
keyboard indicator when active - just drop it from there as well
to fix.
2015-02-20 15:16:58 +01:00
Jakub Steiner
48cfd35b65 theme: a button is a button is a button
https://bugzilla.gnome.org/show_bug.cgi?id=737785
2015-02-20 15:16:06 +01:00
Jakub Steiner
b30ecd29d8 theme: clean up dialogs 2015-02-20 15:14:46 +01:00
Florian Müllner
c647be375a system: Fix visibility of suspend button
It depends on the availability of suspend, not shutdown ...
2015-02-04 12:03:18 +01:00
Takao Fujiwara
d8ca374a06 ibusManager: Disable IBus input sources on password entries
Input method preedit text needs to be disabled on password entries
for security and usability reasons.
IBus 1.5.7 provides the signal set-content-type so that panel UIs can
handle these special purpose input entries:
https://github.com/ibus/ibus/commit/6ca5ddb302c9

Unfortunately IBus versions older than 1.5.10 have a bug which causes
spurious set-content-type emissions when switching input focus that
temporarily lose purpose and hints defeating its intended semantics
and confusing users. We thus don't use it in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=730628
2015-01-12 16:13:45 +01:00
Florian Müllner
e0eebc90e0 Rename KeyBindingMode to ActionMode
The keybinding mode is no longer used exclusively for actions triggered
by keybindings, so reflect this by a more generic name.

https://bugzilla.gnome.org/show_bug.cgi?id=740237
2014-12-19 11:39:50 +01:00
Ryan Lortie
3d4408dce8 network: properly remove connections from list
Due to a typo we were always removing the first (index 0) connection
from the global list of connections instead of the correct one.

This resulted in some connections remaining in the shell's connection
list long after they were removed.  In particular, this resulted in
multiple copies of a bluetooth connection appearing after suspend/resume
(when the device was readded and the cached connection list was
rescanned).

https://bugzilla.gnome.org/show_bug.cgi?id=740227
2014-11-16 15:53:54 -08:00
Takao Fujiwara
e467a734a1 ibusManager: Preload all ibus input sources in user configuration
Normally users switch xkb input sources and ibus input sources.
But currently the first input source only is running. It's also good
to preload all ibus engines in the logging session so that users switch
input sources quickly without the launching time of input sources.

The following is the ibus change:
https://github.com/ibus/ibus/commit/cff35929a9

https://bugzilla.gnome.org/show_bug.cgi?id=695428
2014-11-12 21:07:19 +01:00
Cosimo Cecchi
084f7a36b1 rfkill: hide Airplane Mode indicator when g-s-d says so
https://bugzilla.gnome.org/show_bug.cgi?id=736292
2014-11-07 10:29:13 +01:00
Cosimo Cecchi
1fe3ab8f68 rfkill: remove unused code
https://bugzilla.gnome.org/show_bug.cgi?id=736292
2014-11-07 10:29:13 +01:00
Cosimo Cecchi
49c4ba5656 theme: make a GResource
Now that we have all the infrastructure ready, port the theme to a
GResource.

https://bugzilla.gnome.org/show_bug.cgi?id=736936
2014-10-14 18:54:18 -07:00
Cosimo Cecchi
328bb1c21b st: always use GFile internally
We're moving the theme infrastructure towards GResource, so as a first
step move all the loading to use GFiles instead of URIs or paths.

https://bugzilla.gnome.org/show_bug.cgi?id=736936
2014-10-14 18:53:39 -07:00
Rui Matos
72c6f0025d status/keyboard: Ensure we always have at least one input source
Most of the code handles the sources setting being empty and
InputSourceManager.currentSource being null because previously the
"model" (i.e. the sources list) was kept in gnome-settings-daemon.

But this is fragile and since we're now the canonical place where the
list lives we can force it to never be empty even if the gsetting is
empty or contains only invalid entries.  Adding the default keyboard
layout in that case is the safest thing to do.

https://bugzilla.gnome.org/show_bug.cgi?id=738303
2014-10-10 18:45:45 +02:00
Jinkyu Yi
7026209eae status/keyboard: obtain keyboard variant from IBus
This will fix unable to show keyboard variant from IBus through menu.

https://bugzilla.gnome.org/show_bug.cgi?id=735066
2014-09-26 17:08:25 +02:00
Florian Müllner
c7e3b68dcd location: Add link to corresponding Settings
All other submenus link to the corresponding settings, so we should
do the same for location - the privacy panel in this case, which now
sports a "Location Services" switch ...

https://bugzilla.gnome.org/show_bug.cgi?id=736542
2014-09-12 18:59:36 +02:00
Rui Matos
8589bfb62e Implement input source switching
Instead of calling out to gnome-settings-daemon we'll just implement
the switching logic ourselves and use mutter APIs that allow this
functionality to work both in X sessions and when we're a Wayland
compositor.

Switching IBus engines is done transparently as well just like g-s-d
used to do.

https://bugzilla.gnome.org/show_bug.cgi?id=736435
2014-09-11 19:14:46 +02:00
Rui Matos
a0a701757e status/keyboard: Move all UI elements to the indicator class
This will allow us to have multiple indicator instances, e.g. show a
indicator next to text entries in modal shell dialogs.

https://bugzilla.gnome.org/show_bug.cgi?id=736435
2014-09-11 19:14:46 +02:00
Rui Matos
effe6fab3a status/keyboard: Factor out an InputSourceManager class
https://bugzilla.gnome.org/show_bug.cgi?id=736435
2014-09-11 19:14:46 +02:00
Rui Matos
8e560f98d1 status/keyboard: Factor out a KeyboardManager class
This code will grow in a forthcoming patch so let's move it out.

https://bugzilla.gnome.org/show_bug.cgi?id=736435
2014-09-11 19:14:46 +02:00
Rui Matos
58aabfcf5b status/keyboard: Move IBusManager into its own file
This also makes it a singleton for easier access from multiple places.

https://bugzilla.gnome.org/show_bug.cgi?id=736435
2014-09-11 19:14:45 +02:00
Rui Matos
19e3f794f8 status/keyboard: Remove unused variable
https://bugzilla.gnome.org/show_bug.cgi?id=735976
2014-09-11 19:12:17 +02:00
Rui Matos
2b1077aaa1 switcherPopup: Factor the initial selection into the base class
Only the application switcher needs to keep its own implementation
since it has two modes of operation depending on the binding.

https://bugzilla.gnome.org/show_bug.cgi?id=735976
2014-09-11 19:12:17 +02:00
Rui Matos
547cdf86cc switcherPopup: Move _createSwitcher implementations into constructors
We don't really need this step as a separate method since all
implementations are supposed to be created and shown immediately. This
also ensures that we have items to show in all subclasses.

https://bugzilla.gnome.org/show_bug.cgi?id=735976
2014-09-11 19:12:17 +02:00
Zeeshan Ali (Khattak)
7653175c6f location: Translate accuracy level for geoclue
The enums values of geoclue have gaps in them (so more levels could be
added in future) but enum values of settings don't have such gaps so we
gotta translate between them.

Since desrt says that enums as integers in gsettings are bad, we now
treat accuracy level settings as string.

This fixes the recent regression of geoclue only allowing geiop level
accuracy to apps.

https://bugzilla.gnome.org/show_bug.cgi?id=736479
2014-09-11 17:43:46 +01:00
Zeeshan Ali (Khattak)
5b624a34b8 location: Only show menu when geolocation is in use
Users can now toggle geolocation off/on from privacy panel of
gnome-control-center so we don't need to clutter the menu with a
settings that most users won't touch most of the time.

https://bugzilla.gnome.org/show_bug.cgi?id=731122
2014-08-19 19:20:47 +01:00
Christophe Fergeau
d450b74e10 Remove 'backwards' argument from SwitcherPopup:_keyPressHandler
All derived classes are already checking explicitly for action names
(FOO and FOO_BACKWARDS). mutter used to have a META_KEY_BINDING_REVERSES
flag for keybindings which required special handling of "shift"+FOO as
FOO_BACKWARDS, but this has been removed now, so this special handling
is no longer necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=732296
2014-08-17 19:33:22 +02:00
Christophe Fergeau
e8fa2b6417 Stop using Meta.KeyBindingFlags.REVERSES for IM switch keybinding
When this flag is set on a MetaKeyBinding, mutter will know that
the keybinding has an associated reverse keybinding triggered with
the shift modifier. However, an undesirable side-effect is that
gnome-control-center keyboard panel does not know that this 'shift'
is reserved for these reverse keybindings and cannot detect
conflicting bindings in this case.
This 'reverse' logic can now be handled at a higher level (in gcc keyboard
panel) so this commit removes it from gnome-shell so that they do not
conflict.

https://bugzilla.gnome.org/show_bug.cgi?id=732296
2014-08-17 19:33:22 +02:00
Christophe Fergeau
c459ef6888 Use new meta_key_binding_is_reversed() method
Now that mutter gives a way to check if a MetaKeyBinding was marked as
'reversed' or not, gnome-shell does not have to hardcode that a
MetaKeyBinding using a shift modifier is reversed, it can directly check
if the appropriate flag is set.

https://bugzilla.gnome.org/show_bug.cgi?id=732296
2014-08-17 19:33:22 +02:00