Commit Graph

108 Commits

Author SHA1 Message Date
Philip Withnall 9335565fe3 malcontent-control: Change wording on no-other-users page
Clarify that a standard user account has to be created, and then
parental controls enabled for it — and that clicking the button will
open the control centre.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #25
Helps: #26
2020-12-08 16:35:07 +00:00
Philip Withnall 2010898947 malcontent-control: Add link to guidance on how to set parental controls
Try and nudge parents/carers towards the best practice for how to set
parental controls on a user, by linking them to appropriate external
content from people who know what they’re talking about.

This external content can vary in the translations so that parents are
pointed to appropriate localised guidelines. In the UK, for example,
this may be
https://www.nspcc.org.uk/keeping-children-safe/online-safety/.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-04 11:58:06 +00:00
Philip Withnall cd36d90091 malcontent-control: Drop ‘Restrict Application Installation for Others’
This simplifies the UI, as nobody really understood the difference
between ‘Restrict Application Installation’ and ‘Restrict Application
Installation for Others’. Now there’s just a ‘Restrict Application
Installation’ checkbox, which controls application installation in the
home and system flatpak repos.

The underlying app-filter representation in libmalcontent still supports
restricting installation to them separately, but the UI will always set
them to the same value.

There is a suggestion that we may want to support user repos again in
future iff the user has added a remote to their user repo. However,
figuring that out for other users (which is what the admin would have to
do when setting this all up) starts to get tricky with permissions for
reading other users’ home directories. Skip that for the moment — we can
reconsider adding that option in future if someone argues a case for it.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #30
2020-11-15 17:31:21 +00:00
Philip Withnall db54baf9d6 malcontent-control: Add a --user command line argument
This is handled on the primary instance, and causes the tab to be
switched to show the given username (if possible).

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #19
2020-10-19 17:55:47 +01:00
Philip Withnall 5efc773bda malcontent-control: Add API to select users by username
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-10-19 17:54:37 +01:00
Philip Withnall 8789d8980b malcontent-control: Add descriptive paragraphs to appdata releases
This fixes strict validation.

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

Fixes: #23
2020-09-08 12:52:17 +01:00
Philip Withnall b25110beab malcontent-control: Add a screenshot to the appdata
This fixes a problem with strict validation.

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

Helps: #23
2020-09-08 12:51:53 +01:00
Philip Withnall bf9bf5e8ba 0.9.0
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-09-03 12:03:51 +01:00
Philip Withnall d085c7f585 build: Use meson.current_source_dir() instead of source_root()
The latter doesn’t work well when building as a subproject — it
explicitly refers to the parent project root.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-06 10:59:45 +01:00
Philip Withnall 73d7c5e113 all: Fix various typos and incorrect terminology
Done using:
```
codespell \
    --builtin clear,rare,usage \
    --skip './po/*' --skip './help/*/*.po' --skip './.git/*' --skip './NEWS*' \
    --write-changes .
```
and then some manual checking and editing.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-06-18 13:51:35 +01:00
Philip Withnall 9b3dedd9ed malcontent-control: Centre the user controls
This causes the controls on the main window to be centred at their full
width (when there’s enough window width to do so), rather than expanding
to fill the entire window.

It’s not currently possible with GTK+3 to easily set a maximum width
(of, say, 600px) to the column, without writing a custom widget (like
`HdyColumn` does).

