+static void
+container_set_view (Container *container, Component *component)
+{
+ GnomeViewFrame *view_frame;
+ GtkWidget *view_widget;
+
+ /*
+ * Create the remote view and the local ViewFrame.
+ */
+ view_frame = gnome_client_site_new_view (component->client_site);
+ component->view_frame = view_frame;
+
+ /*
+ * Set the GnomeUIHandler for this ViewFrame. That way, the
+ * embedded component can get access to our UIHandler server
+ * so that it can merge menu and toolbar items when it gets
+ * activated.
+ */
+ gnome_view_frame_set_ui_handler (view_frame, container->uih);
+
+ /*
+ * Embed the view frame into the application.
+ */
+ view_widget = gnome_view_frame_get_wrapper (view_frame);
+ container->view_widget = view_widget;
+ container->component = component;
+
+ /*
+ * In-place activation of a component is a two-step process.
+ * After the user double clicks on the component, our signal
+ * callback (compoennt_user_activate_request_cb()) asks the
+ * component to activate itself (see
+ * gnome_view_frame_view_activate()). The component can then
+ * choose to either accept or refuse activation. When an
+ * embedded component notifies us of its decision to change
+ * its activation state, the "view_activated" signal is
+ * emitted from the view frame. It is at that point that we
+ * actually remove the cover so that events can get through.
+ */
+ gtk_signal_connect (GTK_OBJECT (view_frame), "view_activated",
+ GTK_SIGNAL_FUNC (component_view_activated_cb), component);
+
+ /*
+ * The "user_context" signal is emitted when the user right
+ * clicks on the wrapper. We use it to pop up a verb menu.
+ */
+ gtk_signal_connect (GTK_OBJECT (view_frame), "user_context",
+ GTK_SIGNAL_FUNC (component_user_context_cb), component);
+
+ /*
+ * Show the component.
+ */
+ gtk_scrolled_window_add_with_viewport (container->scroll, view_widget);
+
+ /*
+ * Activate it ( get it to merge menus etc.
+ */
+ gnome_view_frame_view_activate (view_frame);
+
+ gtk_widget_show_all (GTK_WIDGET (container->scroll));
+}
+
+static GnomeObjectClient *
+container_launch_component (GnomeClientSite *client_site,
+ GnomeContainer *container,
+ char *component_goad_id)
+{
+ GnomeObjectClient *object_server;
+
+ /*
+ * Launch the component.
+ */
+ object_server = gnome_object_activate_with_goad_id (
+ NULL, component_goad_id, GOAD_ACTIVATE_SHLIB, NULL);
+
+ if (object_server == NULL)
+ return NULL;
+
+ /*
+ * Bind it to the local ClientSite. Every embedded component
+ * has a local GnomeClientSite object which serves as a
+ * container-side point of contact for the embeddable. The
+ * container talks to the embeddable through its ClientSite
+ */
+ if (!gnome_client_site_bind_embeddable (client_site, object_server)) {
+ gnome_object_unref (GNOME_OBJECT (object_server));
+ return NULL;
+ }
+
+ /*
+ * The GnomeContainer object maintains a list of the
+ * ClientSites which it manages. Here we add the new
+ * ClientSite to that list.
+ */
+ gnome_container_add (container, GNOME_OBJECT (client_site));
+
+ return object_server;
+}
+
+/*
+ * Use query_interface to see if `obj' has `interface'.
+ */
+static gboolean
+gnome_object_has_interface (GnomeObject *obj, char *interface)
+{
+ CORBA_Environment ev;
+ CORBA_Object requested_interface;
+
+ CORBA_exception_init (&ev);
+
+ requested_interface = GNOME_Unknown_query_interface (
+ gnome_object_corba_objref (obj), interface, &ev);
+
+ CORBA_exception_free (&ev);
+
+ if (!CORBA_Object_is_nil(requested_interface, &ev) &&
+ ev._major == CORBA_NO_EXCEPTION)
+ {
+ /* Get rid of the interface we've been passed */
+ CORBA_Object_release (requested_interface, &ev);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+extern "C" {
+ static Component *
+ container_activate_component (Container *container, char *component_goad_id)