Commit 7532ffc2 authored by Robin Stocker's avatar Robin Stocker Committed by John Stowers

Show text in tooltip when label is ellipsized

This is the case for the long texts in the "Typing" section.

https://bugzilla.gnome.org/show_bug.cgi?id=704149
parent 9d8d669e
......@@ -43,6 +43,14 @@ def build_label_beside_widget(txt, *widget, **kwargs):
image.set_tooltip_text(tip)
return image
def show_tooltip_when_ellipsized(label, x, y, keyboard_mode, tooltip):
layout = label.get_layout()
if layout.is_ellipsized():
tooltip.set_text(label.get_text())
return True
else:
return False
if kwargs.get("hbox"):
hbox = kwargs.get("hbox")
else:
......@@ -52,6 +60,8 @@ def build_label_beside_widget(txt, *widget, **kwargs):
lbl = Gtk.Label(txt)
lbl.props.ellipsize = Pango.EllipsizeMode.END
lbl.props.xalign = 0.0
lbl.set_has_tooltip(True)
lbl.connect("query-tooltip", show_tooltip_when_ellipsized)
hbox.pack_start(lbl, True, True, 0)
if kwargs.get("info"):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment