Mercurial > pidgin
diff libpurple/savedstatuses.c @ 18193:09eb621782bc
explicit merge of 'f2eb358baf2c72cb37b6b9bcb4c036e44e0bcc2b'
and '2344c84a6e70c374b19936a127462d2f19c0139c'
author | Ka-Hing Cheung <khc@hxbc.us> |
---|---|
date | Tue, 19 Jun 2007 17:17:57 +0000 |
parents | ab6d2763b8d8 02f39842d28b |
children | 9cb31b7c2dd6 |
line wrap: on
line diff
--- a/libpurple/savedstatuses.c Sun Jun 17 16:55:45 2007 +0000 +++ b/libpurple/savedstatuses.c Tue Jun 19 17:17:57 2007 +0000 @@ -569,6 +569,9 @@ schedule_save(); + purple_signal_emit(purple_savedstatuses_get_handle(), "savedstatus-added", + status); + return status; } @@ -584,6 +587,9 @@ status->title = g_strdup(title); schedule_save(); + + purple_signal_emit(purple_savedstatuses_get_handle(), + "savedstatus-modified", status); } void @@ -594,6 +600,8 @@ status->type = type; schedule_save(); + purple_signal_emit(purple_savedstatuses_get_handle(), + "savedstatus-modified", status); } void @@ -608,6 +616,9 @@ status->message = g_strdup(message); schedule_save(); + + purple_signal_emit(purple_savedstatuses_get_handle(), + "savedstatus-modified", status); } void @@ -637,6 +648,8 @@ substatus->message = g_strdup(message); schedule_save(); + purple_signal_emit(purple_savedstatuses_get_handle(), + "savedstatus-modified", saved_status); } void @@ -660,6 +673,9 @@ return; } } + + purple_signal_emit(purple_savedstatuses_get_handle(), + "savedstatus-modified", saved_status); } /* @@ -683,16 +699,12 @@ } } -gboolean -purple_savedstatus_delete(const char *title) +void +purple_savedstatus_delete_by_status(PurpleSavedStatus *status) { - PurpleSavedStatus *status; time_t creation_time, current, idleaway; - status = purple_savedstatus_find(title); - - if (status == NULL) - return FALSE; + g_return_if_fail(status != NULL); saved_statuses = g_list_remove(saved_statuses, status); creation_time = purple_savedstatus_get_creation_time(status); @@ -713,6 +725,25 @@ if (idleaway == creation_time) purple_prefs_set_int("/purple/savedstatus/idleaway", 0); + purple_signal_emit(purple_savedstatuses_get_handle(), + "savedstatus-deleted", status); +} + +gboolean +purple_savedstatus_delete(const char *title) +{ + PurpleSavedStatus *status; + + status = purple_savedstatus_find(title); + + if (status == NULL) + return FALSE; + + if (purple_savedstatus_get_current() == status) + return FALSE; + + purple_savedstatus_delete_by_status(status); + return TRUE; } @@ -1171,6 +1202,21 @@ purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_SAVEDSTATUS)); + purple_signal_register(handle, "savedstatus-added", + purple_marshal_VOID__POINTER, NULL, 1, + purple_value_new(PURPLE_TYPE_SUBTYPE, + PURPLE_SUBTYPE_SAVEDSTATUS)); + + purple_signal_register(handle, "savedstatus-deleted", + purple_marshal_VOID__POINTER, NULL, 1, + purple_value_new(PURPLE_TYPE_SUBTYPE, + PURPLE_SUBTYPE_SAVEDSTATUS)); + + purple_signal_register(handle, "savedstatus-modified", + purple_marshal_VOID__POINTER, NULL, 1, + purple_value_new(PURPLE_TYPE_SUBTYPE, + PURPLE_SUBTYPE_SAVEDSTATUS)); + purple_signal_connect(purple_accounts_get_handle(), "account-removed", handle, PURPLE_CALLBACK(purple_savedstatus_unset_all_substatuses),