Commit Graph

5845 Commits

Author SHA1 Message Date
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
Sergio Costas
d75a3484d6 windowManager: detect change to a non-existent WS
When using dynamic workspaces, it is possible to try to change to a
non-existent one if the user defines hotkeys for changing to desktop
1, 2, 3... This case is not detected, and gnome shell shows an error:

JS ERROR: TypeError: workspace is null
actionMoveWorkspace@resource:///org/gnome/shell/ui/windowManager.js:2130:13
wrapper@resource:///org/gnome/gjs/modules/_legacy.js:82:22
_showWorkspaceSwitcher@resource:///org/gnome/shell/ui/windowManager.js:2104:13
wrapper@resource:///org/gnome/gjs/modules/_legacy.js:82:22

This patch adds a check before trying to change the workspace, to avoid
switching to a non-existent one.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/365
2019-01-24 23:59:23 +01: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
Philip Withnall
21de3c327b polkitAgent: Disconnect from user signals when closing dialogue
Otherwise the user object could outlive the dialogue, emit a subsequent
signal, and the callback from that signal could reference finalised
objects/widgets from the dialogue. The likely mechanism for the user
outliving the dialogue is caching of user objects within
libaccountsservice.

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
Philip Withnall
081d94e0f6 polkitAgent: Destroy session from dialogue closed handler
Rather than explicitly destroying the session after calling close(),
destroy it from the `closed` signal handler.

This also means we can make the method internal.

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
Philip Withnall
ddd1825162 polkitAgent: Drop close() override in favour of closed signal
In case there are any internal ways the dialogue can close itself
without calling its own close() method, it’s probably better to do all
our cleanup on a handler for the `closed` signal instead.

This should introduce no functional changes except ensuring the
polkitAgent cleanup is always done.

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
Philip Withnall
5f223e0bd8 polkitAgent: Disconnect session signal handlers when destroying session
Otherwise the session could outlive the dialogue, emit a subsequent
signal, and its callback would reference finalised objects/widgets from
the dialogue. The PolkitSession object is implemented by
libpolkit-gobject, so we have no guarantees about its reference counting
— the session object could keep itself alive in another thread, or be a
singleton. In all likelihood, the session hangs around for longer than
the dialogue due to differences in when the two objects are garbage
collected.

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
Philip Withnall
809d92129b search: Initialise searchInProgress when search providers are registered
This avoids the following warning sometimes happening later:

