Blob Blame History Raw
From 6b11d0d78b8f92bc86ce85579c09c338c8b7dcee Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Tue, 5 Nov 2013 19:06:15 +0100
Subject: [PATCH] tweak_typing.py: Make sure we display all the text in labels

This changes the labels from ellipsizing text to wrapping it
instead.
---
 gtweak/tweaks/tweak_typing.py | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/gtweak/tweaks/tweak_typing.py b/gtweak/tweaks/tweak_typing.py
index e93512b..556713e 100644
--- a/gtweak/tweaks/tweak_typing.py
+++ b/gtweak/tweaks/tweak_typing.py
@@ -22,7 +22,7 @@ import logging
 from gi.repository import Pango, Gtk, GnomeDesktop
 
 from gtweak.tweakmodel import Tweak, TweakGroup, TWEAK_GROUP_TYPING
-from gtweak.widgets import GSettingsSwitchTweak, build_label_beside_widget
+from gtweak.widgets import GSettingsSwitchTweak, UI_BOX_SPACING
 from gtweak.gsettings import GSettingsSetting, GSettingsMissingError, GSettingsFakeSetting
 
 class _XkbOption(Tweak):
@@ -52,13 +52,25 @@ class _XkbOption(Tweak):
 
         self._combo = Gtk.ComboBox(model = store)
         renderer = Gtk.CellRendererText()
-        renderer.props.ellipsize = Pango.EllipsizeMode.END
-        renderer.props.max_width_chars = 40
+        renderer.props.wrap_mode = Pango.WrapMode.WORD
+        renderer.props.wrap_width = 1
+        renderer.props.max_width_chars = 35
         self._combo.pack_start(renderer, True)
         self._combo.add_attribute(renderer, "text", 1)
         self._combo_changed_handler_id = self._combo.connect("changed", self._on_combo_changed)
 
-        self.widget = build_label_beside_widget(self.name, self._combo)
+        lbl = Gtk.Label(self.name)
+        lbl.props.wrap_mode = Pango.WrapMode.WORD
+        lbl.props.wrap = True
+        lbl.props.max_width_chars = 30
+        lbl.props.xalign = 0.0
+        lbl.set_mnemonic_widget(self._combo)
+
+        self.widget = Gtk.HBox()
+        self.widget.props.spacing = UI_BOX_SPACING
+        self.widget.pack_start(lbl, True, True, 0)
+        self.widget.pack_start(self._combo, False, False, 0)
+
         self.widget_for_size_group = self._combo
 
         self.reload()
-- 
1.8.3.1