Commit Graph

89 Commits

Author SHA1 Message Date
Georges Basile Stavracas Neto d4f219b71e user-controls: Use GtkRoot API to get toplevel
In practice, widgets that implement GtkRoot represent what
toplevel widgets used to. Use that instead.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 8c170d11a2 project: Port GdkScreen to GdkDisplay
API looks about the same, just switching to 'display'.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 6ee8b77b95 user-controls: Remove unused variable 2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto c39ffd45fc project: Remove unnecessary usage of gtk_widget_show()
Now that widgets are visible by default, no need to show them
after creating them. Also revove gtk_widget_show_all() which
doesn't exist in GTK4.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto bb0865eb23 project: Use gtk_window_present() to present windows
Instead of gtk_widget_show(). In practice, it's exactly the same,
but it'll make follow-up patches cleaner.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 360c5b0271 restrict-applications-selector: Adapt to GtkImage API changes
This was supposed to be a project-wide commit, but actually only
MctRestrictApplicationsDialog had APIs to be updated. MctUseImage
will undergo a major surgery soon, so it's left out.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 8560ca0677 project: Simplify buttons
GtkButton has an 'icon-name' property that greatly simplifies
setting up buttons. GtkMenuButton has a new 'always-show-arrow'
property that also allows us to simplify some code.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto c9f8bb22f6 restrict-applications-selector: Adapt to AdwActionRow
This greatly reduces the code size. GtkBin is no more, and
AdwActionRow has specific API to add suffix widgets.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 2d9b408a32 user-controls: Inherit from AdwBin
GtkBin is no more, but libadwaita has a nice 1:1 replacement which
is AdwBin.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto e322d8cd98 Hdy → Adw
This simply changes namespaces. Fortunately, no further widgetry
changes will be necessary - all the widgets and APIs seem to have
an exact match in libadwaita.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto a8484b9c07 project: Port to GTK4 accessibility framework
This was simple, since few widgets have accessibility properties
manually set. The 'static' role doesn't exist anymore, and GtkLabel
handles everything for us, so we can just drop it.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 262d6a6e7a project: Remove most can-focus properties
In GTK4, can-focus usage is much more specific to widget subclasses,
and in almost all cases it's not necessary to set it.

Remove it everywhere, except in one case where it still needs to be
manually set to False.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 5bec6e8fdc project: Remove all visible=True properties
Start the GTK4 port by cleaning up all visible=True properties,
since widgets are visible by default on GTK4.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto c31640fa12 build: Switch to GTK4 and libadwaita
Switch the build system to GTK4 and libadwaita, instead of GTK3
and libhandy.

This commit breaks the build.
2022-07-20 19:23:12 -03:00
Christopher Davis d11e609543 dependencies: Add libhandy as a subproject
Allows for building on systems that don't ship libhandy
or a version of libhandy that's new enough.
2022-07-20 19:23:12 -03:00
Christopher Davis 73c1d7f3fe restrict-applications-selector: Hide placeholder when list isn't empty
Prevents a broken bottom border radius on the list.
2022-07-20 19:23:12 -03:00
Christopher Davis 9ed46ae597 restrict-applications-selector: Use HdyActionRow
Implements click-to-activate for rows in the dialog.
2022-07-20 19:23:12 -03:00
Christopher Davis c68058f0f3 restrict-applications: Use HdyPreferencesWindow
HdyPreferencesWindow provides a neat API we can use for
windows like this.
2022-07-20 19:23:12 -03:00
Christopher Davis 358cad3a24 user-controls: Use HdyPreferencesPage and HdyActionRow API
This allows us to get styling consistent with
HdyPreferencesWindow and similar content across GNOME.

Part of a consistency push for GNOME 40
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 25486a1df9 libmalcontent-ui: Port to libappstream
Depend on libappstream-dev, and include appstream.h instead of
appstream-glib.h.

We can depend on a new enough version of libappstream that all the
content rating symbols we need are available, which means that
`gs-content-rating.[ch]` can be dropped entirely.

Turns out no code changes are needed other than that.

Fixes: #51
2022-07-13 15:26:12 +01:00
Philip Withnall 0bbdb242a0 build: Bump Meson dependency to 0.57.0
This means we can depend on fix 42ba8efaf2 in Meson, which fixes use of
`volatile` in the default templates used by `gnome.mkenums_simple()`.
This fixes compiler warnings with recent compilers, which are promoted
to errors due to `-Werror`.

Meson 0.57.0 is available in bullseye-backports in Debian, which means
it’s available basically everywhere now.

