2 * CORBA/ORBit server side of GlibLogFunc object, ran by sandbox_parent()
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 "server-GlibLogFunc.h" /* self */
25 #include <glib/gmessages.h>
26 #include "captive/macros.h"
30 POA_Captive_GlibLogFunc servant;
31 PortableServer_POA poa;
32 } impl_POA_Captive_GlibLogFunc;
34 static void impl_Captive_GlibLogFunc_glibLogFunc
35 (impl_POA_Captive_GlibLogFunc *servant,const Captive_GlibLogMessage *glib_log_message,CORBA_Environment *ev);
37 static PortableServer_ServantBase__epv impl_Captive_GlibLogFunc_base_epv={
38 NULL, /* _private data */
39 NULL, /* finalize routine */
40 NULL, /* default_POA routine */
42 static POA_Captive_GlibLogFunc__epv impl_Captive_GlibLogFunc_epv={
44 (gpointer)&impl_Captive_GlibLogFunc_glibLogFunc,
46 static POA_Captive_GlibLogFunc__vepv impl_Captive_GlibLogFunc_vepv={
47 &impl_Captive_GlibLogFunc_base_epv,
48 &impl_Captive_GlibLogFunc_epv,
52 Captive_GlibLogFunc impl_Captive_GlibLogFunc__create(PortableServer_POA poa,CORBA_Environment *ev)
54 Captive_GlibLogFunc retval;
55 impl_POA_Captive_GlibLogFunc *newservant;
56 PortableServer_ObjectId *objid;
58 captive_new0(newservant); /* FIXME: leak */
59 newservant->servant.vepv=&impl_Captive_GlibLogFunc_vepv;
61 POA_Captive_GlibLogFunc__init((PortableServer_Servant)newservant,ev);
62 objid=PortableServer_POA_activate_object(poa,newservant,ev);
64 retval=PortableServer_POA_servant_to_reference(poa,newservant,ev);
70 static void impl_Captive_GlibLogFunc_glibLogFunc
71 (impl_POA_Captive_GlibLogFunc *servant,const Captive_GlibLogMessage *glib_log_message,CORBA_Environment *ev)
73 g_log(G_LOG_DOMAIN,glib_log_message->log_level,"%s",glib_log_message->message);
77 static void impl_Captive_Vfs_registerGlibLogFunc_log_func
78 (const gchar *log_domain,GLogLevelFlags log_level,const gchar *message,const Captive_GlibLogFunc obj /* user_data */)
81 Captive_GlibLogMessage glib_log_message;
84 CORBA_exception_init(&ev);
86 glib_log_message.log_level=log_level;
87 glib_log_message.message=(CORBA_string)message;
88 Captive_GlibLogFunc_glibLogFunc(obj,&glib_log_message,&ev);
89 g_assert(validate_CORBA_Environment(&ev));
92 CORBA_exception_free(&ev);
96 void impl_Captive_Vfs_registerGlibLogFunc
97 (impl_POA_Captive_Vfs *servant,const Captive_GlibLogFunc glib_log_func,CORBA_Environment *ev)
100 G_LOG_DOMAIN, /* log_domain; "Captive" */
102 | 0 /* !G_LOG_FLAG_RECURSION */
105 (GLogFunc)impl_Captive_Vfs_registerGlibLogFunc_log_func, /* log_func */
106 (gpointer)glib_log_func); /* user_data */