# HG changeset patch # User Mark Doliner # Date 1130912074 0 # Node ID 351f4dd75718b31149ad886a52de59954bae1de9 # Parent 4824e4f0c6f3f62b4d69578456dcb327633cb4bc [gaim-migrate @ 14245] Activating a saved status now updates the gtkstatusbar. committer: Tailor Script diff -r 4824e4f0c6f3 -r 351f4dd75718 src/gtksavedstatuses.c --- a/src/gtksavedstatuses.c Wed Nov 02 05:56:15 2005 +0000 +++ b/src/gtksavedstatuses.c Wed Nov 02 06:14:34 2005 +0000 @@ -491,7 +491,6 @@ gtk_widget_show(bbox); /* Use button */ - /* TODO: It might be better if the button said "Use" or "Activate" */ button = gaim_pixbuf_button_from_stock(_("_Use"), GTK_STOCK_EXECUTE, GAIM_BUTTON_HORIZONTAL); dialog->use_button = button; diff -r 4824e4f0c6f3 -r 351f4dd75718 src/gtkstatusbox.c --- a/src/gtkstatusbox.c Wed Nov 02 05:56:15 2005 +0000 +++ b/src/gtkstatusbox.c Wed Nov 02 06:14:34 2005 +0000 @@ -34,13 +34,6 @@ #include "gtkstock.h" #include "gtkstatusbox.h" -/* - * TODO: The preference "/core/status/current" contains the name of - * the GaimSavedStatus that is the current master status of all - * enabled accounts. We need to monitor this preference and - * update ourself when the pref changes. - */ - static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data); static void remove_typing_cb(GtkGaimStatusBox *box); @@ -274,10 +267,6 @@ * or when signing on with the "-n" option, for example). It is * also used when the user selects the "Custom..." option. * - * TODO: It should ONLY update the appearance of the GtkStatusBox. It - * should not trigger the text-input-typing-timer. It should also - * not trigger a status change. - * * Maybe we could accomplish this by triggering off the mouse and * keyboard signals instead of the changed signal? */ @@ -328,13 +317,21 @@ } message = gaim_savedstatus_get_message(saved_status); - if (message != NULL) + if (message == NULL) { + status_box->imhtml_visible = FALSE; + } + else + { + status_box->imhtml_visible = TRUE; + /* * Suppress the "changed" signal because the status * was changed programmatically. */ gtk_widget_set_sensitive(GTK_WIDGET(status_box->imhtml), FALSE); + + gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml)); gtk_imhtml_append_text(GTK_IMHTML(status_box->imhtml), message, 0); gtk_widget_set_sensitive(GTK_WIDGET(status_box->imhtml), TRUE); } @@ -414,6 +411,13 @@ #endif static void +current_status_pref_changed_cb(const char *name, GaimPrefType type, + gpointer val, gpointer data) +{ + update_to_reflect_current_status(data); +} + +static void gtk_gaim_status_box_init (GtkGaimStatusBox *status_box) { GtkCellRenderer *text_rend; @@ -500,9 +504,15 @@ icon_size, "GtkGaimStatusBox"); gtk_gaim_status_box_regenerate(status_box); + + /* Monitor changes in the "/core/status/current" preference */ + gaim_prefs_connect_callback(status_box, "/core/status/current", + current_status_pref_changed_cb, status_box); + + /* TODO: Need to override the destroy method for this object and put the following line in it */ + /* gaim_prefs_disconnect_by_handle(status_box); */ } - static void gtk_gaim_status_box_size_request(GtkWidget *widget, GtkRequisition *requisition) @@ -686,7 +696,11 @@ /* * If the currently selected status is "Custom..." or - * "Saved..." then do nothing. + * "Saved..." then do nothing. Custom statuses are + * activated elsewhere, and we update the status_box + * accordingly by monitoring the preference + * "/core/status/current" and then calling + * update_to_reflect_current_status() */ if ((type < 0) || (type >= GAIM_STATUS_NUM_PRIMITIVES)) return; @@ -694,6 +708,7 @@ /* 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); diff -r 4824e4f0c6f3 -r 351f4dd75718 src/savedstatuses.c --- a/src/savedstatuses.c Wed Nov 02 05:56:15 2005 +0000 +++ b/src/savedstatuses.c Wed Nov 02 06:14:34 2005 +0000 @@ -516,6 +516,9 @@ } g_list_free(accounts); + + gaim_prefs_set_string("/core/status/current", + gaim_savedstatus_get_title(saved_status)); } void