+static GnomeObjectClient *
+launch_server_moniker (GnomeClientSite *client_site, GnomeContainer *container, char *moniker)
+{
+ GnomeObjectClient *object_server;
+
+ gnome_container_add (container, GNOME_OBJECT (client_site));
+
+ printf ("Launching moniker %s...\n", moniker);
+ object_server = gnome_object_activate (moniker, GOAD_ACTIVATE_SHLIB);
+ printf ("Return: %p\n", object_server);
+ if (!object_server){
+ g_warning (_("Can not activate object_server\n"));
+ return NULL;
+ }
+
+ if (!gnome_client_site_bind_embeddable (client_site, object_server)){
+ g_warning (_("Can not bind object server to client_site\n"));
+ return NULL;
+ }
+
+ return object_server;
+}
+
+/*
+ * This function is called when the user double clicks on a View in
+ * order to activate it.
+ */
+static gint
+user_activation_request_cb (GnomeViewFrame *view_frame)
+{
+ /*
+ * If there is already an active View, deactivate it.
+ */
+ if (active_view_frame != NULL) {
+ /*
+ * This just sends a notice to the embedded View that
+ * it is being deactivated. We will also forcibly
+ * cover it so that it does not receive any Gtk
+ * events.
+ */
+ gnome_view_frame_view_deactivate (active_view_frame);
+
+ /*
+ * Here we manually cover it if it hasn't acquiesced.
+ * If it has consented to be deactivated, then it will
+ * already have notified us that it is inactive, and
+ * we will have covered it and set active_view_frame
+ * to NULL. Which is why this check is here.
+ */
+ if (active_view_frame != NULL)
+ gnome_view_frame_set_covered (active_view_frame, TRUE);
+
+ active_view_frame = NULL;
+ }
+
+ /*
+ * Activate the View which the user clicked on. This just
+ * sends a request to the embedded View to activate itself.
+ * When it agrees to be activated, it will notify its
+ * ViewFrame, and our view_activated_cb callback will be
+ * called.
+ *
+ * We do not uncover the View here, because it may not wish to
+ * be activated, and so we wait until it notifies us that it
+ * has been activated to uncover it.
+ */
+ gnome_view_frame_view_activate (view_frame);
+
+ return FALSE;
+}
+
+/*
+ * Gets called when the View notifies the ViewFrame that it would like
+ * to be activated or deactivated.
+ */
+static gint
+view_activated_cb (GnomeViewFrame *view_frame, gboolean activated)
+{
+
+ if (activated) {
+ /*
+ * If the View is requesting to be activated, then we
+ * check whether or not there is already an active
+ * View.
+ */
+ if (active_view_frame != NULL) {
+ g_warning ("View requested to be activated but there is already "
+ "an active View!\n");
+ return FALSE;
+ }
+
+ /*
+ * Otherwise, uncover it so that it can receive
+ * events, and set it as the active View.
+ */
+ gnome_view_frame_set_covered (view_frame, FALSE);
+ active_view_frame = view_frame;
+ } else {
+ /*
+ * If the View is asking to be deactivated, always
+ * oblige. We may have already deactivated it (see
+ * user_activation_request_cb), but there's no harm in
+ * doing it again. There is always the possibility
+ * that a View will ask to be deactivated when we have
+ * not told it to deactivate itself, and that is
+ * why we cover the view here.
+ */
+ gnome_view_frame_set_covered (view_frame, TRUE);
+
+ if (view_frame == active_view_frame)
+ active_view_frame = NULL;
+ }
+
+ return FALSE;
+}
+
+static GnomeViewFrame *
+add_view (Application *app,
+ GnomeClientSite *client_site, GnomeObjectClient *server)
+{
+ GnomeViewFrame *view_frame;
+ GtkWidget *view_widget;
+
+ view_frame = gnome_client_site_embeddable_new_view (client_site);
+
+ gtk_signal_connect (GTK_OBJECT (view_frame), "user_activate",
+ GTK_SIGNAL_FUNC (user_activation_request_cb), NULL);
+ gtk_signal_connect (GTK_OBJECT (view_frame), "view_activated",
+ GTK_SIGNAL_FUNC (view_activated_cb), NULL);