| 685 /* |
685 /* |
| 686 * If there is a token-account, then select the primitive from the |
686 * If there is a token-account, then select the primitive from the |
| 687 * dropdown using a loop. Otherwise select from the default list. |
687 * dropdown using a loop. Otherwise select from the default list. |
| 688 */ |
688 */ |
| 689 primitive = gaim_savedstatus_get_type(saved_status); |
689 primitive = gaim_savedstatus_get_type(saved_status); |
| 690 if (!status_box->token_status_account) |
690 if (!status_box->token_status_account && gaim_savedstatus_is_transient(saved_status) && |
| 691 { |
691 ((primitive == GAIM_STATUS_AVAILABLE) || (primitive == GAIM_STATUS_AWAY) || |
| 692 if (gaim_savedstatus_is_transient(saved_status)) { |
692 (primitive == GAIM_STATUS_INVISIBLE) || (primitive == GAIM_STATUS_OFFLINE)) && |
| 693 index = get_statusbox_index(status_box, saved_status); |
693 (!gaim_savedstatus_has_substatuses(saved_status))) |
| 694 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), |
694 { |
| 695 index); |
695 index = get_statusbox_index(status_box, saved_status); |
| 696 } else { |
696 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), index); |
| 697 gtk_gaim_status_box_refresh(status_box); |
|
| 698 } |
|
| 699 } |
697 } |
| 700 else |
698 else |
| 701 { |
699 { |
| 702 GtkTreeIter iter; |
700 GtkTreeIter iter; |
| 703 GtkGaimStatusBoxItemType type; |
701 GtkGaimStatusBoxItemType type; |
| 713 { |
711 { |
| 714 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, |
712 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, |
| 715 TYPE_COLUMN, &type, |
713 TYPE_COLUMN, &type, |
| 716 DATA_COLUMN, &data, |
714 DATA_COLUMN, &data, |
| 717 -1); |
715 -1); |
| 718 if (type == GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE && primitive == GPOINTER_TO_INT(data)) |
716 |
| |
717 /* This is a special case because Primitives for the token_status_account are actually |
| |
718 * saved statuses with substatuses for the enabled accounts */ |
| |
719 if (status_box->token_status_account && gaim_savedstatus_is_transient(saved_status) |
| |
720 && type == GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE && primitive == GPOINTER_TO_INT(data)) |
| 719 { |
721 { |
| 720 char *name; |
722 char *name; |
| 721 const char *acct_status_name = gaim_status_get_name( |
723 const char *acct_status_name = gaim_status_get_name( |
| 722 gaim_account_get_active_status(status_box->token_status_account)); |
724 gaim_account_get_active_status(status_box->token_status_account)); |
| 723 |
725 |
| 724 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, |
726 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, |
| 725 TEXT_COLUMN, &name, -1); |
727 TEXT_COLUMN, &name, -1); |
| 726 |
728 |
| 727 if (!strcmp(name, acct_status_name)) |
729 if (!gaim_savedstatus_has_substatuses(saved_status) |
| |
730 || !strcmp(name, acct_status_name)) |
| 728 { |
731 { |
| 729 /* Found! */ |
732 /* Found! */ |
| 730 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(status_box), &iter); |
733 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(status_box), &iter); |
| 731 g_free(name); |
734 g_free(name); |
| 732 break; |
735 break; |
| 733 } |
736 } |
| 734 g_free(name); |
737 g_free(name); |
| |
738 } |
| |
739 else if ((type == GTK_GAIM_STATUS_BOX_TYPE_POPULAR) && |
| |
740 (GPOINTER_TO_INT(data) == gaim_savedstatus_get_creation_time(saved_status))) |
| |
741 { |
| |
742 /* Found! */ |
| |
743 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(status_box), &iter); |
| |
744 break; |
| 735 } |
745 } |
| 736 } |
746 } |
| 737 while (gtk_tree_model_iter_next(GTK_TREE_MODEL(status_box->dropdown_store), &iter)); |
747 while (gtk_tree_model_iter_next(GTK_TREE_MODEL(status_box->dropdown_store), &iter)); |
| 738 } |
748 } |
| 739 } |
749 } |
| 1768 |
1778 |
| 1769 if (strncmp(id, gaim_status_get_id(status), strlen(id)) == 0) |
1779 if (strncmp(id, gaim_status_get_id(status), strlen(id)) == 0) |
| 1770 { |
1780 { |
| 1771 /* Selected status and previous status is the same */ |
1781 /* Selected status and previous status is the same */ |
| 1772 if (!message_changed(message, gaim_status_get_attr_string(status, "message"))) |
1782 if (!message_changed(message, gaim_status_get_attr_string(status, "message"))) |
| 1773 changed = FALSE; |
1783 { |
| |
1784 GaimSavedStatus *ss = gaim_savedstatus_get_current(); |
| |
1785 /* Make sure that statusbox displays the correct thing. |
| |
1786 * It can get messed up if the previous selection was a |
| |
1787 * saved status that wasn't supported by this account */ |
| |
1788 if ((gaim_savedstatus_get_type(ss) == primitive) |
| |
1789 && gaim_savedstatus_is_transient(ss) |
| |
1790 && gaim_savedstatus_has_substatuses(ss)) |
| |
1791 changed = FALSE; |
| |
1792 } |
| 1774 } |
1793 } |
| 1775 } else { |
1794 } else { |
| 1776 saved_status = gaim_savedstatus_get_current(); |
1795 saved_status = gaim_savedstatus_get_current(); |
| 1777 if (gaim_savedstatus_get_type(saved_status) == primitive && |
1796 if (gaim_savedstatus_get_type(saved_status) == primitive && |
| 1778 !gaim_savedstatus_has_substatuses(saved_status)) |
1797 !gaim_savedstatus_has_substatuses(saved_status)) |
| 1788 if (status_box->token_status_account) { |
1807 if (status_box->token_status_account) { |
| 1789 const GList *iter = gaim_savedstatuses_get_all(); |
1808 const GList *iter = gaim_savedstatuses_get_all(); |
| 1790 GList *tmp, *active_accts = gaim_accounts_get_all_active(); |
1809 GList *tmp, *active_accts = gaim_accounts_get_all_active(); |
| 1791 |
1810 |
| 1792 for (; iter != NULL; iter = iter->next) { |
1811 for (; iter != NULL; iter = iter->next) { |
| 1793 GaimSavedStatus *ss= iter->data; |
1812 GaimSavedStatus *ss = iter->data; |
| 1794 const char *ss_msg = gaim_savedstatus_get_message(ss); |
1813 const char *ss_msg = gaim_savedstatus_get_message(ss); |
| 1795 if ((gaim_savedstatus_get_type(ss) == primitive) && gaim_savedstatus_is_transient(ss) && |
1814 if ((gaim_savedstatus_get_type(ss) == primitive) && gaim_savedstatus_is_transient(ss) && |
| 1796 gaim_savedstatus_has_substatuses(ss) && /* Must have substatuses */ |
1815 gaim_savedstatus_has_substatuses(ss) && /* Must have substatuses */ |
| 1797 (((ss_msg == NULL) && (message == NULL)) || |
1816 !message_changed(ss_msg, message)) |
| 1798 ((ss_msg != NULL) && (message != NULL) && !strcmp(ss_msg, message)))) |
|
| 1799 { |
1817 { |
| 1800 gboolean found = FALSE; |
1818 gboolean found = FALSE; |
| 1801 /* The currently enabled accounts must have substatuses for all the active accts */ |
1819 /* The currently enabled accounts must have substatuses for all the active accts */ |
| 1802 for(tmp = active_accts; tmp != NULL; tmp = tmp->next) { |
1820 for(tmp = active_accts; tmp != NULL; tmp = tmp->next) { |
| 1803 GaimAccount *acct = tmp->data; |
1821 GaimAccount *acct = tmp->data; |