Notification API. More...
Go to the source code of this file.
Functions | |
struct Notify * | notify_new (void) |
Create a new notifications handler. | |
void | notify_free (struct Notify **ptr) |
Free a notification handler. | |
void | notify_set_parent (struct Notify *notify, struct Notify *parent) |
Set the parent notification handler. | |
bool | notify_send (struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data) |
Send out a notification message. | |
bool | notify_observer_add (struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data) |
Add an observer to an object. | |
bool | notify_observer_remove (struct Notify *notify, const observer_t callback, const void *global_data) |
Remove an observer from an object. | |
void | notify_observer_remove_all (struct Notify *notify) |
Remove all the observers from an object. | |
Notification API.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file notify.h.
struct Notify * notify_new | ( | void | ) |
Create a new notifications handler.
ptr | New notification handler |
Definition at line 62 of file notify.c.
void notify_free | ( | struct Notify ** | ptr | ) |
Free a notification handler.
ptr | Notification handler to free |
Definition at line 75 of file notify.c.
Set the parent notification handler.
notify | Notification handler to alter |
parent | Parent notification handler |
Notifications are passed up the tree of handlers.
Definition at line 95 of file notify.c.
bool notify_send | ( | struct Notify * | notify, |
enum NotifyType | event_type, | ||
int | event_subtype, | ||
void * | event_data | ||
) |
Send out a notification message.
notify | Notification handler |
event_type | Type of event, e.g. NT_ACCOUNT |
event_subtype | Subtype, e.g. NT_ACCOUNT_ADD |
event_data | Private data associated with the event |
true | Successfully sent |
See send() for more details.
Definition at line 173 of file notify.c.
bool notify_observer_add | ( | struct Notify * | notify, |
enum NotifyType | type, | ||
observer_t | callback, | ||
void * | global_data | ||
) |
Add an observer to an object.
notify | Notification handler |
type | Notification type to observe, e.g. NT_WINDOW |
callback | Function to call on a matching event, see observer_t |
global_data | Private data associated with the observer |
true | Successful |
New observers are added to the front of the list, giving them higher priority than existing observers.
Definition at line 191 of file notify.c.
bool notify_observer_remove | ( | struct Notify * | notify, |
const observer_t | callback, | ||
const void * | global_data | ||
) |
Remove an observer from an object.
notify | Notification handler |
callback | Function to call on a matching event, see observer_t |
global_data | Private data to match specific callback |
true | Successful |
send()
is present higher up the call stack, removing multiple entries from the list will cause it to crash. Definition at line 230 of file notify.c.