comparison pidgin/gtkblist.c @ 19899:25f4be036a16

Make changes in the buddylist menutray icon for hidden conversations to work with the new system.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 05 Sep 2007 12:52:48 +0000
parents 1fe1ac03e1fe
children ee5b3ac0d41d
comparison
equal deleted inserted replaced
19898:be8bb6f98c01 19899:25f4be036a16
3750 GString *tooltip_text = NULL; 3750 GString *tooltip_text = NULL;
3751 3751
3752 tooltip_text = g_string_new(""); 3752 tooltip_text = g_string_new("");
3753 l = convs; 3753 l = convs;
3754 while (l != NULL) { 3754 while (l != NULL) {
3755 if (PIDGIN_IS_PIDGIN_CONVERSATION(l->data)) { 3755 int count = GPOINTER_TO_INT(purple_conversation_get_data(l->data, "unseen-count")) + 1;
3756 PidginConversation *gtkconv = PIDGIN_CONVERSATION((PurpleConversation *)l->data); 3756 g_string_append_printf(tooltip_text,
3757 3757 ngettext("%d unread message from %s\n", "%d unread messages from %s\n", count),
3758 g_string_append_printf(tooltip_text, 3758 count, purple_conversation_get_name(l->data));
3759 ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count),
3760 gtkconv->unseen_count,
3761 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)));
3762 }
3763 l = l->next; 3759 l = l->next;
3764 } 3760 }
3765 if(tooltip_text->len > 0) { 3761 if(tooltip_text->len > 0) {
3766 /* get rid of the last newline */ 3762 /* get rid of the last newline */
3767 g_string_truncate(tooltip_text, tooltip_text->len -1); 3763 g_string_truncate(tooltip_text, tooltip_text->len -1);
3805 if (ui->conv.conv != conv || PIDGIN_CONVERSATION(conv)) 3801 if (ui->conv.conv != conv || PIDGIN_CONVERSATION(conv))
3806 return; 3802 return;
3807 ui->conv.flags |= PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE; 3803 ui->conv.flags |= PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE;
3808 ui->conv.last_message = time(NULL); /* XXX: for lack of better data */ 3804 ui->conv.last_message = time(NULL); /* XXX: for lack of better data */
3809 pidgin_blist_update(purple_get_blist(), node); 3805 pidgin_blist_update(purple_get_blist(), node);
3806 purple_conversation_set_data(conv, "unseen-count",
3807 GINT_TO_POINTER(GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count")) + 1));
3810 } 3808 }
3811 3809
3812 static void 3810 static void
3813 displayed_msg_update_ui_cb(PurpleAccount *account, const char *who, const char *message, 3811 displayed_msg_update_ui_cb(PurpleAccount *account, const char *who, const char *message,
3814 PurpleConversation *conv, PurpleMessageFlags flag, PurpleBlistNode *node) 3812 PurpleConversation *conv, PurpleMessageFlags flag, PurpleBlistNode *node)
3816 PidginBlistNode *ui = node->ui_data; 3814 PidginBlistNode *ui = node->ui_data;
3817 if (ui->conv.conv != conv) 3815 if (ui->conv.conv != conv)
3818 return; 3816 return;
3819 ui->conv.flags &= ~PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE; 3817 ui->conv.flags &= ~PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE;
3820 pidgin_blist_update(purple_get_blist(), node); 3818 pidgin_blist_update(purple_get_blist(), node);
3819 purple_conversation_set_data(conv, "unseen-count", 0);
3821 } 3820 }
3822 3821
3823 static void 3822 static void
3824 conversation_created_cb(PurpleConversation *conv, PidginBuddyList *gtkblist) 3823 conversation_created_cb(PurpleConversation *conv, PidginBuddyList *gtkblist)
3825 { 3824 {