[passepartout] all the dialogs are properly translatable now



commit 50b94bbc4ad49265151244099a064e1e358a1e0b
Author: Sven Herzberg <herzi lanedo com>
Date:   Tue Apr 28 10:00:01 2009 +0200

    all the dialogs are properly translatable now
    
    * po/POTFILES.in: added the translatable files
    * src/pptout/config.cc,
    * src/pptout/config.h,
    * src/pptout/docpropsdialog.cc,
    * src/pptout/document/basicframe.cc,
    * src/pptout/document/imageframe.cc,
    * src/pptout/document/rasterframe.cc,
    * src/pptout/document/textframe.cc,
    * src/pptout/imagemeta.cc,
    * src/pptout/preferencesdialog.cc,
    * src/pptout/propertiesdialog.cc,
    * src/pptout/rastermeta.cc,
    * src/pptout/streamdialog.cc,
    * src/pptout/textmeta.cc,
    * src/pptout/widget/filesel.cc,
    * src/pptout/widget/programs.cc: added translation markers to everything that
      can be displayed
---
 po/POTFILES.in                     |   15 ++++++++-
 src/pptout/config.cc               |   42 +++++++++++++++---------
 src/pptout/config.h                |    2 +
 src/pptout/docpropsdialog.cc       |   28 +++++++++++------
 src/pptout/document/basicframe.cc  |    3 +-
 src/pptout/document/imageframe.cc  |    3 +-
 src/pptout/document/rasterframe.cc |    3 +-
 src/pptout/document/textframe.cc   |    3 +-
 src/pptout/imagemeta.cc            |    7 ++--
 src/pptout/preferencesdialog.cc    |   60 ++++++++++++++++++-----------------
 src/pptout/propertiesdialog.cc     |   28 +++++++++--------
 src/pptout/rastermeta.cc           |   18 ++++++-----
 src/pptout/streamdialog.cc         |   45 ++++++++++++++------------
 src/pptout/textmeta.cc             |   13 ++++---
 src/pptout/widget/filesel.cc       |    4 ++-
 src/pptout/widget/programs.cc      |   15 +++++++--
 16 files changed, 174 insertions(+), 115 deletions(-)

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 8626a93..685fec0 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,6 +1,19 @@
-passepartout.desktop.in
 data/passepartout.xml.in
+passepartout.desktop.in
 src/pptout/aboutdialog.cc
+src/pptout/config.cc
+src/pptout/docpropsdialog.cc
+src/pptout/document/basicframe.cc
+src/pptout/document/imageframe.cc
+src/pptout/document/rasterframe.cc
+src/pptout/document/textframe.cc
+src/pptout/imagemeta.cc
 src/pptout/main.cc
+src/pptout/preferencesdialog.cc
+src/pptout/propertiesdialog.cc
+src/pptout/rastermeta.cc
+src/pptout/streamdialog.cc
+src/pptout/textmeta.cc
+src/pptout/widget/filesel.cc
 src/pptout/window.cc
 src/pptout/windowmenus.cc
diff --git a/src/pptout/config.cc b/src/pptout/config.cc
index 7a144ca..5ca8fc5 100644
--- a/src/pptout/config.cc
+++ b/src/pptout/config.cc
@@ -1,33 +1,40 @@
 ///
 // Copyright (C) 2002 - 2004, Fredrik Arnerup & Rasmus Kaj, See COPYING
 ///
+#include "defines.h"
+
 #include "config.h"
+
 #include "preferencesdialog.h"
 
 #include <fstream>
 
+#include "i18n.h"
 #include "util/warning.h"
 #include "util/filesys.h"
 #include "propbase.h"
+#include <glib/gi18n.h>
 
 PFile PFile::instance = PFile();
 PFile &config = PFile::instance;
 
