Mercurial > pidgin
changeset 18100:f63b3a23280d
Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Fri, 15 Jun 2007 03:36:54 +0000 |
parents | 7be04c20bf22 |
children | 5cff2b8bfb08 |
files | finch/gntconv.c |
diffstat | 1 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/finch/gntconv.c Fri Jun 15 02:36:53 2007 +0000 +++ b/finch/gntconv.c Fri Jun 15 03:36:54 2007 +0000 @@ -440,6 +440,16 @@ } static void +gained_focus_cb(GntWindow *window, FinchConv *fc) +{ + GList *iter; + for (iter = fc->list; iter; iter = iter->next) { + purple_conversation_set_data(iter->data, "unseen-count", 0); + purple_conversation_update(iter->data, PURPLE_CONV_UPDATE_UNSEEN); + } +} + +static void finch_create_conversation(PurpleConversation *conv) { FinchConv *ggc = conv->ui_data; @@ -529,6 +539,7 @@ g_free(title); gnt_box_give_focus_to_child(GNT_BOX(ggc->window), ggc->entry); + g_signal_connect(G_OBJECT(ggc->window), "gained-focus", G_CALLBACK(gained_focus_cb), ggc); } static void @@ -622,6 +633,11 @@ if (flags & (PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_NICK | PURPLE_MESSAGE_ERROR)) gnt_widget_set_urgent(ggconv->tv); + if (flags & PURPLE_MESSAGE_RECV && !gnt_widget_has_focus(ggconv->window)) { + int count = GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count")); + purple_conversation_set_data(conv, "unseen-count", GINT_TO_POINTER(count + 1)); + purple_conversation_update(conv, PURPLE_CONV_UPDATE_UNSEEN); + } } static void