File: bonobo-shlib-factory.h

package info (click to toggle)
bonobo 1.0.22-2.2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 13,412 kB
  • ctags: 5,445
  • sloc: ansic: 51,714; sh: 7,733; makefile: 1,425; yacc: 318; xml: 266; sed: 16
file content (120 lines) | stat: -rw-r--r-- 5,278 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
 * bonobo-shlib-factory.h: a ShlibFactory object.
 *
 * Author:
 *    Michael Meeks (michael@helixcode.com)
 *
 * Copyright 2000 Helix Code, Inc.
 */
#ifndef _BONOBO_SHLIB_FACTORY_H_
#define _BONOBO_SHLIB_FACTORY_H_

#include <libgnome/gnome-defs.h>
#include <gtk/gtkobject.h>
#include <bonobo/Bonobo.h>
#include <bonobo/bonobo-object.h>
#include <liboaf/oaf.h>
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-exception.h>

BEGIN_GNOME_DECLS
 
#define BONOBO_SHLIB_FACTORY_TYPE        (bonobo_shlib_factory_get_type ())
#define BONOBO_SHLIB_FACTORY(o)          (GTK_CHECK_CAST ((o), BONOBO_SHLIB_FACTORY_TYPE, BonoboShlibFactory))
#define BONOBO_SHLIB_FACTORY_CLASS(k)    (GTK_CHECK_CLASS_CAST((k), BONOBO_SHLIB_FACTORY_TYPE, BonoboShlibFactoryClass))
#define BONOBO_IS_SHLIB_FACTORY(o)       (GTK_CHECK_TYPE ((o), BONOBO_SHLIB_FACTORY_TYPE))
#define BONOBO_IS_SHLIB_FACTORY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), BONOBO_SHLIB_FACTORY_TYPE))

#define BONOBO_OAF_SHLIB_FACTORY_MULTI(oafiid, descr, fn, data)               \
static CORBA_Object                                                           \
make_factory (PortableServer_POA poa, const char *iid, gpointer impl_ptr,     \
	      CORBA_Environment *ev)                                          \
{                                                                             \
	BonoboShlibFactory *f;                                                \
        CORBA_Object object_ref;                                              \
	f = bonobo_shlib_factory_new_multi (oafiid, poa, impl_ptr, fn, data); \
        object_ref = bonobo_object_corba_objref (BONOBO_OBJECT (f));          \
        if (BONOBO_EX (ev) || !object_ref) {                                  \
		g_warning ("cannot get objref: '%s'",                         \
			   bonobo_exception_get_text (ev));                   \
                return CORBA_OBJECT_NIL;                                      \
        }                                                                     \
        return CORBA_Object_duplicate (object_ref, ev);                       \
}                                                                             \
static OAFPluginObject plugin_list[] = {{oafiid, make_factory}, { NULL } };   \
const OAFPlugin OAF_Plugin_info = { plugin_list, descr };

#define BONOBO_OAF_SHLIB_FACTORY(oafiid, descr, fn, data)                     \
static CORBA_Object                                                           \
make_factory (PortableServer_POA poa, const char *iid, gpointer impl_ptr,     \
	      CORBA_Environment *ev)                                          \
{                                                                             \
	BonoboShlibFactory *f;                                                \
        CORBA_Object object_ref;                                              \
	f = bonobo_shlib_factory_new (oafiid, poa, impl_ptr, fn, data);       \
        object_ref = bonobo_object_corba_objref (BONOBO_OBJECT (f));          \
        if (BONOBO_EX (ev) || !object_ref) {                                  \
		g_warning ("cannot get objref: '%s'",                         \
			   bonobo_exception_get_text (ev));                   \
                return CORBA_OBJECT_NIL;                                      \
        }                                                                     \
        return CORBA_Object_duplicate (object_ref, ev);                       \
}                                                                             \
static OAFPluginObject plugin_list[] = {{oafiid, make_factory}, { NULL } };   \
const OAFPlugin OAF_Plugin_info = { plugin_list, descr };

typedef struct _BonoboShlibFactoryPrivate BonoboShlibFactoryPrivate;
					
typedef struct {
	BonoboGenericFactory base;

	int                  live_objects;
	gpointer             oaf_impl_ptr;

	BonoboShlibFactoryPrivate *priv;
} BonoboShlibFactory;

typedef struct {
	BonoboGenericFactoryClass parent_class;
} BonoboShlibFactoryClass;

GtkType             bonobo_shlib_factory_get_type  (void);

BonoboShlibFactory *bonobo_shlib_factory_construct (
	BonoboShlibFactory    *c_factory,
	const char            *component_id,
	PortableServer_POA     poa,
	gpointer               oaf_impl_ptr,
	CORBA_Object           corba_factory,
	BonoboGenericFactoryFn factory,
	GnomeFactoryCallback   factory_cb,
	void                  *data);

BonoboShlibFactory *bonobo_shlib_factory_new (
	const char            *component_id,
	PortableServer_POA     poa,
	gpointer               oaf_impl_ptr,
	BonoboGenericFactoryFn factory,
	gpointer               user_data);

BonoboShlibFactory *bonobo_shlib_factory_new_multi (
	const char            *component_id,
	PortableServer_POA     poa,
	gpointer               oaf_impl_ptr,
	GnomeFactoryCallback   factory_cb,
	gpointer               user_data);

void                bonobo_shlib_factory_track_object (
	BonoboShlibFactory    *factory,
	BonoboObject          *object);

void                bonobo_shlib_factory_inc_live     (
	BonoboShlibFactory    *factory);

void                bonobo_shlib_factory_dec_live     (
	BonoboShlibFactory    *factory);

END_GNOME_DECLS

#endif