-PFile::PFile(): 
-  ReshapeBoxSize("ReshapeBoxSize", "Size of reshape handles"),
-  DefaultResolution("DefaultResolution", "Default image resolution"),
-  ZoomLevel("ZoomLevel", "Default page zoom level"),
-  StartPage("StartPage", "Default start page in a new document"),
-  Landscape("Landscape", "Landscape format is default"),
-  FakeTransparency("FakeTransparency", "White is transparent"),
-  SingleSided("SingleSided", "Pages are single-sided"),
-  PaperName("PaperName", "Default paper"),
-  PrintCommand("PrintCommand", "Printing command"),
-  StylesheetPath("StylesheetPath", "Path to look for XSLT files in"),
-  DefaultStylesheet("DefaultStylesheet", "Default text stylesheet"),
-  DocTemplatePath("DocTemplatePath", "Default document template"),
-  PSInterpreter("PSInterpreter", "Command to run Ghostscript"),
-  LengthUnit("LengthUnit", "Default unit for measuring lengths"),
+PFile::PFile():
+  i18n_init (Passepartout::init_i18n ()),
+  ReshapeBoxSize("ReshapeBoxSize", _("Size of reshape handles")),
+  DefaultResolution("DefaultResolution", _("Default image resolution")),
+  ZoomLevel("ZoomLevel", _("Default page zoom level")),
+  StartPage("StartPage", _("Default start page in a new document")),
+  Landscape("Landscape", _("Landscape format is default")),
+  FakeTransparency("FakeTransparency", _("White is transparent")),
+  SingleSided("SingleSided", _("Pages are single-sided")),
+  PaperName("PaperName", _("Default paper")),
+  PrintCommand("PrintCommand", _("Printing command")),
+  StylesheetPath("StylesheetPath", _("Path to look for XSLT files in")),
+  DefaultStylesheet("DefaultStylesheet", _("Default text stylesheet")),
+  DocTemplatePath("DocTemplatePath", _("Default document template")),
+  PSInterpreter("PSInterpreter", _("Command to run Ghostscript")),
+  LengthUnit("LengthUnit", _("Default unit for measuring lengths")),
+  dialog (0),
   first_error(true)
 {
   // set default values
@@ -91,7 +98,8 @@ PFile::~PFile() {
   // Evil! All your prior settings are belongs to us ...
   if(!user_file.empty())
     write(user_file);
-  delete dialog;
+  if (dialog)
+    delete dialog;
 }
 
 void PFile::read() {
@@ -131,7 +139,9 @@ void PFile::write(const std::string &filename) {
 Gtk::Dialog &PFile::get_dialog() {
   if(dialog)
     return *dialog;
+
   dialog = new PreferencesDialog();
+  // FIXME: just use Gtk::Dialog.run
   dialog->signal_hide().connect(sigc::mem_fun(*this, &PFile::dialog_done));
   return *dialog;
 }
diff --git a/src/pptout/config.h b/src/pptout/config.h
index bae438f..7044339 100644
--- a/src/pptout/config.h
+++ b/src/pptout/config.h
@@ -35,6 +35,8 @@ struct FVar: public Config::FloatVar, public GuiVar {
 
 /// Passepartout-specific config file reader.
 class PFile: public Config::File, public sigc::trackable {
+private:
+  bool i18n_init;
 public:
 
   /// The global instance.
diff --git a/src/pptout/docpropsdialog.cc b/src/pptout/docpropsdialog.cc
index 1510c6d..fe36d60 100644
--- a/src/pptout/docpropsdialog.cc
+++ b/src/pptout/docpropsdialog.cc
@@ -25,6 +25,8 @@
 #include "widget/wmisc.h"
 #include "widget/usererror.h"
 
+#include <glib/gi18n.h>
+
 DocPropsDialog *DocPropsDialog::_instance = 0;
 
 DocPropsDialog &DocPropsDialog::instance() {
@@ -37,15 +39,17 @@ DocPropsDialog::DocPropsDialog():
   DialogWrap(""), // don't know title or parent
   view(0)
 {
-  template_button = manage(new Gtk::CheckButton("_Use template:", true));
-  portrait_button = manage(new Gtk::RadioButton("_Portrait", true));
-  landscape_button = manage(new Gtk::RadioButton("_Landscape", true));
+  template_button = manage(new Gtk::CheckButton(_("_Use template:"), true));
+
+  /* FIXME: add stock icons from GTK+ for the orientation */
+  portrait_button = manage(new Gtk::RadioButton(_("_Portrait"), true));
+  landscape_button = manage(new Gtk::RadioButton(_("_Landscape"), true));
 
-  single_sided_button = manage(new Gtk::RadioButton("_Single-sided", true));
-  double_sided_button = manage(new Gtk::RadioButton("_Double-sided", true));
+  single_sided_button = manage(new Gtk::RadioButton(_("_Single-sided"), true));
+  double_sided_button = manage(new Gtk::RadioButton(_("_Double-sided"), true));
 
   paper_size = manage(new Gtk::ComboBoxText());
-  file_entry = manage(new FileEntry("Select template"));
+  file_entry = manage(new FileEntry(_("Select template")));
   first_page = manage(new Spinner(config.StartPage.values.front(), false));
 
   Gtk::HBox *template_box = manage(new Gtk::HBox(false, double_space));
@@ -70,6 +74,7 @@ DocPropsDialog::DocPropsDialog():
   }
 
   template_box->pack_start(*template_button, Gtk::PACK_SHRINK);
+  /* FIXME: set a proper filter for the selector (*.pp) */
   template_box->pack_start(*file_entry, Gtk::PACK_EXPAND_WIDGET);
 
   format_box3->pack_start(*paper_size, Gtk::PACK_SHRINK);
@@ -80,11 +85,13 @@ DocPropsDialog::DocPropsDialog():
   sidedness_box->pack_start(*double_sided_button, Gtk::PACK_SHRINK);
 
   Gtk::Label *format_label = 
-    manage(new Gtk::Label("<b>Document _format</b>", 0.0, 0.5, true));
+    manage(new Gtk::Label(Glib::ustring::compose("<b>%1</b>", _("Document _format")),
+						 0.0, 0.5, true));
   format_label->set_use_markup();
   format_label->set_mnemonic_widget(*paper_size);
   format_box->pack_start(*format_label);
   Gtk::HBox *format_box2 = manage(new Gtk::HBox());
+  /* FIXME: don't use empty labels for spacing */
   format_box2->pack_start(*manage(new Gtk::Label("  ")));
   format_box2->pack_start(*format_box3);
   format_box2->pack_start(*manage(new Gtk::VSeparator()), Gtk::PACK_SHRINK,
@@ -94,7 +101,7 @@ DocPropsDialog::DocPropsDialog():
 
   first_page_box->pack_end(*first_page, Gtk::PACK_SHRINK);
   Gtk::Label *first_page_label = 
-    manage(new Gtk::Label("First page nu_mber:", true));
+    manage(new Gtk::Label(_("First page nu_mber:"), true));
   first_page_label->set_mnemonic_widget(first_page->get_spinbutton());
   first_page_box->pack_end(*first_page_label, 
 			   Gtk::PACK_SHRINK);
@@ -190,8 +197,8 @@ void DocPropsDialog::show_it(DocumentView *_view, bool create_new) {
 
   // have to show() first
   set_title(new_document
-	    ? "Create new document"
- 	    : "Document properties");
+	    ? _("Create new document")
+	    : _("Document properties"));
 
   set_transient_for (*dynamic_cast<Gtk::Window*>(view->get_toplevel ()));
 }
@@ -207,6 +214,7 @@ void DocPropsDialog::on_response(int response_id) {
       : Papers::LANDSCAPE; 
 
     if(template_button->get_active() && file_entry->entry.get_text().empty()) {
+	    /* FIXME: is this user-visible? */
       throw UserError("No template file was selected",
 		      "Either select a template or uncheck"
 		      " \"Use template\".");
diff --git a/src/pptout/document/basicframe.cc b/src/pptout/document/basicframe.cc
index 9c795d8..5ba1a2a 100644
--- a/src/pptout/document/basicframe.cc
+++ b/src/pptout/document/basicframe.cc
@@ -10,13 +10,14 @@
 #include <gdkmm.h>
 #include <fstream>
 #include <algorithm>
+#include <glib/gi18n.h>
 
 BasicFrame::BasicFrame(Group *parent, const std::string& name)
   : Pagent(parent, name)
 {}
 
 BasicFrame::BasicFrame(const ElementWrap& xml, Group *parent)
-  : Pagent(parent, xml.get_attribute<string>("name", "unnamed"))
+  : Pagent(parent, xml.get_attribute<string>("name", _("unnamed")))
 {
   locked = xml.get_attribute<bool>("lock", false);
   flow_around = xml.get_attribute<bool>("flowaround", false);
diff --git a/src/pptout/document/imageframe.cc b/src/pptout/document/imageframe.cc
index 20e81f8..6db39d9 100644
--- a/src/pptout/document/imageframe.cc
+++ b/src/pptout/document/imageframe.cc
@@ -16,6 +16,7 @@
 #include "ps/misc.h"
 #include "ps/wineps.h"
 #include "ps/pdfparser.h"
+#include <glib/gi18n.h>
 
 bool ImageFrame::is_postscript(std::string filename) {
   std::ifstream in(filename.c_str());
@@ -25,7 +26,7 @@ bool ImageFrame::is_postscript(std::string filename) {
 }
 
 ImageFrame::ImageFrame(Group *parent, const std::string& assoc)
-  : CachedFrame(parent, "Image " + basename(assoc)),
+  : CachedFrame(parent, Glib::ustring::compose (_("Image %1"), basename(assoc))),
   association(assoc), filewatcher(association)
 {
   filewatcher.modified_signal.connect
diff --git a/src/pptout/document/rasterframe.cc b/src/pptout/document/rasterframe.cc
index 3872b5e..4fed55a 100644
--- a/src/pptout/document/rasterframe.cc
+++ b/src/pptout/document/rasterframe.cc
@@ -12,6 +12,7 @@
 #include "ps/encode.h"
 #include "ps/misc.h"
 #include "pptout/config.h" // Todo
+#include <glib/gi18n.h>
 
 RasterFrame::RasterFrame(const ElementWrap& xml, Group *parent)
   : BasicFrame(xml, parent),
@@ -38,7 +39,7 @@ RasterFrame::RasterFrame(const ElementWrap& xml, Group *parent)
 
 RasterFrame::RasterFrame(Group* parent, const std::string& filename, 
 			   float res)
-  : BasicFrame(parent, "Raster " + basename(filename)),
+  : BasicFrame(parent, Glib::ustring::compose (_("Raster %1"), basename(filename))),
    association(filename), filewatcher(association)
 {
   filewatcher.modified_signal.connect
diff --git a/src/pptout/document/textframe.cc b/src/pptout/document/textframe.cc
index f08ccbd..3911055 100644
--- a/src/pptout/document/textframe.cc
+++ b/src/pptout/document/textframe.cc
@@ -15,10 +15,11 @@
 #include <util/stringutil.h>
 #include <util/filesys.h>
 #include <ps/misc.h>
+#include <glib/gi18n.h>
 
 TextFrame::TextFrame(Group *parent, TextStream *stream,
 		     float w, float h)
-  : CachedFrame(parent, "Text " + (stream ? stream->get_name() : "")),
+  : CachedFrame(parent, Glib::ustring::compose (_("Text %1"), stream ? stream->get_name() : "")),
     truncated(false),
     text_stream(stream),
     num_columns(1), gutter_width(12.0), width(w), height(h)
diff --git a/src/pptout/imagemeta.cc b/src/pptout/imagemeta.cc
index 4cfa72d..82d6669 100644
--- a/src/pptout/imagemeta.cc
+++ b/src/pptout/imagemeta.cc
@@ -8,6 +8,7 @@
 #include "widget/filesel.h"
 #include "widget/wmisc.h"
 #include <gtkmm/label.h>
+#include <glib/gi18n.h>
 
 Pagent* ImageMeta::load(const ElementWrap& xml, Group* parent)
 {
@@ -35,11 +36,11 @@ Viewent::Ref ImageMeta::create_viewent(View& view, Pagent& node) {
 class PropImage : public GenericProp<ImageFrame> {
 public:
   PropImage()
-    : GenericProp<ImageFrame>("_EPS"),
-     e_fname("Associated File")
+    : GenericProp<ImageFrame>(_("_EPS")),
+     e_fname(_("Associated File"))
     {
       Gtk::Box *line = manage(new Gtk::HBox(false, double_space));
-      Gtk::Label *label = manage(new Gtk::Label("_Filename:", 0.0, 0.5, true));
+      Gtk::Label *label = manage(new Gtk::Label(_("_Filename:"), 0.0, 0.5, true));
       label->set_mnemonic_widget(e_fname);
       line->pack_start(*label, Gtk::PACK_SHRINK);
       line->pack_start(e_fname);
diff --git a/src/pptout/preferencesdialog.cc b/src/pptout/preferencesdialog.cc
index b9ed85d..8f8993b 100644
--- a/src/pptout/preferencesdialog.cc
+++ b/src/pptout/preferencesdialog.cc
@@ -24,15 +24,17 @@
 #include <gtkmm/scrolledwindow.h>
 #include <gtkmm/textview.h>
 
+#include <glib/gi18n.h>
+
 PreferencesDialog::PreferencesDialog() : 
-  DialogWrap("Preferences"),
-  file_str("File locations"),
-  prog_str("Program locations"),
-  env_str("Environment"), 
-  tab1_str("Files"),
-  tab2_str("Environment"), 
-  close_button_str("_Close"),
-  apply_button_str("_Save & Close")
+  DialogWrap(_("Preferences")),
+  file_str(_("File locations")),
+  prog_str(_("Program locations")),
+  env_str(_("Environment")),
+  tab1_str(_("Files")),
+  tab2_str(_("Environment")),
+  close_button_str(_("_Close")),
+  apply_button_str(_("_Save & Close"))
 {
   try {
     //Declaration of variables
@@ -95,29 +97,26 @@ PreferencesDialog::PreferencesDialog() :
         tag->property_size_points() = 20;
         table->add(tag);
         i = buffer->insert_with_tag(i, metrics.getName() + "\n", tag);
-        i = buffer->insert(i, "PostScript name: " + *f + "\n");
-        i = buffer->insert(i, "File: "
-                           + font::FontManager::instance().getFontFile(*f)
-                           + "\n\n");
+        i = buffer->insert(i, Glib::ustring::compose (_("PostScript name: %1\n"), *f));
+        i = buffer->insert(i, Glib::ustring::compose (_("File: %1\n\n"),
+                           font::FontManager::instance().getFontFile(*f)));
       }
     }
     Gtk::TextView *text_view = manage(new Gtk::TextView(buffer));
     text_view->set_editable(false);
     tab3_scroller->add(*text_view);
-
     //Tab 1
     xslt_entry =
       manage(new FileEntry(config.StylesheetPath.desc,
-                           "Select default stylesheet folder",
+                           _("Select default stylesheet folder"),
                            Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER));
     xslt_file_entry = manage(new FileEntry(config.DefaultStylesheet.desc,
-                                           "Select default stylesheet"));
+                                           _("Select default stylesheet")));
     /// \todo filesel window titles
     print_entry = manage(new FileEntry(config.PrintCommand.desc, ""));
     gs_entry = manage(new FileEntry(config.PSInterpreter.desc, ""));
     SubPanel *filePanel = manage(new SubPanel(file_str)); 
     SubPanel *progPanel = manage(new SubPanel(prog_str)); 
-
     //Tab 2
     SubPanel *envPanel = manage(new SubPanel(env_str));
     resolution_spin = manage(new Spinner(config.DefaultResolution.
@@ -146,7 +145,6 @@ PreferencesDialog::PreferencesDialog() :
     signal_delete_event().
       connect(sigc::mem_fun(*this, &PreferencesDialog::dialog_delete));
 
-
     //Add the notebook pages
     //---Page 1:
     //-----Main tab layout
@@ -158,7 +156,8 @@ PreferencesDialog::PreferencesDialog() :
 
     if(config.StylesheetPath.visible) {
       tab1_table2->attach
-	(*manage(new Gtk::Label(config.StylesheetPath.desc + ": ",
+	      // TRANSLATORS: this is for settings; "%1" is the setting description
+	(*manage(new Gtk::Label(Glib::ustring::compose (_("%1: "), config.StylesheetPath.desc),
 				Gtk::JUSTIFY_LEFT, 
 				Gtk::ALIGN_BOTTOM)), 
 	 0, 1, 1, 2);
@@ -169,7 +168,7 @@ PreferencesDialog::PreferencesDialog() :
 
     if(config.DefaultStylesheet.visible) {
       tab1_table2->attach
-	(*manage(new Gtk::Label(config.DefaultStylesheet.desc + ": ",
+	(*manage(new Gtk::Label(Glib::ustring::compose (_("%1: "), config.DefaultStylesheet.desc),
 				Gtk::JUSTIFY_LEFT, 
 				Gtk::ALIGN_BOTTOM)), 
 	 0, 1, 2, 3);
@@ -184,7 +183,7 @@ PreferencesDialog::PreferencesDialog() :
 
     if(config.PrintCommand.visible) {
       tab1_table3->attach
-	(*manage(new Gtk::Label(config.PrintCommand.desc + ": ",
+	(*manage(new Gtk::Label(Glib::ustring::compose (_("%1: "), config.PrintCommand.desc),
 				Gtk::JUSTIFY_LEFT, 
 				Gtk::ALIGN_BOTTOM)), 
 	 0, 1, 0, 1);
@@ -195,7 +194,7 @@ PreferencesDialog::PreferencesDialog() :
 
     if(config.PSInterpreter.visible) {
       tab1_table3->attach
-	(*manage(new Gtk::Label(config.PSInterpreter.desc + ": ",
+	(*manage(new Gtk::Label(Glib::ustring::compose (_("%1: "), config.PSInterpreter.desc),
 				Gtk::JUSTIFY_LEFT, 
 				Gtk::ALIGN_BOTTOM)), 
 	 0, 1, 1, 2);
@@ -212,12 +211,12 @@ PreferencesDialog::PreferencesDialog() :
     
     if(config.DefaultResolution.visible) {
       tab2_table2->attach
-	(*manage(new Gtk::Label(config.DefaultResolution.desc + ": ", 
+	(*manage(new Gtk::Label(Glib::ustring::compose (_("%1: "), config.DefaultResolution.desc),
 				Gtk::JUSTIFY_LEFT, 
 				Gtk::ALIGN_BOTTOM)), 
 	 1, 2, 1, 2);
       tab2_table2->attach(*resolution_spin, 2, 3, 1, 2);
-      tab2_table2->attach(*manage(new Gtk::Label("ppi", 
+      tab2_table2->attach(*manage(new Gtk::Label(_("ppi"),
 						 Gtk::JUSTIFY_LEFT, 
 						 Gtk::ALIGN_BOTTOM)), 
 			  3, 4, 1, 2);
@@ -225,12 +224,12 @@ PreferencesDialog::PreferencesDialog() :
 
     if(config.ZoomLevel.visible) {      
       tab2_table2->attach
-	(*manage(new Gtk::Label(config.ZoomLevel.desc + ": ", 
+	(*manage(new Gtk::Label(Glib::ustring::compose (_("%1: "), config.ZoomLevel.desc),
 				Gtk::JUSTIFY_LEFT, 
 				Gtk::ALIGN_BOTTOM)), 
 	 1, 2, 2, 3);
       tab2_table2->attach(*zoom_spin, 2, 3, 2, 3);
-      tab2_table2->attach(*manage(new Gtk::Label("%", 
+      tab2_table2->attach(*manage(new Gtk::Label(_("%"),
 						 Gtk::JUSTIFY_LEFT, 
 						 Gtk::ALIGN_BOTTOM)), 
 			  3, 4, 2, 3);
@@ -240,14 +239,17 @@ PreferencesDialog::PreferencesDialog() :
     
 
     //---Page 3:
-    notebook->append_page(*tab3_scroller, "Font Info");
-
+    notebook->append_page(*tab3_scroller, _("Font Info"));
   } catch(const std::out_of_range &error) {
     throw UserError("Settings not found", 
 		    "Can't find one or more setting values."
 		    "\nYou can still change your settings by editing the</i> "
 		    "<tt>.pptout</tt> file in you home directory.");
   }
+  catch (Glib::Exception &e)
+    {
+      g_warning ("%s", e.what ().c_str ());
+    }
 
   show_all_children();
 }
@@ -278,8 +280,8 @@ void PreferencesDialog::dialog_apply() {
   if(config.ZoomLevel.visible)
     config.ZoomLevel.values.front() = zoom_spin->get();
 
-  Gtk::MessageDialog msg(*this, "Note: you need to restart the program "
-			    "for some changes to take effect");
+  Gtk::MessageDialog msg(*this, _("Note: you need to restart the program "
+			    "for some changes to take effect"));
   msg.run();
   dialog_cancel();
 }
diff --git a/src/pptout/propertiesdialog.cc b/src/pptout/propertiesdialog.cc
index cd9fff1..4af8c0e 100644
--- a/src/pptout/propertiesdialog.cc
+++ b/src/pptout/propertiesdialog.cc
@@ -21,6 +21,8 @@
 #include "document/basicframe.h"
 #include "lengthunits.h"
 #include "config.h"
+#include "defines.h"
+#include <glib/gi18n.h>
 
 
 // The basic properties that apply to all Pagent's.
@@ -35,7 +37,7 @@ public:
   // | left:  | "left"  | width:  | "width"  |
   // | right: | "right" | height: | "height" |
   PropBasic(const std::string &default_unit)
-    :PropBase("_Basic"), object(0),
+    :PropBase(_("_Basic")), object(0),
      e_left(0, true, &length_units, default_unit),
      e_bottom(0, true, &length_units, default_unit), 
      e_width(0, true, &length_units, default_unit),
@@ -43,11 +45,11 @@ public:
      e_scalex(0, true), e_scaley(0, true),
      e_rotate(0, true, &angle_units), e_shear(0, true),
      e_margin(0, true, &length_units, default_unit),
-     c_flow("Text avoids object", 0), c_locked("Locked", 0)
+     c_flow(_("Text avoids object"), 0), c_locked(_("Locked"), 0)
   {
       Gtk::Label *label;
       Gtk::Box *line = manage(new Gtk::HBox(false, double_space));
-      line->pack_start(*(label = manage(new Gtk::Label("Object _name:", 
+      line->pack_start(*(label = manage(new Gtk::Label(_("Object _name:"),
 						       0.0, 0.5, true))),
 		       Gtk::PACK_SHRINK);
       label->set_mnemonic_widget(e_name);
@@ -61,12 +63,12 @@ public:
                            NAME), true)));
       pack_start(*line, Gtk::PACK_SHRINK);
       
-      SubPanel *box = manage(new SubPanel("Geometry"));
+      SubPanel *box = manage(new SubPanel(_("Geometry")));
       Glib::RefPtr<Gtk::SizeGroup>  sizegroup = 
 	Gtk::SizeGroup::create(Gtk::SIZE_GROUP_HORIZONTAL);
 
       line = manage(new Gtk::HBox(false, double_space));
-      sizegroup->add_widget(*(label = manage(new Gtk::Label("_Left:", 
+      sizegroup->add_widget(*(label = manage(new Gtk::Label(_("_Left:"),
 							    0.0, 0.5, true))));
       line->pack_start(*label, Gtk::PACK_SHRINK);
       line->pack_start(e_left, Gtk::PACK_SHRINK);
@@ -74,7 +76,7 @@ public:
 	(bind(sigc::mem_fun(*this, &PropBasic::on_change), LEFT));
       label->set_mnemonic_widget(e_left);
 
-      sizegroup->add_widget(*(label = manage(new Gtk::Label("_Width:",
+      sizegroup->add_widget(*(label = manage(new Gtk::Label(_("_Width:"),
 							    0.0, 0.5, true))));
       line->pack_start(*label, Gtk::PACK_SHRINK);
       line->pack_start(e_width, Gtk::PACK_SHRINK);
@@ -84,7 +86,7 @@ public:
       box->pack_start(*line, Gtk::PACK_SHRINK);
       
       line = manage(new Gtk::HBox(false, double_space));
-      sizegroup->add_widget(*(label = manage(new Gtk::Label("_Bottom:", 
+      sizegroup->add_widget(*(label = manage(new Gtk::Label(_("_Bottom:"),
 							    0.0, 0.5, true))));
       line->pack_start(*label, Gtk::PACK_SHRINK);
       line->pack_start(e_bottom, Gtk::PACK_SHRINK);
@@ -92,7 +94,7 @@ public:
 	(bind(sigc::mem_fun(*this, &PropBasic::on_change), BOTTOM));
       label->set_mnemonic_widget(e_bottom);
 
-      sizegroup->add_widget(*(label = manage(new Gtk::Label("_Height:",
+      sizegroup->add_widget(*(label = manage(new Gtk::Label(_("_Height:"),
 							    0.0, 0.5, true))));
       line->pack_start(*label, Gtk::PACK_SHRINK);
       line->pack_start(e_height, Gtk::PACK_SHRINK);
@@ -104,7 +106,7 @@ public:
       
       box = manage(new SubPanel("Transform"));
       line = manage(new Gtk::HBox(false, double_space));
-      sizegroup->add_widget(*(label = manage(new Gtk::Label("Scale _X",
+      sizegroup->add_widget(*(label = manage(new Gtk::Label(_("Scale _X"),
 							    0.0, 0.5, true))));
       line->pack_start(*label, Gtk::PACK_SHRINK);
       line->pack_start(e_scalex, Gtk::PACK_SHRINK);
@@ -112,7 +114,7 @@ public:
       e_scalex.signal_value_changed().connect
 	(bind(sigc::mem_fun(*this, &PropBasic::on_change), SCALEX));
       
-      sizegroup->add_widget(*(label = manage(new Gtk::Label("R_otate:",
+      sizegroup->add_widget(*(label = manage(new Gtk::Label(_("R_otate:"),
 							    0.0, 0.5, true))));
       line->pack_start(*label, Gtk::PACK_SHRINK);
       line->pack_start(e_rotate, Gtk::PACK_SHRINK);
@@ -122,7 +124,7 @@ public:
       
       box->pack_start(*line, Gtk::PACK_SHRINK);
       line = manage(new Gtk::HBox(false, double_space));
-      sizegroup->add_widget(*(label = manage(new Gtk::Label("Scale _Y",
+      sizegroup->add_widget(*(label = manage(new Gtk::Label(_("Scale _Y"),
 							    0.0, 0.5, true))));
       line->pack_start(*label, Gtk::PACK_SHRINK);
       line->pack_start(e_scaley, Gtk::PACK_SHRINK);
@@ -130,7 +132,7 @@ public:
       e_scaley.signal_value_changed().connect
 	(bind(sigc::mem_fun(*this, &PropBasic::on_change), SCALEY));
 
-      sizegroup->add_widget(*(label = manage(new Gtk::Label("_Shear:",
+      sizegroup->add_widget(*(label = manage(new Gtk::Label(_("_Shear:"),
 							    0.0, 0.5, true))));
       line->pack_start(*label, Gtk::PACK_SHRINK);
       line->pack_start(e_shear, Gtk::PACK_SHRINK);
@@ -285,7 +287,7 @@ PropertiesDialog &PropertiesDialog::instance() {
 }
 
 PropertiesDialog::PropertiesDialog()
-  : UtilityWindow("Object properties"),
+  : UtilityWindow(_("Object properties")),
     document(0)
 {
   add(book);
diff --git a/src/pptout/rastermeta.cc b/src/pptout/rastermeta.cc
index 0524170..ac70c74 100644
--- a/src/pptout/rastermeta.cc
+++ b/src/pptout/rastermeta.cc
@@ -12,6 +12,7 @@
 #include <gtkmm/separator.h>
 #include <gtkmm/sizegroup.h>
 #include <util/warning.h>
+#include <glib/gi18n.h>
 
 Pagent* RasterMeta::load(const ElementWrap& xml, Group* parent)
 {
@@ -52,12 +53,13 @@ PropBase* RasterMeta::getProp() {
 }
 
 PropRaster::PropRaster()
-  :GenericProp<RasterFrame>("_Raster"), use_aspect(true),
-   e_fname("Associated File"),  b_ppic("}", Gtk::JUSTIFY_RIGHT)
+  :GenericProp<RasterFrame>(_("_Raster")), use_aspect(true),
+   e_fname(_("Associated File")),
+   b_ppic("}", Gtk::JUSTIFY_RIGHT) // FIXME: use the locked chain symbol that gimp and co use
 {
   Gtk::Label *label;
   Gtk::Box *line = manage(new Gtk::HBox(false, double_space));
-  label = manage(new Gtk::Label("_Filename:", 0.0, 0.5, true));
+  label = manage(new Gtk::Label(_("_Filename:"), 0.0, 0.5, true));
   label->set_mnemonic_widget(e_fname);
   line->pack_start(*label, Gtk::PACK_SHRINK);
   line->pack_start(e_fname);
@@ -73,28 +75,28 @@ PropRaster::PropRaster()
   Glib::RefPtr<Gtk::SizeGroup>  sizegroup = 
     Gtk::SizeGroup::create(Gtk::SIZE_GROUP_HORIZONTAL);
   
-  SubPanel* rezpanel = manage(new SubPanel("Raster resolution"));
+  SubPanel* rezpanel = manage(new SubPanel(_("Raster resolution")));
   Gtk::Box *hbox = manage(new Gtk::HBox(false, single_space));
   Gtk::Box *vbox = manage(new Gtk::VBox(false, single_space));
   line = manage(new Gtk::HBox(false, double_space));
-  line->pack_start(*(label = manage(new Gtk::Label("_Horizontal:", 
+  line->pack_start(*(label = manage(new Gtk::Label(_("_Horizontal:"),
 						   0.0, 0.5, true))),
 		   Gtk::PACK_SHRINK);
   sizegroup->add_widget(*label);
   label->set_mnemonic_widget(e_ppix);
   line->pack_start(e_ppix, Gtk::PACK_SHRINK);
-  line->pack_start(*(manage(new Gtk::Label("ppi"))),
+  line->pack_start(*(manage(new Gtk::Label(_("ppi")))),
 		   Gtk::PACK_SHRINK);
   vbox->pack_start(*line, Gtk::PACK_SHRINK);
   
   line = manage(new Gtk::HBox(false, double_space));
-  line->pack_start(*(label = manage(new Gtk::Label("_Vertical:", 
+  line->pack_start(*(label = manage(new Gtk::Label(_("_Vertical:"),
 						   0.0, 0.5, true))),
 		   Gtk::PACK_SHRINK);
   sizegroup->add_widget(*label);
   label->set_mnemonic_widget(e_ppiy);
   line->pack_start(e_ppiy, Gtk::PACK_SHRINK);
-  line->pack_start(*(manage(new Gtk::Label("ppi"))),
+  line->pack_start(*(manage(new Gtk::Label(_("ppi")))),
 		   Gtk::PACK_SHRINK);
   vbox->pack_start(*line, Gtk::PACK_SHRINK);
 
diff --git a/src/pptout/streamdialog.cc b/src/pptout/streamdialog.cc
index ec61367..e58d609 100644
--- a/src/pptout/streamdialog.cc
+++ b/src/pptout/streamdialog.cc
@@ -23,6 +23,8 @@
 #include "config.h"
 #include "docview.h"
 
+#include <glib/gi18n.h>
+
 /**
  * File-local utility classes in an unnamed namespace
  */
@@ -71,9 +73,9 @@ namespace {
 }
 
 StreamDialog::StreamDialog()
-  : UtilityWindow("Text Streams"),
-    file_entry("Stream File"), 
-    xfrm_entry("Stylesheet File", config.StylesheetPath.values.front()),
+  : UtilityWindow(_("Text Streams")),
+    file_entry(_("Stream File")),
+    xfrm_entry(_("Stylesheet File"), config.StylesheetPath.values.front()),
     document(0), 
     current_selection("")
 {
@@ -85,7 +87,7 @@ StreamDialog::StreamDialog()
     main_model = Gtk::ListStore::create(main_columns);
     stream_list.set_model(main_model);
     stream_list.set_headers_visible(false);
-    stream_list.append_column("Stream", main_columns.name);
+    stream_list.append_column(_("Stream"), main_columns.name);
     /// \todo  Get a more motivated size, not a hardcoded number of pixels.
     stream_list.property_width_request() = 100;
     stream_list.property_height_request() = 100;
@@ -100,7 +102,7 @@ StreamDialog::StreamDialog()
     scroll->add(stream_list);
     
     Gtk::Label *list_label = 
-      manage(new Gtk::Label("S_treams", 0.0, 0.5, true));
+      manage(new Gtk::Label(_("S_treams"), 0.0, 0.5, true));
     list_label->set_mnemonic_widget(stream_list);
     vbox->pack_start(*list_label, Gtk::PACK_SHRINK);
     vbox->pack_start(*scroll);
@@ -120,13 +122,13 @@ StreamDialog::StreamDialog()
     mainbox->pack_start(*propsbox);
     this->propsbox = propsbox;
     {
-      SubPanel *box = manage(new SubPanel("Stream Source"));
+      SubPanel *box = manage(new SubPanel(_("Stream Source")));
       Gtk::Box *line;
       Glib::RefPtr<Gtk::SizeGroup>  sizegroup = 
 	Gtk::SizeGroup::create(Gtk::SIZE_GROUP_HORIZONTAL);
       
       line = manage(new Gtk::HBox(false, double_space));
-      Gtk::Label *label = manage(new Gtk::Label("_Name:", 0.0, 0.5, true));
+      Gtk::Label *label = manage(new Gtk::Label(_("_Name:"), 0.0, 0.5, true));
       sizegroup->add_widget(*label);
       label->set_mnemonic_widget(name_entry);
       line->pack_start(*label, Gtk::PACK_SHRINK);
@@ -134,7 +136,7 @@ StreamDialog::StreamDialog()
       box->pack_start(*line, Gtk::PACK_SHRINK);
       
       line = manage(new Gtk::HBox(false, double_space));
-      label = manage(new Gtk::Label("_File:", 0.0, 0.5, true));
+      label = manage(new Gtk::Label(_("_File:"), 0.0, 0.5, true));
       sizegroup->add_widget(*label);
       label->set_mnemonic_widget(file_entry);
       line->pack_start(*label, Gtk::PACK_SHRINK);
@@ -142,7 +144,7 @@ StreamDialog::StreamDialog()
       box->pack_start(*line, Gtk::PACK_SHRINK);
       
       line = manage(new Gtk::HBox(false, double_space));
-      label = manage(new Gtk::Label("_Stylesheet:", 1.0, 0.5, true));
+      label = manage(new Gtk::Label(_("_Stylesheet:"), 1.0, 0.5, true));
       sizegroup->add_widget(*label);
       label->set_mnemonic_widget(xfrm_entry.entry.get_entry());
       line->pack_start(*label, Gtk::PACK_SHRINK);
@@ -152,13 +154,13 @@ StreamDialog::StreamDialog()
       propsbox->pack_start(*box, Gtk::PACK_SHRINK);
     }
     {
-      SubPanel* box = manage(new SubPanel("Parameters"));
+      SubPanel* box = manage(new SubPanel(_("Parameters")));
       param_box = box; // we need this for set_sensitive later
 
       param_model = Gtk::ListStore::create(param_columns);
       param_list.set_model(param_model);
-      param_list.append_column("Name", param_columns.name);
-      param_list.append_column_editable("Value", param_columns.value);
+      param_list.append_column(_("Name"), param_columns.name);
+      param_list.append_column_editable(_("Value"), param_columns.value);
       param_list.property_height_request() = 90;
       param_model->signal_row_changed().connect
 	(sigc::mem_fun(*this, &StreamDialog::on_param_row_changed));
@@ -384,7 +386,7 @@ void StreamDialog::set_document(DocRef document_) {
 //*** StreamMenu methods ***
 
 namespace{
-  static const std::string no_stream("( No Stream )"); 
+  static const std::string no_stream(_("( No Stream )")); 
 }
 
 StreamMenu::StreamMenu() {
@@ -426,22 +428,22 @@ void StreamMenu::update(DocRef document, const std::string &select_name) {
 namespace { enum { RESPONSE_TOGGLE_MODE = 4711 }; }
 
 TextFrameDialog::TextFrameDialog(Gtk::Window &parent, DocumentView &_view)
-  : DialogWrap("Create new text frame", parent), view(_view),
-    file_entry("Stream File"), 
-    xfrm_entry("Stylesheet File", config.StylesheetPath.values.front())
+  : DialogWrap(_("Create new text frame"), parent), view(_view),
+    file_entry(_("Stream File")),
+    xfrm_entry(_("Stylesheet File"), config.StylesheetPath.values.front())
 {
   set_modal(true);
   Gtk::Box *main_box = manage(new Gtk::VBox(false, double_space));
   main_box->set_border_width(border_width);
 
   Gtk::Box *old_box = manage(new Gtk::HBox(false, single_space));
-  old_button = manage(new Gtk::RadioButton("From _existing stream: ", 
+  old_button = manage(new Gtk::RadioButton(_("From _existing stream: "),
 					   true));
   old_box->pack_start(*old_button,  Gtk::PACK_SHRINK);
   old_box->pack_start(streams, Gtk::PACK_SHRINK);
   main_box->pack_start(*old_box, Gtk::PACK_SHRINK);
 
-  new_button = manage(new Gtk::RadioButton("C_reate new stream:", 
+  new_button = manage(new Gtk::RadioButton(_("C_reate new stream:"),
 					   true));
   main_box->pack_start(*new_button,  Gtk::PACK_SHRINK);
 
@@ -451,7 +453,7 @@ TextFrameDialog::TextFrameDialog(Gtk::Window &parent, DocumentView &_view)
   new_box = manage(new Gtk::VBox(false, single_space));
 
   line = manage(new Gtk::HBox(false, double_space));
-  Gtk::Label *label = manage(new Gtk::Label("N_ame:", 0.0, 0.5, true));
+  Gtk::Label *label = manage(new Gtk::Label(_("N_ame:"), 0.0, 0.5, true));
   sizegroup->add_widget(*label);
   label->set_mnemonic_widget(name_entry);
   name_entry.set_activates_default();
@@ -460,7 +462,7 @@ TextFrameDialog::TextFrameDialog(Gtk::Window &parent, DocumentView &_view)
   new_box->pack_start(*line, Gtk::PACK_SHRINK);
 
   line = manage(new Gtk::HBox(false, double_space));
-  label = manage(new Gtk::Label("_File:", 0.0, 0.5, true));
+  label = manage(new Gtk::Label(_("_File:"), 0.0, 0.5, true));
   sizegroup->add_widget(*label);
   label->set_mnemonic_widget(file_entry);
   line->pack_start(*label, Gtk::PACK_SHRINK);
@@ -468,7 +470,7 @@ TextFrameDialog::TextFrameDialog(Gtk::Window &parent, DocumentView &_view)
   new_box->pack_start(*line, Gtk::PACK_SHRINK);
 
   line = manage(new Gtk::HBox(false, double_space));
-  label = manage(new Gtk::Label("_Stylesheet:", 1.0, 0.5, true));
+  label = manage(new Gtk::Label(_("_Stylesheet:"), 1.0, 0.5, true));
   sizegroup->add_widget(*label);
   label->set_mnemonic_widget(xfrm_entry.entry.get_entry());
   line->pack_start(*label, Gtk::PACK_SHRINK);
@@ -476,6 +478,7 @@ TextFrameDialog::TextFrameDialog(Gtk::Window &parent, DocumentView &_view)
   new_box->pack_start(*line, Gtk::PACK_SHRINK);
 
   Gtk::Box *format_box = manage(new Gtk::HBox());
+  // FIXME: don't use empty labels for padding
   format_box->pack_start(*manage(new Gtk::Label("  ")), Gtk::PACK_SHRINK);
   format_box->pack_start(*new_box);
   main_box->pack_start(*format_box, Gtk::PACK_SHRINK);
diff --git a/src/pptout/textmeta.cc b/src/pptout/textmeta.cc
index 3789e37..83fd4b4 100644
--- a/src/pptout/textmeta.cc
+++ b/src/pptout/textmeta.cc
@@ -13,6 +13,7 @@
 #include <gtkmm/separator.h>
 #include <gtkmm/sizegroup.h>
 #include <sigc++/bind.h>
+#include <glib/gi18n.h>
 
 Pagent* TextMeta::load(const ElementWrap& xml, Group* parent) {
   return new TextFrame(xml, parent);
@@ -28,28 +29,28 @@ Viewent::Ref TextMeta::create_viewent(View& view, Pagent& node) {
 class PropText : public GenericProp<TextFrame> {
 public:
   PropText()
-    : GenericProp<TextFrame>("Te_xt"),
+    : GenericProp<TextFrame>(_("Te_xt")),
      e_columns(1, false), e_gutter(0, true, &length_units)
   {
     Glib::RefPtr<Gtk::SizeGroup>  sizegroup = 
       Gtk::SizeGroup::create(Gtk::SIZE_GROUP_HORIZONTAL);
     
     Gtk::Box *line = manage(new Gtk::HBox(false, single_space));
-    Gtk::Label *label = manage(new Gtk::Label("_Stream:", 0.0, 0.5, true));
+    Gtk::Label *label = manage(new Gtk::Label(_("_Stream:"), 0.0, 0.5, true));
     line->pack_start(*label, Gtk::PACK_SHRINK);
     label->set_mnemonic_widget(e_stream);
     line->pack_start(e_stream, Gtk::PACK_EXPAND_WIDGET);
     e_stream.signal_changed().connect
       (bind(sigc::mem_fun(*this, &PropText::on_change), STREAM));
-    Gtk::Button *b_streams = manage(new Gtk::Button("E_dit streams", true));
+    Gtk::Button *b_streams = manage(new Gtk::Button(_("E_dit streams"), true));
     b_streams->signal_clicked().connect
       (sigc::mem_fun(StreamDialog::instance(), &StreamDialog::show_raise));
     line->pack_start(*b_streams, Gtk::PACK_SHRINK);
     pack_start(*line, Gtk::PACK_SHRINK);
     
-    SubPanel *box = manage(new SubPanel("Columns"));
+    SubPanel *box = manage(new SubPanel(_("Columns")));
     line = manage(new Gtk::HBox(false, double_space));
-    line->pack_start(*(label = manage(new Gtk::Label("Number of _columns:", 
+    line->pack_start(*(label = manage(new Gtk::Label(_("Number of _columns:"),
 						     0.0, 0.5, true))),
 		     Gtk::PACK_SHRINK);
     sizegroup->add_widget(*label);
@@ -61,7 +62,7 @@ public:
     box->pack_start(*line);
     
     line = manage(new Gtk::HBox(false, double_space));
-    line->pack_start(*(label = manage(new Gtk::Label("_Gutter width:",
+    line->pack_start(*(label = manage(new Gtk::Label(_("_Gutter width:"),
 						     0.0, 0.5, true))),
 		     Gtk::PACK_SHRINK);
     sizegroup->add_widget(*label);
diff --git a/src/pptout/widget/filesel.cc b/src/pptout/widget/filesel.cc
index 94419eb..9f89c75 100644
--- a/src/pptout/widget/filesel.cc
+++ b/src/pptout/widget/filesel.cc
@@ -13,6 +13,8 @@
 #include "util/filesys.h"
 #include "wmisc.h"
 
+#include <glib/gi18n.h>
+
 // *** EndEntry methods ***
 
 EndEntry::EndEntry(int _history_max) : history_max(_history_max) {}
@@ -72,7 +74,7 @@ FileEntry::FileEntry(const Glib::ustring& window_title_,
   Gtk::Box *button_box = manage(new Gtk::HBox(false, single_space));
   Gtk::Image *open_img = manage(new Gtk::Image(Gtk::Stock::OPEN, 
 					       Gtk::ICON_SIZE_BUTTON));
-  Gtk::Label *button_label = manage(new Gtk::Label("Browse ... "));
+  Gtk::Label *button_label = manage(new Gtk::Label(_("Browse ... ")));
   button_box->pack_start(*open_img);
   button_box->pack_start(*button_label);
   button.add(*button_box);
diff --git a/src/pptout/widget/programs.cc b/src/pptout/widget/programs.cc
index 7cd82b4..5a447e5 100644
--- a/src/pptout/widget/programs.cc
+++ b/src/pptout/widget/programs.cc
@@ -13,7 +13,7 @@
 #endif
 
 namespace {
-  const std::string browser = "gnome-moz-remote";
+  const std::string browser = "xdg-open";
 }
 
 void Programs::open_url(const std::string &url) {
@@ -32,13 +32,22 @@ void Programs::open_url(const std::string &url) {
 }
 
 void Programs::open_docs() {
-  std::string url = DOCDIR "/users_guide.html";
+  try
+    {
+      open_url ("ghelp:passepartout");
+      return;
+    }
+  catch (UserError& e)
+    {
+      /* ignore and continue */
+    }
+  std::string url = DOCDIR "/passepartout.html";
   if(access(url))
     url = "file://" + url;
   else
     url = "http://www.stacken.kth.se/project/pptout/doc/"; 
       + std::string(VERSION)
-      + "/users_guide.html";
+      + "/passepartout.html";
   open_url(url);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]