Mercurial > pidgin
changeset 23167:88d67b1bb52a
Get rid of the boldness of the bold timestamps.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Thu, 22 May 2008 21:19:31 +0000 |
parents | e01b5aa9fc7b |
children | d7e66b6137f9 |
files | pidgin/gtkconv.c pidgin/gtkimhtml.c |
diffstat | 2 files changed, 33 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkconv.c Thu May 22 17:47:50 2008 +0000 +++ b/pidgin/gtkconv.c Thu May 22 21:19:31 2008 +0000 @@ -5692,6 +5692,7 @@ const char *tagname = NULL; GtkTextIter start, end; + GtkTextMark *mark; GtkTextTag *tag; GtkTextBuffer *buffer = GTK_IMHTML(gtkconv->imhtml)->text_buffer; @@ -5753,24 +5754,42 @@ g_free(alias_escaped); - g_snprintf(buf2, BUF_LONG, - "<FONT %s><FONT SIZE=\"2\"><!--%s --></FONT>%s</FONT> ", - sml_attrib ? sml_attrib : "", mdate, str); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all | GTK_IMHTML_NO_SCROLL); - - gtk_text_buffer_get_end_iter(buffer, &end); - gtk_text_iter_backward_chars(&end, tag_end_offset + 1); - - start = end; - gtk_text_iter_backward_chars(&start, tag_start_offset + - (alias ? g_utf8_strlen(alias, -1) : 0) + strlen(mdate) + 1); - if (tagname) tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buffer), tagname); else tag = get_buddy_tag(conv, name, TRUE); + if (GTK_IMHTML(gtkconv->imhtml)->show_comments) { + /* The color for the timestamp has to be set in the font-tags, unfortunately. + * Applying the nick-tag to timestamps would work, but that can make it + * bold. I thought applying the "comment" tag again, which has "weight" set + * to PANGO_WEIGHT_NORMAL, would remove the boldness. But it doesn't. So + * this will have to do. I don't terribly like it. -- sadrul */ + GdkColor *color = NULL; + gboolean set = FALSE; + char colcode[] = "COLOR=\"#XXXXXX\""; + g_object_get(G_OBJECT(tag), "foreground-set", &set, "foreground-gdk", &color, NULL); + if (set && color) + g_snprintf(colcode, sizeof(colcode), "COLOR=\"#%02x%02x%02x\"", + color->red >> 8, color->green >> 8, color->blue >> 8); + else + colcode[0] = '\0'; + g_snprintf(buf2, BUF_LONG, "<FONT %s SIZE=\"2\"><!--%s --></FONT>", colcode, mdate); + gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all | GTK_IMHTML_NO_SCROLL); + if (color) + gdk_color_free(color); + } + + gtk_text_buffer_get_end_iter(buffer, &end); + mark = gtk_text_buffer_create_mark(buffer, NULL, &end, TRUE); + + g_snprintf(buf2, BUF_LONG, "<FONT %s>%s</FONT> ", sml_attrib ? sml_attrib : "", str); + gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all | GTK_IMHTML_NO_SCROLL); + + gtk_text_buffer_get_end_iter(buffer, &end); + gtk_text_buffer_get_iter_at_mark(buffer, &start, mark); gtk_text_buffer_apply_tag(buffer, tag, &start, &end); + gtk_text_buffer_delete_mark(buffer, mark); g_free(str);
--- a/pidgin/gtkimhtml.c Thu May 22 17:47:50 2008 +0000 +++ b/pidgin/gtkimhtml.c Thu May 22 21:19:31 2008 +0000 @@ -5003,7 +5003,7 @@ GObject *obj = G_OBJECT(tag); gboolean empty = TRUE; - str += g_snprintf(str, sizeof(buf) - (str - buf), "<font style='"); + str += g_snprintf(str, sizeof(buf) - (str - buf), "<span style='"); /* Weight */ g_object_get(obj, "weight-set", &isset, "weight", &ivalue, NULL); @@ -5095,7 +5095,7 @@ gboolean set = FALSE; g_object_get(G_OBJECT(tag), props[i], &set, NULL); if (set) - return "</font>"; + return "</span>"; } return "";