Mercurial > pidgin.yaz
changeset 23484:06392c8252c0
Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
author | Justin Rodriguez <ffdragon@soc.pidgin.im> |
---|---|
date | Thu, 31 Jul 2008 23:38:07 +0000 |
parents | 748308865dbf |
children | 824e97a1dd22 |
files | pidgin/gtkblist-loader.c pidgin/gtkblist-theme.c pidgin/gtkblist-theme.h pidgin/gtkblist.c |
diffstat | 4 files changed, 406 insertions(+), 325 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkblist-loader.c Wed Jul 23 05:32:00 2008 +0000 +++ b/pidgin/gtkblist-loader.c Thu Jul 31 23:38:07 2008 +0000 @@ -41,12 +41,11 @@ { xmlnode *root_node, *sub_node, *sub_sub_node; gchar *filename, *filename_full, *data; - const gchar *icon_theme = NULL, *tmp; + const gchar *icon_theme = NULL, *temp; gboolean sucess = TRUE; - GdkColor *bgcolor, *expanded_bgcolor, *collapsed_bgcolor, *buddy_bgcolor1, *buddy_bgcolor2; + GdkColor *bgcolor, *expanded_bgcolor, *collapsed_bgcolor, *contact_color; GdkColor color; - FontColorPair *expanded, *collapsed, *online, *away, *offline, *message, *status; - gdouble transparency; + FontColorPair *expanded, *collapsed, *contact, *online, *away, *offline, *idle, *message, *status; PidginBlistLayout *layout; GDir *gdir; PidginBlistTheme *theme; @@ -73,16 +72,18 @@ bgcolor = g_new0(GdkColor, 1); expanded_bgcolor = g_new0(GdkColor, 1); collapsed_bgcolor = g_new0(GdkColor, 1); - buddy_bgcolor1 = g_new0(GdkColor, 1); - buddy_bgcolor2 = g_new0(GdkColor, 1); layout = g_new0(PidginBlistLayout, 1); + contact_color = g_new0(GdkColor, 1); + expanded = g_new0(FontColorPair, 1); collapsed = g_new0(FontColorPair, 1); + contact = g_new0(FontColorPair, 1); online = g_new0(FontColorPair, 1); away = g_new0(FontColorPair, 1); offline = g_new0(FontColorPair, 1); + idle = g_new0(FontColorPair, 1); message = g_new0(FontColorPair, 1); status = g_new0(FontColorPair, 1); @@ -96,9 +97,7 @@ /* <blist> */ if ((sucess = sucess && (sub_node = xmlnode_get_child(root_node, "blist")) != NULL)) { - transparency = atof(xmlnode_get_attrib(sub_node, "transparency")); - - if ((tmp = xmlnode_get_attrib(sub_node, "color")) != NULL && gdk_color_parse(tmp, bgcolor)) + if ((temp = xmlnode_get_attrib(sub_node, "color")) != NULL && gdk_color_parse(temp, bgcolor)) gdk_colormap_alloc_color(gdk_colormap_get_system(), bgcolor, FALSE, TRUE); else { g_free(bgcolor); @@ -112,12 +111,12 @@ expanded->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); - if ((tmp = xmlnode_get_attrib(sub_sub_node, "text_color")) != NULL && gdk_color_parse(tmp, &color)) - expanded->color = g_strdup(tmp); - else expanded->color = DEFAULT_TEXT_COLOR; + if ((temp = xmlnode_get_attrib(sub_sub_node, "text_color")) != NULL && gdk_color_parse(temp, &color)) + expanded->color = g_strdup(temp); + else expanded->color = g_strdup(DEFAULT_TEXT_COLOR); - if ((tmp = xmlnode_get_attrib(sub_sub_node, "background")) != NULL && gdk_color_parse(tmp, expanded_bgcolor)) + if ((temp = xmlnode_get_attrib(sub_sub_node, "background")) != NULL && gdk_color_parse(temp, expanded_bgcolor)) gdk_colormap_alloc_color(gdk_colormap_get_system(), expanded_bgcolor, FALSE, TRUE); else { g_free(expanded_bgcolor); @@ -126,13 +125,14 @@ } if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "collapsed")) != NULL)) { + collapsed->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); - if((tmp = xmlnode_get_attrib(sub_sub_node, "text_color")) != NULL && gdk_color_parse(tmp, &color)) - collapsed->color = g_strdup(tmp); - else collapsed->color = DEFAULT_TEXT_COLOR; + if((temp = xmlnode_get_attrib(sub_sub_node, "text_color")) != NULL && gdk_color_parse(temp, &color)) + collapsed->color = g_strdup(temp); + else collapsed->color = g_strdup(DEFAULT_TEXT_COLOR); - if ((tmp = xmlnode_get_attrib(sub_sub_node, "background")) != NULL && gdk_color_parse(tmp, collapsed_bgcolor)) + if ((temp = xmlnode_get_attrib(sub_sub_node, "background")) != NULL && gdk_color_parse(temp, collapsed_bgcolor)) gdk_colormap_alloc_color(gdk_colormap_get_system(), collapsed_bgcolor, FALSE, TRUE); else { g_free(collapsed_bgcolor); @@ -144,64 +144,70 @@ if ((sucess = sucess && (sub_node = xmlnode_get_child(root_node, "buddys")) != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "placement")) != NULL)) { - layout->status_icon = atoi(xmlnode_get_attrib(sub_sub_node, "status_icon")); - layout->text = atoi(xmlnode_get_attrib(sub_sub_node, "name")); - layout->emblem = atoi(xmlnode_get_attrib(sub_sub_node, "emblem")); - layout->protocol_icon = atoi(xmlnode_get_attrib(sub_sub_node, "protocol_icon")); - layout->buddy_icon = atoi(xmlnode_get_attrib(sub_sub_node, "buddy_icon")); - layout->show_status = atoi(xmlnode_get_attrib(sub_sub_node, "status_icon")) != 0; + layout->status_icon = (temp = xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) : 0; + layout->text = (temp = xmlnode_get_attrib(sub_sub_node, "name")) != NULL ? atoi(temp) : 1; + layout->emblem = (temp = xmlnode_get_attrib(sub_sub_node, "emblem")) != NULL ? atoi(temp) : 2; + layout->protocol_icon = (temp = xmlnode_get_attrib(sub_sub_node, "protocol_icon")) != NULL ? atoi(temp) : 3; + layout->buddy_icon = (temp = xmlnode_get_attrib(sub_sub_node, "buddy_icon")) != NULL ? atoi(temp) : 4; + layout->show_status = (temp = xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) != 0 : 1; } if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "background")) != NULL)) { - - if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color1"), buddy_bgcolor1)) - gdk_colormap_alloc_color(gdk_colormap_get_system(), buddy_bgcolor1, FALSE, TRUE); + if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color"), contact_color)) + gdk_colormap_alloc_color(gdk_colormap_get_system(), contact_color, FALSE, TRUE); else { - g_free(buddy_bgcolor1); - buddy_bgcolor1 = NULL; + g_free(contact_color); + contact_color = NULL; } - - if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color2"), buddy_bgcolor2)) - gdk_colormap_alloc_color(gdk_colormap_get_system(), buddy_bgcolor2, FALSE, TRUE); - else { - g_free(buddy_bgcolor2); - buddy_bgcolor2 = NULL; - } + } + + if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "contact_text")) != NULL)) { + online->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) + contact->color = g_strdup(temp); + else contact->color = g_strdup(DEFAULT_TEXT_COLOR); } if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "online_text")) != NULL)) { online->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); - if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color"), &color)) - online->color = g_strdup(tmp); - else online->color = DEFAULT_TEXT_COLOR; + if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) + online->color = g_strdup(temp); + else online->color = g_strdup(DEFAULT_TEXT_COLOR); } if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "away_text")) != NULL)) { away->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); - if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color"), &color)) - away->color = g_strdup(tmp); - else away->color = DEFAULT_TEXT_COLOR; + if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) + away->color = g_strdup(temp); + else away->color = g_strdup(DEFAULT_TEXT_COLOR); } if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "offline_text")) != NULL)) { offline->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); - if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color"), &color)) - online->color = g_strdup(tmp); - else online->color = DEFAULT_TEXT_COLOR; + if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) + online->color = g_strdup(temp); + else online->color = g_strdup(DEFAULT_TEXT_COLOR); + } + + if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "idle_text")) != NULL)) { + idle->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) + idle->color = g_strdup(temp); + else online->color = g_strdup(DEFAULT_TEXT_COLOR); } if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "message_text")) != NULL)) { message->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); - if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color"), &color)) - message->color = g_strdup(tmp); - else message->color = DEFAULT_TEXT_COLOR; + if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) + message->color = g_strdup(temp); + else message->color = g_strdup(DEFAULT_TEXT_COLOR); } if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "status_text")) != NULL)) { status->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); - if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color"), &color)) - status->color = g_strdup(tmp); - else status->color = DEFAULT_TEXT_COLOR; + if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) + status->color = g_strdup(temp); + else status->color = g_strdup(DEFAULT_TEXT_COLOR); } /* name is required for theme manager */ @@ -217,17 +223,17 @@ "description", data, "icon-theme", icon_theme, "background-color", bgcolor, - "opacity", transparency, "layout", layout, "expanded-color", expanded_bgcolor, "expanded-text", expanded, "collapsed-color", collapsed_bgcolor, "collapsed-text", collapsed, - "buddy-bgcolor1", buddy_bgcolor1, - "buddy-bgcolor2", buddy_bgcolor2, + "contact-color", contact_color, + "contact", contact, "online", online, "away", away, "offline", offline, + "idle", idle, "message", message, "status", status, NULL); @@ -236,7 +242,7 @@ g_object_unref(theme); theme = NULL; } - + xmlnode_free(sub_node); xmlnode_free(root_node); g_dir_close(gdir);
--- a/pidgin/gtkblist-theme.c Wed Jul 23 05:32:00 2008 +0000 +++ b/pidgin/gtkblist-theme.c Thu Jul 31 23:38:07 2008 +0000 @@ -45,13 +45,16 @@ FontColorPair *collapsed; /* buddy */ - GdkColor *buddy_bgcolor1; - GdkColor *buddy_bgcolor2; + GdkColor *contact_color; + + FontColorPair *contact; FontColorPair *online; FontColorPair *away; FontColorPair *offline; + FontColorPair *idle; FontColorPair *message; + FontColorPair *status; } PidginBlistThemePrivate; @@ -75,11 +78,12 @@ PROP_EXPANDED_TEXT, PROP_COLLAPSED_COLOR, PROP_COLLAPSED_TEXT, - PROP_BGCOLOR1, - PROP_BGCOLOR2, + PROP_CONTACT_COLOR, + PROP_CONTACT, PROP_ONLINE, PROP_AWAY, PROP_OFFLINE, + PROP_IDLE, PROP_MESSAGE, PROP_STATUS, }; @@ -88,11 +92,14 @@ * Helpers *****************************************************************************/ -static void +void free_font_and_color(FontColorPair *pair) { if(pair != NULL){ - g_free(pair->font); + if (pair->font) + g_free(pair->font); + if (pair->color) + g_free(pair->color); g_free(pair); } } @@ -106,7 +113,6 @@ gpointer klass) { (PIDGIN_BLIST_THEME(instance))->priv = g_new0(PidginBlistThemePrivate, 1); - } static void @@ -140,11 +146,11 @@ case PROP_COLLAPSED_TEXT: g_value_set_pointer(value, pidgin_blist_theme_get_collapsed_text_info(theme)); break; - case PROP_BGCOLOR1: - g_value_set_pointer(value, pidgin_blist_theme_get_buddy_color_1(theme)); + case PROP_CONTACT_COLOR: + g_value_set_pointer(value, pidgin_blist_theme_get_contact_color(theme)); break; - case PROP_BGCOLOR2: - g_value_set_pointer(value, pidgin_blist_theme_get_buddy_color_2(theme)); + case PROP_CONTACT: + g_value_set_pointer(value, pidgin_blist_theme_get_contact_text_info(theme)); break; case PROP_ONLINE: g_value_set_pointer(value, pidgin_blist_theme_get_online_text_info(theme)); @@ -155,6 +161,9 @@ case PROP_OFFLINE: g_value_set_pointer(value, pidgin_blist_theme_get_offline_text_info(theme)); break; + case PROP_IDLE: + g_value_set_pointer(value, pidgin_blist_theme_get_idle_text_info(theme)); + break; case PROP_MESSAGE: g_value_set_pointer(value, pidgin_blist_theme_get_unread_message_text_info(theme)); break; @@ -168,7 +177,7 @@ } static void -pidgin_blist_theme_set_property(GObject *obj, guint param_id, const GValue *value, +pidgin_blist_theme_set_property(GObject *obj, guint param_id, GValue *value, GParamSpec *psec) { PidginBlistTheme *theme = PIDGIN_BLIST_THEME(obj); @@ -198,11 +207,11 @@ case PROP_COLLAPSED_TEXT: pidgin_blist_theme_set_collapsed_text_info(theme, g_value_get_pointer(value)); break; - case PROP_BGCOLOR1: - pidgin_blist_theme_set_buddy_color_1(theme, g_value_get_pointer(value)); + case PROP_CONTACT_COLOR: + pidgin_blist_theme_set_contact_color(theme, g_value_get_pointer(value)); break; - case PROP_BGCOLOR2: - pidgin_blist_theme_set_buddy_color_2(theme, g_value_get_pointer(value)); + case PROP_CONTACT: + pidgin_blist_theme_set_contact_text_info(theme, g_value_get_pointer(value)); break; case PROP_ONLINE: pidgin_blist_theme_set_online_text_info(theme, g_value_get_pointer(value)); @@ -213,6 +222,9 @@ case PROP_OFFLINE: pidgin_blist_theme_set_offline_text_info(theme, g_value_get_pointer(value)); break; + case PROP_IDLE: + pidgin_blist_theme_set_idle_text_info(theme, g_value_get_pointer(value)); + break; case PROP_MESSAGE: pidgin_blist_theme_set_unread_message_text_info(theme, g_value_get_pointer(value)); break; @@ -240,6 +252,7 @@ free_font_and_color(priv->collapsed); /* Buddy */ + free_font_and_color(priv->contact); free_font_and_color(priv->online); free_font_and_color(priv->away); free_font_and_color(priv->offline); @@ -276,13 +289,6 @@ G_PARAM_READWRITE); g_object_class_install_property(obj_class, PROP_BACKGROUND_COLOR, pspec); - pspec = g_param_spec_double("opacity","Opacity", - "The transparency of the buddy list", - 0.0, 1.0, - 1.0, - G_PARAM_READWRITE); - g_object_class_install_property(obj_class, PROP_OPACITY, pspec); - pspec = g_param_spec_pointer("layout", "Layout", "The layout of icons, name, and status of the blist", G_PARAM_READWRITE); @@ -311,15 +317,15 @@ g_object_class_install_property(obj_class, PROP_COLLAPSED_TEXT, pspec); /* Buddy */ - pspec = g_param_spec_pointer("buddy-bgcolor1", "Buddy Background Color 1", - "The background color of a buddy", + pspec = g_param_spec_pointer("contact-color", "Contact/Chat Background Color", + "The background color of a contact or chat", G_PARAM_READWRITE); - g_object_class_install_property(obj_class, PROP_BGCOLOR1, pspec); + g_object_class_install_property(obj_class, PROP_CONTACT_COLOR, pspec); - pspec = g_param_spec_pointer("buddy-bgcolor2", "Buddy Background Color 2", - "The background color of a buddy", - G_PARAM_READWRITE); - g_object_class_install_property(obj_class, PROP_BGCOLOR2, pspec); + pspec = g_param_spec_pointer("contact", "Contact Text", + "The text information for when a contact is expanded", + G_PARAM_READWRITE); + g_object_class_install_property(obj_class, PROP_CONTACT, pspec); pspec = g_param_spec_pointer("online", "On-line Text", "The text information for when a buddy is online", @@ -336,7 +342,12 @@ G_PARAM_READWRITE); g_object_class_install_property(obj_class, PROP_OFFLINE, pspec); - pspec = g_param_spec_pointer("message", "Meggage Text", + pspec = g_param_spec_pointer("idle", "Idle Text", + "The text information for when a buddy is idle", + G_PARAM_READWRITE); + g_object_class_install_property(obj_class, PROP_IDLE, pspec); + + pspec = g_param_spec_pointer("message", "Message Text", "The text information for when a buddy is has an unread message", G_PARAM_READWRITE); g_object_class_install_property(obj_class, PROP_MESSAGE, pspec); @@ -352,7 +363,7 @@ { static GType type = 0; if (type == 0) { - static const GTypeInfo info = { + static GTypeInfo info = { sizeof (PidginBlistThemeClass), NULL, /* base_init */ NULL, /* base_finalize */ @@ -474,7 +485,7 @@ } GdkColor * -pidgin_blist_theme_get_buddy_color_1(PidginBlistTheme *theme) +pidgin_blist_theme_get_contact_color(PidginBlistTheme *theme) { PidginBlistThemePrivate *priv; @@ -482,11 +493,11 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); - return priv->buddy_bgcolor1; + return priv->contact_color; } -GdkColor * -pidgin_blist_theme_get_buddy_color_2(PidginBlistTheme *theme) +FontColorPair * +pidgin_blist_theme_get_contact_text_info(PidginBlistTheme *theme) { PidginBlistThemePrivate *priv; @@ -494,7 +505,7 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); - return priv->buddy_bgcolor2; + return priv->contact; } FontColorPair * @@ -534,6 +545,18 @@ } FontColorPair * +pidgin_blist_theme_get_idle_text_info(PidginBlistTheme *theme) +{ + PidginBlistThemePrivate *priv; + + g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); + + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + + return priv->idle; +} + +FontColorPair * pidgin_blist_theme_get_unread_message_text_info(PidginBlistTheme *theme) { PidginBlistThemePrivate *priv; @@ -580,7 +603,6 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); - g_free(priv->bgcolor); priv->bgcolor = color; } @@ -618,7 +640,6 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); - g_free(priv->expanded_color); priv->expanded_color = color; } @@ -644,7 +665,6 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); - g_free(priv->collapsed_color); priv->collapsed_color = color; } @@ -662,7 +682,7 @@ } void -pidgin_blist_theme_set_buddy_color_1(PidginBlistTheme *theme, GdkColor *color) +pidgin_blist_theme_set_contact_color(PidginBlistTheme *theme, GdkColor *color) { PidginBlistThemePrivate *priv; @@ -670,12 +690,11 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); - g_free(priv->buddy_bgcolor1); - priv->buddy_bgcolor1 = color; + priv->contact_color = color; } void -pidgin_blist_theme_set_buddy_color_2(PidginBlistTheme *theme, GdkColor *color) +pidgin_blist_theme_set_contact_text_info(PidginBlistTheme *theme, FontColorPair *pair) { PidginBlistThemePrivate *priv; @@ -683,8 +702,8 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); - g_free(priv->buddy_bgcolor2); - priv->buddy_bgcolor2 = color; + free_font_and_color(priv->contact); + priv->contact = pair; } void @@ -727,6 +746,19 @@ } void +pidgin_blist_theme_set_idle_text_info(PidginBlistTheme *theme, FontColorPair *pair) +{ + PidginBlistThemePrivate *priv; + + g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); + + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + + free_font_and_color(priv->idle); + priv->idle = pair; +} + +void pidgin_blist_theme_set_unread_message_text_info(PidginBlistTheme *theme, FontColorPair *pair) { PidginBlistThemePrivate *priv;
--- a/pidgin/gtkblist-theme.h Wed Jul 23 05:32:00 2008 +0000 +++ b/pidgin/gtkblist-theme.h Thu Jul 31 23:38:07 2008 +0000 @@ -78,6 +78,14 @@ } PidginBlistLayout; +/**************************************************************************/ +/** @name FontColorPair API */ +/**************************************************************************/ + +/** + * Frees a font and color pair + */ +void free_font_and_color(FontColorPair *pair); /**************************************************************************/ /** @name Purple Buddy List Theme API */ @@ -149,18 +157,18 @@ FontColorPair *pidgin_blist_theme_get_collapsed_text_info(PidginBlistTheme *theme); /** - * Returns the 1st color to be used for buddys + * Returns the colors to be used for contacts and chats * - * @returns a gdk color + * @returns a gdkcolor for contacts and chats */ - GdkColor *pidgin_blist_theme_get_buddy_color_1(PidginBlistTheme *theme); + GdkColor *pidgin_blist_theme_get_contact_color(PidginBlistTheme *theme); /** - * Returns the 2nd color to be used for buddies + * Returns the text font and color to be used for expanded contacts * - * @returns a gdk color + * @returns a font and color pair */ - GdkColor *pidgin_blist_theme_get_buddy_color_2(PidginBlistTheme *theme); + FontColorPair *pidgin_blist_theme_get_contact_text_info(PidginBlistTheme *theme); /** * Returns the text font and color to be used for online buddies @@ -184,6 +192,13 @@ FontColorPair *pidgin_blist_theme_get_offline_text_info(PidginBlistTheme *theme); /** + * Returns the text font and color to be used for idle buddies + * + * @returns a font and color pair + */ + FontColorPair *pidgin_blist_theme_get_idle_text_info(PidginBlistTheme *theme); + +/** * Returns the text font and color to be used for buddies with unread messages * * @returns a font and color pair @@ -256,18 +271,18 @@ void pidgin_blist_theme_set_collapsed_text_info(PidginBlistTheme *theme, FontColorPair *pair); /** - * Sets the background color to be used for the 1st buddy + * Sets the background color to be used for contacts and chats * - * @param color the color for the 1st buddy + * @param color the color to use for contacts and chats */ -void pidgin_blist_theme_set_buddy_color_1(PidginBlistTheme *theme, GdkColor *color); +void pidgin_blist_theme_set_contact_color(PidginBlistTheme *theme, GdkColor *color); /** - * Sets the background color to be used for the 2nd buddy + * Sets the text color and font to be used for expanded contacts * - * @param color the color for the 2nd buddy + * @param pair the new text font at color pair */ -void pidgin_blist_theme_set_buddy_color_2(PidginBlistTheme *theme, GdkColor *color); +void pidgin_blist_theme_set_contact_text_info(PidginBlistTheme *theme, FontColorPair *pair); /** * Sets the text color and font to be used for online buddies @@ -291,6 +306,13 @@ void pidgin_blist_theme_set_offline_text_info(PidginBlistTheme *theme, FontColorPair *pair); /** + * Sets the text color and font to be used for idle buddies + * + * @param pair the new text font at color pair + */ +void pidgin_blist_theme_set_idle_text_info(PidginBlistTheme *theme, FontColorPair *pair); + +/** * Sets the text color and font to be used for buddies with an unread message * * @param pair the new text font at color pair
--- a/pidgin/gtkblist.c Wed Jul 23 05:32:00 2008 +0000 +++ b/pidgin/gtkblist.c Thu Jul 31 23:38:07 2008 +0000 @@ -3783,19 +3783,22 @@ return ret; } -gchar *pidgin_blist_get_name_markup(PurpleBuddy *b, gboolean selected, gboolean aliased) +gchar * +pidgin_blist_get_name_markup(PurpleBuddy *b, gboolean selected, gboolean aliased) { const char *name; - char *esc, *text = NULL; + char *text = NULL, *name_color, *name_font, *status_color, *status_font; PurplePlugin *prpl; PurplePluginProtocolInfo *prpl_info = NULL; PurpleContact *contact; PurplePresence *presence; struct _pidgin_blist_node *gtkcontactnode = NULL; - char *idletime = NULL, *statustext = NULL; - time_t t; + char *idletime = NULL, *statustext = NULL, *nametext; PurpleConversation *conv = find_conversation_with_buddy(b); gboolean hidden_conv = FALSE; + gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); + FontColorPair *pair; + PidginBlistTheme *theme; if (conv != NULL) { PidginBlistNode *ui = b->node.ui_data; @@ -3813,174 +3816,156 @@ if(contact) gtkcontactnode = ((PurpleBlistNode*)contact)->ui_data; + /* Name */ if(gtkcontactnode && !gtkcontactnode->contact_expanded && contact->alias) name = contact->alias; else name = purple_buddy_get_alias(b); - esc = g_markup_escape_text(name, strlen(name)); + nametext = g_markup_escape_text(name, strlen(name)); presence = purple_buddy_get_presence(b); - if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons") && aliased) - { - if (!selected && purple_presence_is_idle(presence)) - { - text = g_strdup_printf("<span color='%s'>%s</span>", - dim_grey(), esc); - g_free(esc); - if (hidden_conv) { - char *tmp = text; - text = g_strdup_printf("<b>%s</b>", text); + /* Name is all that is needed */ + if (biglist || !aliased) { + + /* Status Info */ + prpl = purple_find_prpl(purple_account_get_protocol_id(b->account)); + + if (prpl != NULL) + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); + + if (prpl_info && prpl_info->status_text && b->account->gc) { + char *tmp = prpl_info->status_text(b); + const char *end; + + if(tmp && !g_utf8_validate(tmp, -1, &end)) { + char *new = g_strndup(tmp, + g_utf8_pointer_to_offset(tmp, end)); + g_free(tmp); + tmp = new; + } + /* add ... to messages that are too long, GTK 2.6+ does it automatically */ +#if !GTK_CHECK_VERSION(2,6,0) + if(tmp) { + char buf[32]; + char *c = tmp; + int length = 0, vis=0; + gboolean inside = FALSE; + g_strdelimit(tmp, "\n", ' '); + purple_str_strip_char(tmp, '\r'); + + while(*c && vis < 20) { + if(*c == '&') + inside = TRUE; + else if(*c == ';') + inside = FALSE; + if(!inside) + vis++; + c = g_utf8_next_char(c); /* this is fun */ + } + + length = c - tmp; + + if(vis == 20) + g_snprintf(buf, sizeof(buf), "%%.%ds...", length); + else + g_snprintf(buf, sizeof(buf), "%%s "); + + statustext = g_strdup_printf(buf, tmp);purple_presence_is_idle(presence) + g_free(tmp); } - return text; - } - else if (hidden_conv) - { - char *tmp = esc; - esc = g_strdup_printf("<b>%s</b>", esc); - g_free(tmp); - } - return esc; - } - - prpl = purple_find_prpl(purple_account_get_protocol_id(b->account)); - - if (prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info && prpl_info->status_text && b->account->gc) { - char *tmp = prpl_info->status_text(b); - const char *end; - - if(tmp && !g_utf8_validate(tmp, -1, &end)) { - char *new = g_strndup(tmp, - g_utf8_pointer_to_offset(tmp, end)); - g_free(tmp); - tmp = new; +#else + if(tmp) { + g_strdelimit(tmp, "\n", ' '); + purple_str_strip_char(tmp, '\r'); + } + statustext = tmp; +#endif } - -#if !GTK_CHECK_VERSION(2,6,0) - if(tmp) { - char buf[32]; - char *c = tmp; - int length = 0, vis=0; - gboolean inside = FALSE; - g_strdelimit(tmp, "\n", ' '); - purple_str_strip_char(tmp, '\r'); - - while(*c && vis < 20) { - if(*c == '&') - inside = TRUE; - else if(*c == ';') - inside = FALSE; - if(!inside) - vis++; - c = g_utf8_next_char(c); /* this is fun */ - } - - length = c - tmp; - - if(vis == 20) - g_snprintf(buf, sizeof(buf), "%%.%ds...", length); - else - g_snprintf(buf, sizeof(buf), "%%s "); - - statustext = g_strdup_printf(buf, tmp); - - g_free(tmp); - } -#else - if(tmp) { - g_strdelimit(tmp, "\n", ' '); - purple_str_strip_char(tmp, '\r'); - } - statustext = tmp; -#endif - } - - if(!purple_presence_is_online(presence) && !statustext) - statustext = g_strdup(_("Offline")); - else if (!statustext) - text = g_strdup(esc); - - if (purple_presence_is_idle(presence)) { - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time")) { + + if(!purple_presence_is_online(presence) && !statustext) + statustext = g_strdup(_("Offline")); + + /* Idle Text */ + if (purple_presence_is_idle(presence) && purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time")) { time_t idle_secs = purple_presence_get_idle_time(presence); if (idle_secs > 0) { int iday, ihrs, imin; + time_t t; time(&t); iday = (t - idle_secs) / (24 * 60 * 60); ihrs = ((t - idle_secs) / 60 / 60) % 24; imin = ((t - idle_secs) / 60) % 60; - + if (iday) idletime = g_strdup_printf(_("Idle %dd %dh %02dm"), iday, ihrs, imin); else if (ihrs) idletime = g_strdup_printf(_("Idle %dh %02dm"), ihrs, imin); else idletime = g_strdup_printf(_("Idle %dm"), imin); - } - else - idletime = g_strdup(_("Idle")); - - if (!selected) { - g_free(text); - text = g_strdup_printf("<span color='%s'>%s</span>\n" - "<span color='%s' size='smaller'>%s%s%s</span>", - dim_grey(), esc, dim_grey(), - idletime != NULL ? idletime : "", - (idletime != NULL && statustext != NULL) ? " - " : "", - statustext != NULL ? statustext : ""); - } - - } else if (!selected && !statustext) {/* We handle selected text later */ - g_free(text); - text = g_strdup_printf("<span color='%s'>%s</span>", dim_grey(), esc); - } else if (!selected && !text) { - g_free(text); - text = g_strdup_printf("<span color='%s'>%s</span>\n" - "<span color='%s' size='smaller'>%s</span>", - dim_grey(), esc, dim_grey(), - statustext != NULL ? statustext : ""); + + } else idletime = g_strdup(_("Idle")); } - } else if (!PURPLE_BUDDY_IS_ONLINE(b)) { - if (!selected && !statustext) {/* We handle selected text later */ - g_free(text); - text = g_strdup_printf("<span color='%s'>%s</span>", dim_grey(), esc); - } else if (!selected && !text) - text = g_strdup_printf("<span color='%s'>%s</span>\n" - "<span color='%s' size='smaller'>%s</span>", - dim_grey(), esc, dim_grey(), - statustext != NULL ? statustext : ""); - - } - /* Not idle and not selected */ - else if (!selected && !text) - { - text = g_strdup_printf("%s\n" - "<span color='%s' size='smaller'>%s</span>", - esc, dim_grey(), - statustext != NULL ? statustext : ""); - } - - /* It is selected. */ - if ((selected && !text) || (selected && idletime)) { - g_free(text); - text = g_strdup_printf("%s\n" - "<span size='smaller'>%s%s%s</span>", - esc, - idletime != NULL ? idletime : "", - (idletime != NULL && statustext != NULL) ? " - " : "", - statustext != NULL ? statustext : ""); - } - - g_free(idletime); - g_free(statustext); - g_free(esc); + } + + /* choose the colors of the text */ + theme = pidgin_blist_get_theme(); + + if (theme == NULL) { + status_color = name_color = "dim grey"; + status_font = name_font = ""; + + } else if (purple_presence_is_idle(presence)) { + pair = pidgin_blist_theme_get_idle_text_info(theme); + status_color = name_color = (pair != NULL && pair->color != NULL) ? pair->color : "dim grey"; + status_font = name_font = (pair != NULL && pair->font != NULL) ? pair->font : ""; + + } else if (!purple_presence_is_online(presence)) { + pair = pidgin_blist_theme_get_offline_text_info(theme); + name_color = (pair != NULL && pair->color != NULL) ? pair->color : "black"; + name_font = (pair != NULL && pair->font != NULL) ? pair->font : ""; + + pair = pidgin_blist_theme_get_status_text_info(theme); + status_color = (pair != NULL && pair->color != NULL) ? g_strdup(pair->color) : "dim grey"; + status_font = (pair != NULL && pair->font != NULL) ? pair->font : ""; + + } else if (purple_presence_is_available(presence)) { + pair = pidgin_blist_theme_get_online_text_info(theme); + name_color = (pair != NULL && pair->color != NULL) ? g_strdup(pair->color) : "black"; + name_font = (pair != NULL && pair->font != NULL) ? pair->font : ""; + + pair = pidgin_blist_theme_get_status_text_info(theme); + status_color = (pair != NULL && pair->color != NULL) ? pair->color : "dim grey"; + status_font = (pair != NULL && pair->font != NULL) ? pair->font : ""; + + } else { + pair = pidgin_blist_theme_get_away_text_info(theme); + name_color = (pair != NULL && pair->color != NULL) ? pair->color : "black"; + name_font = (pair != NULL && pair->font != NULL) ? pair->font : ""; + + pair = pidgin_blist_theme_get_status_text_info(theme); + status_color = (pair != NULL && pair->color != NULL) ? pair->color : "dim grey"; + status_font = (pair != NULL && pair->font != NULL) ? pair->font : ""; + } + + if (selected) { + name_color = "black"; + status_color = "black"; + } + + /* Put it all together */ + if (biglist && (statustext || idletime)) { + text = g_strdup_printf("<span color='%s'>%s</span>\n<span size='smaller' color='%s'>%s%s%s</span>", + name_color, nametext, status_color, + idletime != NULL ? idletime : "", + (idletime != NULL && statustext != NULL) ? " - " : "", + statustext != NULL ? statustext : ""); + + } else text = g_strdup_printf("<span color='%s'>%s</span>", name_color, nametext); if (hidden_conv) { char *tmp = text; @@ -5240,22 +5225,17 @@ PidginBlistLayout *layout; PidginBlistTheme *theme; GtkCellRenderer *rend; - gint i; + gint i, status_icon = 0, text = 1, emblem = 2, protocol_icon = 3, buddy_icon = 4; + column = gtkblist->text_column; - if ((theme = pidgin_blist_get_theme()) != NULL) - layout = pidgin_blist_theme_get_layout(theme); - else { - /* Default Layout */ - layout = g_new0(PidginBlistLayout, 1); - - layout->status_icon = 0; - layout->text = 1; - layout->emblem = 2; - layout->protocol_icon = 3; - layout->buddy_icon = 4; - layout->show_status = 5; + if ((theme = pidgin_blist_get_theme()) != NULL && (layout = pidgin_blist_theme_get_layout(theme)) != NULL) { + status_icon = layout->status_icon ; + text = layout->text; + emblem = layout->emblem; + protocol_icon = layout->protocol_icon; + buddy_icon = layout->buddy_icon; } gtk_tree_view_column_clear(column); @@ -5276,17 +5256,17 @@ rend = pidgin_cell_renderer_expander_new(); gtk_tree_view_column_pack_start(column, rend, FALSE); gtk_tree_view_column_set_attributes(column, rend, + "visible", CONTACT_EXPANDER_VISIBLE_COLUMN, "expander-visible", CONTACT_EXPANDER_COLUMN, #if GTK_CHECK_VERSION(2,6,0) "sensitive", CONTACT_EXPANDER_COLUMN, "cell-background-gdk", BGCOLOR_COLUMN, -#endif - "visible", CONTACT_EXPANDER_VISIBLE_COLUMN, +#endif NULL); for (i = 0; i < 5; i++) { - if (layout->status_icon == i) { + if (status_icon == i) { /* status icons */ rend = gtk_cell_renderer_pixbuf_new(); gtk_tree_view_column_pack_start(column, rend, FALSE); @@ -5299,7 +5279,7 @@ NULL); g_object_set(rend, "xalign", 0.0, "xpad", 6, "ypad", 0, NULL); - } else if (layout->text == i) { + } else if (text == i) { /* name */ gtkblist->text_rend = rend = gtk_cell_renderer_text_new(); gtk_tree_view_column_pack_start (column, rend, TRUE); @@ -5330,7 +5310,7 @@ "cell-background-gdk", BGCOLOR_COLUMN, #endif NULL); - } else if (layout->emblem == i) { + } else if (emblem == i) { /* emblem */ rend = gtk_cell_renderer_pixbuf_new(); g_object_set(rend, "xalign", 1.0, "yalign", 0.5, "ypad", 0, "xpad", 3, NULL); @@ -5341,7 +5321,7 @@ #endif "visible", EMBLEM_VISIBLE_COLUMN, NULL); - } else if (layout->protocol_icon == i) { + } else if (protocol_icon == i) { /* protocol icon */ rend = gtk_cell_renderer_pixbuf_new(); gtk_tree_view_column_pack_start(column, rend, FALSE); @@ -5354,7 +5334,7 @@ NULL); g_object_set(rend, "xalign", 0.0, "xpad", 3, "ypad", 0, NULL); - } else if (layout->buddy_icon == i) { + } else if (buddy_icon == i) { /* buddy icon */ rend = gtk_cell_renderer_pixbuf_new(); g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL); @@ -5368,6 +5348,7 @@ } }/* end for loop */ + } static void pidgin_blist_show(PurpleBuddyList *list) @@ -6022,19 +6003,20 @@ gboolean expanded; GdkColor *bgcolor = NULL; GdkPixbuf *avatar = NULL; - PidginBlistTheme *theme; + PidginBlistTheme *theme = NULL; if(!insert_node(list, gnode, &iter)) return; - theme = pidgin_blist_get_theme(); - - if (theme == NULL) - bgcolor = &(gtkblist->treeview->style->bg[GTK_STATE_ACTIVE]); + if ((theme = pidgin_blist_get_theme()) == NULL) + bgcolor = NULL; else if (purple_blist_node_get_bool(gnode, "collapsed") || count <= 0) bgcolor = pidgin_blist_theme_get_collapsed_background_color(theme); else bgcolor = pidgin_blist_theme_get_expanded_background_color(theme); + if (bgcolor == NULL) + bgcolor = &(gtkblist->treeview->style->bg[GTK_STATE_ACTIVE]); + path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter); expanded = gtk_tree_view_row_expanded(GTK_TREE_VIEW(gtkblist->treeview), path); gtk_tree_path_free(path); @@ -6075,8 +6057,8 @@ PurpleBlistNode *selected_node = NULL; GtkTreeIter iter; FontColorPair *pair; + gchar *text_color, *text_font; PidginBlistTheme *theme; - const gchar *text_color, *text_font; group = (PurpleGroup*)gnode; @@ -6091,24 +6073,20 @@ purple_blist_get_group_online_count(group), purple_blist_get_group_size(group, FALSE)); } - + theme = pidgin_blist_get_theme(); - if (theme == NULL) { - text_color = "black"; - text_font = ""; - } else if (expanded) { - pair = pidgin_blist_theme_get_expanded_text_info(theme); - text_color = pair->color; - text_font = pair->font; - }else { - pair = pidgin_blist_theme_get_collapsed_text_info(theme); - text_color = pair->color; - text_font = pair->font; - } - + if (theme == NULL) + pair = NULL; + else if + (expanded) pair = pidgin_blist_theme_get_expanded_text_info(theme); + else pair = pidgin_blist_theme_get_collapsed_text_info(theme); + + + text_color = (pair == NULL || pair->color == NULL) ? "black" : pair->color; + text_font = (pair == NULL || pair->font == NULL) ? "" : pair->font; esc = g_markup_escape_text(group->name, -1); - mark = g_strdup_printf("<span foreground='%s' font_desc='%s'><span weight='bold'>%s</span>%s</span>", + mark = g_strdup_printf("<span foreground='%s' font_desc='%s'><b>%s</b>%s</span>", text_color, text_font, esc ? esc : "", group_count); g_free(esc); @@ -6117,14 +6095,15 @@ static void buddy_node(PurpleBuddy *buddy, GtkTreeIter *iter, PurpleBlistNode *node) { - PurplePresence *presence; + PurplePresence *presence = purple_buddy_get_presence(buddy); GdkPixbuf *status, *avatar, *emblem, *prpl_icon; + GdkColor *color = NULL; char *mark; char *idle = NULL; gboolean expanded = ((struct _pidgin_blist_node *)(node->parent->ui_data))->contact_expanded; gboolean selected = (gtkblist->selected_node == node); gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); - presence = purple_buddy_get_presence(buddy); + PidginBlistTheme *theme; if (editing_blist) return; @@ -6148,35 +6127,39 @@ emblem = pidgin_blist_get_emblem((PurpleBlistNode*) buddy); mark = pidgin_blist_get_name_markup(buddy, selected, TRUE); + theme = pidgin_blist_get_theme(); + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time") && - purple_presence_is_idle(presence) && - !purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons")) + purple_presence_is_idle(presence) && !biglist) { time_t idle_secs = purple_presence_get_idle_time(presence); if (idle_secs > 0) { + FontColorPair *pair = NULL; + const gchar *textcolor; time_t t; int ihrs, imin; time(&t); + ihrs = (t - idle_secs) / 3600; imin = ((t - idle_secs) / 60) % 60; - idle = g_strdup_printf("%d:%02d", ihrs, imin); - } - } - - if (purple_presence_is_idle(presence)) - { - if (idle && !selected) { - char *i2 = g_strdup_printf("<span color='%s'>%s</span>", - dim_grey(), idle); - g_free(idle); - idle = i2; + + if (selected) textcolor = "dim grey"; + else if (theme != NULL && (pair = pidgin_blist_theme_get_idle_text_info(theme)) != NULL && pair->color != NULL) + textcolor = pair->color; + else textcolor = "black"; + + idle = g_strdup_printf("<span color='%s' font_desc='%s'>%d:%02d</span>", + textcolor, (pair == NULL || pair->font == NULL) ? "" : pair->color, ihrs, imin); } } prpl_icon = pidgin_create_prpl_icon(buddy->account, PIDGIN_PRPL_ICON_SMALL); + if (theme != NULL) + color = pidgin_blist_theme_get_contact_color(theme); + gtk_tree_store_set(gtkblist->treemodel, iter, STATUS_ICON_COLUMN, status, STATUS_ICON_VISIBLE_COLUMN, TRUE, @@ -6189,7 +6172,7 @@ EMBLEM_VISIBLE_COLUMN, (emblem != NULL), PROTOCOL_ICON_COLUMN, prpl_icon, PROTOCOL_ICON_VISIBLE_COLUMN, purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons"), - BGCOLOR_COLUMN, NULL, + BGCOLOR_COLUMN, color, CONTACT_EXPANDER_COLUMN, NULL, CONTACT_EXPANDER_VISIBLE_COLUMN, expanded, GROUP_EXPANDER_VISIBLE_COLUMN, FALSE, @@ -6247,19 +6230,36 @@ if(gtknode->contact_expanded) { GdkPixbuf *status; - char *mark; + gchar *mark; + GdkColor *color = NULL; + PidginBlistTheme *theme = pidgin_blist_get_theme(); + + mark = g_markup_escape_text(purple_contact_get_alias(contact), -1); + + if (theme != NULL) { + FontColorPair *pair = pidgin_blist_theme_get_contact_text_info(theme); + color = pidgin_blist_theme_get_contact_color(theme); + + if (pair != NULL) { + gchar *temp = g_strdup_printf("<span font_desc='%s' foreground='%s'>%s</span>", + (pair->font == NULL) ? "" : pair->font, + (pair->color == NULL) ? "black" : pair->color, mark); + + g_free(mark); + mark = temp; + } + } status = pidgin_blist_get_status_icon(cnode, biglist? PIDGIN_STATUS_ICON_LARGE : PIDGIN_STATUS_ICON_SMALL); - - mark = g_markup_escape_text(purple_contact_get_alias(contact), -1); + gtk_tree_store_set(gtkblist->treemodel, &iter, STATUS_ICON_COLUMN, status, STATUS_ICON_VISIBLE_COLUMN, TRUE, NAME_COLUMN, mark, IDLE_COLUMN, NULL, IDLE_VISIBLE_COLUMN, FALSE, - BGCOLOR_COLUMN, NULL, + BGCOLOR_COLUMN, color, BUDDY_ICON_COLUMN, NULL, CONTACT_EXPANDER_COLUMN, TRUE, CONTACT_EXPANDER_VISIBLE_COLUMN, TRUE, @@ -6327,12 +6327,15 @@ if(purple_account_is_connected(chat->account)) { GtkTreeIter iter; GdkPixbuf *status, *avatar, *emblem, *prpl_icon; - char *mark; + gchar *mark, *color, *font, *tmp; gboolean showicons = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); PidginBlistNode *ui; PurpleConversation *conv; gboolean hidden; + GdkColor *bgcolor = NULL; + FontColorPair *pair; + PidginBlistTheme *theme; if (!insert_node(list, node, &iter)) return; @@ -6352,14 +6355,31 @@ else avatar = NULL; - mark = g_markup_escape_text(purple_chat_get_name(chat), -1); - if (hidden) { - char *bold = g_strdup_printf("<b>%s</b>", mark); - g_free(mark); - mark = bold; - } + mark = g_markup_escape_text(purple_chat_get_name(chat), -1); + + theme = pidgin_blist_get_theme(); + + if (theme == NULL) + pair = NULL; + else if (hidden) + pair = pidgin_blist_theme_get_unread_message_text_info(theme); + else pair = pidgin_blist_theme_get_online_text_info(theme); + + font = (pair == NULL || pair->font == NULL) ? "" : g_strdup(pair->font); + color = (pair == NULL || pair->color == NULL) ? "black" : g_strdup(pair->color); + + tmp = g_strdup_printf("<span font_desc='%s' color='%s' weight='%s'>%s</span>", + font, color, hidden ? "bold" : "normal", mark); + + g_free(font); + g_free(color); + g_free(mark); + mark = tmp; prpl_icon = pidgin_create_prpl_icon(chat->account, PIDGIN_PRPL_ICON_SMALL); + + if (theme != NULL) + bgcolor = pidgin_blist_theme_get_contact_color(theme); gtk_tree_store_set(gtkblist->treemodel, &iter, STATUS_ICON_COLUMN, status, @@ -6371,6 +6391,7 @@ PROTOCOL_ICON_COLUMN, prpl_icon, PROTOCOL_ICON_VISIBLE_COLUMN, purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons"), NAME_COLUMN, mark, + BGCOLOR_COLUMN, bgcolor, GROUP_EXPANDER_VISIBLE_COLUMN, FALSE, -1);