3d8232e0a665f14d28010e8d85086dd978d95fe5
[clg] / glib / alien / callback.c
1 /* Common Lisp bindings for GTK+ v2.0
2 * Copyright (C) 1999-2002 Espen S. Johnsen <espen@users.sourceforge.net>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library 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 GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19 /* $Id: callback.c,v 1.3 2004/11/01 00:08:50 espen Exp $ */
20
21 #include <glib-object.h>
22
23 #ifdef CMUCL
24 #include "lisp.h"
25
26 void (*log_handler) (gchar*, guint, gchar*);
27 #endif
28
29
30
31 GClosure*
32 clg_callback_closure_new (gpointer callback_id, gpointer callback,
33 gpointer destroy_notify)
34 {
35 GClosure *closure;
36
37 closure = g_closure_new_simple (sizeof (GClosure), (gpointer)callback_id);
38 g_closure_set_meta_marshal (closure, callback_id, callback);
39 g_closure_add_finalize_notifier (closure, callback_id, destroy_notify);
40
41 return closure;
42 }
43
44
45 void
46 g_logv (const gchar *log_domain,
47 GLogLevelFlags log_level,
48 const gchar *format,
49 va_list args1)
50 {
51 gchar *msg = g_strdup_vprintf (format, args1);
52 log_handler (log_domain, log_level, msg);
53
54 /* Normally log_handler won't return, so we will be leaking this memory */
55 g_free (msg);
56 }