# HG changeset patch # User Tim Ringenbach # Date 1131317601 0 # Node ID aa77da6c7f21cc44f0edd60c233bc9879893fbb2 # Parent c824e39db0e7916f80669f812761c835d6854a83 [gaim-migrate @ 14286] marv: status_type = g_list_nth_data((GList *)l, active) doesn't work too well if you have non-user settable statuses that have been skipped hm, that's true. oops. committer: Tailor Script diff -r c824e39db0e7 -r aa77da6c7f21 src/gtkstatusbox.c --- a/src/gtkstatusbox.c Sun Nov 06 21:52:00 2005 +0000 +++ b/src/gtkstatusbox.c Sun Nov 06 22:53:21 2005 +0000 @@ -760,6 +760,25 @@ gtk_gaim_status_box_refresh(status_box); } +static GaimStatusType +*find_status_type_by_index(const GaimAccount *account, gint active) +{ + const GList *l = gaim_account_get_status_types(account); + gint i; + + for (i = 0; l; l = l->next) { + GaimStatusType *status_type = l->data; + if (!gaim_status_type_is_user_settable(status_type)) + continue; + + if (active == i) + return status_type; + i++; + } + + return NULL; +} + static void activate_currently_selected_status(GtkGaimStatusBox *status_box) { @@ -790,13 +809,12 @@ /* TODO: Should save the previous status as a transient status? */ if (status_box->account) { - const GList *l = gaim_account_get_status_types(status_box->account); gint active; GaimStatusType *status_type; g_object_get(G_OBJECT(status_box), "active", &active, NULL); - status_type = g_list_nth_data((GList *)l, active); + status_type = find_status_type_by_index(status_box->account, active); if (message) gaim_account_set_status(status_box->account, gaim_status_type_get_id(status_type), TRUE, "message", message, NULL);