2 * Code of leaving libcaptive to be called to cleanup W32 fs state
3 * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; exactly version 2 of June 1991 is required
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "captive/leave.h" /* self */
23 #include <glib/gtypes.h>
24 #include <glib/gmessages.h>
25 #include "captive/macros.h"
26 #include <glib/ghook.h>
30 static GHookList captive_leave_hooklist;
33 static void captive_leave_hooklist_init(void)
35 if (captive_leave_hooklist.is_setup)
38 g_hook_list_init(&captive_leave_hooklist,sizeof(GHook));
42 void captive_leave(void)
44 GHookList captive_leave_hooklist_local;
47 captive_leave_hooklist_init();
48 if (!captive_leave_hooklist.hooks)
51 captive_leave_hooklist_local=captive_leave_hooklist;
52 captive_leave_hooklist.is_setup=FALSE;
54 g_hook_list_invoke(&captive_leave_hooklist_local,
55 FALSE); /* may_recurse */
56 g_hook_list_clear(&captive_leave_hooklist_local);
61 void captive_leave_register(captive_leave_func func,gpointer data)
65 g_return_if_fail(func!=NULL);
67 captive_leave_hooklist_init();
69 ghook=g_hook_alloc(&captive_leave_hooklist);
72 g_hook_append(&captive_leave_hooklist,ghook);