+ static void
+ component_user_activate_request_cb (GnomeViewFrame *view_frame, gpointer data)
+ {
+ Component *component = (Component *) data;
+ Container *container = component->container;
+
+ /*
+ * If there is a
+ * If there is already an active View, deactivate it.
+ */
+ if (container->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 (container->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 (container->active_view_frame != NULL)
+ gnome_view_frame_set_covered (container->active_view_frame, TRUE);
+
+ container->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);
+ }
+
+ static void
+ component_view_activated_cb (GnomeViewFrame *view_frame, gboolean activated, gpointer data)
+ {
+ Component *component = (Component *) data;
+ Container *container = component->container;
+
+ if (activated) {
+ /*
+ * If the View is requesting to be activated, then we
+ * check whether or not there is already an active
+ * View.
+ */
+ if (container->active_view_frame != NULL) {
+ g_warning ("View requested to be activated but there is already "
+ "an active View!\n");
+ return;
+ }
+
+ /*
+ * Otherwise, uncover it so that it can receive
+ * events, and set it as the active View.
+ */
+ gnome_view_frame_set_covered (view_frame, FALSE);
+ container->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 == container->active_view_frame)
+ container->active_view_frame = NULL;
+ }
+ }
+
+ 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);