JS WARNING: [resource:///org/gnome/shell/ui/search.js 701]: reference to undefined property "searchInProgress"

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
Florian Müllner
edbb204332 animation: Disable spinner animations when actor is destroyed
There's nothing to animate anymore, just a source for warnings when
trying to access a destroyed object.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/362
2019-01-24 00:20:58 +01:00
Florian Müllner
9dc3b73ef9 calendar: Rename "Clear All" button
While it hasn't really cleared everything previously (media notifications),
it does less so now. Update the button label to reflect that.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/262
2019-01-22 21:35:52 +00:00
Florian Müllner
a7d618915c calendar: Remove ability to hide events
The functionality is no longer exposed, so remove it altogether.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/262
2019-01-22 21:35:52 +00:00
Florian Müllner
3e3da8e2f8 calendar: Don't allow event messages to be closed
The built-in calendar isn't meant to replace a full-fledged calendar
app, which is why clearing event messages only hides the event in
gnome-shell rather than deleting the actual event. This has turned out
to not be overly useful and often confusing - it creates a discrepancy
with visible events in apps, isn't revertible in a non-obscure fashion
and non-obviously limited to the current date.

As we are considering moving events out of the message list and back to
the calendar, it looks like a good time to remove that ability and keep
notifications as the only removable messages.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/262
2019-01-22 21:35:52 +00:00
Florian Müllner
a6763e7731 messageTray: Chain up in NotificationPolicy constructor
We currently deliberately avoid chaining up in derived policy
constructors to not override properties with their defaults.
That's a neat trick that will stop working when porting to ES6
classes, as chaining up is necessary to actually initialize the
object there (including "this").

Address this by turning all properties into (overridable) getters
that are backed by private properties by default.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/350
2019-01-22 21:33:46 +00:00
Florian Müllner
8f15193b40 messageTray: Split out policy creation
The _createPolicy() method of a subclass usually depends on some
constructor parameters that need to be set before chaining up to
the parent. This works fine with Lang.Class, but will break with
ES6 classes, as "this" is only initialized after chaining up.

Prepare for this by not creating the policy in the constructor,
but when it is first accessed.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/350
2019-01-22 21:33:46 +00:00
Florian Müllner
467b7c1bca lookingGlass: Stop using eval()
Its use is not only strongly discouraged[0], we also rely on it injecting
variables into the global scope to get command-line-like behavior. That
behavior is incompatible with strict mode[1], and in extension with ES6
classes (which imply strict mode).

So to prepare for porting to ES6 classes, replace it with a somewhat less
evil construct that is compatible with strict mode.

[0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#Do_not_ever_use_eval!
[1]
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode#Simplifying_variable_uses

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/350
2019-01-22 21:33:46 +00:00
Florian Müllner
2fc1f1adbe cleanup: Remove obsolete Lang imports
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/350
2019-01-22 21:33:46 +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
Daniel van Vugt
4b28b90e0f notificationDaemon.js: Fix a typo (missing ')')
Introduced in e0a992af73 it was preventing gnome-shell from starting.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/915
2019-01-17 11:55:04 +08:00
Florian Müllner
e0a992af73 notificationDaemon: Fix warning
Since commit 33b8537bf5, we unconditionally access the 'image-path'
hint, resulting in a gjs warning if the hint is not defined.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/309
2019-01-16 18:57:04 +01:00
Florian Müllner
b57832716a calendar: Disconnect signals when resetting notification
Since commit 5fb8d4f730, a NotificationMessage's notification property
is reset to null when the notification is destroyed. However at that
point we still have connected signal handlers around that we'll try
to disconnect later.

Avoid the warnings by disconnecting and resetting the handler IDs at
the same time as the notification.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/308
2019-01-16 17:46:09 +00:00
Florian Müllner
945a019974 animation: Optionally animate spinner start/stop
In contrast to generic animated icons, it is reasonable to expect
spinners to be invisible while inactive. Implement that behavior
in the new Spinner class and optionally animate the transitions.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/316
2019-01-16 17:44:42 +00: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
Florian Müllner
62abf3edc7 audioDeviceSelection: Only include settings button when allowed
https://gitlab.gnome.org/GNOME/gnome-shell/issues/909
2019-01-16 00:30:46 +00:00
Florian Müllner
f8ce47c24d keyboard: Use addSettingsItem() in language menu
If the session mode doesn't allow access to Settings, the language
menu should respect that and not expose the "Region & Languages"
panel. Using the dedicated method instead of manually constructing
the menu item takes care of that and makes for less code.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/780
2019-01-16 00:29:23 +00:00
Bilal Elmoussaoui
ddb3a5c625 Add Iagno to appFavorites 2019-01-15 15:31:13 +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
Carlos Garnacho
25bfe99ed5 messageTray: Port to MetaSoundPlayer for emitting sounds
Move away from ShellGlobal API, which is too tightly coupled to
libcanberra-gtk. The app ID/name seem unused in canberra, so we
may simplify this to a single case.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/327
2019-01-09 23:09:18 +00:00
Carlos Garnacho
9a35c9902a automountManager: 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
Jonas Ådahl
4259676f6e dnd: Repick target actor if destroyed mid iteration
The picked target actor may be destroyed (e.g. hover style change
resulting in the ClutterTexture to be destroyed). If we don't handle
this, GJS will abort when it sees the exception caused by Javascript
code trying to access the destroyed target actor.

To handle it, listen on the 'destroy' signal on the target actor, and
repick, so a valid actor is passed to the next motion callback.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/632
2019-01-09 16:15:59 +00:00
Pascal Nowack
2159d6886f layout: Always allow hiding the overview
When a fullscreen application is focused,
toggling the overview via hot-corner is disabled,
even when the overview is currently visible.
This only makes sense, when the overview is
hidden to not to disturb the behaviour of the
fullscreen application, but leaves an
inconsistency when the overview is visible since
it should work there like when a non-fullscreen-
application is focused.

So, always allow hiding the overview using the
hot corner when the overview is visible.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/429
2019-01-09 15:47:38 +00:00
Jonas Ådahl
8be0c5a58a Add app introspection API
Add a D-Bus API that allows the API user to introspect the application
state of the shell. Currently the only exposed information is list of
running applications and which one is active (i.e. has focus).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/326
2019-01-09 10:13:45 +01: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
e5ce3d541e messageTray: Re-enable unredirection when banner is destroyed
The intention of commit 4dc20398 was to disable unredirection while
banners are shown, but the ::done-displaying signal currently used for
re-enabling unredirection is only emitted under some circumstances, so
it's possible that unredirection is left disabled indefinitely, whoops.

Fix this by tying disabling unredirection explicitly to the lifetime
of the banner actor.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/799
2018-12-05 18:11:39 +00:00
Daniel van Vugt
0e0574a0b4 iconGrid: Eliminate JavaScript for painting/picking
The only reason for `vfunc_paint` and `vfunc_pick` existing was to
implement a culling optimization. Although that optimization actually
made performance worse than none at all because it forced the painting
and picking cycles to spend more time calling into JavaScript.

Turns out we don't have to choose between native code and culling though.
Just reimplement the culling using native ClutterActor functions and we
get the benefits of both.

Performance on an i7-7700:

Moving the cursor over the icon grid:
Before: 70% CPU, 5.5ms per frame
After : 60% CPU, 4.5ms per frame

Scrolling the icon grid:
Before: 60% CPU, 4.4ms per frame
After : 50% CPU, 3.3ms per frame

Helps with https://gitlab.gnome.org/GNOME/gnome-shell/issues/174
2018-11-27 13:25:37 +00:00
daniruiz
3217c10ff2 theme: Replace calendar arrow images with symbolic icons and CSS
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/301
2018-11-26 15:34:08 +00:00
Sam Hewitt
4d2dce2c52 theme: Drop custom assets for window close buttons in overview
They can be replaced by a themed icon and some CSS styling.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/782
2018-11-22 23:50:24 +01:00
Andrea Azzarone
ff2fbf5ae4 dash: destroy items's child before tooltip
Destroy the DashItemContainer's child from the same handler as the tooltip. This
will prevent invalid reads when the item is destroyed while its quicklist is
still open.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/781
2018-11-19 15:51:32 +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
Jasper St. Pierre
04d7069d83 app-usage: Remove crufty old "context"s idea
Back in the day, there was a proposed system of tracking apps in a
specific context.

The inspiration was that you may have used apps in multiple modes:
Firefox may have been used in both "Programmer Reference" and
"Kitten Videos" contexts. Early user response to the feedback wasn't
too positive - context switching is something that humans have trouble
doing implicitly, let alone explicitly. The old codebase still has a
few remnants of this around; let's finally put them to rest.

Note that we still write out a dummy context tag to the XML file - old
versions of the shell will flat out crash if you don't have one of those
in there, so just leave it in for compatibility sake.

https://bugzilla.gnome.org/show_bug.cgi?id=673767
2018-11-17 12:08:33 +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
Florian Müllner
240f3faf6e windowAttentionHandler: Fix syntax errors
Gah, why didn't we catch those?!
2018-11-14 19:38:33 +01:00
Florian Müllner
284978757e windowAttentionHandler: Handle XUrgencyHint as well
While it's not commonly used, it is easy enough to handle it the
same as the demands-attention hint, so do just that.

https://bugzilla.gnome.org/show_bug.cgi?id=643595
2018-11-14 13:42:33 +00:00
Florian Müllner
6099e92df5 workspace: Confine caption width to workspace area
When we started to only show a single caption at a time, we allowed
title captions to be wider than their corresponding window preview.
But while overlapping neighboring previews is fine, we shouldn't
allow the captions to leak outside the workspace area itself and
overlap unrelated elements like workspace switcher or dash.

This partly reverts commit b3b30f239d.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/214
2018-11-13 18:12:59 +00:00
Florian Müllner
a4d09b4264 workspace: Remove dead code
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/214
2018-11-13 18:12:59 +00:00
Erik Duxstad
118cab1766 windowManager: make TouchpadWorkspaceSwitchAction respect natural-scroll
Instead of defaulting to a natural scroll behavior,
have the workspace switch action use the natural-scroll setting
in org.gnome.peripherals.touchpad to determine the correct
direction of travel when swiping. 4 finger swipes will then
match the behavior of the rest of the UI.

Reference: https://gitlab.gnome.org/GNOME/gnome-shell/issues/516
2018-11-13 14:56:11 +00:00
Marco Trevisan (Treviño)
367b1c0627 notificationDaemon: Don't pass unused extra hints value
Probably this is a leftover of old implementations of _iconForNotificationData,
but right now this only takes a value, so just pass one.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/285
2018-11-13 15:39:56 +01:00
Marco Trevisan (Treviño)
33b8537bf5 notificationDaemon: support file:// or icon theme names for image-path
While this sounds counter-intuitive, the image-path hint value might also
be used with URIs or icon names.

As per freedesktop standard:
  The "app_icon" parameter and "image-path" hint should be either an URI
  (file:// is the only URI schema supported right now) or a name in a
  freedesktop.org-compliant icon theme (not a GTK+ stock ID).

Thus the image-path hint should also be parsed as it happens for the
app_icon.

Reuse same logic, by falling back on _iconForNotificationData with the
hint value.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/285
2018-11-13 15:39:46 +01:00
Cosimo Cecchi
5fb8d4f730 calendar: do not call destroy() recursively
We have a callback that will call close() when the notification is
destroyed, and a callback that will call destroy() on the notification
when the message is closed.

Currently, if the notification is destroyed we'll execute our callback
that will call again destroy() on the notification. That's bad
practice in general, and it also has the side effect of resetting the
destroy reason.

This commit avoids re-destroying the notification by dropping the
notification reference on destroy.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/258
2018-11-10 10:56:49 +00:00
Cosimo Cecchi
a98ed08a54 notificationDaemon: use different reason when replacing notification
Differently from the fd.o notifications, Gtk notifications do not
have a mechanism to update themselves. Instead, when a new
notification is received for an ID already known to the notification
daemon, the old notification is dismissed and a replaced with a new
one.

Currently though, there is no way to distinguish a notification that
was dismissed because of an user interaction, or because it was
replaced. That is an useful piece of information, so add a new value
to the NotificationDestroyedReason enum to account for it.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/258
2018-11-10 10:56:49 +00:00