| 311 |
311 |
| 312 /* this function is inappropriate for ones with accounts */ |
312 /* this function is inappropriate for ones with accounts */ |
| 313 if (status_box->account) |
313 if (status_box->account) |
| 314 return; |
314 return; |
| 315 |
315 |
| 316 current_savedstatus_name = gaim_prefs_get_string("/core/status/current"); |
316 current_savedstatus_name = gaim_prefs_get_string("/core/savedstatus/current"); |
| 317 saved_status = gaim_savedstatus_find(current_savedstatus_name); |
317 saved_status = gaim_savedstatus_find(current_savedstatus_name); |
| 318 |
318 |
| 319 /* |
319 /* |
| 320 * Suppress the "changed" signal because the status |
320 * Suppress the "changed" signal because the status |
| 321 * was changed programmatically. |
321 * was changed programmatically. |
| 568 status_box->typing_pixbufs[3] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_TYPING3, |
568 status_box->typing_pixbufs[3] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_TYPING3, |
| 569 icon_size, "GtkGaimStatusBox"); |
569 icon_size, "GtkGaimStatusBox"); |
| 570 |
570 |
| 571 gtk_gaim_status_box_regenerate(status_box); |
571 gtk_gaim_status_box_regenerate(status_box); |
| 572 |
572 |
| 573 /* Monitor changes in the "/core/status/current" preference */ |
573 /* Monitor changes in the "/core/savedstatus/current" preference */ |
| 574 gaim_prefs_connect_callback(status_box, "/core/status/current", |
574 gaim_prefs_connect_callback(status_box, "/core/savedstatus/current", |
| 575 current_status_pref_changed_cb, status_box); |
575 current_status_pref_changed_cb, status_box); |
| 576 |
576 |
| 577 /* TODO: Need to override the destroy method for this object and put the following line in it */ |
577 /* TODO: Need to override the destroy method for this object and put the following line in it */ |
| 578 /* gaim_prefs_disconnect_by_handle(status_box); */ |
578 /* gaim_prefs_disconnect_by_handle(status_box); */ |
| 579 } |
579 } |
| 807 /* |
807 /* |
| 808 * If the currently selected status is "Custom..." or |
808 * If the currently selected status is "Custom..." or |
| 809 * "Saved..." then do nothing. Custom statuses are |
809 * "Saved..." then do nothing. Custom statuses are |
| 810 * activated elsewhere, and we update the status_box |
810 * activated elsewhere, and we update the status_box |
| 811 * accordingly by monitoring the preference |
811 * accordingly by monitoring the preference |
| 812 * "/core/status/current" and then calling |
812 * "/core/savedstatus/current" and then calling |
| 813 * update_to_reflect_current_status() |
813 * update_to_reflect_current_status() |
| 814 */ |
814 */ |
| 815 if ((type < 0) || (type >= GAIM_STATUS_NUM_PRIMITIVES)) |
815 if ((type < 0) || (type >= GAIM_STATUS_NUM_PRIMITIVES)) |
| 816 return; |
816 return; |
| 817 |
817 |
| 834 { |
834 { |
| 835 /* Selected status and previous status is the same */ |
835 /* Selected status and previous status is the same */ |
| 836 if (!message_changed(message, gaim_status_get_attr_string(status, "message"))) |
836 if (!message_changed(message, gaim_status_get_attr_string(status, "message"))) |
| 837 changed = FALSE; |
837 changed = FALSE; |
| 838 } |
838 } |
| 839 |
839 |
| 840 if (changed) |
840 if (changed) |
| 841 { |
841 { |
| 842 if (message) |
842 if (message) |
| 843 gaim_account_set_status(status_box->account, id, |
843 gaim_account_set_status(status_box->account, id, |
| 844 TRUE, "message", message, NULL); |
844 TRUE, "message", message, NULL); |
| 850 /* Save the newly selected status to prefs.xml and status.xml */ |
850 /* Save the newly selected status to prefs.xml and status.xml */ |
| 851 /* TODO: This should be saved as transient. */ |
851 /* TODO: This should be saved as transient. */ |
| 852 const char *current = NULL; |
852 const char *current = NULL; |
| 853 |
853 |
| 854 /* Has the status been really changed? */ |
854 /* Has the status been really changed? */ |
| 855 current = gaim_prefs_get_string("/core/status/current"); |
855 current = gaim_prefs_get_string("/core/savedstatus/current"); |
| 856 saved_status = gaim_savedstatus_find(current); |
856 saved_status = gaim_savedstatus_find(current); |
| 857 if (saved_status && gaim_savedstatus_get_type(saved_status) == type) |
857 if (saved_status && gaim_savedstatus_get_type(saved_status) == type) |
| 858 { |
858 { |
| 859 if (!message_changed(gaim_savedstatus_get_message(saved_status), message)) |
859 if (!message_changed(gaim_savedstatus_get_message(saved_status), message)) |
| 860 changed = FALSE; |
860 changed = FALSE; |
| 865 saved_status = gaim_savedstatus_find(_("Default")); |
865 saved_status = gaim_savedstatus_find(_("Default")); |
| 866 if (saved_status == NULL) |
866 if (saved_status == NULL) |
| 867 saved_status = gaim_savedstatus_new(_("Default"), type); |
867 saved_status = gaim_savedstatus_new(_("Default"), type); |
| 868 gaim_savedstatus_set_type(saved_status, type); |
868 gaim_savedstatus_set_type(saved_status, type); |
| 869 gaim_savedstatus_set_message(saved_status, message); |
869 gaim_savedstatus_set_message(saved_status, message); |
| 870 gaim_prefs_set_string("/core/status/current", _("Default")); |
|
| 871 |
870 |
| 872 /* Set the status for each account */ |
871 /* Set the status for each account */ |
| 873 gaim_savedstatus_activate(saved_status); |
872 gaim_savedstatus_activate(saved_status); |
| 874 } |
873 } |
| 875 } |
874 } |