# HG changeset patch # User Mark Doliner # Date 1130214187 0 # Node ID 7584d802f0acd917cce066c6c528797db07826c6 # Parent 615c2fd3d72eba30b8bfb5ed39446f85da674891 [gaim-migrate @ 14097] 1. Improve "gaim -n" Using this now sets your current status to "Offline." This isn't shown in the gtkstatusbox yet. 2. Change gtkstatusbox to use gaim_savedstatus_activate() instead of having duplicate code. 3. Change gaim_savedstatus_activate() to only attempt to set the "message" attribute of a status when the status type supports the attribute. I think this'll get rid of some warnings CVS is getting good. Can you feel it? committer: Tailor Script diff -r 615c2fd3d72e -r 7584d802f0ac src/gtkmain.c --- a/src/gtkmain.c Tue Oct 25 01:00:28 2005 +0000 +++ b/src/gtkmain.c Tue Oct 25 04:23:07 2005 +0000 @@ -669,7 +669,19 @@ } } - if (!opt_nologin) + if (opt_nologin) + { + /* Set all accounts to "offline" */ + GaimSavedStatus *saved_status; + saved_status = gaim_savedstatus_find(_("Default")); + if (saved_status == NULL) + saved_status = gaim_savedstatus_new(_("Default"), GAIM_STATUS_OFFLINE); + else + gaim_savedstatus_set_type(saved_status, GAIM_STATUS_OFFLINE); + gaim_prefs_set_string("/core/status/current", _("Default")); + gaim_savedstatus_activate(saved_status); + } + else { /* Everything is good to go--sign on already */ gaim_accounts_restore_previous_statuses(); diff -r 615c2fd3d72e -r 7584d802f0ac src/gtkstatusbox.c --- a/src/gtkstatusbox.c Tue Oct 25 01:00:28 2005 +0000 +++ b/src/gtkstatusbox.c Tue Oct 25 04:23:07 2005 +0000 @@ -631,7 +631,6 @@ { GtkGaimStatusBoxItemType type; gchar *title; - GList *l; GtkTreeIter iter; char *message; GaimSavedStatus *saved_status; @@ -660,23 +659,7 @@ gaim_prefs_set_string("/core/status/current", _("Default")); /* Set the status for each account */ - for (l = gaim_accounts_get_all(); l != NULL; l = l->next) - { - GaimAccount *account = (GaimAccount*)l->data; - GaimStatusType *status_type; - - if (!gaim_account_get_enabled(account, GAIM_GTK_UI)) - continue; - - status_type = gaim_account_get_status_type_with_primitive(account, type); - - if (status_type == NULL) - continue; - - gaim_account_set_status(account, - gaim_status_type_get_id(status_type), - TRUE, "message", message, NULL); - } + gaim_savedstatus_activate(saved_status); g_free(title); g_free(message); diff -r 615c2fd3d72e -r 7584d802f0ac src/savedstatuses.c --- a/src/savedstatuses.c Tue Oct 25 01:00:28 2005 +0000 +++ b/src/savedstatuses.c Tue Oct 25 04:23:07 2005 +0000 @@ -531,12 +531,17 @@ if (status_type != NULL) { - if (saved_status->message != NULL) + if ((saved_status->message != NULL) && + (gaim_status_type_get_attr(status_type, "message"))) + { gaim_account_set_status(account, gaim_status_type_get_id(status_type), TRUE, "message", saved_status->message, NULL); + } else + { gaim_account_set_status(account, gaim_status_type_get_id(status_type), TRUE, NULL); + } } }