Commit Graph

554 Commits

Author SHA1 Message Date
Georges Basile Stavracas Neto d204944ae2 main: Improve visuals of loading label
Replace the manual scaling of the font size by a proper style
class, and center-align it vertically.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto a4ac1d644d user-selector: Purge items after listing users
The first call to act_user_manager_list_users() may lazily load
and notify the 'is-loaded' property, in which case we end up
indirectly recursing into reload_users(). Because we recurse
*after* purging carousel items, the same user is added twice:
once in the leaf recursion call, and once again in the call that
notified the 'is-loaded' property.

A simple workaround to this is purging carousel items after the
call to act_user_manager_list_users().
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto b5e516bea0 user-controls: Don't set popover direction
Let GTK handle that as it sees fit.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto e5ecc02488 user-controls: Remove OARS widgetry size group
We don't actually want the menu button to have the same size
of the popover, since the popover can grow pretty wide.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto b25a4e2119 carousel: Simplify arrow handling
The CSS-based animation is incompatible with the layout machinery
of GTK4, and we can't easily reintroduce it without another major
surgery in the carousel code, so just drop it for now.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 15172723dd carousel: Use revealer to calculate arrow offset
Now that the inner GtkStack has margins, it has an odd offset from
what we would expect. A better widget to use is the GtkRevealer,
which must cover the entire allocation, and therefore will always
produce the expected x offset.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 4887ded149 carousel: Replace size-allocate callback by a layout manager
GTK4 has no size-allocate signal anymore, but we can use a custom
layout manager to produce the same effect.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 3656cffcc0 carousel: Cleanup overlays
There are overlays inside overlays and that is not playing well
with event delivery - the main box is eating away clicks from the
userlist avatars.

Remove all that, and the extra overlays, and just leave one simple
overlay handling the whole widgetry.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 1d20fc50c9 carousel: Improve carousel box
This makes the carousel look more like what it used to.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto cd7d6a3845 carousel: Reindent file
No functional changes, just reindent the file.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto a9290f86b9 main: Make unlock button a pill
And set the 'suggested-action' style class too. This makes the
button more inline with modern GNOME HIG.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 486183a017 carousel: Move margins to inner stack 2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 0134e5d875 main: Remove has-default from buttons
This property is read-only in GTK4.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 8a8fe7b346 restrict-applications-dialog: Use close-request
Instead of delete-event. Pretty straightforward, 1:1 port to this
new signal.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 977b82f681 main: Remove can-default 2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto adaea91a4c carousel: Remove pass-through from overlay children
It doesn't exist anymore.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 3e1c14bda3 project: Port to GtkStack API changes 2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 6cd201166b main: Remove use-popover property from GtkMenuButton
It doesn't exist anymore.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 58fc4e0a5b main: Reimplement primary menu accellerator as a shortcut
In GTK4, the replacement to accelerators like this are shortcut
controllers.

Add a global shortcut controller to the primary menu button, and
bind it to F10.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 6fc250d5cf main: Adapt to GtkHeaderBar API changes 2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto dc1f68c7bc application: Port to gtk_show_uri_full()
A pretty straightfoward port, and most importantly, this function
actually exists in GTK4 :)
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto b71b83f348 carousel: Port MctCarousel to GTK4
Make it an AdwBin subclass. Purge all GtkContainer usage, and expose
GTK4-inspired API to add items to the carousel, and also to control
the internal GtkRevealer.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 0fca70768a carousel: Make MctCarouselItem subclass GtkButton
And add a setter to its internal child.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto e088443645 carousel: use double to translate coordinates
That's what GTK4 expects now.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 03ecb2dcb2 user-controls: Use GtkPopoverMenu API to set menu model
Pretty trivial replacement, since 'oars_popover' already is a
GtkPopoverMenu.
2022-07-20 19:23:12 -03:00
Georges Basile Stavracas Neto 6cb361efb9 user-image: Port to AdwAvatar
This simultaneously allows us to remove a lot of code, and make
Malcontent more consistent with the rest of the system.

Port MctUserImage to use an AdwAvatar internally. Make it inherit
AdwBin since it has a single child now.
2022-07-20 19:23:12 -03:00
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 631df4f1a5 project: Adapt to GtkBox API changes
GtkBox provides a different API surface, such as gtk_box_append()
and gtk_box_prepend(), so switch to that.
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 d142554ed3 malcontent-control: Replace border-width by margins
The 'border-width' property does not exist in GTK4 anymore, so
replace it with margin-* and in one case just remove it entirely.
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 52b4b490f3 dockerfile: Add libhandy as a dependency
Though it's unlikely Debian will have a version
new enough for us, it's still useful to have this an
advance. The meson subproject will work in cases where
we don't have a new enough version of libhandy.
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 554b390cd4 main.ui: Use HdyStatusPage for status pages
We now have a nice pre-built widget for status pages
with an icon, title, description, and children.
We should take advantage of that instead of manually
setting up each status page.
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
Christopher Davis d80ed10592 malcontent-control: Use HdyWindow and HdyHeaderBar 2022-07-13 12:00:33 -03:00