[gnome-music/gbsneto/silence-gtk-warnings] smoothscale: Retrieve padding with the context state
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/gbsneto/silence-gtk-warnings] smoothscale: Retrieve padding with the context state
- Date: Wed, 3 Apr 2019 15:07:31 +0000 (UTC)
commit 439068307e71e95e7eed31d34e1ecef6f1dfcb24
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Apr 3 12:04:35 2019 -0300
smoothscale: Retrieve padding with the context state
When retrieving the padding, SmoothScale calls ctx.get_padding()
and passes Gtk.StateFlags.NORMAL to it. This goes against the
correct practices of GtkStyleContext; we need to pass the current
state to all style context functions now.
Fix that by feeding ctx.get_padding() with ctx.get_state().
gnomemusic/widgets/smoothscale.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/widgets/smoothscale.py b/gnomemusic/widgets/smoothscale.py
index 7cd40bc9..ccd5dca1 100644
--- a/gnomemusic/widgets/smoothscale.py
+++ b/gnomemusic/widgets/smoothscale.py
@@ -184,9 +184,11 @@ class SmoothScale(Gtk.Scale):
return
# Update self._timeout.
+ style_context = self.get_style_context()
+ state = style_context.get_state()
+
width = self.get_allocated_width()
- padding = self.get_style_context().get_padding(
- Gtk.StateFlags.NORMAL)
+ padding = style_context.get_padding(state)
width = max(width - (padding.left + padding.right), 1)
timeout_period = min(1000 * duration // width, 1000)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]