diff options
author | Alexander Mikhaylenko <alexm@gnome.org> | 2021-02-08 19:22:14 +0500 |
---|---|---|
committer | António Fernandes <antoniojpfernandes@gmail.com> | 2021-06-01 19:48:15 +0000 |
commit | 1134d86886747f87806a2d90057dc2b398e66dd4 (patch) | |
tree | 8b1c8cd1f3879a292d44a17aeb4709e5bd18100c | |
parent | 9b7df261b12f130fea2f42ceab0e4ca96985ffd3 (diff) | |
download | nautilus-1134d86886747f87806a2d90057dc2b398e66dd4.tar.gz |
floating-bar: Don't start spinner if it's not visible
Animating unmapped widgets can still change their size, so they have to
be measured every time. https://gitlab.gnome.org/GNOME/gtk/-/issues/1025
As a workaround, ensure the spinner doesn't animate while it's not shown,
to reduce CPU usage.
-rw-r--r-- | src/nautilus-floating-bar.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nautilus-floating-bar.c b/src/nautilus-floating-bar.c index 30fbf5779..fdb76fb95 100644 --- a/src/nautilus-floating-bar.c +++ b/src/nautilus-floating-bar.c @@ -399,7 +399,12 @@ nautilus_floating_bar_constructed (GObject *obj) w = gtk_spinner_new (); gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0); gtk_widget_set_visible (w, self->show_spinner); - gtk_spinner_start (GTK_SPINNER (w)); + /* As a workaround for https://gitlab.gnome.org/GNOME/gtk/-/issues/1025, + * ensure the spinner animates if and only if it's visible, to reduce CPU + * usage. */ + g_object_bind_property (obj, "show-spinner", + w, "active", + G_BINDING_SYNC_CREATE); self->spinner = w; gtk_widget_set_size_request (w, 16, 16); |