Bumping the dependency required fixing a few deprecations in the
`meson.build` files.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-07-13 15:26:11 +01:00
Philip Withnall ec7fa2529b libmalcontent-ui: Improve keynav between listboxes
Fix using the up and down keys to change the keyboard focus between rows
between the listboxes. Previously, keynav would fail at the bottom of
the first listbox, and at the top of the second.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-10-07 16:22:51 +01:00
Philip Withnall af3a8b33db libmalcontent-ui: Drop handling of eos-link desktop files
They are being dropped in Endless OS, and would have been filtered out
by the fact they’re not flatpaks anyway.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-11 13:50:53 +00:00
Will Thompson fc047e6e67 libmalcontent-ui: Sort apps on the visible name
Previously, we sorted apps based on their display name, but
(confusingly) displayed their name. This leads to inconsistencies like
Rhythmbox being sorted (in French) as "Lecteur de musique Rhythmbox"
which places it between Krita and LibreOffice, but displayed as
"Rhythmbox".

Fixes #32
2021-02-25 14:12:20 +00:00
Philip Withnall 351a7811e5 Merge branch 'appstream-glib-dep' into 'master'
Bump appstream-glib dep and update content rating code

See merge request pwithnall/malcontent!100
2020-12-08 12:18:09 +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 cac7ba414c user-controls: Only save the app filter if it’s changed
This prevents a polkit authentication prompt popping up unexpectedly if,
for example, a non-privileged user has opened and immediately closed
malcontent-control.

Spotted by Andre Moreira Magalhaes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-11-03 17:49:00 +00:00
Philip Withnall ecfb3035d5 libmalcontent-ui: Load restricted apps and OARS when loading app filter
While the label for the OARS pseudo-combobox was updated when loading a
user’s app filter, the internal state (`self->selected_age`) was not.
Similarly, the set of restricted apps wasn’t loaded until the restricted
apps dialog was opened.

This caused problems when loading a user’s parental controls and then
editing a control which *wasn’t* restricted apps or the OARS level. The
resulting app filter would be built using default values for those two
controls, overwriting and losing their previous values when it was
saved.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-10-29 19:22:13 +00:00
Philip Withnall e7588a2333 libmalcontent-ui: Sync switches with app filter when loading selector
Since the changes to avoid reloading the app list entirely when loading
an app filter (commit 9d4639cf49), the switch states haven’t been set
properly when loading a new app filter, since the app rows already
exist, and the switch states were only set on creation.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-10-29 19:20:14 +00:00
Philip Withnall fc5432205c gs-content-rating: Backport OARS/CSM mapping changes from appstream-glib
This is a backport of commit f742cc3cf2428 from appstream-glib:

    as-content-rating: Align the OARS/CSM mappings of sex-*

    Align the OARS/CSM mappings of sex-homosexuality and sex-themes, as the
    two are identical apart from discriminating on sexual orientation.

    This is a follow-up to commit 01e9ee8113a8ad.

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

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-10-29 15:13:09 +00:00
Philip Withnall 1371e1c819 libmalcontent-ui: Bump appstream-glib dependency to ≥ 0.7.15
This allows some (but not all) of the fallback code to be dropped.
appstream-glib 0.7.17 is available on all versions of Fedora and Debian
which malcontent is packaged for:
 • https://packages.debian.org/search?suite=bullseye&searchon=names&keywords=appstream-glibhttps://src.fedoraproject.org/rpms/libappstream-glib

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-10-29 15:10:00 +00:00
Philip Withnall 93b88af0c1 libmalcontent-ui: Reload the app list when it changes on the system
This will no longer destroy in-progress user input.

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

Fixes: #18
2020-10-20 19:13:01 +01:00
Philip Withnall e1b5bcd324 libmalcontent-ui: Load the app list when constructing the apps selector
Rather than waiting until an app filter is set on the application
selector, load the app list immediately at construction time. This is
now possible because it can be diffed easily when the app filter is set.

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

Fixes: #28
2020-10-20 19:13:01 +01:00
Philip Withnall 9d4639cf49 libmalcontent-ui: Cache and diff the app list when rebuilding it
Instead of removing all the entries in the list store when the set of
installed apps is updated, diff the old and new lists so that removed
apps can be selectively removed from the list store, and added apps can
be selectively added.

This means that we can (in subsequent commits) reload the app list less
conservatively, as doing so will no longer remove in-progress user
modifications to the set of blocked apps. Modifications are still only
saved when the restrict applications dialogue is closed.

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

Helps: #18, #28
2020-10-20 19:13:01 +01:00
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