Fix MessagTextview height

On some Desktops eg. Mate, the MessageTextview was to big, because
the default height seems to be 82.

What influences the default height (compare Windows where it is 46),
is unclear.
This commit is contained in:
Philipp Hörist 2018-02-20 22:03:57 +01:00
parent 64d743de3e
commit 27ffae2af4
1 changed files with 4 additions and 5 deletions

View File

@ -1380,13 +1380,12 @@ class ScrolledWindow(Gtk.ScrolledWindow):
def do_get_preferred_height(self):
min_height, natural_height = Gtk.ScrolledWindow.do_get_preferred_height(self)
child = self.get_child()
# Gtk Bug: If policy is set to Automatic, the ScrolledWindow
# has a min size of around 46 depending on the System. Because
# we want it smaller, we set policy NEVER if the height is < 50
# has a min size of around 46-82 depending on the System. Because
# we want it smaller, we set policy NEVER if the height is < 90
# so the ScrolledWindow will shrink to around 26 (1 line heigh).
# Once it gets over 50 its no problem to restore the policy.
if natural_height < 50:
# Once it gets over 90 its no problem to restore the policy.
if natural_height < 90:
GLib.idle_add(self.set_policy,
Gtk.PolicyType.AUTOMATIC,
Gtk.PolicyType.NEVER)