Mercurial > pidgin
changeset 11664:38bbb0f15453
[gaim-migrate @ 13949]
"This patch updates the colors of the tabs correctly. I
have removed the tab-highlighting stuff from the core
to the UI." Sadrul Habib Chowdhury
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Fri, 14 Oct 2005 11:30:37 +0000 |
parents | 03db7f366ae1 |
children | 2350fe2bef87 |
files | src/conversation.c src/conversation.h src/gtkconv.c src/gtkconv.h |
diffstat | 4 files changed, 56 insertions(+), 105 deletions(-) [+] |
line wrap: on
line diff
--- a/src/conversation.c Fri Oct 14 10:53:32 2005 +0000 +++ b/src/conversation.c Fri Oct 14 11:30:37 2005 +0000 @@ -671,16 +671,6 @@ } void -gaim_conversation_set_unseen(GaimConversation *conv, GaimUnseenState state) -{ - g_return_if_fail(conv != NULL); - - conv->unseen = state; - - gaim_conversation_update(conv, GAIM_CONV_UPDATE_UNSEEN); -} - -void gaim_conversation_foreach(void (*func)(GaimConversation *conv)) { GaimConversation *conv; @@ -695,14 +685,6 @@ } } -GaimUnseenState -gaim_conversation_get_unseen(const GaimConversation *conv) -{ - g_return_val_if_fail(conv != NULL, 0); - - return conv->unseen; -} - void gaim_conversation_set_name(GaimConversation *conv, const char *name) { @@ -854,7 +836,6 @@ GaimConversationUiOps *ops; const char *alias; GaimBuddy *b; - GaimUnseenState unseen; /* int logging_font_options = 0; */ g_return_if_fail(conv != NULL); @@ -922,28 +903,12 @@ ops->write_conv(conv, who, alias, message, flags, mtime); - /* Tab highlighting */ - if (!(flags & GAIM_MESSAGE_RECV) && !(flags & GAIM_MESSAGE_SYSTEM) && !(flags & GAIM_MESSAGE_ERROR)) - return; - if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { - if ((flags & GAIM_MESSAGE_RECV) == GAIM_MESSAGE_RECV) + if ((flags & GAIM_MESSAGE_RECV) == GAIM_MESSAGE_RECV) { gaim_conv_im_set_typing_state(GAIM_CONV_IM(conv), GAIM_NOT_TYPING); + gaim_conversation_update(conv, GAIM_CONV_UPDATE_TITLE); + } } - - { - if ((flags & GAIM_MESSAGE_NICK) == GAIM_MESSAGE_NICK || - gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) - unseen = GAIM_UNSEEN_NICK; - else if ((((flags & GAIM_MESSAGE_SYSTEM) == GAIM_MESSAGE_SYSTEM) || - ((flags & GAIM_MESSAGE_ERROR) == GAIM_MESSAGE_ERROR)) && - gaim_conversation_get_unseen(conv) != GAIM_UNSEEN_TEXT) - unseen = GAIM_UNSEEN_EVENT; - else - unseen = GAIM_UNSEEN_TEXT; - } - - gaim_conversation_set_unseen(conv, unseen); } gboolean
--- a/src/conversation.h Fri Oct 14 10:53:32 2005 +0000 +++ b/src/conversation.h Fri Oct 14 11:30:37 2005 +0000 @@ -52,18 +52,6 @@ } GaimConversationType; /** - * Unseen text states. - */ -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. */ - -} GaimUnseenState; - -/** * Conversation update type. */ typedef enum @@ -246,8 +234,6 @@ GList *send_history; /**< The send history. */ - GaimUnseenState unseen; /**< The unseen tab state. */ - union { GaimConvIm *im; /**< IM-specific data. */ @@ -397,24 +383,6 @@ void gaim_conversation_autoset_title(GaimConversation *conv); /** - * Sets the conversation's unseen state. - * - * @param conv The conversation. - * @param state The new unseen state. - */ -void gaim_conversation_set_unseen(GaimConversation *conv, - GaimUnseenState state); - -/** - * Returns the conversation's unseen state. - * - * @param conv The conversation. - * - * @return The conversation's unseen state. - */ -GaimUnseenState gaim_conversation_get_unseen(const GaimConversation *conv); - -/** * Sets the specified conversation's name. * * @param conv The conversation.
--- a/src/gtkconv.c Fri Oct 14 10:53:32 2005 +0000 +++ b/src/gtkconv.c Fri Oct 14 11:30:37 2005 +0000 @@ -127,6 +127,7 @@ static void gtkconv_set_unseen(GaimGtkConversation *gtkconv, GaimUnseenState state); static void update_typing_icon(GaimGtkConversation *gtkconv); static char *item_factory_translate_func (const char *path, gpointer func_data); +gboolean gaim_gtkconv_has_focus(GaimConversation *conv); static GdkColor *get_nick_color(GaimGtkConversation *gtkconv, const char *name) { static GdkColor col; @@ -1601,7 +1602,6 @@ { GaimGtkConversation *next_gtkconv = NULL; GaimGtkWindow *win; - GList *l; int index, i, total, found = 0; win = gtkconv->win; @@ -1615,14 +1615,9 @@ if (i == -1) { break; } - for (l = next_gtkconv->convs; l; l = forward ? l->next : l->prev) { - GaimConversation *c = l->data; - if (gaim_conversation_get_unseen(c) > 0) - { - found = 1; - break; - } - } + + if (next_gtkconv->unseen_state > 0) + found = 1; } if (!found) { @@ -1631,13 +1626,9 @@ !found && (forward ? i < index : i >= 0) && (next_gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(win, i)); forward ? i++ : i--) { - for (l = next_gtkconv->convs; l; l = forward ? l->next : l->prev) { - GaimConversation *c = l->data; - if (gaim_conversation_get_unseen(c) > 0) { - found = 1; - break; - } - } + + if (next_gtkconv->unseen_state > 0) + found = 1; } if (!found) { @@ -4261,6 +4252,24 @@ if(sml_attrib) g_free(sml_attrib); + + /* Tab highlighting stuff */ + if (!gaim_gtkconv_has_focus(conv)) + { + GaimUnseenState unseen = GAIM_UNSEEN_NONE; + + if ((flags & GAIM_MESSAGE_NICK) == GAIM_MESSAGE_NICK || + gtkconv->unseen_state == GAIM_UNSEEN_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) + unseen = GAIM_UNSEEN_EVENT; + else + unseen = GAIM_UNSEEN_TEXT; + + gtkconv_set_unseen(gtkconv, unseen); + } } static void @@ -4914,15 +4923,15 @@ { strcpy(color, "#D1940C"); } - else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) + else if (gtkconv->unseen_state == GAIM_UNSEEN_NICK) { strcpy(color, "#0D4E91"); } - else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) + else if (gtkconv->unseen_state == GAIM_UNSEEN_TEXT) { strcpy(color, "#DF421E"); } - else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_EVENT) + else if (gtkconv->unseen_state == GAIM_UNSEEN_EVENT) { strcpy(color, "#868272"); } @@ -5662,24 +5671,20 @@ close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) { GaimGtkWindow *win = d; - GList *l, *j; + GList *l; /* If there are unread messages then show a warning dialog */ for (l = gaim_gtk_conv_window_get_gtkconvs(win); l != NULL; l = l->next) { GaimGtkConversation *gtkconv = l->data; - - for (j = gtkconv->convs; j != NULL; j = j->next) { - GaimConversation *conv = j->data; - if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM && - gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) - { - build_warn_close_dialog(win); - gtk_widget_show_all(warn_close_dialog); - - return TRUE; - } + if (gaim_conversation_get_type(gtkconv->active_conv) == GAIM_CONV_TYPE_IM && + gtkconv->unseen_state == GAIM_UNSEEN_TEXT) + { + build_warn_close_dialog(win); + gtk_widget_show_all(warn_close_dialog); + + return TRUE; } } @@ -5691,10 +5696,9 @@ static void gtkconv_set_unseen(GaimGtkConversation *gtkconv, GaimUnseenState state) { - GList *l; - - for (l = gtkconv->convs; l != NULL; l = l->next) - gaim_conversation_set_unseen(l->data, state); + gtkconv->unseen_state = state; + + gaim_gtkconv_updated(gtkconv->active_conv, GAIM_CONV_UPDATE_UNSEEN); } /* * When a conversation window is focused, we know the user
--- a/src/gtkconv.h Fri Oct 14 10:53:32 2005 +0000 +++ b/src/gtkconv.h Fri Oct 14 11:30:37 2005 +0000 @@ -29,6 +29,18 @@ typedef struct _GaimGtkChatPane GaimGtkChatPane; typedef struct _GaimGtkConversation GaimGtkConversation; +/** + * Unseen text states. + */ +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. */ + +} GaimUnseenState; + enum { CHAT_USERS_ICON_COLUMN, CHAT_USERS_ALIAS_COLUMN, @@ -132,6 +144,8 @@ GtkWidget *toolbar; + GaimUnseenState unseen_state; + struct { GtkWidget *image;