]> www.fi.muni.cz Git - evince.git/blobdiff - pdf/xpdf/gpdf.cc
Completely synched with Xpdf 0.90
[evince.git] / pdf / xpdf / gpdf.cc
index 3c2a45f3632eafd54d882898eb7ea8fa739fecc1..a4f64a2e059c8fcf4f26dadaef3fda83990453a4 100644 (file)
@@ -4,6 +4,7 @@
  * Author:
  *   Michael Meeks <michael@imaginator.com>
  */
  * Author:
  *   Michael Meeks <michael@imaginator.com>
  */
+#include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
@@ -19,7 +20,6 @@ extern "C" {
 #include <bonobo.h>
 #undef  GString 
 }
 #include <bonobo.h>
 #undef  GString 
 }
-#include "config.h"
 #include "bonobo-application-x-pdf.h"
 
 poptContext ctx;
 #include "bonobo-application-x-pdf.h"
 
 poptContext ctx;
@@ -49,7 +49,7 @@ struct  _Component {
        Container         *container;
 
        BonoboClientSite   *client_site;
        Container         *container;
 
        BonoboClientSite   *client_site;
-       BonoboViewFrame   *view_frame;
+       BonoboViewFrame    *view_frame;
        BonoboObjectClient *server;
 };
 
        BonoboObjectClient *server;
 };
 
