Mercurial > pidgin.yaz
changeset 14747:091b6ce6372e
[gaim-migrate @ 17504]
Don't exclude the current popular status from the popular statuses list.
Also, fix selecting a saved status that doesn't apply to the token status account.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Wed, 18 Oct 2006 00:54:57 +0000 |
parents | 54ce6f592b01 |
children | 95246f6b6414 |
files | gtk/gtkstatusbox.c libgaim/savedstatuses.c |
diffstat | 2 files changed, 34 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/gtk/gtkstatusbox.c Tue Oct 17 21:47:48 2006 +0000 +++ b/gtk/gtkstatusbox.c Wed Oct 18 00:54:57 2006 +0000 @@ -687,15 +687,13 @@ * dropdown using a loop. Otherwise select from the default list. */ primitive = gaim_savedstatus_get_type(saved_status); - if (!status_box->token_status_account) + if (!status_box->token_status_account && gaim_savedstatus_is_transient(saved_status) && + ((primitive == GAIM_STATUS_AVAILABLE) || (primitive == GAIM_STATUS_AWAY) || + (primitive == GAIM_STATUS_INVISIBLE) || (primitive == GAIM_STATUS_OFFLINE)) && + (!gaim_savedstatus_has_substatuses(saved_status))) { - if (gaim_savedstatus_is_transient(saved_status)) { - index = get_statusbox_index(status_box, saved_status); - gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), - index); - } else { - gtk_gaim_status_box_refresh(status_box); - } + index = get_statusbox_index(status_box, saved_status); + gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), index); } else { @@ -715,7 +713,11 @@ TYPE_COLUMN, &type, DATA_COLUMN, &data, -1); - if (type == GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE && primitive == GPOINTER_TO_INT(data)) + + /* This is a special case because Primitives for the token_status_account are actually + * saved statuses with substatuses for the enabled accounts */ + if (status_box->token_status_account && gaim_savedstatus_is_transient(saved_status) + && type == GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE && primitive == GPOINTER_TO_INT(data)) { char *name; const char *acct_status_name = gaim_status_get_name( @@ -724,7 +726,8 @@ gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, TEXT_COLUMN, &name, -1); - if (!strcmp(name, acct_status_name)) + if (!gaim_savedstatus_has_substatuses(saved_status) + || !strcmp(name, acct_status_name)) { /* Found! */ gtk_combo_box_set_active_iter(GTK_COMBO_BOX(status_box), &iter); @@ -733,6 +736,13 @@ } g_free(name); } + else if ((type == GTK_GAIM_STATUS_BOX_TYPE_POPULAR) && + (GPOINTER_TO_INT(data) == gaim_savedstatus_get_creation_time(saved_status))) + { + /* Found! */ + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(status_box), &iter); + break; + } } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(status_box->dropdown_store), &iter)); } @@ -1770,7 +1780,16 @@ { /* Selected status and previous status is the same */ if (!message_changed(message, gaim_status_get_attr_string(status, "message"))) - changed = FALSE; + { + GaimSavedStatus *ss = gaim_savedstatus_get_current(); + /* Make sure that statusbox displays the correct thing. + * It can get messed up if the previous selection was a + * saved status that wasn't supported by this account */ + if ((gaim_savedstatus_get_type(ss) == primitive) + && gaim_savedstatus_is_transient(ss) + && gaim_savedstatus_has_substatuses(ss)) + changed = FALSE; + } } } else { saved_status = gaim_savedstatus_get_current(); @@ -1790,12 +1809,11 @@ GList *tmp, *active_accts = gaim_accounts_get_all_active(); for (; iter != NULL; iter = iter->next) { - GaimSavedStatus *ss= iter->data; + GaimSavedStatus *ss = iter->data; const char *ss_msg = gaim_savedstatus_get_message(ss); if ((gaim_savedstatus_get_type(ss) == primitive) && gaim_savedstatus_is_transient(ss) && gaim_savedstatus_has_substatuses(ss) && /* Must have substatuses */ - (((ss_msg == NULL) && (message == NULL)) || - ((ss_msg != NULL) && (message != NULL) && !strcmp(ss_msg, message)))) + !message_changed(ss_msg, message)) { gboolean found = FALSE; /* The currently enabled accounts must have substatuses for all the active accts */
--- a/libgaim/savedstatuses.c Tue Oct 17 21:47:48 2006 +0000 +++ b/libgaim/savedstatuses.c Wed Oct 18 00:54:57 2006 +0000 @@ -700,10 +700,7 @@ GList *popular = NULL; GList *cur; int i; - GaimSavedStatus *current, *next; - - /* We don't want the current status to be in the GList */ - current = gaim_savedstatus_get_current(); + GaimSavedStatus *next; /* Copy 'how_many' elements to a new list */ i = 0; @@ -711,7 +708,7 @@ while ((i < how_many) && (cur != NULL)) { next = cur->data; - if ((next != current) && (!gaim_savedstatus_is_transient(next) + if ((!gaim_savedstatus_is_transient(next) || gaim_savedstatus_get_message(next) != NULL)) { popular = g_list_prepend(popular, cur->data);