Mercurial > pidgin.yaz
changeset 13387:d9dbb874a30c
[gaim-migrate @ 15760]
SF Patch #1441721 from Kevin Stange (SimGuy)
"emit a signal when the current savedstatus changes"
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Fri, 03 Mar 2006 07:02:59 +0000 |
parents | 54f679516b52 |
children | 0a8b72b12cef |
files | doc/Makefile.am doc/savedstatus-signals.dox plugins/ChangeLog.API src/savedstatuses.c src/value.h |
diffstat | 5 files changed, 38 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/Makefile.am Fri Mar 03 06:14:20 2006 +0000 +++ b/doc/Makefile.am Fri Mar 03 07:02:59 2006 +0000 @@ -25,6 +25,7 @@ notify-signals.dox \ plugin-ids.dox \ plugin-signals.dox \ + savedstatus-signals.dox \ sound-signals.dox \ the_penguin.txt \ xfer-signals.dox
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/savedstatus-signals.dox Fri Mar 03 07:02:59 2006 +0000 @@ -0,0 +1,18 @@ +/** @page savedstatus-signals Saved Status Signals + + @signals + @signal savedstatus-changed + @endsignals + + <hr> + + @signaldef savedstatus-changed + @signalproto +void (*savedstatus_changed)(GaimSavedStatus *new, GaimSavedStatus *old); + @endsignalproto + @signaldesc + Emitted when a new saved status is activated. + @endsignaldef + + */ +// vim: syntax=c tw=75 et
--- a/plugins/ChangeLog.API Fri Mar 03 06:14:20 2006 +0000 +++ b/plugins/ChangeLog.API Fri Mar 03 07:02:59 2006 +0000 @@ -333,6 +333,7 @@ * "gtkblist-hiding" * "gtkblist-unhiding" * "log-displaying" + * "savedstatus-changed" Signals - Removed: * "account-away": replaced by account-status-changed
--- a/src/savedstatuses.c Fri Mar 03 06:14:20 2006 +0000 +++ b/src/savedstatuses.c Fri Mar 03 07:02:59 2006 +0000 @@ -950,6 +950,7 @@ gaim_savedstatus_activate(GaimSavedStatus *saved_status) { GList *accounts, *node; + GaimSavedStatus *old = gaim_savedstatus_get_current(); g_return_if_fail(saved_status != NULL); @@ -973,6 +974,10 @@ gaim_prefs_set_int("/core/savedstatus/current", gaim_savedstatus_get_creation_time(saved_status)); + + gaim_signal_emit(gaim_savedstatuses_get_handle(), "savedstatus-changed", + saved_status, old); + } void @@ -1024,6 +1029,8 @@ void gaim_savedstatuses_init(void) { + void *handle = gaim_savedstatuses_get_handle(); + creation_times = g_hash_table_new(g_int_hash, g_int_equal); /* @@ -1040,6 +1047,13 @@ gaim_prefs_add_int("/core/savedstatus/idleaway", 0); load_statuses(); + + gaim_signal_register(handle, "savedstatus-changed", + gaim_marshal_VOID__POINTER_POINTER, NULL, 2, + gaim_value_new(GAIM_TYPE_SUBTYPE, + GAIM_SUBTYPE_SAVEDSTATUS), + gaim_value_new(GAIM_TYPE_SUBTYPE, + GAIM_SUBTYPE_SAVEDSTATUS)); } void @@ -1061,5 +1075,7 @@ } g_hash_table_destroy(creation_times); + + gaim_signals_unregister_by_instance(gaim_savedstatuses_get_handle()); }