[Goodies-commits] r5696 - in xfce4-dict/trunk: . lib
Enrico Troeger
enrico at xfce.org
Sun Oct 19 11:29:58 CEST 2008
Author: enrico
Date: 2008-10-19 09:29:58 +0000 (Sun, 19 Oct 2008)
New Revision: 5696
Modified:
xfce4-dict/trunk/ChangeLog
xfce4-dict/trunk/lib/dictd.c
Log:
Do not skip the first line of a dictd server text response as it might contain useful information.
Modified: xfce4-dict/trunk/ChangeLog
===================================================================
--- xfce4-dict/trunk/ChangeLog 2008-10-19 09:29:55 UTC (rev 5695)
+++ xfce4-dict/trunk/ChangeLog 2008-10-19 09:29:58 UTC (rev 5696)
@@ -1,6 +1,8 @@
2008-10-14 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* Beautify the texview output a little bit.
+ * Do not skip the first line of a dictd server text response as it
+ might contain useful information.
2008-09-29 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: xfce4-dict/trunk/lib/dictd.c
===================================================================
--- xfce4-dict/trunk/lib/dictd.c 2008-10-19 09:29:55 UTC (rev 5695)
+++ xfce4-dict/trunk/lib/dictd.c 2008-10-19 09:29:58 UTC (rev 5696)
@@ -105,6 +105,7 @@
{
gint max_lines, i;
gint defs_found = 0;
+ gboolean first_line;
gchar *answer, *tmp, *stripped;
gchar **lines, **dict_parts;
@@ -220,7 +221,8 @@
break;
/* all following lines represents the translation */
- i += 2; /* skip the next two lines */
+ i++;
+ first_line = TRUE;
while (lines[i] != NULL && lines[i][0] != '\r' && lines[i][0] != '\n')
{
/* check for a leading period indicating end of text response */
@@ -237,8 +239,16 @@
stripped = g_strstrip(lines[i]);
if (strlen(stripped) > 0)
{
- gtk_text_buffer_insert_with_tags(dd->main_textbuffer, &dd->textiter, stripped, -1,
- dd->main_tag_indent, NULL);
+ if (first_line)
+ { /* do not indent the first line */
+ gtk_text_buffer_insert(dd->main_textbuffer, &dd->textiter, stripped, -1);
+ first_line = FALSE;
+ }
+ else
+ {
+ gtk_text_buffer_insert_with_tags(dd->main_textbuffer, &dd->textiter,
+ stripped, -1, dd->main_tag_indent, NULL);
+ }
if (i < (max_lines - 1) && lines[i + 1][0] != '.')
gtk_text_buffer_insert(dd->main_textbuffer, &dd->textiter, "\n", 1);
}
More information about the Goodies-commits
mailing list