comparison src/gtkstatusbox.c @ 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 225e1b274033
children 39f2aa4350d8
comparison
equal deleted inserted replaced
11980:67fbd2ff4c4e 11981:053bb5ad040b
762 if ((type < 0) || (type >= GAIM_STATUS_NUM_PRIMITIVES)) 762 if ((type < 0) || (type >= GAIM_STATUS_NUM_PRIMITIVES))
763 return; 763 return;
764 764
765 /* TODO: Should save the previous status as a transient status? */ 765 /* TODO: Should save the previous status as a transient status? */
766 766
767 /* Save the newly selected status to prefs.xml and status.xml */ 767 if (status_box->account) {
768 /* TODO: This should be saved as transient. */ 768 const GList *l = gaim_account_get_status_types(status_box->account);
769 saved_status = gaim_savedstatus_find(_("Default")); 769 gint active;
770 if (saved_status == NULL) 770 GaimStatusType *status_type;
771 saved_status = gaim_savedstatus_new(_("Default"), type); 771
772 gaim_savedstatus_set_type(saved_status, type); 772 g_object_get(G_OBJECT(status_box), "active", &active, NULL);
773 gaim_savedstatus_set_message(saved_status, message); 773
774 gaim_prefs_set_string("/core/status/current", _("Default")); 774 status_type = g_list_nth_data((GList *)l, active);
775 775 if (message)
776 /* Set the status for each account */ 776 gaim_account_set_status(status_box->account, gaim_status_type_get_id(status_type),
777 gaim_savedstatus_activate(saved_status); 777 TRUE, "message", message, NULL);
778 else
779 gaim_account_set_status(status_box->account, gaim_status_type_get_id(status_type),
780 TRUE, NULL);
781
782 } else {
783 /* Save the newly selected status to prefs.xml and status.xml */
784 /* TODO: This should be saved as transient. */
785 saved_status = gaim_savedstatus_find(_("Default"));
786 if (saved_status == NULL)
787 saved_status = gaim_savedstatus_new(_("Default"), type);
788 gaim_savedstatus_set_type(saved_status, type);
789 gaim_savedstatus_set_message(saved_status, message);
790 gaim_prefs_set_string("/core/status/current", _("Default"));
791
792 /* Set the status for each account */
793 gaim_savedstatus_activate(saved_status);
794 }
778 795
779 g_free(title); 796 g_free(title);
780 g_free(message); 797 g_free(message);
781 } 798 }
782 799
872 } 889 }
873 else 890 else
874 { 891 {
875 gtk_widget_hide_all(status_box->vbox); 892 gtk_widget_hide_all(status_box->vbox);
876 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) 893 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box)))
877 activate_currently_selected_status(status_box); 894 activate_currently_selected_status(status_box); /* This is where we actually set the status */
878 } 895 }
879 gtk_gaim_status_box_refresh(status_box); 896 gtk_gaim_status_box_refresh(status_box);
880 } 897 }
881 898
882 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data) 899 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data)