+ static void
+ component_user_context_cb (GnomeViewFrame *view_frame, gpointer data)
+ {
+ Component *component = (Component *) data;
+ char *executed_verb;
+ GList *l;
+
+ /*
+ * See if the remote GnomeEmbeddable supports any verbs at
+ * all.
+ */
+ l = gnome_client_site_get_verbs (component->client_site);
+ if (l == NULL)
+ return;
+ gnome_client_site_free_verbs (l);
+
+ /*
+ * Popup the verb popup and execute the chosen verb. This
+ * function saves us the work of creating the menu, connecting
+ * the callback, and executing the verb on the remove
+ * GnomeView. We could implement all this functionality
+ * ourselves if we wanted.
+ */
+ executed_verb = gnome_view_frame_popup_verbs (view_frame);
+
+ g_free (executed_verb);
+ }
+}
+
+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;
+/* gtk_box_pack_start (GTK_BOX (container->app), view_widget,
+ FALSE, FALSE, 5);*/
+ gnome_app_set_contents (GNOME_APP (container->app), view_widget);
+ /*
+ * The "user_activate" signal will be emitted when the user
+ * double clicks on the "cover". The cover is a transparent
+ * window which sits on top of the component and keeps any
+ * events (mouse, keyboard) from reaching it. When the user
+ * double clicks on the cover, the container (that's us)
+ * can choose to activate the component.
+ */
+ gtk_signal_connect (GTK_OBJECT (view_frame), "user_activate",
+ GTK_SIGNAL_FUNC (component_user_activate_request_cb), 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_widget_show_all (view_widget);
+}
+
+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;