Commit Graph

54 Commits

Author SHA1 Message Date
Philip Withnall 1d5da7c094 libmalcontent-ui: Adjust the app list sort to be more stable
This doesn’t achieve anything by itself, but makes some upcoming commits
to diff the new/old app lists work properly.

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

Helps: #18, #28
2020-10-15 16:40:10 +01:00
Philip Withnall d01f063c39 libmalcontent-ui: Add g_autolist() to simplify memory management
This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-10-15 15:09:11 +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
Matthew Leeds 15e8a74b21 tree-wide: Replace usages of whitelist/blacklist
Replace usages of the terms whitelist and blacklist with the more
inclusive and more precise terms allowlist and blocklist, which are
actually also more consistent with parts of the codebase, e.g.
mct_app_filter_is_content_type_allowed().

The only API break here is in libmalcontent/app-filter.h but the
relevant API is not used anywhere else in Endless OS beyond this repo,
nor to my knowledge in any other distribution. Also, per the README,
this project's API is not stable, so now is a good time to make this
change.
2020-06-09 15:35:21 -07:00
Philip Withnall 2d4e8e0012 gs-content-rating: Backport OARS/CSM mapping changes from appstream-glib
This is a backport of commit 01e9ee8113 from appstream-glib:

    as-content-rating: Lower the OARS/CSM mapping of sex-homosexuality/intense

    This rationalises it with the OARS/CSM mapping of
    sex-themes/intense, and with many western societal norms. It is
    against the laws and morals of various western countries to discriminate
    on sexual orientation, so the mappings for sex-homosexuality/intense and
    sex-themes/intense should be the same.

    The mappings for the other values of sex-homosexuality and sex-themes
    remain different, as their descriptions aren’t as comparable (for
    example, for `mild`, the descriptions are “Indirect references to
    homosexuality” vs “Provocative references or descriptions”).

    The sex-homosexuality ratings category does need to continue to exist,
    though, as it’s illegal in some countries to *not* discriminate on
    sexual orientation. Those countries can provide and maintain their own
    OARS/age mappings.

    See https://gitlab.freedesktop.org/pwithnall/malcontent/-/issues/21.
    This issue is now being solved in appstream-glib as the content rating
    code has been moved there so it can be shared between malcontent and
    gnome-software.

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

