# HG changeset patch # User Mark Doliner # Date 1100490836 0 # Node ID 5709800d1dee3fdb04b81b90d526855c83ec4db8 # Parent 5a1fe52036ad5fa42686c4e64ecbcbe03e304d95 [gaim-migrate @ 11303] I really like this a lot better... hope I'm not stepping on any toes... committer: Tailor Script diff -r 5a1fe52036ad -r 5709800d1dee src/gtkstatusselector.c --- a/src/gtkstatusselector.c Mon Nov 15 03:31:43 2004 +0000 +++ b/src/gtkstatusselector.c Mon Nov 15 03:53:56 2004 +0000 @@ -214,68 +214,69 @@ status_switched_cb(GtkWidget *combo, GaimGtkStatusSelector *selector) { GtkTreeIter iter; + const char *status_type_id; + char *text; + GList *l; - if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(selector->priv->combo), + if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(selector->priv->combo), &iter)) { - const char *status_type_id; - char *text; - GList *l; + return; + } + + gtk_tree_model_get(GTK_TREE_MODEL(selector->priv->model), &iter, + COLUMN_NAME, &text, + COLUMN_STATUS_TYPE_ID, &status_type_id, + -1); - gtk_tree_model_get(GTK_TREE_MODEL(selector->priv->model), &iter, - COLUMN_NAME, &text, - COLUMN_STATUS_TYPE_ID, &status_type_id, - -1); + if (!strcmp(text, _("New status"))) + { + /* TODO */ + } + else + { + const char *message = ""; + GtkTextBuffer *buffer; + gboolean allow_message = FALSE; - if (!strcmp(text, _("New status"))) + buffer = + gtk_text_view_get_buffer(GTK_TEXT_VIEW(selector->priv->entry)); + + gtk_text_buffer_set_text(buffer, message, -1); + + for (l = gaim_connections_get_all(); l != NULL; l = l->next) { - /* TODO */ - } - else - { - const char *message = ""; - GtkTextBuffer *buffer; - gboolean allow_message = FALSE; + GaimConnection *gc = (GaimConnection *)l->data; + GaimAccount *account = gaim_connection_get_account(gc); + GaimStatusType *status_type; - buffer = - gtk_text_view_get_buffer(GTK_TEXT_VIEW(selector->priv->entry)); + status_type = gaim_account_get_status_type(account, + status_type_id); - gtk_text_buffer_set_text(buffer, message, -1); + if (status_type == NULL) + continue; - for (l = gaim_connections_get_all(); l != NULL; l = l->next) + if (gaim_status_type_get_attr(status_type, "message") != NULL) { - GaimConnection *gc = (GaimConnection *)l->data; - GaimAccount *account = gaim_connection_get_account(gc); - GaimStatusType *status_type; - - status_type = gaim_account_get_status_type(account, - status_type_id); - - if (status_type == NULL) - continue; + gaim_account_set_status(account, + "away", TRUE, + "message", message, + NULL); - if (gaim_status_type_get_attr(status_type, "message") != NULL) - { - gaim_account_set_status(account, - "away", TRUE, - "message", message, - NULL); + allow_message = TRUE; + } + else + { + gaim_account_set_status(account, + "away", TRUE, + NULL); + } + } - allow_message = TRUE; - } - else - { - gaim_account_set_status(gaim_connection_get_account(gc), - "away", TRUE, - NULL); - } - } - - if (allow_message) - gtk_widget_show(selector->priv->sw); - else - gtk_widget_hide(selector->priv->sw); - } + if (allow_message) + gtk_widget_show(selector->priv->sw); + else + gtk_widget_hide(selector->priv->sw); } }