1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 actions.h for the Openbox window manager
4 Copyright (c) 2007 Dana Jansens
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 See the COPYING file for a copy of the GNU General Public License.
21 static void actions_unregister(ObActionsDefinition *def);
23 struct _ObActionsDefinition {
27 ObActionsDataParseFunc parse;
28 ObActionsDataFreeFunc free;
34 static GSList *registered = NULL;
37 void actions_startup(gboolean reconfig)
44 void actions_shutdown(gboolean reconfig)
48 /* free all the registered actions */
50 actions_unregister(registered->data);
51 registered = g_slist_delete_link(registered, registered);
55 gboolean actions_register(const gchar *name,
57 ObActionsDataSetupFunc setup,
58 ObActionsDataParseFunc parse,
59 ObActionsDataFreeFunc free,
63 ObActionsDefinition *def;
65 for (it = registered; it; it = g_slist_next(it)) {
67 if (!g_ascii_strcasecmp(name, def->name)) /* already registered */
71 def = g_new(ObActionsDefinition, 1);
72 def->name = g_strdup(name);
73 def->interactive = interactive;
77 def->action_data = setup();
81 static void actions_unregister(ObActionsDefinition *def)
84 def->free(def->action_data);