Mercurial > pidgin
changeset 12021:1a86417abfc8
[gaim-migrate @ 14314]
Yet another patch from charkins related to the docklet. This one prevents the docklet's unseen msg notification from kicking in for non-logged text (e.g. notification of file transfer, etc).
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Wed, 09 Nov 2005 03:55:20 +0000 |
parents | 440d9354b67f |
children | 9d562dde0a3a |
files | plugins/ChangeLog.API plugins/docklet/docklet.c src/gtkconv.c src/gtkconv.h |
diffstat | 4 files changed, 59 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/ChangeLog.API Wed Nov 09 03:09:55 2005 +0000 +++ b/plugins/ChangeLog.API Wed Nov 09 03:55:20 2005 +0000 @@ -141,6 +141,8 @@ visibility manager - see the docs for more information * gaim_gtk_blist_visibility_manager_remove() to indicate the removal of a visibility manager - see the docs for more information + * gaim_gtk_conversations_get_first_unseen() to find the first conv + with an "unseen" state >= to the specified state Signals - Changed: * "received-im-msg" and "received-chat-msg" to match, both now pass a
--- a/plugins/docklet/docklet.c Wed Nov 09 03:09:55 2005 +0000 +++ b/plugins/docklet/docklet.c Wed Nov 09 03:55:20 2005 +0000 @@ -95,15 +95,8 @@ gboolean pending = FALSE; /* determine if any ims have unseen messages */ - for(l = gaim_get_ims(); l!=NULL; l=l->next) { - GaimConversation *conv = (GaimConversation*)l->data; - if(GAIM_IS_GTK_CONVERSATION(conv)) { - if(GAIM_GTK_CONVERSATION(conv)->unseen_state!=GAIM_UNSEEN_NONE) { - pending = TRUE; - break; - } - } - } + if(gaim_gtk_conversations_get_first_unseen(GAIM_CONV_TYPE_IM, GAIM_UNSEEN_TEXT)) + pending = TRUE; /* iterate through all accounts and determine which * status to show in the tray icon based on the following
--- a/src/gtkconv.c Wed Nov 09 03:09:55 2005 +0000 +++ b/src/gtkconv.c Wed Nov 09 03:55:20 2005 +0000 @@ -2355,6 +2355,31 @@ /************************************************************************** * End of the bunch of buddy icon functions **************************************************************************/ +GaimConversation * +gaim_gtk_conversations_get_first_unseen(GaimConversationType type, + GaimUnseenState min_state) +{ + GList *l; + + if(type==GAIM_CONV_TYPE_IM) { + l = gaim_get_ims(); + } else if(type==GAIM_CONV_TYPE_CHAT) { + l = gaim_get_chats(); + } else { + l = gaim_get_conversations(); + } + + for(; l!=NULL; l=l->next) { + GaimConversation *conv = (GaimConversation*)l->data; + if(GAIM_IS_GTK_CONVERSATION(conv)) { + if(GAIM_GTK_CONVERSATION(conv)->unseen_state>=min_state) { + return conv; + } + } + } + + return NULL; +} GaimGtkWindow * gaim_gtkconv_get_window(GaimGtkConversation *gtkconv) @@ -4335,13 +4360,13 @@ { GaimUnseenState unseen = GAIM_UNSEEN_NONE; - if ((flags & GAIM_MESSAGE_NICK) == GAIM_MESSAGE_NICK || - gtkconv->unseen_state == GAIM_UNSEEN_NICK) + if ((flags & GAIM_MESSAGE_NICK) == GAIM_MESSAGE_NICK) unseen = GAIM_UNSEEN_NICK; - else if ((((flags & GAIM_MESSAGE_SYSTEM) == GAIM_MESSAGE_SYSTEM) || - ((flags & GAIM_MESSAGE_ERROR) == GAIM_MESSAGE_ERROR)) && - gtkconv->unseen_state != GAIM_UNSEEN_TEXT) + else if (((flags & GAIM_MESSAGE_SYSTEM) == GAIM_MESSAGE_SYSTEM) || + ((flags & GAIM_MESSAGE_ERROR) == GAIM_MESSAGE_ERROR)) unseen = GAIM_UNSEEN_EVENT; + else if ((flags & GAIM_MESSAGE_NO_LOG) == GAIM_MESSAGE_NO_LOG) + unseen = GAIM_UNSEEN_NOLOG; else unseen = GAIM_UNSEEN_TEXT; @@ -5816,10 +5841,14 @@ static void gtkconv_set_unseen(GaimGtkConversation *gtkconv, GaimUnseenState state) { - gtkconv->unseen_state = state; - - gaim_conversation_update(gtkconv->active_conv, GAIM_CONV_UPDATE_UNSEEN); -} + /* only allow NONE or higher priority unseen state */ + if((state==GAIM_UNSEEN_NONE && gtkconv->unseen_state!=GAIM_UNSEEN_NONE) + || state > gtkconv->unseen_state) { + gtkconv->unseen_state = state; + gaim_conversation_update(gtkconv->active_conv, GAIM_CONV_UPDATE_UNSEEN); + } +} + /* * When a conversation window is focused, we know the user * has looked at it so we know there are no longer unseen
--- a/src/gtkconv.h Wed Nov 09 03:09:55 2005 +0000 +++ b/src/gtkconv.h Wed Nov 09 03:55:20 2005 +0000 @@ -34,11 +34,11 @@ */ typedef enum { - GAIM_UNSEEN_NONE = 0, /**< No unseen text in the conversation. */ - GAIM_UNSEEN_TEXT, /**< Unseen text in the conversation. */ - GAIM_UNSEEN_NICK, /**< Unseen text and the nick was said. */ - GAIM_UNSEEN_EVENT /**< Unseen events in the conversation. */ - + GAIM_UNSEEN_NONE = 0, /**< No unseen text in the conversation. */ + GAIM_UNSEEN_EVENT = 1, /**< Unseen events in the conversation. */ + GAIM_UNSEEN_NOLOG = 2, /**< Unseen text with NO_LOG flag. */ + GAIM_UNSEEN_TEXT = 3, /**< Unseen text in the conversation. */ + GAIM_UNSEEN_NICK = 4 /**< Unseen text and the nick was said. */ } GaimUnseenState; enum { @@ -200,6 +200,18 @@ */ void gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv); +/** + * Finds the first conversation of the given type which has an unseen + * state greater than or equal to the specified minimum state. + * + * @param type The type of conversation. + * @param min_state The minimum unseen state. + * @return First conversation matching criteria, or NULL. + */ +GaimConversation * +gaim_gtk_conversations_get_first_unseen(GaimConversationType type, + GaimUnseenState min_state); + GaimGtkWindow *gaim_gtkconv_get_window(GaimGtkConversation *gtkconv); GdkPixbuf *gaim_gtkconv_get_tab_icon(GaimConversation *conv, gboolean small_icon); void gaim_gtkconv_new(GaimConversation *conv);