- 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
+container_create_menus (Container *container)
+{
+ GnomeUIHandlerMenuItem *menu_list;
+
+ gnome_ui_handler_create_menubar (container->uih);
+
+ /*
+ * Create the basic menus out of UIInfo structures.
+ */
+ menu_list = gnome_ui_handler_menu_parse_uiinfo_list_with_data (container_main_menu, container);
+ gnome_ui_handler_menu_add_list (container->uih, "/", menu_list);
+ gnome_ui_handler_menu_free_list (menu_list);
+}
+
+static void
+container_create_toolbar (Container *container)
+{
+ GnomeUIHandlerToolbarItem *toolbar;
+
+ gnome_ui_handler_create_toolbar (container->uih, "pdf");
+ toolbar = gnome_ui_handler_toolbar_parse_uiinfo_list_with_data (container_toolbar, container);
+ gnome_ui_handler_toolbar_add_list (container->uih, "/", toolbar);
+ gnome_ui_handler_toolbar_free_list (toolbar);
+}
+
+static Container *
+container_new (const char *fname)
+{
+ Container *container;
+ static GtkTargetEntry drag_types[] =
+ {
+ { "text/uri-list", 0, 0 },
+ };
+ static gint n_drag_types = sizeof (drag_types) / sizeof (drag_types [0]);
+
+ container = g_new0 (Container, 1);
+
+ container->app = gnome_app_new ("pdf-viewer",
+ "GNOME PDF viewer");
+ container->zoom = 86.0;
+
+ gtk_drag_dest_set (container->app,
+ GTK_DEST_DEFAULT_ALL,
+ drag_types, n_drag_types,
+ GDK_ACTION_COPY);
+
+ gtk_signal_connect (GTK_OBJECT(container->app),
+ "drag_data_received",
+ GTK_SIGNAL_FUNC(filenames_dropped), (gpointer)container);
+
+ gtk_window_set_default_size (GTK_WINDOW (container->app), 600, 600);
+ gtk_window_set_policy (GTK_WINDOW (container->app), TRUE, TRUE, FALSE);
+
+ container->container = gnome_container_new ();
+ container->view_widget = NULL;
+ container->scroll = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new (NULL, NULL));
+ gtk_scrolled_window_set_policy (container->scroll, GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+ gnome_app_set_contents (GNOME_APP (container->app), GTK_WIDGET (container->scroll));
+
+ /*
+ * Create the GnomeUIHandler object which will be used to
+ * create the container's menus and toolbars. The UIHandler
+ * also creates a CORBA server which embedded components use
+ * to do menu/toolbar merging.
+ */
+ container->uih = gnome_ui_handler_new ();
+ gnome_ui_handler_set_app (container->uih, GNOME_APP (container->app));
+
+ container_create_menus (container);
+ container_create_toolbar (container);
+
+ gtk_widget_show_all (container->app);
+
+ if (fname)
+ if (!open_pdf (container, fname)) {
+ container_destroy (container);
+ return NULL;
+ }
+
+ containers = g_list_append (containers, container);
+
+ gtk_widget_show_all (container->app);
+
+ return container;