comparison pidgin/gtkblist.c @ 25389:dc2584ebaa1a

Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick. Parenthesized a bunch of truth statements in gtkblist-theme-loader to clarify what it is doing. Also s/sucess/success/g (if anyone feels like it, there is also a variable named sucess in gtkprefs.c and a misspelled 'sucessful' in gtksourceundomanager.c). Oh, and I guess I also tested that the patch works properly :) refs #7760 committer: Gary Kramlich <grim@reaperworld.com>
author Paul Aurich <paul@darkrain42.org>
date Tue, 06 Jan 2009 03:54:50 +0000
parents 6c6846d169d6
children 94a6eb10c691
comparison
equal deleted inserted replaced
25388:44ce467babaf 25389:dc2584ebaa1a
169 static char *pidgin_get_group_title(PurpleBlistNode *gnode, gboolean expanded); 169 static char *pidgin_get_group_title(PurpleBlistNode *gnode, gboolean expanded);
170 static void pidgin_blist_expand_contact_cb(GtkWidget *w, PurpleBlistNode *node); 170 static void pidgin_blist_expand_contact_cb(GtkWidget *w, PurpleBlistNode *node);
171 static void set_urgent(void); 171 static void set_urgent(void);
172 172
173 typedef enum { 173 typedef enum {
174 PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE = 1 << 0, /* Whether there's pending message in a conversation */ 174 PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE = 1 << 0, /* Whether there's pending message in a conversation */
175 PIDGIN_BLIST_CHAT_HAS_PENDING_MESSAGE_WITH_NICK = 1 << 1, /* Whether there's a pending message in a chat that mentions our nick */
175 } PidginBlistNodeFlags; 176 } PidginBlistNodeFlags;
176 177
177 typedef struct _pidgin_blist_node { 178 typedef struct _pidgin_blist_node {
178 GtkTreeRowReference *row; 179 GtkTreeRowReference *row;
179 gboolean contact_expanded; 180 gboolean contact_expanded;
4362 PidginBlistNode *ui = node->ui_data; 4363 PidginBlistNode *ui = node->ui_data;
4363 if (ui->conv.conv != conv || !pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv)) || 4364 if (ui->conv.conv != conv || !pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv)) ||
4364 !(flag & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV))) 4365 !(flag & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)))
4365 return; 4366 return;
4366 ui->conv.flags |= PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE; 4367 ui->conv.flags |= PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE;
4368 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT
4369 && (flag & PURPLE_MESSAGE_NICK))
4370 ui->conv.flags |= PIDGIN_BLIST_CHAT_HAS_PENDING_MESSAGE_WITH_NICK;
4371
4367 ui->conv.last_message = time(NULL); /* XXX: for lack of better data */ 4372 ui->conv.last_message = time(NULL); /* XXX: for lack of better data */
4368 pidgin_blist_update(purple_get_blist(), node); 4373 pidgin_blist_update(purple_get_blist(), node);
4369 } 4374 }
4370 4375
4371 static void 4376 static void
4372 displayed_msg_update_ui_cb(PidginConversation *gtkconv, PurpleBlistNode *node) 4377 displayed_msg_update_ui_cb(PidginConversation *gtkconv, PurpleBlistNode *node)
4373 { 4378 {
4374 PidginBlistNode *ui = node->ui_data; 4379 PidginBlistNode *ui = node->ui_data;
4375 if (ui->conv.conv != gtkconv->active_conv) 4380 if (ui->conv.conv != gtkconv->active_conv)
4376 return; 4381 return;
4377 ui->conv.flags &= ~PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE; 4382 ui->conv.flags &= ~(PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE |
4383 PIDGIN_BLIST_CHAT_HAS_PENDING_MESSAGE_WITH_NICK);
4378 pidgin_blist_update(purple_get_blist(), node); 4384 pidgin_blist_update(purple_get_blist(), node);
4379 } 4385 }
4380 4386
4381 static void 4387 static void
4382 conversation_created_cb(PurpleConversation *conv, PidginBuddyList *gtkblist) 4388 conversation_created_cb(PurpleConversation *conv, PidginBuddyList *gtkblist)
6400 chat = (PurpleChat*)node; 6406 chat = (PurpleChat*)node;
6401 6407
6402 if(purple_account_is_connected(chat->account)) { 6408 if(purple_account_is_connected(chat->account)) {
6403 GtkTreeIter iter; 6409 GtkTreeIter iter;
6404 GdkPixbuf *status, *avatar, *emblem, *prpl_icon; 6410 GdkPixbuf *status, *avatar, *emblem, *prpl_icon;
6405 gchar *mark, *color, *font, *tmp; 6411 const gchar *color, *font;
6412 gchar *mark, *tmp;
6406 gboolean showicons = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); 6413 gboolean showicons = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons");
6407 gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); 6414 gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons");
6408 PidginBlistNode *ui; 6415 PidginBlistNode *ui;
6409 PurpleConversation *conv; 6416 PurpleConversation *conv;
6410 gboolean hidden; 6417 gboolean hidden;
6411 GdkColor *bgcolor = NULL; 6418 GdkColor *bgcolor = NULL;
6412 FontColorPair *pair; 6419 FontColorPair *pair;
6413 PidginBlistTheme *theme; 6420 PidginBlistTheme *theme;
6414 gboolean selected = (gtkblist->selected_node == node); 6421 gboolean selected = (gtkblist->selected_node == node);
6422 gboolean nick_said = FALSE;
6415 6423
6416 if (!insert_node(list, node, &iter)) 6424 if (!insert_node(list, node, &iter))
6417 return; 6425 return;
6418 6426
6419 ui = node->ui_data; 6427 ui = node->ui_data;
6420 conv = ui->conv.conv; 6428 conv = ui->conv.conv;
6421 hidden = (conv && (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE) && 6429 if (conv && pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv))) {
6422 pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv))); 6430 hidden = (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE);
6431 nick_said = (ui->conv.flags & PIDGIN_BLIST_CHAT_HAS_PENDING_MESSAGE_WITH_NICK);
6432 }
6423 6433
6424 status = pidgin_blist_get_status_icon(node, 6434 status = pidgin_blist_get_status_icon(node,
6425 biglist ? PIDGIN_STATUS_ICON_LARGE : PIDGIN_STATUS_ICON_SMALL); 6435 biglist ? PIDGIN_STATUS_ICON_LARGE : PIDGIN_STATUS_ICON_SMALL);
6426 emblem = pidgin_blist_get_emblem(node); 6436 emblem = pidgin_blist_get_emblem(node);
6427 6437
6435 6445
6436 theme = pidgin_blist_get_theme(); 6446 theme = pidgin_blist_get_theme();
6437 6447
6438 if (theme == NULL) 6448 if (theme == NULL)
6439 pair = NULL; 6449 pair = NULL;
6450 else if (nick_said)
6451 pair = pidgin_blist_theme_get_unread_message_nick_said_text_info(theme);
6440 else if (hidden) 6452 else if (hidden)
6441 pair = pidgin_blist_theme_get_unread_message_text_info(theme); 6453 pair = pidgin_blist_theme_get_unread_message_text_info(theme);
6442 else pair = pidgin_blist_theme_get_online_text_info(theme); 6454 else pair = pidgin_blist_theme_get_online_text_info(theme);
6443 6455
6456
6444 font = (pair == NULL || pair->font == NULL) ? "" : pair->font; 6457 font = (pair == NULL || pair->font == NULL) ? "" : pair->font;
6445 color = (selected || pair == NULL || pair->color == NULL) ? "black" : pair->color; 6458 if (selected || pair == NULL || pair->color == NULL)
6459 /* nick_said color is the same as gtkconv:tab-label-attention */
6460 color = (nick_said ? "#006aff" : "black");
6461 else
6462 color = pair->color;
6446 6463
6447 tmp = g_strdup_printf("<span font_desc='%s' color='%s' weight='%s'>%s</span>", 6464 tmp = g_strdup_printf("<span font_desc='%s' color='%s' weight='%s'>%s</span>",
6448 font, color, hidden ? "bold" : "normal", mark); 6465 font, color, hidden ? "bold" : "normal", mark);
6449 6466
6450 g_free(mark); 6467 g_free(mark);