Skip to content
Snippets Groups Projects
Commit ae958db7 authored by Bruce Cowan's avatar Bruce Cowan :airplane:
Browse files

Better tooltips

parent 4103238c
No related branches found
No related tags found
1 merge request!2Gtk4
......@@ -7,6 +7,8 @@
#include "config.h"
#include "rugby-possibility-widget.h"
#include <glib/gi18n.h>
struct _RugbyPossibilityWidget
{
GtkDrawingArea parent_instance;
......@@ -155,16 +157,27 @@ rugby_possibility_widget_constructed (GObject *obj)
"kicks", &kicks,
NULL);
if (tries > 0 || utries > 0)
g_string_append_printf (tooltip, "%d tries, %d converted",
if ((tries + utries) > 0)
{
g_string_append_printf (tooltip,
ngettext ("%d try, %d converted",
"%d tries, %d converted",
tries + utries),
tries + utries, tries);
if (kicks > 0)
if (kicks > 0)
g_string_append_printf (tooltip,
ngettext (", %d kick",
", %d kicks",
kicks),
kicks);
}
else if (kicks > 0)
{
if (tooltip->len == 0)
g_string_append_printf (tooltip, "%d kicks", kicks);
else
g_string_append_printf (tooltip, ", %d kicks", kicks);
g_string_append_printf (tooltip,
ngettext ("%d kick",
"%d kicks", kicks),
kicks);
}
gtk_widget_set_tooltip_text (GTK_WIDGET (self), tooltip->str);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment