diff options
| author | Dana Jansens <danakj@orodu.net> | 2010-02-11 10:25:22 -0500 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2010-02-11 11:01:18 -0500 |
| commit | 2202f11f239bb33e49c05aa73b51e7418748cb6b (patch) | |
| tree | a9cf7fa0fe3b12b7b39978e247a965dbd04fe493 /openbox/actions.c | |
| parent | c168faee634d3c3f9494b2a4da89b80d10f311ce (diff) | |
add an optional shutdown function which actions can register
Diffstat (limited to 'openbox/actions.c')
| -rw-r--r-- | openbox/actions.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/openbox/actions.c b/openbox/actions.c index 023fab3a..35d5cc25 100644 --- a/openbox/actions.c +++ b/openbox/actions.c @@ -49,6 +49,7 @@ struct _ObActionsDefinition { } setup; ObActionsDataFreeFunc free; ObActionsRunFunc run; + ObActionsShutdownFunc shutdown; }; struct _ObActionsAct { @@ -79,7 +80,9 @@ void actions_shutdown(gboolean reconfig) /* free all the registered actions */ while (registered) { - actions_definition_unref(registered->data); + ObActionsDefinition *d = registered->data; + if (d->shutdown) d->shutdown(); + actions_definition_unref(d); registered = g_slist_delete_link(registered, registered); } } @@ -135,6 +138,22 @@ gboolean actions_register(const gchar *name, return def != NULL; } +gboolean actions_set_shutdown(const gchar *name, + ObActionsShutdownFunc shutdown) +{ + GSList *it; + ObActionsDefinition *def; + + for (it = registered; it; it = g_slist_next(it)) { + def = it->data; + if (!g_ascii_strcasecmp(name, def->name)) { + def->shutdown = shutdown; + return TRUE; + } + } + return FALSE; +} + static void actions_definition_ref(ObActionsDefinition *def) { ++def->ref; |
