| 694 * was changed programmatically. |
694 * was changed programmatically. |
| 695 */ |
695 */ |
| 696 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE); |
696 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE); |
| 697 |
697 |
| 698 /* |
698 /* |
| 699 * If the saved_status is transient, is Available, Away, Invisible |
699 * If there is a token-account, then select the primitive from the |
| 700 * or Offline, and it does not have an substatuses, then select |
700 * dropdown using a loop. Otherwise select from the default list. |
| 701 * the primitive in the dropdown menu. Otherwise select the |
|
| 702 * popular status in the dropdown menu. |
|
| 703 */ |
701 */ |
| 704 primitive = gaim_savedstatus_get_type(saved_status); |
702 primitive = gaim_savedstatus_get_type(saved_status); |
| 705 if (!status_box->token_status_account && gaim_savedstatus_is_transient(saved_status) && |
703 if (!status_box->token_status_account) |
| 706 ((primitive == GAIM_STATUS_AVAILABLE) || (primitive == GAIM_STATUS_AWAY) || |
|
| 707 (primitive == GAIM_STATUS_INVISIBLE) || (primitive == GAIM_STATUS_OFFLINE)) && |
|
| 708 (!gaim_savedstatus_has_substatuses(saved_status))) |
|
| 709 { |
704 { |
| 710 index = get_statusbox_index(status_box, saved_status); |
705 index = get_statusbox_index(status_box, saved_status); |
| 711 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), index); |
706 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), index); |
| |
707 if (index == -1) |
| |
708 gtk_gaim_status_box_refresh(status_box); |
| 712 } |
709 } |
| 713 else |
710 else |
| 714 { |
711 { |
| 715 GtkTreeIter iter; |
712 GtkTreeIter iter; |
| 716 GtkGaimStatusBoxItemType type; |
713 GtkGaimStatusBoxItemType type; |
| 726 { |
723 { |
| 727 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, |
724 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, |
| 728 TYPE_COLUMN, &type, |
725 TYPE_COLUMN, &type, |
| 729 DATA_COLUMN, &data, |
726 DATA_COLUMN, &data, |
| 730 -1); |
727 -1); |
| 731 if (status_box->token_status_account && gaim_savedstatus_is_transient(saved_status) |
728 if (type == GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE && primitive == GPOINTER_TO_INT(data)) |
| 732 && type == GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE && primitive == GPOINTER_TO_INT(data)) |
|
| 733 { |
729 { |
| 734 char *name; |
730 char *name; |
| 735 const char *acct_status_name = gaim_status_get_name( |
731 const char *acct_status_name = gaim_status_get_name( |
| 736 gaim_account_get_active_status(status_box->token_status_account)); |
732 gaim_account_get_active_status(status_box->token_status_account)); |
| 737 |
733 |
| 738 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, |
734 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, |
| 739 TEXT_COLUMN, &name, -1); |
735 TEXT_COLUMN, &name, -1); |
| 740 |
736 |
| 741 if (!gaim_savedstatus_has_substatuses(saved_status) |
737 if (!strcmp(name, acct_status_name)) |
| 742 || !strcmp(name, acct_status_name)) |
|
| 743 { |
738 { |
| 744 /* Found! */ |
739 /* Found! */ |
| 745 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(status_box), &iter); |
740 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(status_box), &iter); |
| 746 g_free(name); |
741 g_free(name); |
| 747 break; |
742 break; |
| 748 } |
743 } |
| 749 g_free(name); |
744 g_free(name); |
| 750 } |
|
| 751 else if ((type == GTK_GAIM_STATUS_BOX_TYPE_POPULAR) && |
|
| 752 (GPOINTER_TO_INT(data) == gaim_savedstatus_get_creation_time(saved_status))) |
|
| 753 { |
|
| 754 /* Found! */ |
|
| 755 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(status_box), &iter); |
|
| 756 break; |
|
| 757 } |
745 } |
| 758 } |
746 } |
| 759 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)); |
| 760 } |
748 } |
| 761 } |
749 } |
| 982 |
970 |
| 983 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf, _("Available"), NULL, GINT_TO_POINTER(GAIM_STATUS_AVAILABLE)); |
971 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf, _("Available"), NULL, GINT_TO_POINTER(GAIM_STATUS_AVAILABLE)); |
| 984 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf2, _("Away"), NULL, GINT_TO_POINTER(GAIM_STATUS_AWAY)); |
972 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf2, _("Away"), NULL, GINT_TO_POINTER(GAIM_STATUS_AWAY)); |
| 985 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf4, _("Invisible"), NULL, GINT_TO_POINTER(GAIM_STATUS_INVISIBLE)); |
973 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf4, _("Invisible"), NULL, GINT_TO_POINTER(GAIM_STATUS_INVISIBLE)); |
| 986 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf3, _("Offline"), NULL, GINT_TO_POINTER(GAIM_STATUS_OFFLINE)); |
974 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf3, _("Offline"), NULL, GINT_TO_POINTER(GAIM_STATUS_OFFLINE)); |
| |
975 |
| |
976 if (pixbuf2) g_object_unref(G_OBJECT(pixbuf2)); |
| |
977 if (pixbuf3) g_object_unref(G_OBJECT(pixbuf3)); |
| |
978 if (pixbuf4) g_object_unref(G_OBJECT(pixbuf4)); |
| 987 } |
979 } |
| 988 |
980 |
| 989 add_popular_statuses(status_box); |
981 add_popular_statuses(status_box); |
| 990 |
982 |
| 991 gtk_gaim_status_box_add_separator(GTK_GAIM_STATUS_BOX(status_box)); |
983 gtk_gaim_status_box_add_separator(GTK_GAIM_STATUS_BOX(status_box)); |
| 992 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_CUSTOM, pixbuf, _("New..."), NULL, NULL); |
984 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_CUSTOM, pixbuf, _("New..."), NULL, NULL); |
| 993 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_SAVED, pixbuf, _("Saved..."), NULL, NULL); |
985 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_SAVED, pixbuf, _("Saved..."), NULL, NULL); |
| |
986 if (pixbuf) g_object_unref(G_OBJECT(pixbuf)); |
| 994 |
987 |
| 995 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store)); |
988 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store)); |
| 996 status_menu_refresh_iter(status_box); |
989 status_menu_refresh_iter(status_box); |
| 997 |
990 |
| 998 } else { |
991 } else { |