+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");
+
+ 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 = bonobo_container_new ();
+ container->view_widget = NULL;
+ container->slot = gtk_event_box_new ();
+ gtk_widget_show (container->slot);
+
+ gnome_app_set_contents (GNOME_APP (container->app), GTK_WIDGET (container->slot));
+
+ gtk_object_set_data (GTK_OBJECT (container->app), "container_data", container);
+ gtk_signal_connect (GTK_OBJECT (container->app), "delete_event",
+ GTK_SIGNAL_FUNC (container_destroy_cb), container);
+
+ /*
+ * Create the BonoboUIHandler 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 = bonobo_ui_handler_new ();
+ bonobo_ui_handler_set_app (container->uih, GNOME_APP (container->app));
+
+ container_create_menus (container);
+ container_create_toolbar (container);
+
+ gtk_widget_show_all (container->app);
+
+ containers = g_list_append (containers, container);
+
+ if (fname)
+ if (!open_pdf (container, fname)) {
+ container_destroy (container);
+ return NULL;
+ }
+
+ gtk_widget_show_all (container->app);
+
+ return container;
+}
+
+int
+main (int argc, char **argv)
+{
+ CORBA_Environment ev;
+ CORBA_ORB orb;
+ const char **view_files = NULL;
+ gboolean loaded;
+ int i;
+
+ CORBA_exception_init (&ev);