Commit 72971546 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen
Browse files

Elide (_x) in the middle of the string, too. (#323956, Abel Cheung)

2006-05-08  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtktoolbar.c (_gtk_toolbar_elide_underscores): Elide (_x) in the middle
	of the string, too.  (#323956, Abel Cheung)
parent 8ade9249
2006-05-08 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktoolbar.c (_gtk_toolbar_elide_underscores): Elide (_x) in the middle
of the string, too. (#323956, Abel Cheung)
* gtk/gtkuimanager.c (update_node): Fix tooltips.
* configure.in: Require Pango 1.13.0
......
2006-05-08 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktoolbar.c (_gtk_toolbar_elide_underscores): Elide (_x) in the middle
of the string, too. (#323956, Abel Cheung)
* gtk/gtkuimanager.c (update_node): Fix tooltips.
* configure.in: Require Pango 1.13.0
......
......@@ -4877,38 +4877,40 @@ gchar *
_gtk_toolbar_elide_underscores (const gchar *original)
{
gchar *q, *result;
const gchar *p;
const gchar *p, *end;
gsize len;
gboolean last_underscore;
gint s;
if (!original)
return NULL;
s = strlen (original);
q = result = g_malloc (s + 1);
len = strlen (original);
q = result = g_malloc (len + 1);
last_underscore = FALSE;
for (p = original; *p; p++)
end = original + len;
for (p = original; p < end; p++)
{
if (!last_underscore && *p == '_')
last_underscore = TRUE;
else
{
last_underscore = FALSE;
*q++ = *p;
if (*p != '_' && original + 2 <= p && p + 1 <= end && p[-2] == '(' && p[1] == ')')
{
q--;
*q = '\0';
p++;
}
else
*q++ = *p;
}
}
if (last_underscore)
*q++ = '_';
*q = '\0';
if (s > 4)
{
if (original[s - 4] == '(' &&
original[s - 3] == '_' &&
original[s - 1] == ')')
q[-3] = '\0';
}
return result;
}
......
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