pidgin.next.minor: 5ce50c4a: Get rid of the boldness of the bold time...
sadrul at pidgin.im
sadrul at pidgin.im
Thu May 22 17:50:40 EDT 2008
-----------------------------------------------------------------
Revision: 5ce50c4a271c4f856b4c72a4f831be53c285603e
Ancestor: bd4c2ebb9b819fcf7a27ec53f01ccc93263ecf9c
Author: sadrul at pidgin.im
Date: 2008-05-22T21:19:31
Branch: im.pidgin.pidgin.next.minor
URL: http://d.pidgin.im/viewmtn/revision/info/5ce50c4a271c4f856b4c72a4f831be53c285603e
Modified files:
pidgin/gtkconv.c pidgin/gtkimhtml.c
ChangeLog:
Get rid of the boldness of the bold timestamps.
-------------- next part --------------
============================================================
--- pidgin/gtkconv.c 76f2309ed714716a423d17056d9a42d85dff356d
+++ pidgin/gtkconv.c fc866c385139d7c2b7593e455004217c87b29ccf
@@ -5692,6 +5692,7 @@ pidgin_conv_write_conv(PurpleConversatio
const char *tagname = NULL;
GtkTextIter start, end;
+ GtkTextMark *mark;
GtkTextTag *tag;
GtkTextBuffer *buffer = GTK_IMHTML(gtkconv->imhtml)->text_buffer;
@@ -5753,24 +5754,42 @@ pidgin_conv_write_conv(PurpleConversatio
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);
============================================================
--- pidgin/gtkimhtml.c c2cc324fb739634840486a853d8237644655be76
+++ pidgin/gtkimhtml.c 731b0418f2c6876b8ec34446b0e84672898cb9d0
@@ -5003,7 +5003,7 @@ static const gchar *tag_to_html_start(Gt
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 @@ static const gchar *tag_to_html_end(GtkT
gboolean set = FALSE;
g_object_get(G_OBJECT(tag), props[i], &set, NULL);
if (set)
- return "</font>";
+ return "</span>";
}
return "";
More information about the Commits
mailing list