Fixes: https://gitlab.freedesktop.org/pwithnall/malcontent/-/issues/21
2020-06-09 11:07:54 +01:00
Philip Withnall 52399e8d58 libmalcontent-ui: Use appstream-glib code for content rating systems
If a suitably new version of appstream-glib is available, use its
implementation of content rating systems (see
https://github.com/hughsie/appstream-glib/pull/364), rather than our
forked one.

This adds a dependency on libappstream-glib, but no particular version.

Eventually, our copy of `gs-content-rating.[ch]` can be dropped.

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

Fixes: #7
2020-05-21 16:25:21 +01:00
Philip Withnall 12c1718782 libmalcontent-ui: Fix inconsistencies in OARS → CSM mappings
This incorporates the following commits from gnome-software:
 • 4db48ef429501d86a45e87eaf8dd97e59dea0d58
 • a62b57a60f886a61c30f17b08277c1b826068a9d
 • 617f0de4f109efe319de36cbc42076e667578eda

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-05-21 16:14:09 +01:00
Philip Withnall 2a87b85fe1 libmalcontent-ui: Add an explicit array length argument to a function
This aligns the copy of the API here with what’s being proposed in
appstream-glib (https://github.com/hughsie/appstream-glib/pull/364). In
a few commits’ time, this copy will be deprecated.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-05-21 16:03:46 +01:00
Philip Withnall 150d303d39 fixup! libmalcontent-ui: Update content rating formatting code 2020-05-21 16:02:40 +01:00
Philip Withnall 9064babe6f fixup! libmalcontent-ui: Update content rating formatting code 2020-05-21 16:01:10 +01:00
Philip Withnall 6174eebd55 libmalcontent-ui: Drop an unused content rating function
This drops a load of translatable strings which aren’t used in
malcontent.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-05-21 12:34:46 +01:00
Philip Withnall a27f96517f libmalcontent-ui: Choose rating system by territory rather than language
This incorporates commit ed981f1d26f9a2c086eeccdee2909959de64f908 from
gnome-software, which ensures that content rating systems are chosen by
territory rather than language.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-05-21 12:31:41 +01:00
Philip Withnall 396dd3c039 libmalcontent-ui: Update content rating formatting code
This incorporates commit 7d00c4d84b2a47dd815dc88da1a82dc54800d4b6 from
gnome-software, which allows the ESRB strings to be localised.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-05-21 12:30:05 +01:00
Philip Withnall c835bcdc9a user-controls: Make whole ‘Restrict Applications’ row activatable
Previously, just the button at the end was activatable, but making the
whole row activatable makes it an easier hit target.

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 15:20:09 +01:00
Philip Withnall f856d46571 libmalcontent-ui: Explicitly state translation domains in UI files
This means the strings are always translated using the correct domain,
regardless of which program libmalcontent-ui is used in.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-04-27 12:11:39 +01:00
Philip Withnall 3556813c55 libmalcontent-ui: Use library i18n functions
Rather than application i18n functions and `#include`s. This ensures
that the correct translation domain is used.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-04-27 11:55:10 +01:00
Philip Withnall 28992ac7f3 user-controls: Add a fallback bus connection
This is a hack to allow `MctUserControls` to be used from `GtkBuilder`
templates, where it’s not possible to pass construct-only properties in
to the `MctUserControls` constructor. It’s not feasible to make
`MctUserControls:dbus-connection` not construct-only, because it gets
used to construct an `MctManager` which then subscribes to various
signals.

So for the cases where `MctUserControls` is used from a builder
template, the code has to connect to the system bus manually, which is
possibly (though unlikely) a blocking operation.

This fixes a critical warning when enabling parental controls in
gnome-initial-setup.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-04-07 12:52:15 +01: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 8b95a655a8 Merge branch 'oars-button-direction' into 'master'
user-controls: Make OARS drop down open to the right

See merge request pwithnall/malcontent!43
2020-03-16 17:11:22 +00:00
Philip Withnall bf0eaea612 user-controls: Update when the ActUser changes
When the user object changes one of its properties (for example, the
user’s locale might change if the administrator is editing a user in
g-c-c while viewing their parental controls in malcontent-control),
update the UI.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-03-16 12:11:45 +00:00
Philip Withnall 4698ad88a0 user-controls: Update OARS menu entries before choosing an updated one
If the user’s locale changes, we need to update the set of entries in
the OARS menu before selecting a new one and updating the label.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-03-16 12:10:11 +00:00
Matthew Leeds 87db73178f user-controls: Make OARS drop down open to the right
On laptops which have a 1366 by 768 display, in gnome-initial-setup the
OARS dropdown is cut off by the edge of the screen. Only the first
couple entries are visible. So make it open to the right instead, where
more room is available.
2020-03-13 11:32:11 -07:00
Philip Withnall 2cc56e1441 user-controls: Drop unused flatpak include
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-03-02 15:58:10 +00:00
Philip Withnall 82ecf17079 user-controls: Left-align the OARS drop-down text
Make it look more and more like a combo box. This widget really should
have been a combo box to begin with. We’re eventually going to end up
re-implementing a combo box from first principles at this rate.

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

Helps: #11
2020-02-26 11:00:41 +00:00
Philip Withnall 3f3e86bcbb user-controls: More minor wording tweaks
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #11
2020-02-26 11:00:28 +00:00
Philip Withnall 1d46f55be4 restrict-applications-dialog: Remove the Save button
Add a close button instead, as the dialogue is instant-apply.

See https://developer.gnome.org/hig/stable/dialogs.html.en#instant-and-explicit-apply

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

Helps: #11
2020-02-26 11:00:12 +00:00
Philip Withnall 8c7815e33c restrict-applications-dialog: Allow introduction label to wrap
Rather than ellipsising, allow it to wrap. Also ensure it’s
left-aligned.

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

Helps: #11
2020-02-26 09:15:19 +00:00
Philip Withnall 2d43ac38ec libmalcontent-ui: Restyle ‘restricts’ switches in yellow
This has fewer ‘error’ connotations than red. See
https://gitlab.freedesktop.org/pwithnall/malcontent/issues/11#note_419124.

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

Helps: #11
2020-02-25 12:49:29 +00:00
Philip Withnall 3db3a42e8d user-controls: Line wrap labels rather than ellipsising
The labels are too long to fit on a single line, given the default width
of the user controls widget, so allow them to wrap onto multiple lines
rather than unhelpfully ellipsising.

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

Helps: #11
2020-02-25 12:25:40 +00:00
Philip Withnall 008b75edd1 user-controls: Add a drop-down arrow next to the OARS age selector
To make it more obvious that it triggers a drop-down menu. Potentially,
this should be a `GtkComboBox` rather than reinventing the wheel using a
`GtkMenuButton` — but that’s a change for another day.

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

Helps: #11
2020-02-25 12:25:40 +00:00
Philip Withnall 7ad804835a user-controls: Rename OARS widget variables to be more descriptive
This doesn’t introduce any functional changes.

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

Helps: #11
2020-02-25 12:25:40 +00:00
Philip Withnall 5a1bfb842a user-controls: Include user display name in the description labels
This clarifies that the settings apply to that user.

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

Helps: #11
2020-02-25 12:25:40 +00:00
Philip Withnall dee4d92ea9 restrict-applications-dialog: Invert controls to be restrictive
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #11
2020-02-25 12:25:40 +00:00
Philip Withnall 8753109e80 user-controls: Tweak the wording of the ‘application suitability’ label
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #11
2020-02-25 12:25:40 +00:00
Philip Withnall 516e3936eb user-controls: Relabel ‘allow installation’ as ‘restrict installation’
This is part of a move to make all the controls restrictive, rather than
permissive.

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

Helps: #11
2020-02-25 12:25:40 +00:00
Philip Withnall f956fab427 user-controls: Tweak the wording of the ‘restrict applications’ label
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #11
2020-02-25 12:25:40 +00:00
Philip Withnall 8e4fa643d3 user-controls: Relabel ‘allow web browsers’ as ‘restrict web browsers’
This is part of a move to make all the controls restrictive, rather than
permissive.

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

Helps: #11
2020-02-25 12:25:40 +00:00
Philip Withnall b9a2b7a6a7 user-controls: Add CSS to support styling switches as ‘restrictive’
This will be used in upcoming commits to mark switches as restricting
something when they’re active, rather than allowing something. Their
background will be red, rather than blue.

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

Helps: #11
2020-02-25 12:25:40 +00:00
Philip Withnall 67ca6806e6 user-controls: Add separators between rows
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #11
2020-02-25 10:31:38 +00:00
Philip Withnall ef6fc0a7f5 user-controls: Fix icon for ‘Restrict Applications’ button
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #11
2020-02-25 10:31:24 +00:00
Philip Withnall 98395185e3 user-controls: Add full stops to end of control descriptions
They are sentences.

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

Helps: #11
2020-02-25 10:31:24 +00:00
Philip Withnall 1c033f82df user-controls: Allow widgets to be used without an `ActUser`
Allow the user controls widget to be used for user accounts which don’t
currently exist. This is necessary for using them in
gnome-initial-setup.

See the big new documentation comment at the top of the widget for
details of how the new semantics work.

This adds API, but does not break existing API.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-14 12:00:57 +00:00
Philip Withnall fc9ba76331 user-controls: Add some missing includes to the header
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-06 12:52:06 +00:00
Philip Withnall e4fbb570af user-controls: Add some missing documentation comments
The annotations in these fix some GIR warnings.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-06 12:52:06 +00:00
Philip Withnall 7dfd03907d user-controls: Split out app filter construction into a new method
This means that calling code can extract the app filter manually rather
than having to rely on the `MctUserControls` to save it. This will be
useful in a few commits’ time when support is added for using
`MctUserControls` for not-yet-created users.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-06 12:52:06 +00:00
Philip Withnall e3f923b294 user-controls: Don’t clear filter if updating it is a no-op
If `self->user == NULL`, don’t clear the app filter, as that leaves us
in a worse-off position than before.

Rename the method to make it clearer that it queries the filter from the
user.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-06 12:52:06 +00:00
Philip Withnall 3519ac2dc1 user-controls: Tweak the API of an internal helper function
Make it take a `MctUserControls` rather than a member of it. This
introduces no functional changes, but will make some upcoming
refactoring easier.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-06 12:52:06 +00:00
Philip Withnall 608444891f user-controls: Modernise GObject property code
This introduces no functional changes, but does make the code work
better with `-Wswitch-enum`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-06 12:52:06 +00:00
Philip Withnall 0f2c8d6601 restrict-applications-selector: Drop unnecessary include
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-06 12:52:06 +00:00
Philip Withnall 6b45ad9f76 restrict-applications-dialog: Drop accountsservice dependency
Instead of taking an `ActUser` as a property of the
`MctRestrictApplicationsDialog`, take the display name which we would
have queried from it.

This will allow the restrict applications dialog to be used in
situations where an `ActUser` isn’t available, such as when setting the
parental controls for a yet-to-be-created user.

This breaks the `MctRestrictApplicationsDialog` API, but the previous
API hadn’t yet been released.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-06 12:52:06 +00:00