changeset 11981:053bb5ad040b

[gaim-migrate @ 14274] continuing with my baby step #if 0'd commits, now you can actually change your status via the individual selectors. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Sat, 05 Nov 2005 02:32:36 +0000
parents 67fbd2ff4c4e
children 54a3eae03182
files src/gtkstatusbox.c
diffstat 1 files changed, 28 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkstatusbox.c	Sat Nov 05 02:09:30 2005 +0000
+++ b/src/gtkstatusbox.c	Sat Nov 05 02:32:36 2005 +0000
@@ -764,17 +764,34 @@
 
 	/* TODO: Should save the previous status as a transient status? */
 
-	/* Save the newly selected status to prefs.xml and status.xml */
-	/* TODO: This should be saved as transient. */
-	saved_status = gaim_savedstatus_find(_("Default"));
-	if (saved_status == NULL)
-		saved_status = gaim_savedstatus_new(_("Default"), type);
-	gaim_savedstatus_set_type(saved_status, type);
-	gaim_savedstatus_set_message(saved_status, message);
-	gaim_prefs_set_string("/core/status/current", _("Default"));
+	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);
 
-	/* Set the status for each account */
-	gaim_savedstatus_activate(saved_status);
+		status_type = g_list_nth_data((GList *)l, active);
+		if (message)
+			gaim_account_set_status(status_box->account, gaim_status_type_get_id(status_type),
+			                        TRUE, "message", message, NULL);
+		else
+			gaim_account_set_status(status_box->account, gaim_status_type_get_id(status_type),
+			                        TRUE, NULL);
+
+	} else {
+		/* Save the newly selected status to prefs.xml and status.xml */
+		/* TODO: This should be saved as transient. */
+		saved_status = gaim_savedstatus_find(_("Default"));
+		if (saved_status == NULL)
+			saved_status = gaim_savedstatus_new(_("Default"), type);
+		gaim_savedstatus_set_type(saved_status, type);
+		gaim_savedstatus_set_message(saved_status, message);
+		gaim_prefs_set_string("/core/status/current", _("Default"));
+
+		/* Set the status for each account */
+		gaim_savedstatus_activate(saved_status);
+	}
 
 	g_free(title);
 	g_free(message);
@@ -874,7 +891,7 @@
 	{
 		gtk_widget_hide_all(status_box->vbox);
 		if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box)))
-			activate_currently_selected_status(status_box);
+			activate_currently_selected_status(status_box); /* This is where we actually set the status */
 	}
 	gtk_gaim_status_box_refresh(status_box);
 }