diff options
author | Sadrul Habib Chowdhury <sadrul@pidgin.im> | 2007-06-15 03:36:54 +0000 |
---|---|---|
committer | Sadrul Habib Chowdhury <sadrul@pidgin.im> | 2007-06-15 03:36:54 +0000 |
commit | 980e7b67c3f5befa4375aba9709c267375f6bc06 (patch) | |
tree | c720dadefaebc61627432cae17236713d7c0dd58 | |
parent | 75c9c3ccf2fff10e2996557126c00496e7a8b78c (diff) | |
download | pidgin-980e7b67c3f5befa4375aba9709c267375f6bc06.tar.gz |
Provide a 'unseen-count' data for the conversations so the dbus-docklet can use that information.
-rw-r--r-- | finch/gntconv.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/finch/gntconv.c b/finch/gntconv.c index fb036b8cd6..c6ed24d0e8 100644 --- a/finch/gntconv.c +++ b/finch/gntconv.c @@ -440,6 +440,16 @@ create_conv_from_userlist(GntWidget *widget, FinchConv *fc) } 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 @@ finch_create_conversation(PurpleConversation *conv) 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 @@ finch_write_common(PurpleConversation *conv, const char *who, const char *messag 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 |