Mercurial > pidgin
changeset 11954:351f4dd75718
[gaim-migrate @ 14245]
Activating a saved status now updates the gtkstatusbar.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 02 Nov 2005 06:14:34 +0000 |
parents | 4824e4f0c6f3 |
children | e094639ab422 |
files | src/gtksavedstatuses.c src/gtkstatusbox.c src/savedstatuses.c |
diffstat | 3 files changed, 32 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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);