1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ |
---|
2 | /** |
---|
3 | * Bonobo Unknown interface base implementation |
---|
4 | * |
---|
5 | * Authors: |
---|
6 | * Miguel de Icaza (miguel@kernel.org) |
---|
7 | * Michael Meeks (michael@helixcode.com) |
---|
8 | * |
---|
9 | * Copyright 1999,2000 Helix Code, Inc. |
---|
10 | */ |
---|
11 | #ifndef _BONOBO_OBJECT_H_ |
---|
12 | #define _BONOBO_OBJECT_H_ |
---|
13 | |
---|
14 | #include <libgnome/gnome-defs.h> |
---|
15 | #include <gtk/gtkobject.h> |
---|
16 | #include <bonobo/Bonobo.h> |
---|
17 | |
---|
18 | BEGIN_GNOME_DECLS |
---|
19 | |
---|
20 | #undef BONOBO_OBJECT_DEBUG |
---|
21 | |
---|
22 | #define BONOBO_OBJECT_TYPE (bonobo_object_get_type ()) |
---|
23 | #define BONOBO_OBJECT(o) (GTK_CHECK_CAST ((o), BONOBO_OBJECT_TYPE, BonoboObject)) |
---|
24 | #define BONOBO_OBJECT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), BONOBO_OBJECT_TYPE, BonoboObjectClass)) |
---|
25 | #define BONOBO_IS_OBJECT(o) (GTK_CHECK_TYPE ((o), BONOBO_OBJECT_TYPE)) |
---|
26 | #define BONOBO_IS_OBJECT_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), BONOBO_OBJECT_TYPE)) |
---|
27 | |
---|
28 | #define BONOBO_OBJREF(o) (bonobo_object_corba_objref(BONOBO_OBJECT(o))) |
---|
29 | #define BONOBO_OBJECT_IS_LOCAL(o) ((o)->servant && (o)->vepv) |
---|
30 | |
---|
31 | /* |
---|
32 | * If you're using a custom servant for your CORBA objects, just make |
---|
33 | * sure that the second element is a 'gpointer' to hold the BonoboObject |
---|
34 | * pointer for servant->BonoboObject translation |
---|
35 | */ |
---|
36 | typedef struct { |
---|
37 | POA_Bonobo_Unknown servant_placeholder; |
---|
38 | gpointer bonobo_object; |
---|
39 | } BonoboObjectServant; |
---|
40 | |
---|
41 | typedef struct _BonoboObjectPrivate BonoboObjectPrivate; |
---|
42 | |
---|
43 | typedef struct { |
---|
44 | GtkObject base; |
---|
45 | |
---|
46 | Bonobo_Unknown corba_objref; |
---|
47 | gpointer servant; |
---|
48 | BonoboObjectPrivate *priv; |
---|
49 | } BonoboObject; |
---|
50 | |
---|
51 | typedef struct { |
---|
52 | GtkObjectClass parent_class; |
---|
53 | |
---|
54 | /* |
---|
55 | * signals. |
---|
56 | */ |
---|
57 | void (*query_interface) (BonoboObject *object, const char *repo_id, CORBA_Object *retval); |
---|
58 | void (*system_exception)(BonoboObject *object, CORBA_Object cobject, CORBA_Environment *ev); |
---|
59 | |
---|
60 | gpointer expansion; /* Used by XObject */ |
---|
61 | } BonoboObjectClass; |
---|
62 | |
---|
63 | GtkType bonobo_object_get_type (void); |
---|
64 | BonoboObject *bonobo_object_construct (BonoboObject *object, |
---|
65 | CORBA_Object corba_object); |
---|
66 | BonoboObject *bonobo_object_new_from_servant (void *servant); |
---|
67 | BonoboObject *bonobo_object_from_servant (PortableServer_Servant servant); |
---|
68 | void bonobo_object_bind_to_servant (BonoboObject *object, |
---|
69 | void *servant); |
---|
70 | PortableServer_Servant bonobo_object_get_servant (BonoboObject *object); |
---|
71 | Bonobo_Unknown bonobo_object_activate_servant_full (BonoboObject *object, |
---|
72 | void *servant, |
---|
73 | gpointer shlib_id); |
---|
74 | Bonobo_Unknown bonobo_object_activate_servant (BonoboObject *object, |
---|
75 | void *servant); |
---|
76 | void bonobo_object_add_interface (BonoboObject *object, |
---|
77 | BonoboObject *newobj); |
---|
78 | BonoboObject *bonobo_object_query_local_interface (BonoboObject *object, |
---|
79 | const char *repo_id); |
---|
80 | Bonobo_Unknown bonobo_object_query_interface (BonoboObject *object, |
---|
81 | const char *repo_id); |
---|
82 | Bonobo_Unknown bonobo_object_corba_objref (BonoboObject *object); |
---|
83 | |
---|
84 | /* |
---|
85 | * Gnome Object Life Cycle |
---|
86 | */ |
---|
87 | Bonobo_Unknown bonobo_object_dup_ref (Bonobo_Unknown object, |
---|
88 | CORBA_Environment *ev); |
---|
89 | void bonobo_object_release_unref (Bonobo_Unknown object, |
---|
90 | CORBA_Environment *ev); |
---|
91 | void bonobo_object_ref (BonoboObject *object); |
---|
92 | void bonobo_object_idle_unref (BonoboObject *object); |
---|
93 | void bonobo_object_unref (BonoboObject *object); |
---|
94 | POA_Bonobo_Unknown__epv *bonobo_object_get_epv (void); |
---|
95 | void bonobo_object_init (void); |
---|
96 | void bonobo_object_trace_refs (BonoboObject *object, |
---|
97 | const char *fn, |
---|
98 | int line, |
---|
99 | gboolean ref); |
---|
100 | #ifdef BONOBO_OBJECT_DEBUG |
---|
101 | # define bonobo_object_ref(o) G_STMT_START{bonobo_object_trace_refs((o),G_GNUC_PRETTY_FUNCTION,__LINE__,TRUE);}G_STMT_END |
---|
102 | # define bonobo_object_unref(o) G_STMT_START{bonobo_object_trace_refs((o),G_GNUC_PRETTY_FUNCTION,__LINE__,FALSE);}G_STMT_END |
---|
103 | #endif /* BONOBO_OBJECT_DEBUG */ |
---|
104 | void bonobo_object_dump_interfaces (BonoboObject *object); |
---|
105 | |
---|
106 | /* |
---|
107 | * Error checking |
---|
108 | */ |
---|
109 | void bonobo_object_check_env (BonoboObject *object, |
---|
110 | CORBA_Object corba_object, |
---|
111 | CORBA_Environment *ev); |
---|
112 | |
---|
113 | #define BONOBO_OBJECT_CHECK(o,c,e) \ |
---|
114 | G_STMT_START { \ |
---|
115 | if ((e)->_major != CORBA_NO_EXCEPTION) \ |
---|
116 | bonobo_object_check_env(o,c,e); \ |
---|
117 | } G_STMT_END |
---|
118 | |
---|
119 | /* |
---|
120 | * Others |
---|
121 | */ |
---|
122 | gboolean bonobo_unknown_ping (Bonobo_Unknown object); |
---|
123 | void bonobo_object_list_unref_all (GList **list); |
---|
124 | void bonobo_object_slist_unref_all (GSList **list); |
---|
125 | |
---|
126 | END_GNOME_DECLS |
---|
127 | |
---|
128 | #endif |
---|