From a suggestion by Nick Richards
(https://www.nedrichards.com/2020/04/endless-3.8.0-beta-1-trip-report/).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-05-01 16:11:39 +01:00
Philip Withnall 659d22ba34 0.8.0
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-04-28 14:07:37 +01:00
Will Thompson a626236f59 Add translator comments for about dialog strings
When ordering commercial translations, at least one translator
translated these literally, eg "Sitio web de mal gusto" and
"créditos-de-traductor".

It's likely that translators familiar with GNOME would not make this
mistake, but let's be explicit anyway.
2020-04-20 13:47:22 +01:00
Philip Withnall 99736b3f6c malcontent-control: Add a header bar and primary menu
This makes it easier to access the help and about dialogue, and brings
the application in line with the [GNOME
HIG](https://developer.gnome.org/hig/stable/header-bars.html.en).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-04-06 12:38:11 +01:00
Philip Withnall e03bb128b8 malcontent-control: Add an action to launch the help
Also add actions for `app.about` and `app.quit`, for completeness.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-04-03 15:08:47 +01:00
Philip Withnall 2e8a07d58c 0.7.0
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-03-24 11:23:01 +00:00
Philip Withnall f917f6e79a malcontent-control: Refactor bus initialisation
Get the system bus higher up in the application, so the same system bus
connection can be shared between different parts of the application if
needed in future.

This also means the synchronous I/O needed to connect to the bus is done
before the application UI is shown, which prevents it unnecessarily
blocking initialisation of the `MctUserControls` widget.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-03-23 14:43:22 +00:00
Philip Withnall 4481cf1271 malcontent-control: Imply all app-filter polkit permissions
When unlocking malcontent-control while running as an unprivileged user
to edit *that* user’s parental controls, the `ChangeOwn` and `ReadOwn`
privileges should also be granted.

Otherwise a second polkit authorisation dialogue is popped up after
editing any of the parental controls, to get permission to save the
changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-03-17 17:31:53 +00:00
Philip Withnall cbc9b93348 malcontent-control: Tweak polkit label wording
When malcontent-control is run as an unprivileged user (i.e. a child)
the fact that the unlock wording refers to ‘other users’ is a little
confusing, since the purpose of running malcontent-control was likely to
edit the parental controls for *this* user.

Adjust the wording to make this a little clearer.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-03-17 17:30:49 +00:00
Philip Withnall b4c5ca22f2 malcontent-control: Drop unused flatpak dependency
Note that it’s still transitively required through libmalcontent-ui.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-03-02 15:58:25 +00:00
Philip Withnall 15e3e7a407 0.6.0
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-27 15:19:00 +00:00
Philip Withnall 8027351f58 carousel: Lower CSS priority
Otherwise an application won’t be able to override the CSS installed by
libmalcontent-ui if this is ever moved into libmalcontent-ui.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-25 12:25:40 +00:00
Philip Withnall b4eab1a7c0 malcontent-control: Add scalable and symbolic icons
Drawn by Jakub Steiner. Thanks!

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

Fixes: #9
2020-02-19 13:46:03 +00:00
Philip Withnall 8da1088e9b user-selector: Fix some const-to-non-const cast warnings
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-18 12:08:42 +00:00
Philip Withnall cb27d75645 Release version 0.5.0
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-14 14:47:13 +00:00
Philip Withnall 1f3f0a4560 libmalcontent-ui: Move widgets over from malcontent-control
They need to be re-used in gnome-initial-setup. The other widgets which
remain in malcontent-control don’t need to be used in g-i-s so can stay
where they are for now. They might move across to libmalcontent-ui later
if there’s a need for it.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-04 11:36:58 +00:00
Philip Withnall 4054913dc2 malcontent-control: Fix losing user changes when apps are installed
If the user has the restrict applications dialogue open and has made
some changes, then installs/uninstalls a flatpak (for example) from
gnome-software in another window, then the list of apps in the restrict
applications dialogue will be reloaded and the user’s changes will be
lost.

Prevent that by not reloading when the set of installed apps changes.
This is not a long-term solution: ideally we’d diff the changes against
the list of apps in the restrict applications dialogue and only update
what’s changed.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-03 17:49:21 +00:00
Philip Withnall 591f63890b malcontent-control: Fix ‘Block Web Browsers’ label sense
The switch is actually controlling whether to allow web browsers, not
block them, and is enabled by default.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-03 17:33:04 +00:00
Philip Withnall 7fd8705f33 malcontent-control: Treat lack of GPermission as lack of permissions
Rather than assuming that having no GPermission means we do have
permissions, which was a little confusing and didn’t match other points
in the code.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-03 17:29:17 +00:00
Philip Withnall 32c7435b8d malcontent-control: Update an issue link in a FIXME comment
Since this code has moved out of our downstream g-c-c fork, the issue
tracking is now upstream, so update an issue link.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-03 17:29:17 +00:00
Philip Withnall 695ee10235 malcontent-control: Fix use-after-free when closing
Sometimes, when closing the application,
`flush_update_blacklisted_apps()` would be called after
`MctRestrictApplicationsSelector` had been destroyed, leading to a
critical.

This was because the `MctRestrictApplicationsDialog` was being disposed
early due to its `destroy-with-parent` property being set. The dispose
function of `MctUserControls` was run several times due to GTK calling
`g_object_run_dispose()`, and the critical would be emitted the second
time.

Make the dispose function’s call to `flush_update_blacklisted_apps()` be
safe for multiple dispose calls, and ensure the dialog isn’t destroyed
too early.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-03 17:29:17 +00:00
Philip Withnall 00bb439f6e malcontent-control: Fix use of an uninitialised variable in the carousel
`dest_x` is not set if `gtk_widget_translate_coordinates()` fails, which
it can do before the widget is realised.

This fixes a valgrind warning, but doesn’t change any user-visible
behaviour as far as I can tell.

This has been upstreamed to gnome-control-center as
https://gitlab.gnome.org/GNOME/gnome-control-center/merge_requests/691.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-03 17:29:17 +00:00
Philip Withnall 2ab9924d8d malcontent-control: Hide administrator accounts
Children can’t be administrator accounts, otherwise applying parental
controls to them would be pointless and ineffective. So hide the
administrator accounts from the parental controls app.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-03 17:29:17 +00:00
Philip Withnall ee342d374b malcontent-control: Add MctUserSelector:show-administrators property
We don’t want to show administrators in the parental controls app,
since child accounts are not administrators (if they are, they are too
powerful to be constrained by parental controls).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-03 17:29:17 +00:00
Philip Withnall a05ac751a1 malcontent-control: Add a main stack page for when there are no users
Point the admin towards gnome-control-center so they can add child user
accounts.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-03 17:29:17 +00:00
Philip Withnall f9a11b22b3 malcontent-control: Update the app filter after permissions have changed
After the user’s current set of permissions have changed, they may now
be able to query the app filter whereas previously they weren’t allowed
to. So try re-querying it.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-03 17:29:17 +00:00
Philip Withnall 8badee7fa9 malcontent-control: Add polkit policy support
Add an unlock screen to the application, which is shown on startup if
the current user doesn’t have permission to view the parental controls
of other users. It requests permission using a new polkit action which
implies the various accounts-service actions we need.

This adds a dependency on `polkit-gobject-1`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-03 17:29:17 +00:00
Philip Withnall 36162c2c23 malcontent-control: Tweak default window height to match new controls
A fairly arbitrary decision which seems to match the new controls a bit
better, removing the large whitespace gap at the bottom of the window.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-03 17:29:17 +00:00
Philip Withnall d56b19da1a malcontent-control: Relabel ‘no restriction’ entry for OARS settings
‘All Ages’ is perhaps a bit clearer than ‘No Restriction’.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-03 17:29:17 +00:00
Philip Withnall 629e7aac15 malcontent-control: Relabel a group of controls
This fits in better with the new design, and is more noun-like than
verb-like.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-03 17:29:17 +00:00
Philip Withnall 08ab378053 malcontent-control: Redesign other controls on main window
Following the redesign of the app filter controls, redesign the rest of
the controls on the window to match the list-box-like new style. This
doesn’t change their functionality.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-03 17:29:17 +00:00
Philip Withnall bffab0942f malcontent-control: Move the app restrictions into a separate dialogue
Rather than having a scrollable listbox within a scrollable list of
widgets, move the listbox out to a separate dialogue.

This involves separating out all the code to query the apps, to get and
to set the app filter, from `MctUserControls` out into the new
`MctRestrictApplicationsSelector`. Most of it is unchanged, aside from
its interaction with the filter: the filter is now provided to the
widget by the calling code, rather than being queried by the widget
itself. The widget’s status can be queried into an
`MctAppFilterBuilder`, rather than being used to set the app filter
directly.

This commit redesigns the appearance of the relevant widgets in the main
window so that they follow the new list-box-like visual design. A
following commit will apply similar changes to the other widgest in the
main screen.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-03 17:29:17 +00:00
Philip Withnall 0e22ad7861 malcontent-control: Use g_signal_connect_object() when we don’t hold ref
The application doesn’t hold a ref to some of the widgets it holds a
pointer to, since their ownership is controlled by the main window. The
main window’s lifecycle is controlled by the application, but its
dispose cycle runs at a slightly different time.

Hence, we should disconnect from the widget signals when we can, but
without holding a strong ref.
2020-02-03 17:19:59 +00:00
Philip Withnall f3aea0247a malcontent-control: Use new error domain and codes
The error domain was renamed in libmalcontent, so we should use the new
domain rather than the compatibility defines.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-30 09:38:33 +00:00
Philip Withnall e220fd9919 malcontent-control: Allow NULL user accounts
If there are no suitable users to show in the user selector, then no
user can be selected, so the controls have to handle a NULL user.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-30 09:38:33 +00:00
Philip Withnall f670880382 malcontent-control: Fix a typo in an enum value
The values are the same so this doesn’t introduce any functional
changes, but it does fix the type.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-30 09:38:33 +00:00
Philip Withnall e54f7eaf8a malcontent-control: Ignore a harmless error
This is a backport of
https://github.com/endlessm/gnome-control-center/pull/205 from Endless’
gnome-control-center fork, applied there after the code was copied over
here.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-30 09:31:40 +00:00
Philip Withnall 368cc1fb76 malcontent-control: Fix a crash when flushing changes
The `GSource` was being removed twice, once in `blacklist_apps_cb()` and
once in `flush_update_blacklisted_apps()`, leading to a critical warning
from GLib.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-30 09:31:40 +00:00
Philip Withnall c7f975bb2b malcontent-control: Add initial draft of main interface
This replicates the old interface from Endless’ gnome-control-center,
with no attempt to improve or rework it. That will come later.

It might not work fully.

It allows a user to be selected, and their parental controls to be
changed. It currently doesn’t filter the users.

It supports a simple ‘Loading’ screen, before displaying the main
interface. If loading fails (due to a D-Bus error with accountsservice),
an error page is displayed instead.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-30 09:31:40 +00:00
Philip Withnall 1623876fbc malcontent-control: Add an MctUserSelector widget
This isn’t used yet, but will be soon. It encapsulates an
`ActUserManager` with an `MctCarousel` to provide an all-inclusive
widget for selecting a user account.

It’s based off code from the user accounts panel of
gnome-control-center, licenced as GPLv2+, and authored by many people
over time (see
https://gitlab.gnome.org/GNOME/gnome-control-center/commits/master/panels/user-accounts).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-30 09:31:40 +00:00
Philip Withnall 484993b658 malcontent-control: Add basic accessibility support to g-c-c widgets
Not submitting this upstream as it hasn’t been tested thoroughly enough.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-29 15:31:42 +00:00
Philip Withnall 9e73c34664 malcontent-control: Fix some minor leaks in MctCarousel
Relevant chunks upstreamed in
https://gitlab.gnome.org/GNOME/gnome-control-center/merge_requests/683.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-29 15:31:42 +00:00
Philip Withnall 2c043a6bd5 malcontent-control: Reformat and rename code from gnome-control-center
Make it fit in with the surrounding code style, and rename the classes
to `MctCarousel` and `MctUserControls`. List them in `meson.build` and
`POTFILES.in`. No other changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-29 15:31:42 +00:00
Philip Withnall aa6ece8a91 malcontent-control: Add widgets from gnome-control-center
Add `CcCarousel` and `CcAppPermissions` from gnome-control-center and
rename the files. None of the contents of the files have been changed
yet. The files are from git master of gnome-control-center on
2020-01-08.

`carousel.{c,h,ui}` are licensed under GPLv2+, and are copyright 2016
Red Hat, Inc. The original author was Felipe Borges.

`user-controls.{c,h,ui}` are licensed under GPLv3+, and are copyright
2018, 2019 Endless, Inc.

`gs-content-rating.{c,h}` are originally from gnome-software, are
licensed under GPLv2+, and are copyright 2015, 2016 Richard Hughes. He
was also the original author. These files are needed by
`user-controls.{c,h}`.

`user-image.{c,h}` are licensed under GPLv2+ and are copyright 2015, Red
Hat, Inc. The original author was Ondrej Holy.

This code will not stay as copy-paste code for too long. The ultimate
plan is to rework most of the widgets:
 • `CcCarousel`: Will be reworked to provide more information about the
   screen time usage of each user. It will become a summary widget as
   well as a selector.
 • `GsContentRating`: Will be abstracted out into libappstream-glib, or
   some other suitable library, where its implementation can be shared
   between gnome-software and malcontent.
 • `CcUserControls`: Will be reworked as the UI of malcontent evolves.
   Will also be removed from gnome-control-center once malcontent-control
   is released.
 • `CcUserImage`: As per `CcCarousel`, this will evolve into a new
   widget.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-29 15:28:21 +00:00
Philip Withnall b0f72c432f malcontent-control: Add initial main window
It’s currently empty, but it’s a start.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-29 15:27:33 +00:00
Philip Withnall cf6331cac6 malcontent-control: Add an AppData file
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-29 15:27:33 +00:00
Philip Withnall 8b62f08cf6 malcontent-control: Add a desktop file
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-29 15:27:33 +00:00
Philip Withnall 1d8f7d665c malcontent-control: Add initial skeleton application
This does nothing at the moment (not even showing a main window), but it
soon will do.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-29 15:07:15 +00:00