Philipp Hörist pushed to branch master at gajim / gajim

Commits:
12783e03 by Philipp Hörist at 2017-10-27T10:42:43+02:00
Catch require_version ValueError

- - - - -
87b65401 by Philipp Hörist at 2017-10-27T10:46:59+02:00
Fix height of MessageTextView in some cases

- - - - -


2 changed files:

- gajim/chat_control_base.py
- gajim/gtkspell.py


Changes:

=====================================
gajim/chat_control_base.py
=====================================
--- a/gajim/chat_control_base.py
+++ b/gajim/chat_control_base.py
@@ -1343,15 +1343,23 @@ class ChatControlBase(MessageControl, 
ChatCommandProcessor, CommandTools):
 
 class ScrolledWindow(Gtk.ScrolledWindow):
     def __init__(self, *args, **kwargs):
-        super().__init__(*args, **kwargs)
+        Gtk.ScrolledWindow.__init__(self, *args, **kwargs)
 
     def do_get_preferred_height(self):
         min_height, natural_height = 
Gtk.ScrolledWindow.do_get_preferred_height(self)
         child = self.get_child()
-        if natural_height and self.get_max_content_height() > -1 and child:
-            _, child_nat_height = child.get_preferred_height()
-            if natural_height > child_nat_height:
-                if child_nat_height < 26:
-                    return 26, 26
+        # 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
+        # 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:
+            GLib.idle_add(self.set_policy,
+                          Gtk.PolicyType.AUTOMATIC,
+                          Gtk.PolicyType.NEVER)
+        else:
+            GLib.idle_add(self.set_policy,
+                          Gtk.PolicyType.AUTOMATIC,
+                          Gtk.PolicyType.AUTOMATIC)
 
         return min_height, natural_height


=====================================
gajim/gtkspell.py
=====================================
--- a/gajim/gtkspell.py
+++ b/gajim/gtkspell.py
@@ -25,7 +25,7 @@ try:
     gi.require_version('GtkSpell', '3.0')
     from gi.repository import GtkSpell
     HAS_GTK_SPELL = True
-except ImportError:
+except (ImportError, ValueError):
     HAS_GTK_SPELL = False
 
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/compare/40547c4d4be712f43407283827de0cd702814815...87b6540104cd2393efc4e61fad10c1bfd4439026

---
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/compare/40547c4d4be712f43407283827de0cd702814815...87b6540104cd2393efc4e61fad10c1bfd4439026
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to