- DOC_ROOT *doc = hack_global;
-
- g_return_val_if_fail (doc, FALSE);
- g_return_val_if_fail (doc->magic == DOC_ROOT_MAGIC, FALSE);
-
- if (doc->out && doc->pdf) {
- printf ("There are %d pages\n", doc->pdf->getNumPages());
-
- gdk_draw_line (doc->pixmap,
- widget->style->black_gc,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
- doc->pdf->displayPage(doc->out, 1, 1, 0, gTrue); /* 86 zoom */
- printf ("Draw pixmap %p\n", doc->pixmap);
- gdk_draw_string (doc->pixmap, widget->style->font, widget->style->black_gc,
- 10, 10, "Hello");
- gdk_draw_pixmap(widget->window,
- widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
- doc->pixmap,
- 0, 0,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
- } else
- printf ("Null pointer error %p %p\n", doc->out, doc->pdf);
-
- return FALSE;
+ 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;