@@ -98,7 +98,7 @@ extern "C" {
     g_return_val_if_fail (container->view_widget == NULL, FALSE);
 
     comp = container_activate_component (
     g_return_val_if_fail (container->view_widget == NULL, FALSE);
 
     comp = container_activate_component (
-           container, "OAFIID:gpdf_component:892f2727-e2ec-423c-91ad-6f7b75fec6c8");
+           container, "OAFIID:GNOME_XPDF_Embeddable");
 
     if (!comp || !(object = comp->server)) {
       gnome_error_dialog (_("Could not launch bonobo object."));
 
     if (!comp || !(object = comp->server)) {
       gnome_error_dialog (_("Could not launch bonobo object."));
@@ -106,7 +106,7 @@ extern "C" {
     }
     
     CORBA_exception_init (&ev);
     }
     
     CORBA_exception_init (&ev);
-    persist = Bonobo_Unknown_query_interface (
+    persist = Bonobo_Unknown_queryInterface (
       bonobo_object_corba_objref (BONOBO_OBJECT (object)),
       "IDL:Bonobo/PersistStream:1.0", &ev);
     
       bonobo_object_corba_objref (BONOBO_OBJECT (object)),
       "IDL:Bonobo/PersistStream:1.0", &ev);
     
@@ -119,7 +119,7 @@ extern "C" {
     stream = bonobo_stream_open (BONOBO_IO_DRIVER_FS, name, Bonobo_Storage_READ, 0);
     
     if (stream == NULL) {
     stream = bonobo_stream_open (BONOBO_IO_DRIVER_FS, name, Bonobo_Storage_READ, 0);
     
     if (stream == NULL) {
-      char *err = g_strconcat (_("Could not open "), name, NULL);
+      char *err = g_strdup_printf (_("Could not open %s"), name);
       gnome_error_dialog_parented (err, GTK_WINDOW(container->app));
       g_free (err);
       return FALSE;
       gnome_error_dialog_parented (err, GTK_WINDOW(container->app));
       g_free (err);
       return FALSE;
@@ -196,7 +196,7 @@ extern "C" {
        g_free (fname);
       } else {
        GtkWidget *dialog;
        g_free (fname);
       } else {
        GtkWidget *dialog;
-       dialog = gnome_message_box_new ("Can't open a directory",
+       dialog = gnome_message_box_new (_("Can't open a directory"),
                                        GNOME_MESSAGE_BOX_ERROR,
                                        GNOME_STOCK_BUTTON_OK, NULL);
        gnome_dialog_set_parent (GNOME_DIALOG (dialog),
                                        GNOME_MESSAGE_BOX_ERROR,
                                        GNOME_STOCK_BUTTON_OK, NULL);
        gnome_dialog_set_parent (GNOME_DIALOG (dialog),
@@ -290,7 +290,7 @@ extern "C" {
 static void
 container_dump_cmd (GtkWidget *widget, Container *container)
 {
 static void
 container_dump_cmd (GtkWidget *widget, Container *container)
 {
-       bonobo_win_dump (BONOBO_WIN (container->app), "on demand");
+       bonobo_window_dump (BONOBO_WINDOW(container->app), "on demand");
 }
 
 static void
 }
 
 static void
@@ -383,13 +383,6 @@ container_launch_component (BonoboClientSite    *client_site,
                return NULL;
        }
 
                return NULL;
        }
 
-       /*
-        * The BonoboContainer object maintains a list of the
-        * ClientSites which it manages.  Here we add the new
-        * ClientSite to that list.
-        */
-       bonobo_item_container_add (container, BONOBO_OBJECT (client_site));
-
        return object_server;
 }
 
        return object_server;
 }
 
@@ -481,8 +474,8 @@ container_new (const char *fname)
        
        container = g_new0 (Container, 1);
 
        
        container = g_new0 (Container, 1);
 
-       container->app = bonobo_win_new ("pdf-viewer",
-                                        "GNOME PDF viewer");
+       container->app = bonobo_window_new ("pdf-viewer",
+                                        _("GNOME PDF viewer"));
 
        gtk_drag_dest_set (container->app,
                           GTK_DEST_DEFAULT_ALL,
 
        gtk_drag_dest_set (container->app,
                           GTK_DEST_DEFAULT_ALL,
@@ -502,7 +495,7 @@ container_new (const char *fname)
        container->slot = gtk_event_box_new ();
        gtk_widget_show (container->slot);
 
        container->slot = gtk_event_box_new ();
        gtk_widget_show (container->slot);
 
-       bonobo_win_set_contents (BONOBO_WIN (container->app),
+       bonobo_window_set_contents (BONOBO_WINDOW(container->app),
                                 GTK_WIDGET (container->slot));
        gtk_widget_show_all (container->slot);
 
                                 GTK_WIDGET (container->slot));
        gtk_widget_show_all (container->slot);
 
@@ -511,7 +504,7 @@ container_new (const char *fname)
                             GTK_SIGNAL_FUNC (container_destroy_cb), container);
 
        ui_container = bonobo_ui_container_new ();
                             GTK_SIGNAL_FUNC (container_destroy_cb), container);
 
        ui_container = bonobo_ui_container_new ();
-       bonobo_ui_container_set_win (ui_container, BONOBO_WIN (container->app));
+       bonobo_ui_container_set_win (ui_container, BONOBO_WINDOW(container->app));
 
        container->ui_component = bonobo_ui_component_new ("gpdf");
        bonobo_ui_component_set_container (
 
        container->ui_component = bonobo_ui_component_new ("gpdf");
        bonobo_ui_component_set_container (
@@ -541,46 +534,49 @@ container_new (const char *fname)
 int
 main (int argc, char **argv)
 {
 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);
-  
-
-  gnomelib_register_popt_table (oaf_popt_options, "OAF");
-  gnome_init_with_popt_table("PDFViewer", "0.0.1",
-                            argc, argv,
-                            gpdf_popt_options, 0, &ctx); 
-  orb = oaf_init (argc, argv);
-
-  CORBA_exception_free (&ev);
-
-  if (bonobo_init (orb, NULL, NULL) == FALSE)
-    g_error (_("Could not initialize Bonobo!\n"));
-  bonobo_activate ();
-
-  view_files = poptGetArgs (ctx);
-
-  /* Load files */
-  i = 0;
-  loaded = FALSE;
-  if (view_files) {
-    for (i = 0; view_files[i]; i++)
-      if (container_new (view_files[i])) {
-       loaded = TRUE;
-       while (gtk_events_pending ())
-         gtk_main_iteration ();
-      }
-  }
-  if ((i == 0) || !loaded)
-    container_new (NULL);
-  
-  poptFreeContext (ctx);
-
-  gtk_main ();
+       CORBA_Environment ev;
+       CORBA_ORB         orb;
+       const char      **view_files = NULL;
+       gboolean          loaded;
+       int               i;
+
+       bindtextdomain (PACKAGE, GNOMELOCALEDIR);
+       textdomain (PACKAGE);
+       setlocale (LC_ALL, "");
+       
+       CORBA_exception_init (&ev);
+       
+       gnomelib_register_popt_table (oaf_popt_options, "OAF");
+       gnome_init_with_popt_table("PDFViewer", "0.0.1",
+                                  argc, argv,
+                                  gpdf_popt_options, 0, &ctx); 
+       orb = oaf_init (argc, argv);
+       
+       CORBA_exception_free (&ev);
+       
+       if (bonobo_init (orb, NULL, NULL) == FALSE)
+               g_error (_("Could not initialize Bonobo!\n"));
+       bonobo_activate ();
+       
+       view_files = poptGetArgs (ctx);
+       
+       /* Load files */
+       i = 0;
+       loaded = FALSE;
+       if (view_files) {
+               for (i = 0; view_files[i]; i++)
+                       if (container_new (view_files[i])) {
+                               loaded = TRUE;
+                               while (gtk_events_pending ())
+                                       gtk_main_iteration ();
+                       }
+       }
+       if ((i == 0) || !loaded)
+               container_new (NULL);
+       
+       poptFreeContext (ctx);
+       
+       gtk_main ();
        
        
-  return 0;
+       return 0;
 }
 }