- static void
- connect_signals (DOC_ROOT *doc)
- {
- GtkWidget *w;
-
- simple_menu_connect (doc, "about_menu", GTK_SIGNAL_FUNC (do_about_box));
- simple_menu_connect (doc, "close_menu", GTK_SIGNAL_FUNC (do_close));
- simple_menu_connect (doc, "exit_menu", GTK_SIGNAL_FUNC (do_exit));
-
- simple_button_connect (doc, "forward", GTK_SIGNAL_FUNC (do_forward_button));
- simple_button_connect (doc, "back", GTK_SIGNAL_FUNC (do_back_button));
- simple_button_connect (doc, "first", GTK_SIGNAL_FUNC (do_first_button));
- simple_button_connect (doc, "last", GTK_SIGNAL_FUNC (do_last_button));
-/* simple_button_connect (doc, "larger", GTK_SIGNAL_FUNC (do_larger_button)); need to resize the gtkpixmap...
- simple_button_connect (doc, "smaller", GTK_SIGNAL_FUNC (do_smaller_button)); but bed first. */
-
- gtk_signal_connect (GTK_OBJECT (doc->mainframe), "destroy",
- GTK_SIGNAL_FUNC (do_close), doc);
- }
+static void
+component_add_view (Component *component)
+{
+ GnomeViewFrame *view_frame;
+ GtkWidget *view_widget;
+
+ /*
+ * Create the remote view and the local ViewFrame.
+ */
+ view_frame = gnome_client_site_embeddable_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, component->container->uih);
+
+ /*
+ * Embed the view frame into the application.
+ */
+ view_widget = gnome_view_frame_get_wrapper (view_frame);
+ gtk_box_pack_start (GTK_BOX (component->views_hbox), view_widget,
+ FALSE, FALSE, 5);
+
+ /*
+ * 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);