gtranslator r3502 - in trunk: . data data/colorschemes data/desktop data/pixmaps doc doc/reference help plugins po src src/dialogs src/pixmaps src/plugin-system src/toolbareditor



Author: psanxiao
Date: Sun Mar  2 21:32:24 2008
New Revision: 3502
URL: http://svn.gnome.org/viewvc/gtranslator?rev=3502&view=rev

Log:
Merged from GOBJECT_WORK branch (revisions 3194:3501)


Added:
   trunk/configure.ac
      - copied unchanged from r3501, /branches/GOBJECT_WORK/configure.ac
   trunk/data/gtr-toolbar.xml
      - copied unchanged from r3501, /branches/GOBJECT_WORK/data/gtr-toolbar.xml
   trunk/data/gtranslator-ui.xml
      - copied unchanged from r3501, /branches/GOBJECT_WORK/data/gtranslator-ui.xml
   trunk/data/gtranslator.pc.in
      - copied unchanged from r3501, /branches/GOBJECT_WORK/data/gtranslator.pc.in
   trunk/data/layout.xml
      - copied unchanged from r3501, /branches/GOBJECT_WORK/data/layout.xml
   trunk/data/po.lang
      - copied unchanged from r3501, /branches/GOBJECT_WORK/data/po.lang
   trunk/doc/reference/
      - copied from r3501, /branches/GOBJECT_WORK/doc/reference/
   trunk/plugins/
      - copied from r3501, /branches/GOBJECT_WORK/plugins/
   trunk/src/actions-edit.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/actions-edit.c
   trunk/src/actions-file.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/actions-file.c
   trunk/src/actions-go.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/actions-go.c
   trunk/src/actions-help.c
      - copied, changed from r3501, /branches/GOBJECT_WORK/src/actions-help.c
   trunk/src/actions-search.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/actions-search.c
   trunk/src/actions-view.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/actions-view.c
   trunk/src/application.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/application.c
   trunk/src/application.h
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/application.h
   trunk/src/comment.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/comment.c
   trunk/src/comment.h
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/comment.h
   trunk/src/dialogs/
      - copied from r3501, /branches/GOBJECT_WORK/src/dialogs/
   trunk/src/gtranslator-enum-types.c.template
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/gtranslator-enum-types.c.template
   trunk/src/gtranslator-enum-types.h.template
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/gtranslator-enum-types.h.template
   trunk/src/gtranslator-marshal.list
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/gtranslator-marshal.list
   trunk/src/header.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/header.c
   trunk/src/header.h
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/header.h
   trunk/src/history-entry.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/history-entry.c
   trunk/src/history-entry.h
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/history-entry.h
   trunk/src/io-error-message-area.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/io-error-message-area.c
   trunk/src/io-error-message-area.h
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/io-error-message-area.h
   trunk/src/message-table-model.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/message-table-model.c
   trunk/src/message-table-model.h
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/message-table-model.h
   trunk/src/message-table.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/message-table.c
   trunk/src/message-table.h
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/message-table.h
   trunk/src/msg.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/msg.c
   trunk/src/msg.h
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/msg.h
   trunk/src/notebook.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/notebook.c
   trunk/src/notebook.h
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/notebook.h
   trunk/src/plugin-system/
      - copied from r3501, /branches/GOBJECT_WORK/src/plugin-system/
   trunk/src/po.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/po.c
   trunk/src/po.h
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/po.h
   trunk/src/prefs-manager-app.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/prefs-manager-app.c
   trunk/src/prefs-manager-app.h
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/prefs-manager-app.h
   trunk/src/prefs-manager-private.h
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/prefs-manager-private.h
   trunk/src/prefs-manager.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/prefs-manager.c
   trunk/src/prefs-manager.h
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/prefs-manager.h
   trunk/src/statusbar.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/statusbar.c
   trunk/src/statusbar.h
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/statusbar.h
   trunk/src/tab.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/tab.c
   trunk/src/tab.h
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/tab.h
   trunk/src/toolbareditor/
      - copied from r3501, /branches/GOBJECT_WORK/src/toolbareditor/
   trunk/src/update-from-gedit.sh
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/update-from-gedit.sh
   trunk/src/window.c
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/window.c
   trunk/src/window.h
      - copied unchanged from r3501, /branches/GOBJECT_WORK/src/window.h
Removed:
   trunk/configure.in
   trunk/data/colorschemes/
   trunk/data/pixmaps/
   trunk/src/about.c
   trunk/src/about.h
   trunk/src/actions.c
   trunk/src/bookmark.c
   trunk/src/bookmark.h
   trunk/src/charmap-panel.c
   trunk/src/charmap-panel.h
   trunk/src/color-schemes.c
   trunk/src/color-schemes.h
   trunk/src/compile.c
   trunk/src/compile.h
   trunk/src/dialogs.c
   trunk/src/dialogs.h
   trunk/src/dict-panel.c
   trunk/src/dict-panel.h
   trunk/src/dictionary.c
   trunk/src/dictionary.h
   trunk/src/dnd.c
   trunk/src/dnd.h
   trunk/src/find.c
   trunk/src/find.h
   trunk/src/gdict-sidebar.c
   trunk/src/gdict-sidebar.h
   trunk/src/glossary-panel.c
   trunk/src/glossary-panel.h
   trunk/src/gucharmap.c
   trunk/src/gucharmap.h
   trunk/src/gui.c
   trunk/src/gui.h
   trunk/src/header_dialog.glade
   trunk/src/header_stuff.c
   trunk/src/header_stuff.h
   trunk/src/history.c
   trunk/src/history.h
   trunk/src/languages.c
   trunk/src/languages.h
   trunk/src/languages.xsl
   trunk/src/learn.c
   trunk/src/learn.h
   trunk/src/main_window.glade
   trunk/src/menus.c
   trunk/src/menus.h
   trunk/src/message.c
   trunk/src/message.h
   trunk/src/messages-table.c
   trunk/src/messages-table.h
   trunk/src/nautilus-string.c
   trunk/src/nautilus-string.h
   trunk/src/page.c
   trunk/src/page.h
   trunk/src/parse.c
   trunk/src/parse.h
   trunk/src/pixmaps/
   trunk/src/preferences.c
   trunk/src/preferences.glade
   trunk/src/preferences.h
   trunk/src/prefs.c
   trunk/src/prefs.h
   trunk/src/prefs_init.c
   trunk/src/replace.c
   trunk/src/replace.h
   trunk/src/runtime-config.c
   trunk/src/runtime-config.h
   trunk/src/save.c
   trunk/src/save.h
   trunk/src/session.c
   trunk/src/session.h
   trunk/src/sighandling.c
   trunk/src/sighandling.h
   trunk/src/stylistics.c
   trunk/src/stylistics.h
   trunk/src/translator.c
   trunk/src/translator.h
   trunk/src/undo.c
   trunk/src/undo.h
   trunk/src/utils.c
   trunk/src/utils.h
   trunk/src/vfs-handle.c
   trunk/src/vfs-handle.h
Modified:
   trunk/AUTHORS
   trunk/ChangeLog
   trunk/INSTALL
   trunk/MAINTAINERS
   trunk/Makefile.am
   trunk/autogen.sh
   trunk/data/ChangeLog
   trunk/data/Makefile.am
   trunk/data/desktop/gtranslator.desktop.in.in
   trunk/doc/Makefile.am
   trunk/help/ChangeLog
   trunk/install-sh
   trunk/po/ChangeLog
   trunk/po/POTFILES.in
   trunk/po/ga.po
   trunk/po/gl.po
   trunk/po/oc.po
   trunk/po/pt_BR.po
   trunk/src/ChangeLog
   trunk/src/Makefile.am
   trunk/src/actions.h
   trunk/src/draw-spaces.c
   trunk/src/main.c
   trunk/src/message-area.c
   trunk/src/message-area.h
   trunk/src/utils_gui.c
   trunk/src/utils_gui.h
   trunk/src/view.c
   trunk/src/view.h

Modified: trunk/AUTHORS
==============================================================================
--- trunk/AUTHORS	(original)
+++ trunk/AUTHORS	Sun Mar  2 21:32:24 2008
@@ -1,15 +1,12 @@
 Authors :
 -------
 
-Ross Golder		<ross golder org> (active main developer)
-Ignacio Casal Quinteiro <nacho resa gmail com>
 Pablo Sanxiao		<psanxiao gmail com>
-Juanjo SÃnchez		<jjsanchez igalia com>
-Fatih Demir 		<kabalak kabalak net>
+Ignacio Casal Quinteiro <nacho resa gmail com>
+Ross Golder		<ross golder org>
+Fatih Demir 		<kabalak kabalak net> (Original Author)
 
 
 Other contributors are listed in the "THANKS" file in the same
  directory.
 
---
-Fatih Demir, <kabalak kabalak net>

Modified: trunk/INSTALL
==============================================================================
--- trunk/INSTALL	(original)
+++ trunk/INSTALL	Sun Mar  2 21:32:24 2008
@@ -1,38 +1,54 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006 Free Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
 Basic Installation
 ==================
 
-   These are generic installation instructions.
+Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
 
    The `configure' shell script attempts to guess correct values for
 various system-dependent variables used during compilation.  It uses
 those values to create a `Makefile' in each directory of the package.
 It may also create one or more `.h' files containing system-dependent
 definitions.  Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, a file
-`config.cache' that saves the results of its tests to speed up
-reconfiguring, and a file `config.log' containing compiler output
-(useful mainly for debugging `configure').
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
 
    If you need to do unusual things to compile the package, please try
 to figure out how `configure' could check whether to do them, and mail
 diffs or instructions to the address given in the `README' so they can
-be considered for the next release.  If at some point `config.cache'
-contains results you don't want to keep, you may remove or edit it.
-
-   The file `configure.in' is used to create `configure' by a program
-called `autoconf'.  You only need `configure.in' if you want to change
-it or regenerate `configure' using a newer version of `autoconf'.
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
 
 The simplest way to compile this package is:
 
   1. `cd' to the directory containing the package's source code and type
-     `./configure' to configure the package for your system.  If you're
-     using `csh' on an old version of System V, you might need to type
-     `sh ./configure' instead to prevent `csh' from trying to execute
-     `configure' itself.
+     `./configure' to configure the package for your system.
 
-     Running `configure' takes awhile.  While running, it prints some
-     messages telling which features it is checking for.
+     Running `configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
 
   2. Type `make' to compile the package.
 
@@ -54,49 +70,49 @@
 Compilers and Options
 =====================
 
-   Some systems require unusual options for compilation or linking that
-the `configure' script does not know about.  You can give `configure'
-initial values for variables by setting them in the environment.  Using
-a Bourne-compatible shell, you can do that on the command line like
-this:
-     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about.  Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
 
-Or on systems that have the `env' program, you can do it like this:
-     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+   *Note Defining Variables::, for more details.
 
 Compiling For Multiple Architectures
 ====================================
 
-   You can compile the package for more than one kind of computer at the
+You can compile the package for more than one kind of computer at the
 same time, by placing the object files for each architecture in their
-own directory.  To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+own directory.  To do this, you can use GNU `make'.  `cd' to the
 directory where you want the object files and executables to go and run
 the `configure' script.  `configure' automatically checks for the
 source code in the directory that `configure' is in and in `..'.
 
-   If you have to use a `make' that does not supports the `VPATH'
-variable, you have to compile the package for one architecture at a time
-in the source code directory.  After you have installed the package for
-one architecture, use `make distclean' before reconfiguring for another
-architecture.
+   With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
 
 Installation Names
 ==================
 
-   By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/man', etc.  You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PATH'.
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
 
    You can specify separate installation prefixes for
 architecture-specific files and architecture-independent files.  If you
-give `configure' the option `--exec-prefix=PATH', the package will use
-PATH as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
 
    In addition, if you use an unusual directory layout you can give
-options like `--bindir=PATH' to specify different values for particular
+options like `--bindir=DIR' to specify different values for particular
 kinds of files.  Run `configure --help' for a list of the directories
 you can set and what kinds of files go in them.
 
@@ -107,7 +123,7 @@
 Optional Features
 =================
 
-   Some packages pay attention to `--enable-FEATURE' options to
+Some packages pay attention to `--enable-FEATURE' options to
 `configure', where FEATURE indicates an optional part of the package.
 They may also pay attention to `--with-PACKAGE' options, where PACKAGE
 is something like `gnu-as' or `x' (for the X Window System).  The
@@ -122,48 +138,86 @@
 Specifying the System Type
 ==========================
 
-   There may be some features `configure' can not figure out
-automatically, but needs to determine by the type of host the package
-will run on.  Usually `configure' can figure that out, but if it prints
-a message saying it can not guess the host type, give it the
-`--host=TYPE' option.  TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name with three fields:
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
      CPU-COMPANY-SYSTEM
 
-See the file `config.sub' for the possible values of each field.  If
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
 `config.sub' isn't included in this package, then this package doesn't
-need to know the host type.
+need to know the machine type.
 
-   If you are building compiler tools for cross-compiling, you can also
-use the `--target=TYPE' option to select the type of system they will
-produce code for and the `--build=TYPE' option to select the type of
-system on which you are compiling the package.
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
 
 Sharing Defaults
 ================
 
-   If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
 `configure' looks for `PREFIX/share/config.site' if it exists, then
 `PREFIX/etc/config.site' if it exists.  Or, you can set the
 `CONFIG_SITE' environment variable to the location of the site script.
 A warning: not all `configure' scripts look for a site script.
 
-Operation Controls
+Defining Variables
 ==================
 
-   `configure' recognizes the following options to control how it
-operates.
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
 
-`--cache-file=FILE'
-     Use and save the results of the tests in FILE instead of
-     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
-     debugging `configure'.
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
+
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
 
 `--help'
+`-h'
      Print a summary of the options to `configure', and exit.
 
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
 `--quiet'
 `--silent'
 `-q'
@@ -175,8 +229,6 @@
      Look for the package's source code in directory DIR.  Usually
      `configure' can determine that directory automatically.
 
-`--version'
-     Print the version of Autoconf used to generate the `configure'
-     script, and exit.
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
 
-`configure' also accepts some other, not widely useful, options.

Modified: trunk/MAINTAINERS
==============================================================================
--- trunk/MAINTAINERS	(original)
+++ trunk/MAINTAINERS	Sun Mar  2 21:32:24 2008
@@ -6,3 +6,13 @@
 E-mail: jjsanchez igalia com
 Userid: jjsanchez
 
+Past Maintainers:
+================
+
+Ross Golder
+E-mail: ross golder org
+Userid: rossg
+
+Fatih Demir
+E-mail: kabalak kabalak net
+Userid: kabalak

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Sun Mar  2 21:32:24 2008
@@ -1,6 +1,6 @@
 ## the main Makefile.am
 
-SUBDIRS = data doc help man src po
+SUBDIRS = data doc help man src plugins po
 
 EXTRA_DIST= \
 		DEPENDS \

Modified: trunk/autogen.sh
==============================================================================
--- trunk/autogen.sh	(original)
+++ trunk/autogen.sh	Sun Mar  2 21:32:24 2008
@@ -6,7 +6,7 @@
 
 PKG_NAME="gtranslator"
 
-(test -f $srcdir/configure.in \
+(test -f $srcdir/configure.ac \
   && test -d $srcdir/src \
   && test -f $srcdir/src/main.c) || {
     echo -n "**Error**: Directory "\`$srcdir\'" is NOT the top source"
@@ -31,4 +31,4 @@
   exit 1
 fi
 
-GNOME_DATADIR="$gnome_datadir" USE_GNOME2_MACROS=1 . $gnome_autogen
+REQUIRED_AUTOMAKE_VERSION=1.9 USE_GNOME2_MACROS=1 . gnome-autogen.sh

Modified: trunk/data/Makefile.am
==============================================================================
--- trunk/data/Makefile.am	(original)
+++ trunk/data/Makefile.am	Sun Mar  2 21:32:24 2008
@@ -1,8 +1,26 @@
 ## the ./data/Makefile.am of gtranslator ..
 
 SUBDIRS = \
-	colorschemes \
 	desktop \
 	mime \
-	pixmaps \
 	scripts
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = gtranslator- GTR_API_VERSION@.pc
+
+gtranslator- GTR_API_VERSION@.pc: gtranslator.pc
+	cp gtranslator.pc gtranslator- GTR_API_VERSION@.pc
+
+uidir = $(pkgdatadir)
+ui_DATA = \
+		gtranslator-ui.xml \
+		gtr-toolbar.xml \
+		po.lang \
+		layout.xml
+
+EXTRA_DIST = \
+		$(ui_DATA) \
+		gtranslator.pc.in
+
+CLEANFILES =	 			\
+		$(pkgconfig_DATA)

Modified: trunk/data/desktop/gtranslator.desktop.in.in
==============================================================================
--- trunk/data/desktop/gtranslator.desktop.in.in	(original)
+++ trunk/data/desktop/gtranslator.desktop.in.in	Sun Mar  2 21:32:24 2008
@@ -1,7 +1,7 @@
 [Desktop Entry]
 Encoding=UTF-8
-_Name=gtranslator PO file editor
-_Comment=Translate programs to your own language
+_Name=Gtranslator PO Editor
+_Comment=Translate and localize applications and libraries
 Icon=gtranslator.png
 Exec=gtranslator
 Terminal=false

Modified: trunk/doc/Makefile.am
==============================================================================
--- trunk/doc/Makefile.am	(original)
+++ trunk/doc/Makefile.am	Sun Mar  2 21:32:24 2008
@@ -1 +1 @@
-SUBDIRS = UMTF
+SUBDIRS = reference UMTF

Modified: trunk/install-sh
==============================================================================
--- trunk/install-sh	(original)
+++ trunk/install-sh	Sun Mar  2 21:32:24 2008
@@ -1,251 +1,519 @@
 #!/bin/sh
-#
 # install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
+
+scriptversion=2006-12-25.00
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
 #
-# Copyright 1991 by the Massachusetts Institute of Technology
 #
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission.  M.I.T. makes no representations about the
-# suitability of this software for any purpose.  It is provided "as is"
-# without express or implied warranty.
+# FSF changes to this file are in the public domain.
 #
 # Calling this script install-sh is preferred over install.sh, to prevent
 # `make' implicit rules from creating a file called install from it
 # when there is no Makefile.
 #
 # This script is compatible with the BSD install script, but was written
-# from scratch.  It can only install one file at a time, a restriction
-# shared with many OS's install programs.
+# from scratch.
 
+nl='
+'
+IFS=" ""	$nl"
 
 # set DOITPROG to echo to test this script
 
 # Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
+doit=${DOITPROG-}
+if test -z "$doit"; then
+  doit_exec=exec
+else
+  doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
 
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+  test "$posix_glob" != "?" || {
+    if (set -f) 2>/dev/null; then
+      posix_glob=
+    else
+      posix_glob=:
+    fi
+  }
+'
+
+posix_mkdir=
 
-# put in absolute paths if you don't have them in your path; or use env. vars.
+# Desired mode of installed file.
+mode=0755
 
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
 rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
-    case $1 in
-	-c) instcmd="$cpprog"
-	    shift
-	    continue;;
-
-	-d) dir_arg=true
-	    shift
-	    continue;;
-
-	-m) chmodcmd="$chmodprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-o) chowncmd="$chownprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-g) chgrpcmd="$chgrpprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-s) stripcmd="$stripprog"
-	    shift
-	    continue;;
-
-	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
-	    shift
-	    continue;;
-
-	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
-	    shift
-	    continue;;
+stripcmd=
 
-	*)  if [ x"$src" = x ]
-	    then
-		src=$1
-	    else
-		# this colon is to work around a 386BSD /bin/sh bug
-		:
-		dst=$1
-	    fi
-	    shift
-	    continue;;
-    esac
-done
+src=
+dst=
+dir_arg=
+dst_arg=
 
-if [ x"$src" = x ]
-then
-	echo "install:	no input file specified"
-	exit 1
-else
-	true
-fi
+copy_on_change=false
+no_target_directory=
 
-if [ x"$dir_arg" != x ]; then
-	dst=$src
-	src=""
-	
-	if [ -d $dst ]; then
-		instcmd=:
-		chmodcmd=""
-	else
-		instcmd=mkdir
-	fi
-else
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
 
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad 
-# if $src (and thus $dsttmp) contains '*'.
-
-	if [ -f $src -o -d $src ]
-	then
-		true
-	else
-		echo "install:  $src does not exist"
-		exit 1
-	fi
-	
-	if [ x"$dst" = x ]
-	then
-		echo "install:	no destination specified"
-		exit 1
-	else
-		true
-	fi
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
 
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
+Options:
+     --help     display this help and exit.
+     --version  display version info and exit.
 
-	if [ -d $dst ]
-	then
-		dst="$dst"/`basename $src`
-	else
-		true
-	fi
-fi
+  -c            (ignored)
+  -C            install only if different (preserve the last data modification time)
+  -d            create directories instead of installing files.
+  -g GROUP      $chgrpprog installed files to GROUP.
+  -m MODE       $chmodprog installed files to MODE.
+  -o USER       $chownprog installed files to USER.
+  -s            $stripprog installed files.
+  -t DIRECTORY  install into DIRECTORY.
+  -T            report an error if DSTFILE is a directory.
 
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+  RMPROG STRIPPROG
+"
 
-# Make sure that the destination directory exists.
-#  this part is taken from Noah Friedman's mkinstalldirs script
+while test $# -ne 0; do
+  case $1 in
+    -c) ;;
 
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='	
-'
-IFS="${IFS-${defaultIFS}}"
+    -C) copy_on_change=true;;
 
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@% g' -e 's ^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
-	pathcomp="${pathcomp}${1}"
-	shift
-
-	if [ ! -d "${pathcomp}" ] ;
-        then
-		$mkdirprog "${pathcomp}"
-	else
-		true
-	fi
+    -d) dir_arg=true;;
 
-	pathcomp="${pathcomp}/"
-done
-fi
+    -g) chgrpcmd="$chgrpprog $2"
+	shift;;
 
-if [ x"$dir_arg" != x ]
-then
-	$doit $instcmd $dst &&
-
-	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
-	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
-	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
-	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
+    --help) echo "$usage"; exit $?;;
 
-# If we're going to rename the final executable, determine the name now.
+    -m) mode=$2
+	case $mode in
+	  *' '* | *'	'* | *'
+'*	  | *'*'* | *'?'* | *'['*)
+	    echo "$0: invalid mode: $mode" >&2
+	    exit 1;;
+	esac
+	shift;;
 
-	if [ x"$transformarg" = x ] 
-	then
-		dstfile=`basename $dst`
-	else
-		dstfile=`basename $dst $transformbasename | 
-			sed $transformarg`$transformbasename
-	fi
+    -o) chowncmd="$chownprog $2"
+	shift;;
 
-# don't allow the sed command to completely eliminate the filename
+    -s) stripcmd=$stripprog;;
 
-	if [ x"$dstfile" = x ] 
-	then
-		dstfile=`basename $dst`
-	else
-		true
-	fi
+    -t) dst_arg=$2
+	shift;;
+
+    -T) no_target_directory=true;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    --)	shift
+	break;;
+
+    -*)	echo "$0: invalid option: $1" >&2
+	exit 1;;
 
-# Make a temp file name in the proper directory.
+    *)  break;;
+  esac
+  shift
+done
 
-	dsttmp=$dstdir/#inst.$$#
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+  # When -d is used, all remaining arguments are directories to create.
+  # When -t is used, the destination is already specified.
+  # Otherwise, the last argument is the destination.  Remove it from $  
+  for arg
+  do
+    if test -n "$dst_arg"; then
+      # $@ is not empty: it contains at least $arg.
+      set fnord "$@" "$dst_arg"
+      shift # fnord
+    fi
+    shift # arg
+    dst_arg=$arg
+  done
+fi
 
-# Move or copy the file name to the temp name
+if test $# -eq 0; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
 
-	$doit $instcmd $src $dsttmp &&
+if test -z "$dir_arg"; then
+  trap '(exit $?); exit' 1 2 13 15
 
-	trap "rm -f ${dsttmp}" 0 &&
+  # Set umask so as not to create temps with too-generous modes.
+  # However, 'strip' requires both read and write access to temps.
+  case $mode in
+    # Optimize common cases.
+    *644) cp_umask=133;;
+    *755) cp_umask=22;;
+
+    *[0-7])
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw='% 200'
+      fi
+      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+    *)
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw=,u+rw
+      fi
+      cp_umask=$mode$u_plus_rw;;
+  esac
+fi
 
-# and set any options; do chmod last to preserve setuid bits
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    dstdir=$dst
+    test -d "$dstdir"
+    dstdir_status=$?
+  else
+
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dst_arg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dst_arg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst;;
+    esac
 
-# If any of these fail, we abort the whole thing.  If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+	echo "$0: $dst_arg: Is a directory" >&2
+	exit 1
+      fi
+      dstdir=$dst
+      dst=$dstdir/`basename "$src"`
+      dstdir_status=0
+    else
+      # Prefer dirname, but fall back on a substitute if dirname fails.
+      dstdir=`
+	(dirname "$dst") 2>/dev/null ||
+	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	     X"$dst" : 'X\(//\)[^/]' \| \
+	     X"$dst" : 'X\(//\)$' \| \
+	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+	echo X"$dst" |
+	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)[^/].*/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\).*/{
+		   s//\1/
+		   q
+		 }
+		 s/.*/./; q'
+      `
+
+      test -d "$dstdir"
+      dstdir_status=$?
+    fi
+  fi
+
+  obsolete_mkdir_used=false
+
+  if test $dstdir_status != 0; then
+    case $posix_mkdir in
+      '')
+	# Create intermediate dirs using mode 755 as modified by the umask.
+	# This is like FreeBSD 'install' as of 1997-10-28.
+	umask=`umask`
+	case $stripcmd.$umask in
+	  # Optimize common cases.
+	  *[2367][2367]) mkdir_umask=$umask;;
+	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+	  *[0-7])
+	    mkdir_umask=`expr $umask + 22 \
+	      - $umask % 100 % 40 + $umask % 20 \
+	      - $umask % 10 % 4 + $umask % 2
+	    `;;
+	  *) mkdir_umask=$umask,go-w;;
+	esac
+
+	# With -d, create the new directory with the user-specified mode.
+	# Otherwise, rely on $mkdir_umask.
+	if test -n "$dir_arg"; then
+	  mkdir_mode=-m$mode
+	else
+	  mkdir_mode=
+	fi
 
-	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
-	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
-	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
-	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+	posix_mkdir=false
+	case $umask in
+	  *[123567][0-7][0-7])
+	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
+	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+	    ;;
+	  *)
+	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
 
-# Now rename the file to the real destination.
+	    if (umask $mkdir_umask &&
+		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+	    then
+	      if test -z "$dir_arg" || {
+		   # Check for POSIX incompatibilities with -m.
+		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+		   # other-writeable bit of parent directory when it shouldn't.
+		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
+		   case $ls_ld_tmpdir in
+		     d????-?r-*) different_mode=700;;
+		     d????-?--*) different_mode=755;;
+		     *) false;;
+		   esac &&
+		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+		   }
+		 }
+	      then posix_mkdir=:
+	      fi
+	      rmdir "$tmpdir/d" "$tmpdir"
+	    else
+	      # Remove any dirs left behind by ancient mkdir implementations.
+	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+	    fi
+	    trap '' 0;;
+	esac;;
+    esac
 
-	$doit $rmcmd -f $dstdir/$dstfile &&
-	$doit $mvcmd $dsttmp $dstdir/$dstfile 
+    if
+      $posix_mkdir && (
+	umask $mkdir_umask &&
+	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+      )
+    then :
+    else
+
+      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # or it failed possibly due to a race condition.  Create the
+      # directory the slow way, step by step, checking for races as we go.
+
+      case $dstdir in
+	/*) prefix='/';;
+	-*) prefix='./';;
+	*)  prefix='';;
+      esac
+
+      eval "$initialize_posix_glob"
+
+      oIFS=$IFS
+      IFS=/
+      $posix_glob set -f
+      set fnord $dstdir
+      shift
+      $posix_glob set +f
+      IFS=$oIFS
+
+      prefixes=
+
+      for d
+      do
+	test -z "$d" && continue
+
+	prefix=$prefix$d
+	if test -d "$prefix"; then
+	  prefixes=
+	else
+	  if $posix_mkdir; then
+	    (umask=$mkdir_umask &&
+	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+	    # Don't fail if two instances are running concurrently.
+	    test -d "$prefix" || exit 1
+	  else
+	    case $prefix in
+	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+	      *) qprefix=$prefix;;
+	    esac
+	    prefixes="$prefixes '$qprefix'"
+	  fi
+	fi
+	prefix=$prefix/
+      done
 
-fi &&
+      if test -n "$prefixes"; then
+	# Don't fail if two instances are running concurrently.
+	(umask $mkdir_umask &&
+	 eval "\$doit_exec \$mkdirprog $prefixes") ||
+	  test -d "$dstdir" || exit 1
+	obsolete_mkdir_used=true
+      fi
+    fi
+  fi
+
+  if test -n "$dir_arg"; then
+    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+  else
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+    # Copy the file name to the temp name.
+    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+    # If -C, don't bother to copy if it wouldn't change the file.
+    if $copy_on_change &&
+       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
+       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
+
+       eval "$initialize_posix_glob" &&
+       $posix_glob set -f &&
+       set X $old && old=:$2:$4:$5:$6 &&
+       set X $new && new=:$2:$4:$5:$6 &&
+       $posix_glob set +f &&
+
+       test "$old" = "$new" &&
+       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+    then
+      rm -f "$dsttmp"
+    else
+      # Rename the file to the real destination.
+      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+      # The rename failed, perhaps because mv can't rename something else
+      # to itself, or perhaps because mv is so ancient that it does not
+      # support -f.
+      {
+	# Now remove or move aside any old file at destination location.
+	# We try this two ways since rm can't unlink itself on some
+	# systems and the destination file might be busy for other
+	# reasons.  In this case, the final cleanup might fail but the new
+	# file should still install successfully.
+	{
+	  test ! -f "$dst" ||
+	  $doit $rmcmd -f "$dst" 2>/dev/null ||
+	  { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+	    { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+	  } ||
+	  { echo "$0: cannot unlink or rename $dst" >&2
+	    (exit 1); exit 1
+	  }
+	} &&
+
+	# Now rename the file to the real destination.
+	$doit $mvcmd "$dsttmp" "$dst"
+      }
+    fi || exit 1
 
+    trap '' 0
+  fi
+done
 
-exit 0
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Sun Mar  2 21:32:24 2008
@@ -1,39 +1,45 @@
 # List of source files containing translatable strings.
 # Please keep this file sorted alphabetically.
+[encoding: UTF-8]
 data/desktop/gtranslator.desktop.in.in
 data/mime/gtranslator.keys_template.in
-src/about.c
-src/bookmark.c
-src/color-schemes.c
+data/po.lang
+data/desktop/gtranslator.desktop.in
+plugins/alternate-language/alternate-language-panel.c
+plugins/alternate-language/alternate-language-plugin.c
+plugins/alternate-language/alternate-language.gtranslator-plugin.desktop.in
+plugins/charmap/charmap-plugin.c
+plugins/charmap/charmap.gtranslator-plugin.desktop.in
+plugins/dictionary/dict-panel.c
+plugins/dictionary/dict.gtranslator-plugin.desktop.in
+plugins/dictionary/dictionary-plugin.c
+plugins/open-tran/open-tran-dialog.glade
+plugins/open-tran/open-tran-panel.c
+plugins/open-tran/open-tran-plugin.c
+plugins/open-tran/open-tran.gtranslator-plugin.desktop.in
+src/actions-file.c
+src/actions-help.c
 src/comment.c
-src/compile.c
-src/dialogs.c
-src/dict-panel.c
-src/dictionary.c
-src/find.c
-src/gui.c
-src/header_dialog.glade
-src/header_stuff.c
-src/history.c
-src/languages.c
-src/learn.c
+src/dialogs/bookmarks-dialog.glade
+src/dialogs/comment-dialog.c
+src/dialogs/comment-dialog.glade
+src/dialogs/file-dialogs.c
+src/dialogs/header-dialog.c
+src/dialogs/header-dialog.glade
+src/dialogs/preferences-dialog.c
+src/dialogs/preferences-dialog.glade
+src/dialogs/search-dialog.c
+src/dialogs/search-dialog.glade
 src/main.c
-src/main_window.glade
-src/menus.c
-src/message.c
-src/messages-table.c
-src/page.c
-src/parse.c
-src/preferences.c
-src/preferences.glade
-src/prefs.c
-src/replace.c
-src/runtime-config.c
-src/save.c
-src/session.c
-src/sighandling.c
-src/stylistics.c
-src/translator.c
-src/utils.c
+src/message-table.c
+src/notebook.c
+src/po.c
+src/plugin-system/plugin-manager.c
+src/prefs-manager.c
+src/statusbar.c
+src/tab.c
+src/toolbareditor/egg-editable-toolbar.c
+src/toolbareditor/egg-toolbar-editor.c
 src/utils_gui.c
-src/vfs-handle.c
+src/view.c
+src/window.c

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Sun Mar  2 21:32:24 2008
@@ -2,20 +2,29 @@
 # Welcome to the gtranslator-automake-autoconf Wonderland!
 # --------------------------------------------------------
 
+SUBDIRS = toolbareditor \
+	  dialogs \
+	  plugin-system
+
+noinst_LTLIBRARIES = libgtranslator.la
+
 INCLUDES = \
 	-I$(top_srcdir)						\
 	-I$(includedir)						\
+	-I$(top_srcdir)/src/dialogs				\
+	-I$(top_srcdir)/src/toolbareditor			\
+	-I$(top_srcdir)/src/plugin-system			\
 	-DGNOMELOCALEDIR=\""$(prefix)/${DATADIRNAME}/locale"\"	\
-        -DPREFIX=\""$(prefix)"\"                                \
-        -DSYSCONFDIR=\""$(sysconfdir)"\"                        \
-        -DDATADIR=\""$(datadir)"\"                              \
-        -DLIBDIR=\""$(libdir)"\"                                \
+	-DPREFIX=\""$(prefix)"\"                                \
+	-DSYSCONFDIR=\""$(sysconfdir)"\"                        \
+	-DDATADIR=\""$(pkgdatadir)"\"                              \
+	-DLIBDIR=\""$(libdir)"\"                                \
 	$(GTRANSLATOR_CFLAGS)                                   \
 	$(GTKSPELL_CFLAGS)                                      \
+	$(SPELLCHECK_CFLAGS)					\
 	$(DEPRECATED_FLAGS)                                     \
 	-DG_LOG_DOMAIN=\""$(PACKAGE)"\"                         \
-	-DSCHEMESDIR=\""$(datadir)"/gtranslator/colorschemes\"	\
-	-DSCRIPTSDIR=\""$(datadir)"/gtranslator/scripts\"	\
+	-DSCRIPTSDIR=\""$(pkgdatadir)"/scripts\"	\
 	-DWINDOW_ICON=\""$(datadir)"/pixmaps/gtranslator.png\"
 
 bin_PROGRAMS = \
@@ -24,58 +33,82 @@
 #	gtranslator-auto-learn \
 #	gtranslator-export-learn-buffer
 
-gtranslator_SOURCES = \
-	about.c about.h \
-	actions.c actions.h \
-	bookmark.c bookmark.h \
-	charmap-panel.c charmap-panel.h \
-	color-schemes.c color-schemes.h \
-	comment.c comment.h \
-	compile.c compile.h \
-	dialogs.c dialogs.h \
-	dictionary.c dictionary.h \
-	dict-panel.c dict-panel.h \
-	dnd.c dnd.h \
+gtranslator_SOURCES = main.c
+
+gtranslator_LDADD = libgtranslator.la $(GTRANSLATOR_LIBS) $(GTKSPELL_LIBS) $(INTLLIBS)
+
+gtranslator_LDFLAGS = -export-dynamic -no-undefined -export-symbols-regex "^[[^_]].*"
+
+libgtranslator_la_LDFLAGS = -export-dynamic -no-undefined -export-symbols-regex "^[[^_]].*"
+
+BUILT_SOURCES =                         \
+        gtranslator-marshal.h  \
+        gtranslator-marshal.c	\
+	gtranslator-enum-types.h \
+	gtranslator-enum-types.c
+
+INST_H_FILES =				\
+	application.h \
+	comment.h \
+	header.h \
+	io-error-message-area.h \
+	message-area.h \
+	message-table.h \
+	msg.h \
+	notebook.h \
+	po.h \
+	statusbar.h \
+	tab.h \
+	utils_gui.h \
+	view.h \
+	window.h
+
+headerdir = $(prefix)/include/gtranslator- GTR_API_VERSION@/gtranslator
+
+header_DATA = \
+	$(INST_H_FILES)
+
+libgtranslator_la_SOURCES = \
+	$(BUILT_SOURCES) \
+	application.c \
 	draw-spaces.c draw-spaces.h \
-	find.c find.h \
-	gdict-sidebar.c gdict-sidebar.h \
-	glossary-panel.c glossary-panel.h \
-	gucharmap.c gucharmap.h \
-	gui.c gui.h \
-	header_stuff.c header_stuff.h \
-	history.c history.h \
-	languages.c languages.h \
-	learn.c learn.h \
-	main.c \
-	menus.c menus.h \
-	message.c message.h \
-	message-area.c message-area.h \
-	messages-table.c messages-table.h \
-	nautilus-string.c nautilus-string.h \
-	parse.c parse.h \
-	page.c page.h \
-	preferences.c preferences.h \
-	prefs.c prefs_init.c prefs.h \
-	replace.c replace.h \
-	runtime-config.c runtime-config.h \
-	session.c session.h \
-	sighandling.c sighandling.h \
-	stylistics.c stylistics.h \
-	translator.c translator.h \
-	undo.c undo.h \
-	utils.c utils.h \
-	utils_gui.c utils_gui.h \
-	vfs-handle.c vfs-handle.h \
-	view.c view.h
+	message-area.c \
+	message-table.c \
+	message-table-model.c \
+	message-table-model.h \
+	notebook.c \
+	tab.c \
+	view.c \
+	window.c \
+	po.c \
+	utils_gui.c \
+	msg.c \
+	actions.h \
+	actions-file.c \
+	actions-go.c \
+	actions-edit.c \
+	actions-view.c \
+	actions-help.c \
+	io-error-message-area.c \
+	prefs-manager.c \
+	prefs-manager.h \
+	prefs-manager-private.h \
+	prefs-manager-app.c \
+	prefs-manager-app.h \
+	history-entry.c \
+	history-entry.h \
+	actions-search.c \
+	header.c \
+	statusbar.c \
+	comment.c \
+	$(INST_H_FILES) 
 
-gtranslator_LDADD = \
-	$(INTLLIBS) \
+libgtranslator_la_LIBADD = \
 	$(GTRANSLATOR_LIBS) \
-	$(GTKSPELL_LIBS)
+	dialogs/libdialogs.la \
+	toolbareditor/libtoolbareditor.la \
+	plugin-system/libpluginsystem.la 
 	
-gtranslator_LDFLAGS = \
-	-Wall
-
 #gtranslator_auto_learn_SOURCES = \
 #	auto-learn.c
 #	
@@ -86,13 +119,19 @@
 #	export-learn-buffer.c
 #	
 
-gladedir = $(pkgdatadir)
+gtranslator-enum-types.h: gtranslator-enum-types.h.template $(INST_H_FILES) $(GLIB_MKENUMS)
+	(cd $(srcdir) && $(GLIB_MKENUMS) --template gtranslator-enum-types.h.template $(INST_H_FILES)) > $@
+	
+gtranslator-enum-types.c: gtranslator-enum-types.c.template $(INST_H_FILES) $(GLIB_MKENUMS)
+	(cd $(srcdir) && $(GLIB_MKENUMS) --template gtranslator-enum-types.c.template $(INST_H_FILES)) > $@
+
+gtranslator-marshal.h: gtranslator-marshal.list $(GLIB_GENMARSHAL)
+	$(GLIB_GENMARSHAL) $< --header --prefix=gtranslator_marshal > $@
 
-glade_DATA =  \
-       header_dialog.glade \
-       main_window.glade \
-       preferences.glade
+gtranslator-marshal.c: gtranslator-marshal.list $(GLIB_GENMARSHAL)
+	$(GLIB_GENMARSHAL) $< --body --header --prefix=gtranslator_marshal > $@
 
-EXTRA_DIST = ChangeLog $(glade_DATA)
+EXTRA_DIST = ChangeLog gtranslator-marshal.list
 
 
+CLEANFILES = $(BUILT_SOURCES)

Copied: trunk/src/actions-help.c (from r3501, /branches/GOBJECT_WORK/src/actions-help.c)
==============================================================================
--- /branches/GOBJECT_WORK/src/actions-help.c	(original)
+++ trunk/src/actions-help.c	Sun Mar  2 21:32:24 2008
@@ -43,6 +43,7 @@
 	const gchar *authors[] = {
 		N_("Current Developers"),
 		"---------------------------------------------------------",
+		"Pablo Sanxiao <psanxiao gmail org>",
 		"Ignacio Casal Quinteiro <nacho resa gmail com>",
 		"SeÃn de BÃrca <leftmostcat gmail com>",
 		"",

Modified: trunk/src/actions.h
==============================================================================
--- trunk/src/actions.h	(original)
+++ trunk/src/actions.h	Sun Mar  2 21:32:24 2008
@@ -1,99 +1,130 @@
 /*
- * (C) 2001-2002 	Fatih Demir <kabalak kabalak net>
- *			Gediminas Paulauskas <menesis kabalak net>
- *
- * gtranslator is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- * gtranslator is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *    GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Copyright (C) 2007  Ignacio Casal Quinteiro <nacho resa gmail com>
+ * 
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU General Public License as published by
+ *     the Free Software Foundation, either version 3 of the License, or
+ *     (at your option) any later version.
+ * 
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANMSGILITY or FITNESS FOR A PARTICULAR PURMSGSE.  See the
+ *     GNU General Public License for more details.
+ * 
+ *     You should have received a copy of the GNU General Public License
+ *     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
-#ifndef GTR_ACTIONS_H
-#define GTR_ACTIONS_H 1
+#ifndef __ACTIONS_H__
+#define __ACTIONS_H__
 
-#include <glib.h>
-#include <gtk/gtkwidget.h>
+#include <gtk/gtkaction.h>
+#include "window.h"
 
-/*
- * ACT_* enum values and handling of gui activation/disabling.
- */
+G_BEGIN_DECLS
 
-enum {
-	ACT_NULL,
-	ACT_COMPILE,
-	ACT_UPDATE,
-	ACT_ADD_BOOKMARK,
-	ACT_SAVE,
-	ACT_AUTOTRANSLATE,
-	ACT_REMOVE_ALL_TRANSLATIONS,
-	ACT_SAVE_AS,
-	ACT_REVERT,
-	ACT_CLOSE,
-	/***********************/
-	ACT_UNDO,
-	ACT_CUT,
-	ACT_COPY,
-	ACT_PASTE,
-	ACT_CLEAR,
-	ACT_FIND,
-	ACT_FIND_AGAIN,
-	ACT_REPLACE,
-	ACT_QUERY,
-	ACT_HEADER,
-	ACT_COMMENT,
-	ACT_COPY_MSGID2MSGSTR,
-	/***********************/
-	ACT_FIRST,
-	ACT_BACK,
-	ACT_NEXT,
-	ACT_LAST,
-	ACT_GOTO,
-	ACT_NEXT_FUZZY,
-	ACT_NEXT_UNTRANSLATED,
-	/***********************/
-	ACT_FUZZY,
-	
-	/*
-	 * This must always be the last, add new entries above
-	 */
-	ACT_END
-};
+/*File*/
+void       gtranslator_open_file_dialog         (GtkAction * action,
+						 GtranslatorWindow *window);
 
-/*
- * Defines for convenient handling of the state changes.
- */
-/*#define gtranslator_actions_enable(args...) gtranslator_actions_set_up(TRUE, args, ACT_END)
-#define gtranslator_actions_disable(args...) gtranslator_actions_set_up(FALSE, args, ACT_END)*/
+void       gtranslator_save_current_file_dialog (GtkWidget * widget,
+						 GtranslatorWindow *window);
 
-/*
- * Set up the general binding at startup time.
- */
-void gtranslator_actions_set_up_default(void);
+void       gtranslator_save_file_as_dialog      (GtkAction * action,
+						 GtranslatorWindow *window);
 
-/*
- * The real backend function for the actions.
- */
-void gtranslator_actions_set_up(gboolean state, ...);
+gboolean   gtranslator_open                     (const gchar *filename,
+						 GtranslatorWindow *window,
+						 GError **error);
 
-/*
- * Easy calls for the defined states to easify work.
- */
-void gtranslator_actions_set_up_state_no_file(void);
-void gtranslator_actions_set_up_file_opened(void);
+void       gtranslator_file_close               (GtkAction * widget,
+						 GtranslatorWindow *window);
 
-/*
- * The GUI Undo/Redo callbacks/functions.
- */
-void gtranslator_actions_undo(GtkWidget *widget, gpointer useless);
+void       gtranslator_file_quit                (GtkAction *action,
+						 GtranslatorWindow *window);
+
+void       gtranslator_actions_load_uris        (GtranslatorWindow *window,
+						 const GSList        *uris);
+
+/*Edit*/
+void       gtranslator_actions_edit_undo        (GtkAction   *action,
+						 GtranslatorWindow *window);
+
+void       gtranslator_actions_edit_redo        (GtkAction   *action,
+						 GtranslatorWindow *window);
+
+void       gtranslator_actions_edit_cut         (GtkAction   *action,
+						 GtranslatorWindow *window);
+
+void       gtranslator_actions_edit_copy        (GtkAction   *action,
+						 GtranslatorWindow *window);
+
+void       gtranslator_actions_edit_paste       (GtkAction   *action,
+						 GtranslatorWindow *window);
+
+void 	   gtranslator_actions_edit_header 	(GtkAction *action,
+						 GtranslatorWindow *window);
+
+void       gtranslator_edit_message_comment     (GtkAction *action,
+						 GtranslatorWindow *window);
+
+void       gtranslator_message_copy_to_translation
+                                                (GtkAction *action,
+						 GtranslatorWindow *window);
+
+void       gtranslator_message_status_toggle_fuzzy
+                                                (GtkAction *action,
+						 GtranslatorWindow *window);
+
+void       gtranslator_actions_edit_preferences (GtkAction *action,
+						 GtranslatorWindow *window);
+
+/* View */
+
+/*Go*/
+void       gtranslator_message_go_to_first      (GtkAction  * action,
+						 GtranslatorWindow *window);
+
+void       gtranslator_message_go_to_previous   (GtkAction *action,
+						 GtranslatorWindow *window);
+
+void       gtranslator_message_go_to_next       (GtkAction *action,
+						 GtranslatorWindow *window);
+
+void       gtranslator_message_go_to_last       (GtkAction *action,
+						 GtranslatorWindow *window);
+
+void       gtranslator_message_go_to_next_fuzzy (GtkAction *action,
+						 GtranslatorWindow *window);
+
+void       gtranslator_message_go_to_prev_fuzzy (GtkAction *action,
+						 GtranslatorWindow *window);
+
+void       gtranslator_message_go_to_next_untranslated
+                                                (GtkAction *action,
+						 GtranslatorWindow *window);
+
+void       gtranslator_message_go_to_prev_untranslated
+                                                (GtkAction *action,
+						 GtranslatorWindow *window);
+
+/*Search*/
+void       _gtranslator_actions_search_find     (GtkAction   *action,
+						 GtranslatorWindow *window);
+
+void       _gtranslator_actions_search_replace  (GtkAction   *action,
+						 GtranslatorWindow *window);
+
+/*Help*/
+void       gtranslator_window_show_home_page    (GtkAction *action,
+						 gpointer useless);
+
+void       gtranslator_about_dialog             (GtkAction *action,
+						 GtranslatorWindow *window);
+
+
+
+G_END_DECLS
 
 #endif

Modified: trunk/src/draw-spaces.c
==============================================================================
--- trunk/src/draw-spaces.c	(original)
+++ trunk/src/draw-spaces.c	Sun Mar  2 21:32:24 2008
@@ -1,5 +1,9 @@
 /*
  * Copyright (C) 2007  Ignacio Casal Quinteiro <nacho resa gmail com>
+ *		 2006  Paolo Borelli
+ * 		 2007  Steve FrÃcinaux
+ *
+ * Based in gedit draw spaces plugin.
  * 
  *     This program is free software: you can redistribute it and/or modify
  *     it under the terms of the GNU General Public License as published by
@@ -127,7 +131,7 @@
 	gunichar c;
 	cr = gdk_cairo_create(event->window);
 	//This color should be configurable
-	gdk_color_parse("#000000", &color);
+	gdk_color_parse("#444444", &color);
 	gdk_cairo_set_source_color(cr, &color);
 	cairo_set_line_width(cr, 0.8);
 	

Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c	(original)
+++ trunk/src/main.c	Sun Mar  2 21:32:24 2008
@@ -1,8 +1,9 @@
 /*
- * (C) 2000-2004 	Fatih Demir <kabalak kabalak net>
+ * (C) 2000-2007 	Fatih Demir <kabalak kabalak net>
  *			Ross Golder <ross golder org>
  *			Gediminas Paulauskas <menesis kabalak net>
  *			Peeter Vois <peeter kabalak net>
+ * 			Ignacio Casal <nacho resa gmail com>
  * 
  * gtranslator is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -23,90 +24,38 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#include <gnome.h>
 
-#include "bookmark.h"
-#include "dialogs.h"
-#include "gui.h"
-#include "learn.h"
-#include "prefs.h"
-#include "runtime-config.h"
-#include "session.h"
-#include "sighandling.h"
-#include "translator.h"
-#include "utils.h"
+#include "application.h"
+#include "prefs-manager-app.h"
+#include "plugins-engine.h"
+#include "utils_gui.h"
 
 #include <locale.h>
 #include <glib.h>
-
-#include <signal.h>
-
-#include <libgnome/gnome-program.h>
-
-#include <libgnomevfs/gnome-vfs-init.h>
+#include <glib/gi18n.h>
 
 #include <gconf/gconf.h>
 
 /*
- * The static variables used in the poptTable.
- */
-static gchar 	*gtranslator_geometry=NULL;
-
-/*
- * List of files that are currently open
- */
-GSList *open_files;
-
-/*
- * gtranslator's option table.
- */
-static struct poptOption gtranslator_options[] = {
-	{
-	 	NULL, '\0', POPT_ARG_INTL_DOMAIN, PACKAGE,
-	 	0, NULL, NULL
-	},
-	{
-		"geometry", 'g', POPT_ARG_STRING, &gtranslator_geometry,
-		0, N_("Specify main window geometry"), N_("GEOMETRY")
-	},
-	POPT_AUTOHELP {NULL}
-};
-
-/*
  * The ubiquitous main function...
  */
-int main(int argc, char *argv[])
+gint
+main(gint argc,
+     gchar *argv[])
 {
-	GnomeProgram    *program=NULL;
-	GnomeClient 	*client=NULL;
-	GnomeClientFlags flags;
-	
-	poptContext 	context;
-	
-	const char 	**args=NULL;
-	GValue value = { 0, };
-
-	GError		*error=NULL;
-
-	int			i;
+	GError *error = NULL;
+	GtranslatorPluginsEngine *engine;
 	
 	/*
 	 * Initialize gettext.
 	 */ 
-	bindtextdomain(PACKAGE, DATADIR "/locale");
-	textdomain(PACKAGE);
+	setlocale (LC_ALL, "");
+	
+	bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR);
+	bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+	textdomain(GETTEXT_PACKAGE);
 
-	/*
-	 * Set up the signal handler.
-	 */
-	signal(SIGSEGV, gtranslator_signal_handler);
-	signal(SIGKILL, gtranslator_signal_handler);
-	signal(SIGILL, gtranslator_signal_handler);
-	signal(SIGABRT, gtranslator_signal_handler);
-	signal(SIGINT, gtranslator_signal_handler);
-	signal(SIGHUP, gtranslator_signal_handler);
-	signal(SIGQUIT, gtranslator_signal_handler);
-	signal(SIGTERM, gtranslator_signal_handler);
+	g_set_application_name(_("Gtranslator"));
 
 	/*
 	 * Initialize the GConf library.
@@ -122,26 +71,7 @@
 		g_clear_error(&error);
 	}
 
-	/*
-	 * Initialize gtranslator within libgnomeui.
-	 */
-	setlocale(LC_ALL, "");
-	program = gnome_program_init(PACKAGE, VERSION, LIBGNOMEUI_MODULE, 
-			   argc, argv,
-			   GNOME_PARAM_POPT_TABLE, gtranslator_options, 
-			   GNOME_PROGRAM_STANDARD_PROPERTIES,
-			   NULL);
-	context = gnome_program_preinit(program, PACKAGE, VERSION, argc, argv);
-	bind_textdomain_codeset(PACKAGE, "UTF-8");
-
-	/* Initialize configuration client */
-	gtranslator_config_init();
-
-	/*
-	 * Read all of our "normal" preferences -- translator data is now
-	 *  outsourced into the GtrTranslator structure.
-	 */
-	gtranslator_preferences_read();
+	gtk_init(&argc, &argv);
 
 	/*
 	 * Show the application window with icon.
@@ -151,120 +81,32 @@
 	{
 		g_warning(_("Error setting the default window icon: %s"),
 			  error->message);
+		g_clear_error(&error);
 	}
-	g_clear_error(&error);
-
-	/*
-	 * Create our own .gtranslator directory in the user's home directory.
-	 */
-	gtranslator_utils_create_gtranslator_directory();
-
-	/*
-	 * Read the translator information/data into our generally used 
-	 *  GtrTranslator structure.
-	 */
-	gtranslator_translator=gtranslator_translator_new();
 	
 	/*
-	 * Get the master session management client.
-	 */
-	client = gnome_master_client();
-		
-	/*
-	 * Connect the signals needed for session management.
+	 * Init preferences manager
 	 */
-	g_signal_connect(G_OBJECT(client), "save_yourself",
-			 G_CALLBACK(gtranslator_session_sleep),
-			   (gpointer) argv[0]);
-	g_signal_connect(G_OBJECT(client), "die",
-			 G_CALLBACK(gtranslator_session_die), NULL);
-
+	gtranslator_prefs_manager_app_init();
+	
 	/*
-	 * Initialize our generally used GtrRuntimeConfig structure.
+	 * Init plugin engine
 	 */
-	gtranslator_runtime_config=gtranslator_runtime_config_new();
+	engine = gtranslator_plugins_engine_get_default ();
+	
+	gtk_about_dialog_set_url_hook (gtranslator_utils_activate_url, NULL, NULL);
 
 	/* 
 	 * Create the main app-window. 
 	 */
-	gtranslator_create_main_window();
-
-	/*
-	 * Initialize GnomeVFS right now, if needed.
-	 */
-	if(!gnome_vfs_initialized())
-	{
-		gnome_vfs_init();
-	}
-
-	/*
-	 * Init the learn buffer and connected stuff.
-	 */
-	gtranslator_learn_init();
-
-
-	/*
-	 * Load our possibly existing bookmarks' list from our preferences
-	 *  settings - shall make easy access to problematic messages
-	 *   possible and make life faster and easier.
-	 */
-	gtranslator_bookmark_load_list();
-	gtranslator_bookmark_show_list();
+	gtranslator_application_open_window(GTR_APP);
 	
 	/*
-	 * Check the session client flags, and restore state if needed 
-	 */
-	flags = gnome_client_get_flags(client);
-	if(flags & GNOME_CLIENT_RESTORED)
-	{
-		gtranslator_session_restore(client);
-	}
-
-	/*
-	 * Clean up the temporary file in the user's home dir eventually 
-	 *  created by gtranslator.
-	 */
-	gtranslator_utils_remove_temp_files();
-
-	/*
-	 * Test if there's a crash recovery file lying around in ~/.gtranslator.
-	 */
-	if(g_file_test(gtranslator_runtime_config->crash_filename, G_FILE_TEST_EXISTS))
-	{
-		gtranslator_rescue_file_dialog();
-	}
-
-	/*
-	 * Open up the arguments as files (for now, only the first file is
-	 *  opened).
-	 */
-	g_value_init (&value, G_TYPE_POINTER);
-	g_object_get_property (G_OBJECT (program), GNOME_PARAM_POPT_CONTEXT, &value);
-	context = g_value_get_pointer (&value);
-	g_value_unset (&value);
-
-	args = poptGetArgs(context);
-	for (i = 0; args && args[i]; i++)
-	{
-		/*
-		 * Try to open up the supported "special" gettext file types.
-		 */ 
-		if(!gtranslator_open((gchar *)args[i], &error))
-		{
-			g_assert(error!=NULL);
-			fprintf(stderr, _("Couldn't open '%s': %s\n"),
-				(gchar *)args[i], error->message);
-			g_clear_error(&error);
-			return 1;
-		}
-	}
-	
-	poptFreeContext(context);
-
-	/*
 	 * Enter main GTK loop
 	 */
 	gtk_main();
 	
+	gtranslator_prefs_manager_app_shutdown();
+
 	return 0;
 }

Modified: trunk/src/message-area.c
==============================================================================
--- trunk/src/message-area.c	(original)
+++ trunk/src/message-area.c	Sun Mar  2 21:32:24 2008
@@ -1,11 +1,8 @@
-/* Gtranslator - Message Area 
+/*
+ * message-area.c
+ * This file is part of gtranslator
  *
- * Copyright (C) 2007 The Free Software Foundation
- *
- * 	Ignacio Casal Quinteiro <nacho resa gmail com>
- *
- * Based on gedit code (gedit/gedit-message-area.h) by: 
- * 	- Paolo Maggi <paolo gnome org>
+ * Copyright (C) 2005 - Paolo Maggi
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,32 +16,42 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the gtranslator Team, 2005. See the AUTHORS file for a
+ * list of people on the gtranslator Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id: message-area.c 5887 2007-09-07 07:20:19Z pborelli $
  */
- 
+
+/* TODO: Style properties */
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#include "message-area.h"
-
+#include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
 #include <gdk/gdkkeysyms.h>
-#include <glib/gi18n.h>
 
-#define GTRANSLATOR_MESSAGE_AREA_GET_PRIVATE(object) \
-	(G_TYPE_INSTANCE_GET_PRIVATE ((object), GTRANSLATOR_TYPE_MESSAGE_AREA, GtranslatorMessageAreaPrivate))
+#include "message-area.h"
 
-G_DEFINE_TYPE(GtranslatorMessageArea, gtranslator_message_area, GTK_TYPE_HBOX)
+#define GTR_MESSAGE_AREA_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
+					       GTR_TYPE_MESSAGE_AREA, \
+					       GtranslatorMessageAreaPrivate))
 
 struct _GtranslatorMessageAreaPrivate
 {
 	GtkWidget *main_hbox;
-	
+
 	GtkWidget *contents;
 	GtkWidget *action_area;
-	
+
 	gboolean changing_style;
 };
 
@@ -56,16 +63,23 @@
 };
 
 enum {
-	SIGNAL_RESPONSE,
-	SIGNAL_CLOSE,
-	SIGNAL_LAST
+	RESPONSE,
+	CLOSE,
+	LAST_SIGNAL
 };
 
-static guint signals[SIGNAL_LAST];
+static guint signals[LAST_SIGNAL];
+
+G_DEFINE_TYPE(GtranslatorMessageArea, gtranslator_message_area, GTK_TYPE_HBOX)
+
 
 static void
 gtranslator_message_area_finalize (GObject *object)
 {
+	/*
+	GtranslatorMessageArea *message_area = GTR_MESSAGE_AREA (object);
+	*/
+
 	G_OBJECT_CLASS (gtranslator_message_area_parent_class)->finalize (object);
 }
 
@@ -74,13 +88,14 @@
 		   gboolean   create)
 {
 	ResponseData *ad = g_object_get_data (G_OBJECT (widget),
-                                       	      "gtranslator-message-area-response-data");
+                                       	      "message-area-response-data");
 
-	if (ad == NULL && create) {
+	if (ad == NULL && create)
+	{
 		ad = g_new (ResponseData, 1);
 
 		g_object_set_data_full (G_OBJECT (widget),
-					"gtranslator-message-area-response-data",
+					"message-area-response-data",
 					ad,
 					g_free);
     	}
@@ -94,14 +109,16 @@
 {
 	GList *children, *tmp_list;
 	GtkWidget *child = NULL;
-      
+
 	children = gtk_container_get_children (
 			GTK_CONTAINER (message_area->priv->action_area));
 
-	for (tmp_list = children; tmp_list; tmp_list = tmp_list->next) {
+	for (tmp_list = children; tmp_list; tmp_list = tmp_list->next)
+	{
 		ResponseData *rd = get_response_data (tmp_list->data, FALSE);
-      
-		if (rd && rd->response_id == response_id) {
+
+		if (rd && rd->response_id == response_id)
+		{
 			child = tmp_list->data;
 			break;
 		}
@@ -118,9 +135,9 @@
 	if (!find_button (message_area, GTK_RESPONSE_CANCEL))
 		return;
 
-	/* Emit response signal */
-	gtranslator_message_area_response (GTRANSLATOR_MESSAGE_AREA (message_area), 
-				   GTK_RESPONSE_CANCEL);    
+	/* emit response signal */
+	gtranslator_message_area_response (GTR_MESSAGE_AREA (message_area),
+				     GTK_RESPONSE_CANCEL);
 }
 
 static gboolean
@@ -128,7 +145,7 @@
 		    GdkEventExpose *event,
 		    gpointer        user_data)
 {
-	gtk_paint_flat_box (widget->style, 
+	gtk_paint_flat_box (widget->style,
 			    widget->window,
 			    GTK_STATE_NORMAL,
 			    GTK_SHADOW_OUT,
@@ -139,118 +156,115 @@
 			    widget->allocation.y + 1,
 			    widget->allocation.width - 2,
 			    widget->allocation.height - 2);
-		      
-	return FALSE;		      
-}
 
-static void
-style_set (GtkWidget *widget,
-	   GtkStyle  *prev_style)
-{
-	GtkTooltips *tooltips;
-	GtkStyle *style;
-	
-	GtranslatorMessageArea *message_area = GTRANSLATOR_MESSAGE_AREA (widget);
-	
-	if (message_area->priv->changing_style)
-		return;
-	
-	tooltips = gtk_tooltips_new ();
-	g_object_ref_sink (tooltips);
-
-	gtk_tooltips_force_window (tooltips);
-	gtk_widget_ensure_style (tooltips->tip_window);
-	style = gtk_widget_get_style (tooltips->tip_window);
-	
-	message_area->priv->changing_style = TRUE;
-	gtk_widget_set_style (GTK_WIDGET (widget), style);
-	message_area->priv->changing_style = FALSE;	
-	
-	g_object_unref (tooltips);
+	return FALSE;
 }
 
-static void 
-gtranslator_message_area_class_init (GtranslatorMessageAreaClass *class)
+static void
+gtranslator_message_area_class_init (GtranslatorMessageAreaClass *klass)
 {
 	GObjectClass *object_class;
-	GtkWidgetClass *widget_class;
 	GtkBindingSet *binding_set;
-	
-	object_class = G_OBJECT_CLASS (class);
-	widget_class = GTK_WIDGET_CLASS (class);
+
+	object_class = G_OBJECT_CLASS (klass);
 	object_class->finalize = gtranslator_message_area_finalize;
-	
-	widget_class->style_set = style_set;
-	
-	class->close = gtranslator_message_area_close;
+
+	klass->close = gtranslator_message_area_close;
 
 	g_type_class_add_private (object_class, sizeof(GtranslatorMessageAreaPrivate));
 
-	signals[SIGNAL_RESPONSE] = 
-		g_signal_new ("response",
-			      G_OBJECT_CLASS_TYPE (class),
-			      G_SIGNAL_RUN_LAST,
-			      G_STRUCT_OFFSET (GtranslatorMessageAreaClass, response),
-			      NULL, NULL,
-			      g_cclosure_marshal_VOID__INT,
-			      G_TYPE_NONE, 1,
-			      G_TYPE_INT);
-
-	signals[SIGNAL_CLOSE] =  
-		g_signal_new ("close",
-			      G_OBJECT_CLASS_TYPE (class),
-			      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-			      G_STRUCT_OFFSET (GtranslatorMessageAreaClass, close),
-		  	      NULL, NULL,
-		 	      g_cclosure_marshal_VOID__VOID,
-			      G_TYPE_NONE, 0);
-  
-	binding_set = gtk_binding_set_by_class (class);
-  
+	signals[RESPONSE] = g_signal_new ("response",
+					  G_OBJECT_CLASS_TYPE (klass),
+					  G_SIGNAL_RUN_LAST,
+					  G_STRUCT_OFFSET (GtranslatorMessageAreaClass, response),
+					  NULL, NULL,
+					  g_cclosure_marshal_VOID__INT,
+					  G_TYPE_NONE, 1,
+					  G_TYPE_INT);
+
+	signals[CLOSE] =  g_signal_new ("close",
+					G_OBJECT_CLASS_TYPE (klass),
+					G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+					G_STRUCT_OFFSET (GtranslatorMessageAreaClass, close),
+		  			NULL, NULL,
+		  			g_cclosure_marshal_VOID__VOID,
+					G_TYPE_NONE, 0);
+
+	binding_set = gtk_binding_set_by_class (klass);
+
 	gtk_binding_entry_add_signal (binding_set, GDK_Escape, 0, "close", 0);
 }
 
 static void
+style_set (GtkWidget        *widget,
+	   GtkStyle         *prev_style,
+	   GtranslatorMessageArea *message_area)
+{
+	GtkWidget *window;
+	GtkStyle *style;
+
+	if (message_area->priv->changing_style)
+		return;
+
+	/* This is a hack needed to use the tooltip background color */
+	window = gtk_window_new (GTK_WINDOW_POPUP);
+	gtk_widget_set_name (window, "gtk-tooltip");
+	gtk_widget_ensure_style (window);
+	style = gtk_widget_get_style (window);
+
+	message_area->priv->changing_style = TRUE;
+	gtk_widget_set_style (GTK_WIDGET (message_area), style);
+	message_area->priv->changing_style = FALSE;
+
+	gtk_widget_destroy (window);
+
+	gtk_widget_queue_draw (GTK_WIDGET (message_area));
+}
+
+static void
 gtranslator_message_area_init (GtranslatorMessageArea *message_area)
 {
-	message_area->priv = GTRANSLATOR_MESSAGE_AREA_GET_PRIVATE (message_area);
+	message_area->priv = GTR_MESSAGE_AREA_GET_PRIVATE (message_area);
 
-        /* FIXME: use style properties */
-	message_area->priv->main_hbox = gtk_hbox_new (FALSE, 16);
+	message_area->priv->main_hbox = gtk_hbox_new (FALSE, 16); /* FIXME: use style properties */
 	gtk_widget_show (message_area->priv->main_hbox);
+	gtk_container_set_border_width (GTK_CONTAINER (message_area->priv->main_hbox),
+					8); /* FIXME: use style properties */
 
-	/* FIXME: use style properties */
-	gtk_container_set_border_width (GTK_CONTAINER (message_area->priv->main_hbox), 
-					8);
-
-        /* FIXME: use style properties */ 
-	message_area->priv->action_area = gtk_vbox_new (TRUE, 10); 
+	message_area->priv->action_area = gtk_vbox_new (TRUE, 10); /* FIXME: use style properties */
 	gtk_widget_show (message_area->priv->action_area);
-
-	gtk_box_pack_end (GTK_BOX (message_area->priv->main_hbox), 
+	gtk_box_pack_end (GTK_BOX (message_area->priv->main_hbox),
 			    message_area->priv->action_area,
-			    FALSE, 
-			    TRUE, 
+			    FALSE,
+			    TRUE,
 			    0);
 
-	gtk_box_pack_start (GTK_BOX (message_area), 
-			    message_area->priv->main_hbox, 
-			    TRUE, 
-			    TRUE, 
+	gtk_box_pack_start (GTK_BOX (message_area),
+			    message_area->priv->main_hbox,
+			    TRUE,
+			    TRUE,
 			    0);
-			
-	/* CHECK: do we really need it? */    	
-	gtk_widget_set_name (GTK_WIDGET (message_area), "gtk-tooltips");	    
-	
+
+	gtk_widget_set_app_paintable (GTK_WIDGET (message_area), TRUE);
+
 	g_signal_connect (message_area,
-			  "expose_event",
-			  G_CALLBACK (paint_message_area), 
-			  NULL);			  		    
+			  "expose-event",
+			  G_CALLBACK (paint_message_area),
+			  NULL);
+
+	/* Note that we connect to style-set on one of the internal
+	 * widgets, not on the message area itself, since gtk does
+	 * not deliver any further style-set signals for a widget on
+	 * which the style has been forced with gtk_widget_set_style() */
+	g_signal_connect (message_area->priv->main_hbox,
+			  "style-set",
+			  G_CALLBACK (style_set),
+			  message_area);
 }
 
 static gint
 get_response_for_widget (GtranslatorMessageArea *message_area,
-			 GtkWidget      *widget)
+			 GtkWidget        *widget)
 {
 	ResponseData *rd;
 
@@ -265,7 +279,7 @@
 action_widget_activated (GtkWidget *widget, GtranslatorMessageArea *message_area)
 {
 	gint response_id;
-  
+
 	response_id = get_response_for_widget (message_area, widget);
 
 	gtranslator_message_area_response (message_area, response_id);
@@ -273,26 +287,26 @@
 
 void
 gtranslator_message_area_add_action_widget (GtranslatorMessageArea *message_area,
-				    GtkWidget      *child,
-				    gint            response_id)
+				      GtkWidget        *child,
+				      gint              response_id)
 {
 	ResponseData *ad;
 	guint signal_id;
-  
-	g_return_if_fail (GTRANSLATOR_IS_MESSAGE_AREA (message_area));
+
+	g_return_if_fail (GTR_IS_MESSAGE_AREA (message_area));
 	g_return_if_fail (GTK_IS_WIDGET (child));
 
 	ad = get_response_data (child, TRUE);
 
 	ad->response_id = response_id;
 
-	if (GTK_IS_BUTTON (child)) {
+	if (GTK_IS_BUTTON (child))
 		signal_id = g_signal_lookup ("clicked", GTK_TYPE_BUTTON);
-	} else {
+	else
 		signal_id = GTK_WIDGET_GET_CLASS (child)->activate_signal;
-	}
 
-	if (signal_id) {
+	if (signal_id)
+	{
 		GClosure *closure;
 
 		closure = g_cclosure_new_object (G_CALLBACK (action_widget_activated),
@@ -303,98 +317,97 @@
 						0,
 						closure,
 						FALSE);
-	} else {
-		g_warning ("Only 'activatable' widgets can be packed into the action area of a GtranslatorMessageArea");
 	}
+	else
+		g_warning ("Only 'activatable' widgets can be packed into the action area of a GtranslatorMessageArea");
 
-	if (response_id != GTK_RESPONSE_HELP) {
+	if (response_id != GTK_RESPONSE_HELP)
 		gtk_box_pack_start (GTK_BOX (message_area->priv->action_area),
 				    child,
 				    FALSE,
 				    FALSE,
 				    0);
-	} else {
+	else
 		gtk_box_pack_end (GTK_BOX (message_area->priv->action_area),
 				    child,
 				    FALSE,
 				    FALSE,
 				    0);
-	}
 }
 
 void
-gtranslator_message_area_set_contents(GtranslatorMessageArea *message_area,
-			      GtkWidget      *contents)
+gtranslator_message_area_set_contents	(GtranslatorMessageArea *message_area,
+				 GtkWidget        *contents)
 {
-	g_return_if_fail (GTRANSLATOR_IS_MESSAGE_AREA (message_area));
+	g_return_if_fail (GTR_IS_MESSAGE_AREA (message_area));
 	g_return_if_fail (GTK_IS_WIDGET (contents));
 
   	message_area->priv->contents = contents;
-
-	gtk_box_pack_start (GTK_BOX (message_area->priv->main_hbox), 
-			    message_area->priv->contents, 
-			    TRUE, 
-			    TRUE, 
-			    0);	
+	gtk_box_pack_start (GTK_BOX (message_area->priv->main_hbox),
+			    message_area->priv->contents,
+			    TRUE,
+			    TRUE,
+			    0);
 }
 
-GtkWidget *
+GtkWidget*
 gtranslator_message_area_add_button (GtranslatorMessageArea *message_area,
 			       const gchar      *button_text,
 			       gint              response_id)
 {
 	GtkWidget *button;
-  
-	g_return_val_if_fail (GTRANSLATOR_IS_MESSAGE_AREA (message_area), NULL);
+
+	g_return_val_if_fail (GTR_IS_MESSAGE_AREA (message_area), NULL);
 	g_return_val_if_fail (button_text != NULL, NULL);
 
 	button = gtk_button_new_from_stock (button_text);
 
 	GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
-  
+
 	gtk_widget_show (button);
-  
+
 	gtranslator_message_area_add_action_widget (message_area,
-					    button,
-					    response_id);
+					      button,
+					      response_id);
 
 	return button;
 }
 
 static void
 add_buttons_valist (GtranslatorMessageArea *message_area,
-		    const gchar    *first_button_text,
-		    va_list         args)
+		    const gchar      *first_button_text,
+		    va_list           args)
 {
 	const gchar* text;
 	gint response_id;
 
-	g_return_if_fail (GTRANSLATOR_IS_MESSAGE_AREA (message_area));
-  
+	g_return_if_fail (GTR_IS_MESSAGE_AREA (message_area));
+
 	if (first_button_text == NULL)
 		return;
-  
+
 	text = first_button_text;
 	response_id = va_arg (args, gint);
 
-	while (text != NULL) {
-		gtranslator_message_area_add_button (message_area, 
-					     text,
-					     response_id);
+	while (text != NULL)
+	{
+		gtranslator_message_area_add_button (message_area,
+					       text,
+					       response_id);
 
 		text = va_arg (args, gchar*);
+		if (text == NULL)
+        		break;
 
-		if (text == NULL) break;
-        		
 		response_id = va_arg (args, int);
 	}
 }
 
 void
 gtranslator_message_area_add_buttons (GtranslatorMessageArea *message_area,
-			      const gchar    *first_button_text,
-			      ...)
-{  
+				const gchar      *first_button_text,
+				...)
+{
 	va_list args;
 
 	va_start (args, first_button_text);
@@ -402,31 +415,31 @@
 	add_buttons_valist (message_area,
                             first_button_text,
                             args);
-  
+
 	va_end (args);
 }
-				 
+
 GtkWidget *
 gtranslator_message_area_new (void)
 {
-	return g_object_new (GTRANSLATOR_TYPE_MESSAGE_AREA, NULL);
+	return g_object_new (GTR_TYPE_MESSAGE_AREA, NULL);
 }
 
 GtkWidget *
 gtranslator_message_area_new_with_buttons (const gchar *first_button_text,
-                                   ...)
+                                     ...)
 {
 	GtranslatorMessageArea *message_area;
 	va_list args;
-  
-	message_area = GTRANSLATOR_MESSAGE_AREA (gtranslator_message_area_new ());
+
+	message_area = GTR_MESSAGE_AREA (gtranslator_message_area_new ());
 
 	va_start (args, first_button_text);
 
 	add_buttons_valist (message_area,
 			    first_button_text,
 			    args);
-  
+
 	va_end (args);
 
 	return GTK_WIDGET (message_area);
@@ -440,13 +453,13 @@
 	GList *children;
 	GList *tmp_list;
 
-	g_return_if_fail (GTRANSLATOR_IS_MESSAGE_AREA (message_area));
+	g_return_if_fail (GTR_IS_MESSAGE_AREA (message_area));
 
 	children = gtk_container_get_children (GTK_CONTAINER (message_area->priv->action_area));
 
 	tmp_list = children;
-
-	while (tmp_list != NULL) {
+	while (tmp_list != NULL)
+	{
 		GtkWidget *widget = tmp_list->data;
 		ResponseData *rd = get_response_data (widget, FALSE);
 
@@ -466,18 +479,19 @@
 	GList *children;
 	GList *tmp_list;
 
-	g_return_if_fail (GTRANSLATOR_IS_MESSAGE_AREA (message_area));
+	g_return_if_fail (GTR_IS_MESSAGE_AREA (message_area));
 
 	children = gtk_container_get_children (GTK_CONTAINER (message_area->priv->action_area));
 
 	tmp_list = children;
-	while (tmp_list != NULL) {
+	while (tmp_list != NULL)
+	{
 		GtkWidget *widget = tmp_list->data;
 		ResponseData *rd = get_response_data (widget, FALSE);
 
 		if (rd && rd->response_id == response_id)
-			gtk_widget_grab_default (widget);
-	    
+		gtk_widget_grab_default (widget);
+
 		tmp_list = g_list_next (tmp_list);
 	}
 
@@ -486,41 +500,40 @@
 
 void
 gtranslator_message_area_response (GtranslatorMessageArea *message_area,
-			   gint              response_id)
+			     gint              response_id)
 {
-	g_return_if_fail (GTRANSLATOR_IS_MESSAGE_AREA (message_area));
+	g_return_if_fail (GTR_IS_MESSAGE_AREA (message_area));
 
 	g_signal_emit (message_area,
-		       signals[SIGNAL_RESPONSE],
+		       signals[RESPONSE],
 		       0,
 		       response_id);
 }
 
 GtkWidget *
-gtranslator_message_area_add_stock_button_with_text (GtranslatorMessageArea *message_area, 
-				    	     const gchar    *text,
-				    	     const gchar    *stock_id,
-				    	     gint            response_id)
+gtranslator_message_area_add_stock_button_with_text (GtranslatorMessageArea *message_area,
+				    	       const gchar      *text,
+				    	       const gchar      *stock_id,
+				    	       gint              response_id)
 {
 	GtkWidget *button;
-  
-	g_return_val_if_fail (GTRANSLATOR_IS_MESSAGE_AREA (message_area), NULL);
+
+	g_return_val_if_fail (GTR_IS_MESSAGE_AREA (message_area), NULL);
 	g_return_val_if_fail (text != NULL, NULL);
 	g_return_val_if_fail (stock_id != NULL, NULL);
 
 	button = gtk_button_new_with_mnemonic (text);
-
         gtk_button_set_image (GTK_BUTTON (button),
                               gtk_image_new_from_stock (stock_id,
                                                         GTK_ICON_SIZE_BUTTON));
 
 	GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
-  
+
 	gtk_widget_show (button);
-  
+
 	gtranslator_message_area_add_action_widget (message_area,
-					    button,
-					    response_id);
+					      button,
+					      response_id);
 
 	return button;
 }

Modified: trunk/src/message-area.h
==============================================================================
--- trunk/src/message-area.h	(original)
+++ trunk/src/message-area.h	Sun Mar  2 21:32:24 2008
@@ -1,11 +1,8 @@
-/* Gtranslator - Message Area 
+/*
+ * message-area.h
+ * This file is part of gtranslator
  *
- * Copyright (C) 2007 The Free Software Foundation
- *
- * 	Ignacio Casal Quinteiro <nacho resa gmail com>
- *
- * Based on gedit code (gedit/gedit-message-area.h) by: 
- * 	- Paolo Maggi <paolo gnome org>
+ * Copyright (C) 2005 - Paolo Maggi 
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,42 +16,74 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 59 Temple Place, Suite 330, 
+ * Boston, MA 02111-1307, USA.
+ */
+ 
+/*
+ * Modified by the gtranslator Team, 2005. See the AUTHORS file for a 
+ * list of people on the gtranslator Team.  
+ * See the ChangeLog files for a list of changes. 
+ *
+ * $Id: message-area.h 5666 2007-06-29 19:52:25Z sfre $
  */
 
-#ifndef __GTRANSLATOR_MESSAGE_AREA_H__
-#define __GTRANSLATOR_MESSAGE_AREA_H__
+#ifndef __GTR_MESSAGE_AREA_H__
+#define __GTR_MESSAGE_AREA_H__
 
-#include <gtk/gtk.h>
+#include <gtk/gtkhbox.h>
 
 G_BEGIN_DECLS
 
-typedef struct _GtranslatorMessageArea GtranslatorMessageArea;
-typedef struct _GtranslatorMessageAreaClass GtranslatorMessageAreaClass;
+/*
+ * Type checking and casting macros
+ */
+#define GTR_TYPE_MESSAGE_AREA              (gtranslator_message_area_get_type())
+#define GTR_MESSAGE_AREA(obj)              (G_TYPE_CHECK_INSTANCE_CAST((obj), GTR_TYPE_MESSAGE_AREA, GtranslatorMessageArea))
+#define GTR_MESSAGE_AREA_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass), GTR_TYPE_MESSAGE_AREA, GtranslatorMessageAreaClass))
+#define GTR_IS_MESSAGE_AREA(obj)           (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTR_TYPE_MESSAGE_AREA))
+#define GTR_IS_MESSAGE_AREA_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GTR_TYPE_MESSAGE_AREA))
+#define GTR_MESSAGE_AREA_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), GTR_TYPE_MESSAGE_AREA, GtranslatorMessageAreaClass))
+
+/* Private structure type */
 typedef struct _GtranslatorMessageAreaPrivate GtranslatorMessageAreaPrivate;
 
-#define GTRANSLATOR_TYPE_MESSAGE_AREA            (gtranslator_message_area_get_type())
-#define GTRANSLATOR_MESSAGE_AREA(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GTRANSLATOR_TYPE_MESSAGE_AREA, GtranslatorMessageArea))
-#define GTRANSLATOR_MESSAGE_AREA_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GTRANSLATOR_TYPE_MESSAGE_AREA, GtranslatorMessageAreaClass))
-#define GTRANSLATOR_IS_MESSAGE_AREA(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTRANSLATOR_TYPE_MESSAGE_AREA))
-#define GTRANSLATOR_IS_MESSAGE_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTRANSLATOR_TYPE_MESSAGE_AREA))
-#define GTRANSLATOR_MESSAGE_AREA_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTRANSLATOR_TYPE_MESSAGE_AREA, GtranslatorMessageAreaClass))
+/*
+ * Main object structure
+ */
+typedef struct _GtranslatorMessageArea GtranslatorMessageArea;
 
-struct _GtranslatorMessageArea {
+struct _GtranslatorMessageArea 
+{
 	GtkHBox parent;
 
+	/*< private > */
 	GtranslatorMessageAreaPrivate *priv;
 };
 
-struct _GtranslatorMessageAreaClass {
+/*
+ * Class definition
+ */
+typedef struct _GtranslatorMessageAreaClass GtranslatorMessageAreaClass;
+
+struct _GtranslatorMessageAreaClass 
+{
 	GtkHBoxClass parent_class;
 
-	void (* response) (GtranslatorMessageArea *message_area, 
-			   gint            response_id);
+	/* Signals */
+	void (* response) (GtranslatorMessageArea *message_area, gint response_id);
 
+	/* Keybinding signals */
 	void (* close)    (GtranslatorMessageArea *message_area);
+
+	/* Padding for future expansion */
+	void (*_gtranslator_reserved1) (void);
+	void (*_gtranslator_reserved2) (void);	
 };
 
+/*
+ * Public methods
+ */
 GType 		 gtranslator_message_area_get_type 		(void) G_GNUC_CONST;
 
 GtkWidget	*gtranslator_message_area_new      		(void);
@@ -62,10 +91,10 @@
 GtkWidget	*gtranslator_message_area_new_with_buttons	(const gchar      *first_button_text,
                                         		 ...);
 
-void		 gtranslator_message_area_set_contents	        (GtranslatorMessageArea *message_area,
+void		 gtranslator_message_area_set_contents	(GtranslatorMessageArea *message_area,
                                              		 GtkWidget        *contents);
                               		 
-void		 gtranslator_message_area_add_action_widget	(GtranslatorMessageArea   *message_area,
+void		 gtranslator_message_area_add_action_widget	(GtranslatorMessageArea *message_area,
                                          		 GtkWidget        *child,
                                          		 gint              response_id);
                                          		 
@@ -74,26 +103,27 @@
                                          		 gint              response_id);
              		 
 GtkWidget	*gtranslator_message_area_add_stock_button_with_text 
-							(GtranslatorMessageArea   *message_area, 
+							(GtranslatorMessageArea *message_area, 
 				    			 const gchar      *text, 
 				    			 const gchar      *stock_id, 
 				    			 gint              response_id);
 
-void       	 gtranslator_message_area_add_buttons 	        (GtranslatorMessageArea *message_area,
+void       	 gtranslator_message_area_add_buttons 	(GtranslatorMessageArea *message_area,
                                          		 const gchar      *first_button_text,
                                          		 ...);
 
 void		 gtranslator_message_area_set_response_sensitive 
-							(GtranslatorMessageArea   *message_area,
+							(GtranslatorMessageArea *message_area,
                                         		 gint              response_id,
                                         		 gboolean          setting);
 void 		 gtranslator_message_area_set_default_response 
 							(GtranslatorMessageArea *message_area,
                                         		 gint              response_id);
 
+/* Emit response signal */
 void		 gtranslator_message_area_response           	(GtranslatorMessageArea *message_area,
                                     			 gint              response_id);
 
 G_END_DECLS
 
-#endif  /* __GTRANSLATOR_MESSAGE_AREA_H__ */
+#endif  /* __GTR_MESSAGE_AREA_H__  */

Modified: trunk/src/utils_gui.c
==============================================================================
--- trunk/src/utils_gui.c	(original)
+++ trunk/src/utils_gui.c	Sun Mar  2 21:32:24 2008
@@ -1,5 +1,9 @@
 /*
- * (C) 2001-2003 	Fatih Demir <kabalak kabalak net>
+ * (C) 2001-2007 	Fatih Demir <kabalak kabalak net>
+ * 			Ignacio Casal <nacho resa gmail com>
+ * 			Paolo Maggi 
+ *
+ * 	Based in gedit utils funcs.
  *
  * gtranslator is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -17,356 +21,510 @@
  *
  */
 
-#include "dialogs.h"
-#include "gui.h"
-#include "nautilus-string.h"
-#include "parse.h"
-#include "prefs.h"
-#include "runtime-config.h"
-#include "utils.h"
 #include "utils_gui.h"
 
-#include <libgnome/gnome-url.h>
+#include <string.h>
 
-#include <libgnomeui/libgnomeui.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glade/glade.h>
+#include <gtk/gtk.h>
 
-/*
- * Show an error message.
- */
-GtkWidget * gtranslator_utils_error_dialog(gchar *format, ...)
-{
-	gchar *error;
-	va_list ap;
-	GtkWidget *w;
-	
-	va_start(ap, format);
-	error = g_strdup_vprintf(format, ap);
-	va_end(ap);
-	w = gnome_app_error(GNOME_APP(gtranslator_application), error);
-	g_free(error);
-	return w;
-}
 
-/*
- * Shows the gtranslator homepage on the web.
- */
-void gtranslator_utils_show_home_page(GtkWidget *widget, gpointer useless)
+GtkWidget *
+gtranslator_gtk_button_new_with_stock_icon (const gchar *label,
+				      const gchar *stock_id)
 {
-	gnome_url_show("http://gtranslator.sourceforge.net";, NULL);
-}
+	GtkWidget *button;
 
-/*
- * Go through the characters and search for free spaces
- * and replace them with '·''s.
- */
-gchar *gtranslator_utils_invert_dot(gchar *str)
-{
-	GString *newstr;
-	gunichar middot;
-	const char *p;
+	button = gtk_button_new_with_mnemonic (label);
+	gtk_button_set_image (GTK_BUTTON (button),
+			      gtk_image_new_from_stock (stock_id,
+							GTK_ICON_SIZE_BUTTON));
 
-	g_return_val_if_fail(str != NULL, NULL);
-	g_return_val_if_fail(strlen(str) >= 0, str);
-	
-	newstr = g_string_sized_new(strlen(str)+10);
-	middot = g_utf8_get_char("Â");
-	p = str;
-	while(*p) {
-		gunichar c = g_utf8_get_char(p);
-		if (c == middot)
-			g_string_append_c(newstr, ' ');
-		else if (g_unichar_break_type(c) == G_UNICODE_BREAK_SPACE)
-			g_string_append_unichar(newstr, middot);
-		else
-			g_string_append_unichar(newstr, c);
-		p = g_utf8_next_char(p);
-	}
-	return(g_string_free(newstr, FALSE));
+        return button;
 }
 
-/*
- * Save the current application main window's geometry.
- */
-void gtranslator_utils_save_geometry(void)
+void
+gtranslator_utils_menu_position_under_widget (GtkMenu  *menu,
+					gint     *x,
+					gint     *y,
+					gboolean *push_in,
+					gpointer  user_data)
 {
-	if (GtrPreferences.save_geometry == TRUE) {
-		gint x, y, w, h, d;
-		
-		/*
-		 * Use the Gdk functions to get the window typistics and then
-		 *  store the data - we're currently stumping the silly "depth"
-		 *   data also, but well...
-		 */
-		gdk_window_get_geometry(GDK_WINDOW(gtranslator_application->window),
-			&x, &y, &w, &h, &d);
-		
-		gtranslator_config_set_int("geometry/x", x);
-		gtranslator_config_set_int("geometry/y", y);
-		gtranslator_config_set_int("geometry/width", w);
-		gtranslator_config_set_int("geometry/height", h);
+	GtkWidget *w = GTK_WIDGET (user_data);
+	GtkRequisition requisition;
+
+	gdk_window_get_origin (w->window, x, y);
+	gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
+
+	if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL)
+	{
+		*x += w->allocation.x + w->allocation.width - requisition.width;
 	}
+	else
+	{
+		*x += w->allocation.x;
+	}
+
+	*y += w->allocation.y + w->allocation.height;
+
+	*push_in = TRUE;
 }
 
-/*
- * Restore the geometry.
- */
-void gtranslator_utils_restore_geometry(gchar  * gstr)
+void
+gtranslator_utils_menu_position_under_tree_view (GtkMenu  *menu,
+					   gint     *x,
+					   gint     *y,
+					   gboolean *push_in,
+					   gpointer  user_data)
 {
-	gint x=0, y=0, width=0, height=0;
+	GtkTreeView *tree = GTK_TREE_VIEW (user_data);
+	GtkTreeModel *model;
+	GtkTreeSelection *selection;
+	GtkTreeIter iter;
+	
+	model = gtk_tree_view_get_model (tree);
+	g_return_if_fail (model != NULL);
 
-	/*
-	 * Set the main window's geometry from the preferences.
-	 */
-	if (gstr == NULL)
+	selection = gtk_tree_view_get_selection (tree);
+	g_return_if_fail (selection != NULL);
+
+	if (gtk_tree_selection_get_selected (selection, NULL, &iter))
 	{
-		if(GtrPreferences.save_geometry == TRUE)
-		{
-			x=gtranslator_config_get_int("geometry/x");
-			y=gtranslator_config_get_int("geometry/y");
-			width=gtranslator_config_get_int("geometry/width");
-			height=gtranslator_config_get_int("geometry/height");
-		}
-		else
+		GtkTreePath *path;
+		GdkRectangle rect;
+
+		gdk_window_get_origin (GTK_WIDGET (tree)->window, x, y);
+			
+		path = gtk_tree_model_get_path (model, &iter);
+		gtk_tree_view_get_cell_area (tree, path,
+					     gtk_tree_view_get_column (tree, 0), /* FIXME 0 for RTL ? */
+					     &rect);
+		gtk_tree_path_free (path);
+		
+		*x += rect.x;
+		*y += rect.y + rect.height;
+		
+		if (gtk_widget_get_direction (GTK_WIDGET (tree)) == GTK_TEXT_DIR_RTL)
 		{
-			return;
+			GtkRequisition requisition;
+			gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
+			*x += rect.width - requisition.width;
 		}
 	}
-	/*
-	 * If a geometry definition had been defined try to parse it.
-	 */
 	else
 	{
-		if(!gtk_window_parse_geometry(GTK_WINDOW(gtranslator_application->window), gstr))
-		{
-			g_warning(_("The geometry string \"%s\" couldn't be parsed!"), gstr);
-			return;
-		}
+		/* no selection -> regular "under widget" positioning */
+		gtranslator_utils_menu_position_under_widget (menu,
+							x, y, push_in,
+							tree);
 	}
-	if (x != -1)
-		gtk_window_move(GTK_WINDOW(gtranslator_application), x, y);
-	if ((width > 0) && (height > 0))
-		gtk_window_resize(GTK_WINDOW(gtranslator_application), width, height);
 }
 
-GtkWidget *gtranslator_utils_attach_combo_with_label(GtkWidget  * table, gint row,
-				   const char *label_text,
-				   GList  * list, const char *value,
-				   gboolean editable,
-				   GCallback callback,
-				   gpointer user_data)
+
+/**
+ * gtranslator_utils_get_glade_widgets:
+ * @filename: the path to the glade file
+ * @root_node: the root node in the glade file
+ * @error_widget: a pointer were a #GtkLabel
+ * @widget_name: the name of the first widget
+ * @...: a pointer were the first widget is returned, followed by more
+ *       name / widget pairs and terminated by NULL.
+ *
+ * This function gets the requested widgets from a glade file. In case
+ * of error it returns FALSE and sets error_widget to a GtkLabel containing
+ * the error message to display.
+ *
+ * Returns FALSE if an error occurs, TRUE on success.
+ */
+gboolean
+gtranslator_utils_get_glade_widgets (const gchar *filename,
+				     const gchar *root_node,
+				     GtkWidget **error_widget,
+				     const gchar *widget_name,
+				     ...)
 {
 	GtkWidget *label;
-	GtkWidget *combo;
-	label = gtk_label_new(label_text);
-	combo = gtk_combo_new();
-	gtk_combo_set_popdown_strings(GTK_COMBO(combo), list);
-	if (value)
-		gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), value);
-	
-	gtk_editable_set_editable(GTK_EDITABLE(GTK_COMBO(combo)->entry), editable);
-	
-	gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, row, row + 1);
-	gtk_table_attach_defaults(GTK_TABLE(table), combo, 1, 2, row, row + 1);
-	
-	g_signal_connect(G_OBJECT(GTK_COMBO(combo)->entry), "changed",
-			 G_CALLBACK(callback), user_data);
-	return combo;
-}
-
-GtkWidget *gtranslator_utils_attach_toggle_with_label(GtkWidget  * table, gint row,
-				    const char *label_text,
-				    gboolean value,
-				    GCallback callback)
-{
-	GtkWidget *toggle;
-	toggle = gtk_check_button_new_with_label(label_text);
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), value);
-	gtk_table_attach_defaults(GTK_TABLE(table), toggle,
-	                          0, GTK_TABLE(table)->ncols > 1 ? 2 : 1,
-	                          row, row + 1);
+	GladeXML *gui;
+	va_list args;
+	const gchar *name;
+	gchar *msg;
+	gchar *filename_markup;
+	gchar *msg_plain;
+	gboolean ret = TRUE;
+
+	g_return_val_if_fail (filename != NULL, FALSE);
+	g_return_val_if_fail (error_widget != NULL, FALSE);
+	g_return_val_if_fail (widget_name != NULL, FALSE);
+
+	*error_widget = NULL;
 
-	if(callback)
+	gui = glade_xml_new (filename, root_node, NULL);
+	if (!gui)
 	{
-		g_signal_connect(G_OBJECT(toggle), "toggled",
-			         G_CALLBACK(callback), NULL);
+		filename_markup = g_markup_printf_escaped ("<i>%s</i>", filename);
+		msg_plain = g_strdup_printf (_("Unable to find file %s."),
+				filename_markup);
+		msg = g_strconcat ("<span size=\"large\" weight=\"bold\">",
+				msg_plain, "</span>\n\n",
+				_("Please check your installation."), NULL);
+		label = gtk_label_new (msg);
+
+		gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+		gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+		
+		g_free (filename_markup);
+		g_free (msg_plain);
+		g_free (msg);
+
+		gtk_misc_set_padding (GTK_MISC (label), 5, 5);
+ 		
+		*error_widget = label;
+
+		return FALSE;
 	}
 
-	return toggle;
+	va_start (args, widget_name);
+	for (name = widget_name; name; name = va_arg (args, const gchar *) )
+	{
+		GtkWidget **wid;
+
+		wid = va_arg (args, GtkWidget **);
+		*wid = glade_xml_get_widget (gui, name);
+		if (*wid == NULL)
+		{
+			g_warning ("Cannot find widget '%s' inside file '%s'.",
+				   name,
+				   filename);
+				   
+			filename_markup = g_markup_printf_escaped ("<i>%s</i>", filename);
+			msg_plain = g_strdup_printf (
+					_("Unable to find the required widgets inside file %s."),
+					filename_markup);
+			msg = g_strconcat ("<span size=\"large\" weight=\"bold\">",
+					msg_plain, "</span>\n\n",
+					_("Please check your installation."), NULL);
+			label = gtk_label_new (msg);
+
+			gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+			gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+			
+			g_free (filename_markup);
+			g_free (msg_plain);
+			g_free (msg);
+
+			gtk_misc_set_padding (GTK_MISC (label), 5, 5);
+ 			
+			*error_widget = label;
+
+			ret = FALSE;
+
+			break;
+		}
+	}
+	va_end (args);
+
+	g_object_unref (gui);
+
+	return ret;
 }
 
-GtkWidget *gtranslator_utils_attach_entry_with_label(GtkWidget  * table, gint row,
-				   const char *label_text,
-				   const char *value,
-				   GCallback callback)
+static gboolean
+is_valid_scheme_character (gchar c)
 {
-	GtkWidget *label;
-	GtkWidget *entry;
-	label = gtk_label_new(label_text);
-	entry = gtk_entry_new();
-	if (value)
-		gtk_entry_set_text(GTK_ENTRY(entry), value);
-	gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, row, row + 1);
-	gtk_table_attach_defaults(GTK_TABLE(table), entry, 1, 2, row, row + 1);
-	g_signal_connect(G_OBJECT(entry), "changed",
-			 G_CALLBACK(callback), NULL);
-	return entry;
-}
-
-GtkWidget *gtranslator_utils_attach_text_with_label(GtkWidget  * table, gint row,
-				  const char *label_text,
-				  const char *value,
-				  GCallback callback)
+	return g_ascii_isalnum (c) || c == '+' || c == '-' || c == '.';
+}
+
+static gboolean
+has_valid_scheme (const gchar *uri)
 {
-	GtkWidget *label;
-	GtkWidget *widget;
-	GtkWidget *scroll;
-	GtkTextBuffer *buff;
-	GtkTextIter start;
-
-	label = gtk_label_new(label_text);
-	scroll = gtk_scrolled_window_new(NULL, NULL);
-	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
-				       GTK_POLICY_NEVER,
-				       GTK_POLICY_AUTOMATIC);
-	widget = gtk_text_view_new();
-	if (value) {
-		buff = gtk_text_buffer_new(NULL);
-		gtk_text_buffer_get_start_iter(buff, &start);
-		gtk_text_buffer_insert(buff, &start, value, strlen(value));
-		gtk_text_view_set_buffer(GTK_TEXT_VIEW(widget), buff);
-		if(callback)
-		{
-			g_signal_connect(G_OBJECT(buff), "changed",
-					 G_CALLBACK(callback), NULL);
-		}
+	const gchar *p;
+
+	p = uri;
 
+	if (!is_valid_scheme_character (*p)) {
+		return FALSE;
 	}
-	gtk_container_add(GTK_CONTAINER(scroll), widget);
-	gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, row, row + 1);
-	gtk_table_attach_defaults(GTK_TABLE(table), scroll, 1, 2, row, row + 1);
 
-	return widget;
+	do {
+		p++;
+	} while (is_valid_scheme_character (*p));
+
+	return *p == ':';
 }
 
-GtkWidget *gtranslator_utils_attach_spin_with_label(GtkWidget *table,
-	gint row, const gchar *label_text, gfloat minimum, gfloat maximum,
-	gfloat value, GCallback callback)
+gboolean
+gtranslator_utils_is_valid_uri (const gchar *uri)
 {
-	GtkWidget *label;
-	GtkWidget *spin_button;
-	GtkObject *adjustment;
+	const guchar *p;
 
-	label=gtk_label_new(label_text);
-	adjustment=gtk_adjustment_new(value, minimum, maximum, 1.0, 1.0, 1.0);
+	if (uri == NULL)
+		return FALSE;
 
-	spin_button=gtk_spin_button_new(GTK_ADJUSTMENT(adjustment), 1, 0);
-	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_button), value);
+	if (!has_valid_scheme (uri))
+		return FALSE;
 
-	gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, row, row + 1);
-	gtk_table_attach_defaults(GTK_TABLE(table), spin_button, 1, 2, row, row + 1);
+	/* We expect to have a fully valid set of characters */
+	for (p = (const guchar *)uri; *p; p++) {
+		if (*p == '%')
+		{
+			++p;
+			if (!g_ascii_isxdigit (*p))
+				return FALSE;
+
+			++p;		
+			if (!g_ascii_isxdigit (*p))
+				return FALSE;
+		}
+		else
+		{
+			if (*p <= 32 || *p >= 128)
+				return FALSE;
+		}
+	}
 
-	g_signal_connect(G_OBJECT(spin_button), "changed",
-		G_CALLBACK(callback), NULL);
-	
-	return spin_button;
+	return TRUE;
 }
 
-/*
- * Adds a GnomeFontPicker to the given table.
+/**
+ * gtranslator_utils_drop_get_uris:
+ * @selection_data: the #GtkSelectionData from drag_data_received
+ * @info: the info from drag_data_received
+ *
+ * Create a list of valid uri's from a uri-list drop.
+ * 
+ * Return value: a string array which will hold the uris or NULL if there 
+ *		 were no valid uris. g_strfreev should be used when the 
+ *		 string array is no longer used
  */
-GtkWidget *gtranslator_utils_attach_font_with_label(GtkWidget *table,
-	gint row, const gchar *label_text, const gchar *title_text,
-	const gchar *fontspec, GCallback callback)
+gchar **
+gtranslator_utils_drop_get_uris (GtkSelectionData *selection_data)
 {
-	GtkWidget *label;
-	GtkWidget *font_selector;
-		
-	label=gtk_label_new(label_text);
-	
-	font_selector=gnome_font_picker_new();
-	
-	gnome_font_picker_set_title(GNOME_FONT_PICKER(font_selector), 
-		title_text);
-	
-	if(fontspec)
+	gchar **uris;
+	gint i;
+	gint p = 0;
+	gchar **uri_list;
+
+	uris = g_uri_list_extract_uris ((gchar *) selection_data->data);
+	uri_list = g_new0(gchar *, g_strv_length (uris) + 1);
+
+	for (i = 0; uris[i] != NULL; i++)
 	{
-		gnome_font_picker_set_font_name(GNOME_FONT_PICKER(font_selector),
-			fontspec);
+		/* Silently ignore malformed URI/filename */
+		if (gtranslator_utils_is_valid_uri (uris[i]))
+			uri_list[p++] = g_strdup (uris[i]);
 	}
-	
-	gnome_font_picker_set_mode(GNOME_FONT_PICKER(font_selector),
-		GNOME_FONT_PICKER_MODE_FONT_INFO);
-	
-	gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, row, row + 1);
-	gtk_table_attach_defaults(GTK_TABLE(table), font_selector, 1, 2, 
-		row, row + 1);
-	
-	g_signal_connect(G_OBJECT(font_selector), "font_set",
-		G_CALLBACK(callback), NULL);
-	
-	return font_selector;
+
+	if (*uri_list == NULL)
+	{
+		g_free(uri_list);
+		return NULL;
+	}
+
+	return uri_list;
 }
 
-/*
- * Check if the given file is already opened by gtranslator.
- */
-gboolean gtranslator_utils_reopen_if_already_open(const gchar *filename)
+gchar *
+gtranslator_utils_escape_search_text (const gchar* text)
 {
-	gchar *resultfilename;
+	GString *str;
+	gint length;
+	const gchar *p;
+ 	const gchar *end;
 
-	g_return_val_if_fail(filename!=NULL, FALSE);
+	if (text == NULL)
+		return NULL;
 
-	resultfilename=gtranslator_config_get_string("runtime/filename");
+    	length = strlen (text);
 
-	/*
-	 * Test if we've got a filename and then test it for equality with our
-	 *  currently in another instance opened po file.
-	 */
-	if(resultfilename && (!nautilus_strcasecmp(resultfilename, filename)) &&
-		(strlen(resultfilename)==strlen(filename)))
-	{
-		gint reply;
-		reply = gtranslator_already_open_dialog(NULL, (gpointer)filename);
-		if(reply == GTK_RESPONSE_NO)
-		return FALSE;
-	}
+	/* no escape when typing.
+	 * The short circuit works only for ascii, but we only
+	 * care about not escaping a single '\' */
+	if (length == 1)
+		return g_strdup (text);
 
-	/*
-	 * Assume we want to open it
-	 */
-	return TRUE;
+	str = g_string_new ("");
+
+	p = text;
+  	end = text + length;
+
+  	while (p != end)
+    	{
+      		const gchar *next;
+      		next = g_utf8_next_char (p);
+
+		switch (*p)
+        	{
+       			case '\n':
+          			g_string_append (str, "\\n");
+          			break;
+			case '\r':
+          			g_string_append (str, "\\r");
+          			break;
+			case '\t':
+          			g_string_append (str, "\\t");
+          			break;
+			case '\\':
+          			g_string_append (str, "\\\\");
+          			break;
+        		default:
+          			g_string_append_len (str, p, next - p);
+          			break;
+        	}
+
+      		p = next;
+    	}
+
+	return g_string_free (str, FALSE);
 }
 
-/*
- * Check for a needed program -- returns FALSE on failure (how logical, not ,-)).
- */
-gboolean gtranslator_utils_check_program(const gchar *program_name,
-	const gint type_int)
+gchar *
+gtranslator_utils_unescape_search_text (const gchar *text)
 {
-	g_return_val_if_fail(program_name!=NULL, FALSE);
+	GString *str;
+	gint length;
+	gboolean drop_prev = FALSE;
+	const gchar *cur;
+	const gchar *end;
+	const gchar *prev;
 	
-	if(!g_find_program_in_path(program_name))
+	if (text == NULL)
+		return NULL;
+
+	length = strlen (text);
+
+	str = g_string_new ("");
+
+	cur = text;
+	end = text + length;
+	prev = NULL;
+	
+	while (cur != end) 
 	{
-		gchar *warning_message;
+		const gchar *next;
+		next = g_utf8_next_char (cur);
 
-		if(type_int==0)
+		if (prev && (*prev == '\\')) 
+		{
+			switch (*cur) 
+			{
+				case 'n':
+					str = g_string_append (str, "\n");
+				break;
+				case 'r':
+					str = g_string_append (str, "\r");
+				break;
+				case 't':
+					str = g_string_append (str, "\t");
+				break;
+				case '\\':
+					str = g_string_append (str, "\\");
+					drop_prev = TRUE;
+				break;
+				default:
+					str = g_string_append (str, "\\");
+					str = g_string_append_len (str, cur, next - cur);
+				break;
+			}
+		} 
+		else if (*cur != '\\') 
+		{
+			str = g_string_append_len (str, cur, next - cur);
+		} 
+		else if ((next == end) && (*cur == '\\')) 
 		{
-			warning_message=g_strdup_printf(
-				_("The necessary decompression program `%s' is not installed!"), program_name);
+			str = g_string_append (str, "\\");
 		}
-		else
+		
+		if (!drop_prev)
 		{
-			warning_message=g_strdup_printf(
-				_("The necessary compression program `%s' is not installed!"), program_name);
+			prev = cur;
+		}
+		else 
+		{
+			prev = NULL;
+			drop_prev = FALSE;
 		}
 
-		gnome_app_warning(GNOME_APP(gtranslator_application), warning_message);
-		g_free(warning_message);
-
-		return FALSE;
+		cur = next;
 	}
-	else
+
+	return g_string_free (str, FALSE);
+}
+
+/*
+ * n: len of the string in bytes
+ */
+gboolean 
+g_utf8_caselessnmatch (const gchar *s1,
+		       const gchar *s2,
+		       gssize n1,
+		       gssize n2)
+{
+	gchar *casefold;
+	gchar *normalized_s1;
+      	gchar *normalized_s2;
+	gint len_s1;
+	gint len_s2;
+	gboolean ret = FALSE;
+
+	g_return_val_if_fail (s1 != NULL, FALSE);
+	g_return_val_if_fail (s2 != NULL, FALSE);
+	g_return_val_if_fail (n1 > 0, FALSE);
+	g_return_val_if_fail (n2 > 0, FALSE);
+
+	casefold = g_utf8_casefold (s1, n1);
+	normalized_s1 = g_utf8_normalize (casefold, -1, G_NORMALIZE_NFD);
+	g_free (casefold);
+
+	casefold = g_utf8_casefold (s2, n2);
+	normalized_s2 = g_utf8_normalize (casefold, -1, G_NORMALIZE_NFD);
+	g_free (casefold);
+
+	len_s1 = strlen (normalized_s1);
+	len_s2 = strlen (normalized_s2);
+
+	if (len_s1 < len_s2)
+		goto finally_2;
+
+	ret = (strncmp (normalized_s1, normalized_s2, len_s2) == 0);
+	
+finally_2:
+	g_free (normalized_s1);
+	g_free (normalized_s2);	
+
+	return ret;
+}
+
+void
+gtranslator_utils_activate_url (GtkAboutDialog *dialog,
+				const gchar *url,
+				gpointer data)
+{
+	gchar **open;
+	gchar *program;
+	GPtrArray *array;
+
+	if (g_find_program_in_path ("xdg-open"))
 	{
-		return TRUE;
+		program = g_strdup ("xdg-open");
 	}
+	else return;
+	
+	array = g_ptr_array_new ();
+	g_ptr_array_add (array, program);
+	g_ptr_array_add (array, g_strdup (url));
+	
+	open = (gchar **)g_ptr_array_free (array, FALSE);
+					
+	gdk_spawn_on_screen (gdk_screen_get_default (),
+			     NULL,
+			     open,
+			     NULL,
+			     G_SPAWN_SEARCH_PATH,
+			     NULL,
+			     NULL, NULL, NULL);
+					
+	g_strfreev (open);
 }

Modified: trunk/src/utils_gui.h
==============================================================================
--- trunk/src/utils_gui.h	(original)
+++ trunk/src/utils_gui.h	Sun Mar  2 21:32:24 2008
@@ -20,80 +20,44 @@
 #ifndef GTR_UTILS_GUI_H
 #define GTR_UTILS_GUI_H 1
 
-#include "parse.h"
-#include "stylistics.h"
-
 #include <gtk/gtkwidget.h>
-#include <gtk/gtksignal.h>
+#include <gtk/gtkmenu.h>
+#include <gtk/gtkaboutdialog.h>
+
+GtkWidget     *gtranslator_gtk_button_new_with_stock_icon (const gchar *label,
+				      const gchar *stock_id);
 
-/*
- * GUI related utility functions for gtranslator.
- */
-
-/*
- * Show an error messagebox to the user. 
- */
-GtkWidget *gtranslator_utils_error_dialog(gchar *format, ...);
-
-/*
- * Show the homepage of gtranslator.
- */
-void gtranslator_utils_show_home_page(GtkWidget  *widget, gpointer useless);
-
-/*
- * Invert the dots in the message.
- */
-gchar *gtranslator_utils_invert_dot(gchar *str);
-
-/*
- * Routines for saving/restoring/setting geometry of the main window.
- */
-void gtranslator_utils_save_geometry(void);
-void gtranslator_utils_restore_geometry(gchar *gstr);
-
-/*
- * Convenience functions for adding items 
- */
-GtkWidget *gtranslator_utils_attach_combo_with_label(GtkWidget * table, 
-	gint row, const char *label_text, GList * list, const char *value,
-	gboolean editable, GCallback callback, gpointer user_data);
-
-GtkWidget *gtranslator_utils_attach_entry_with_label(GtkWidget * table, 
-	gint row, const char *label_text, const char *value,
-	GCallback callback);
-
-GtkWidget *gtranslator_utils_attach_toggle_with_label(GtkWidget * table, 
-	gint row, const char *label_text, gboolean value,
-	GCallback callback);
-
-GtkWidget *gtranslator_utils_attach_text_with_label(GtkWidget * table, 
-	gint row, const char *label_text, const char *value,
-	GCallback callback);
-
-GtkWidget *gtranslator_utils_attach_spin_with_label(GtkWidget *table,
-	gint row, const gchar *label_text, gfloat minimum, gfloat maximum,
-	gfloat value, GCallback callback);
-	
-GtkWidget *gtranslator_utils_attach_font_with_label(GtkWidget *table,
-	gint row, const gchar *label_text, const gchar *title_text,
-	const gchar *fontspec, GCallback callback);
-	
-/*
- * Checks the given file for the right permissions for
- *  open/writing the files.
- */
-gboolean gtranslator_utils_check_file_permissions(GtrPo *po_file);
-
-/*
- * Checks if we've been started with the given file yet.
- */
-gboolean gtranslator_utils_check_file_being_open(const gchar *filename);
-
-/*
- * Check for a given program being in the user's path -- should be useful
- *  for the "differently" opening/saving functions...
- */
-gboolean gtranslator_utils_check_program(const gchar *program_name,
-	const gint type_int);
+void           gtranslator_utils_menu_position_under_widget (GtkMenu  *menu,
+					gint     *x,
+					gint     *y,
+					gboolean *push_in,
+					gpointer  user_data);
+					
+void           gtranslator_utils_menu_position_under_tree_view (GtkMenu  *menu,
+					   gint     *x,
+					   gint     *y,
+					   gboolean *push_in,
+					   gpointer  user_data);
+
+gboolean       gtranslator_utils_get_glade_widgets    (const gchar *filename,
+						       const gchar *root_node,
+						       GtkWidget **error_widget,
+						       const gchar *widget_name,
+						       ...)G_GNUC_NULL_TERMINATED;
+
+gchar        **gtranslator_utils_drop_get_uris        (GtkSelectionData *selection_data);
+
+gchar         *gtranslator_utils_escape_search_text   (const gchar* text);
+
+gchar         *gtranslator_utils_unescape_search_text (const gchar *text);
+
+gboolean       g_utf8_caselessnmatch                  (const gchar *s1,
+						       const gchar *s2,
+						       gssize n1,
+						       gssize n2);
+
+void           gtranslator_utils_activate_url         (GtkAboutDialog *dialog,
+						       const gchar *url,
+						       gpointer data);
 
 #endif

Modified: trunk/src/view.c
==============================================================================
--- trunk/src/view.c	(original)
+++ trunk/src/view.c	Sun Mar  2 21:32:24 2008
@@ -1,5 +1,10 @@
 /*
  * Copyright (C) 2007  Ignacio Casal Quinteiro <nacho resa gmail com>
+ *		 1998, 1999 Alex Roberts, Evan Lawrence
+ * 		 2000  2002 Chema Celorio, Paolo Maggi 
+ * 		 2003  2005 Paolo Maggi  
+ * 
+ * Some funcs based in gedit-view.c file.
  * 
  *     This program is free software: you can redistribute it and/or modify
  *     it under the terms of the GNU General Public License as published by
@@ -20,13 +25,33 @@
 #include <config.h>
 #endif
 
+#include <string.h>
+
+#include "draw-spaces.h"
+#include "prefs-manager.h"
+#include "utils_gui.h"
 #include "view.h"
 
 #include <glib.h>
+#include <glib/gi18n.h>
 #include <glib-object.h>
 #include <gtk/gtk.h>
-#include <gtksourceview/gtksourcetag.h>
-#include <gtksourceview/gtksourcetagtable.h>
+
+#include <gtksourceview/gtksourcelanguagemanager.h>
+#include <gtksourceview/gtksourceiter.h>
+#include <gtksourceview/gtksourcebuffer.h>
+
+//#undef HAVE_GTKSPELL
+#ifdef HAVE_GTKSPELL
+#include <gtkspell/gtkspell.h>
+#endif
+
+#undef HAVE_SPELL_CHECK
+#ifdef HAVE_SPELL_CHECK
+#include <gtkspellcheck/client.h>
+#include <gtkspellcheck/manager.h>
+#include <gtkspellcheck/textviewclient.h>
+#endif
 
 #define GTR_VIEW_GET_PRIVATE(object)	(G_TYPE_INSTANCE_GET_PRIVATE ( \
 						 	(object),	\
@@ -37,82 +62,120 @@
 
 struct _GtranslatorViewPrivate
 {
-	GtkSourceTagTable *table;
 	GtkSourceBuffer *buffer;
-	GSList		*tags;
+	
+	guint        search_flags;
+	gchar       *search_text;
+	
+#ifdef HAVE_GTKSPELL
+	GtkSpell *spell;
+#endif
+	
+#ifdef HAVE_SPELL_CHECK
+	GtkSpellCheckClient *client;
+	GtkSpellCheckManager *manager;
+#endif
 };
 
 
+#ifdef HAVE_GTKSPELL
 static void
-setup_all_tags(GtranslatorViewPrivate *priv)
+gtranslator_attach_gtkspell(GtranslatorView *view)
 {
-	GtkTextTag *tag;
-	
-	
-	//		"</[A-Za-z0-9\\n]+>",
-	//"<[A-Za-z0-9\\n]+[^>]*/?>",
-	/*"http:\\/\\/[a-zA-Z0-9\\.\\-_/~]+",
-	"mailto:[a-z0-9\\ \\-_]+ [a-z0-9\\ \\-_]+",
-	"<?[a-z0-9\\ \\-_]+ [a-z0-9\\ \\-_]+>?",
-	"&[a-z,A-Z,\\-,0-9,#\\.]*;"*/
+	gint i;
+	GError *error = NULL;
+	gchar *errortext = NULL;
+	view->priv->spell = NULL;
+	
+	view->priv->spell = 
+		gtkspell_new_attach(GTK_TEXT_VIEW(view), NULL, &error);
+	if (view->priv->spell == NULL) 
+	{
+		g_warning(_("gtkspell error: %s\n"), error->message);
+		errortext = g_strdup_printf(_("GtkSpell was unable to initialize.\n %s"),
+					    error->message);
+		g_warning(errortext);
+		
+		g_error_free(error);
+		g_free(errortext);
+	}
+}
+#endif
 
+#ifdef HAVE_SPELL_CHECK
+static void
+gtranslator_attach_spellcheck(GtranslatorView *view)
+{
+	view->priv->client = GTK_SPELL_CHECK_CLIENT(gtk_spell_check_text_view_client_new(GTK_TEXT_VIEW(view)));
+	view->priv->manager = gtk_spell_check_manager_new(NULL, TRUE);
 	
-	/*
-	 * Now is neccessary create the tags and add them to the table
-	 */
-	tag = gtk_pattern_tag_new("args-def", "arguments",
-				  "%([0-9]+(\\$))?[-+'#0]?[0-9]*(.[0-9]+)?[hlL]?[dioxXucsfeEgGp]");
-	
-	g_object_set(G_OBJECT(tag), "foreground", "blue", NULL);
-	
-	priv->tags = g_slist_append(priv->tags, tag);
-	
-	
-	tag = gtk_pattern_tag_new("tags-def", "tags",
-				  "</[A-Za-z0-9\\n]+>");
-	
-	g_object_set(G_OBJECT(tag), "foreground", "green", NULL);
-	
-	priv->tags = g_slist_append(priv->tags, tag);
-	
-	tag = gtk_pattern_tag_new("tags2-def", "tags2",
-				  "<[A-Za-z0-9\\n]+[^>]*/?>");
-	
-	g_object_set(G_OBJECT(tag), "foreground", "green", NULL);
-	
-	priv->tags = g_slist_append(priv->tags, tag);
-	
-	/*tag = gtk_pattern_tag_new("url-def", "url",
-				  "&[a-z,A-Z,\\-,0-9,#\\.]*;");
-				  
-	g_object_set(G_OBJECT(tag), "foreground", "red", NULL);
-	
-	priv->tags = g_slist_append(priv->tags, tag);*/
+	gtk_spell_check_manager_attach(view->priv->manager,
+				       view->priv->client);
 }
+#endif
+
 	       
 static void
 gtranslator_view_init (GtranslatorView *view)
 {
-	
-	GtkSourceTagStyle *style;
+	GtkSourceLanguageManager *lm;
+	GtkSourceLanguage *lang;
+	GPtrArray *dirs;
+	gchar **langs;
+	const gchar * const *temp;
+	gint i;
 	
 	view->priv = GTR_VIEW_GET_PRIVATE (view);
 	
 	GtranslatorViewPrivate *priv = view->priv;
 	
-	priv->table = gtk_source_tag_table_new();
-	
-	setup_all_tags(priv);
+	lm = gtk_source_language_manager_new();
+	dirs = g_ptr_array_new();
 	
-	gtk_source_tag_table_add_tags(priv->table, priv->tags);
-	
-	priv->buffer = gtk_source_buffer_new(priv->table);
-	gtk_source_buffer_set_highlight(priv->buffer, TRUE);
+	for(temp = gtk_source_language_manager_get_search_path(lm);
+	    temp != NULL && *temp != NULL;
+	    ++temp)
+		g_ptr_array_add(dirs, g_strdup(*temp));
+		
+	g_ptr_array_add(dirs, g_strdup(DATADIR));
+	g_ptr_array_add(dirs, NULL);
+	langs = (gchar **)g_ptr_array_free(dirs, FALSE);
+
+	
+	gtk_source_language_manager_set_search_path(lm, langs);
+	lang = gtk_source_language_manager_get_language(lm, "gtranslator");
+	g_strfreev(langs);
+		
+	priv->buffer = gtk_source_buffer_new_with_language(lang);
 	
 	gtk_text_view_set_buffer(GTK_TEXT_VIEW(view), GTK_TEXT_BUFFER(priv->buffer));
 	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(view), GTK_WRAP_WORD);
-/*	gtk_source_view_set_show_line_markers(GTK_SOURCE_VIEW(view), TRUE);
-	gtk_source_view_set_show_line_numbers(GTK_SOURCE_VIEW(view), TRUE);*/
+	
+	//Set syntax highlight according to preferences
+	gtk_source_buffer_set_highlight_syntax(priv->buffer, gtranslator_prefs_manager_get_highlight());
+	
+	//Set dot char according to preferences
+	
+	if(gtranslator_prefs_manager_get_visible_whitespace())
+		gtranslator_view_enable_visible_whitespace(view, TRUE);
+	
+	/*
+	 *  Set fonts according to preferences 
+	 */
+	if (gtranslator_prefs_manager_get_use_custom_font ())
+	{
+		gchar *editor_font;
+
+		editor_font = g_strdup(gtranslator_prefs_manager_get_editor_font ());
+
+		gtranslator_view_set_font (view, FALSE, editor_font);
+
+		g_free (editor_font);
+	}
+	else
+	{
+		gtranslator_view_set_font (view, TRUE, NULL);
+	}
 }
 
 static void
@@ -141,3 +204,543 @@
 	return view;
 }
 
+
+gboolean
+gtranslator_view_get_selected_text (GtranslatorView *view,
+				    gchar         **selected_text,
+				    gint           *len)
+{
+	GtkTextIter start, end;
+	GtkTextBuffer *doc;
+
+	g_return_val_if_fail (selected_text != NULL, FALSE);
+	g_return_val_if_fail (*selected_text == NULL, FALSE);
+	g_return_val_if_fail (GTR_IS_VIEW(view), FALSE);
+
+	doc = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view));
+	
+	if (!gtk_text_buffer_get_selection_bounds (doc, &start, &end))
+	{
+		if (len != NULL)
+			len = 0;
+
+		return FALSE;
+	}
+
+	*selected_text = gtk_text_buffer_get_slice (doc, &start, &end, TRUE);
+
+	if (len != NULL)
+		*len = g_utf8_strlen (*selected_text, -1);
+
+	return TRUE;
+}
+
+/**
+ * gtranslator_view_enable_spellcheck:
+ * @view: a #GtranslatorView
+ * @enable: TRUE if you want enable the spellcheck
+ * 
+ * Enables the spellcheck
+ **/
+void
+gtranslator_view_enable_spellcheck(GtranslatorView *view,
+				    gboolean enable)
+{
+	if(enable)
+	{
+#ifdef HAVE_GTKSPELL
+		gtranslator_attach_gtkspell(view);
+#endif
+#ifdef HAVE_SPELL_CHECK
+		if(!view->priv->manager)
+			gtranslator_attach_spellcheck(view);
+		else
+			gtk_spell_check_manager_set_active(view->priv->manager,
+							   TRUE);
+#endif
+	}
+	else
+	{
+#ifdef HAVE_GTKSPELL
+		if(!view->priv->spell)
+			return;
+		gtkspell_detach(view->priv->spell);
+#endif
+#ifdef HAVE_SPELL_CHECK
+		if(!view->priv->manager)
+			return;
+		gtk_spell_check_manager_set_active(view->priv->manager,
+						   FALSE);
+#endif
+	}
+}
+
+/**
+ * gtranslator_view_enable_visible_whitespace:
+ * @view: a #GtranslatorView
+ * @enable: TRUE if you want to enable special chars for white spaces
+ *
+ * Enables special chars for white spaces including \n and \t
+**/
+void
+gtranslator_view_enable_visible_whitespace(GtranslatorView *view,
+					   gboolean enable)
+{
+	g_return_if_fail(GTR_IS_VIEW(view));
+	
+	if(enable)
+		g_signal_connect(view, "event-after",
+				 G_CALLBACK(on_event_after), NULL);
+	else
+		g_signal_handlers_disconnect_by_func(view,
+						     G_CALLBACK(on_event_after),
+						     NULL);
+	
+	/*It's neccessary redraw the widget when you connect or disconnect the signal*/
+	gtk_widget_queue_draw (GTK_WIDGET (view));
+}
+
+void
+gtranslator_view_cut_clipboard (GtranslatorView *view)
+{
+	GtkTextBuffer *buffer;
+	GtkClipboard *clipboard;
+
+	g_return_if_fail (GTR_IS_VIEW (view));
+
+	buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
+	g_return_if_fail (buffer != NULL);
+
+	clipboard = gtk_widget_get_clipboard (GTK_WIDGET (view),
+					      GDK_SELECTION_CLIPBOARD);
+
+	/* FIXME: what is default editability of a buffer? */
+  	gtk_text_buffer_cut_clipboard (buffer,
+  				       clipboard,
+				       gtk_text_view_get_editable(
+						GTK_TEXT_VIEW (view)));
+  	
+	gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (view),
+				      gtk_text_buffer_get_insert (buffer),
+				      0.0,
+				      FALSE,
+				      0.0,
+				      0.0);
+}
+
+void
+gtranslator_view_copy_clipboard (GtranslatorView *view)
+{
+	GtkTextBuffer *buffer;
+	GtkClipboard *clipboard;
+
+	g_return_if_fail (GTR_IS_VIEW (view));
+
+	buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
+	g_return_if_fail (buffer != NULL);
+
+	clipboard = gtk_widget_get_clipboard (GTK_WIDGET (view),
+					      GDK_SELECTION_CLIPBOARD);
+
+  	gtk_text_buffer_copy_clipboard (buffer, clipboard);
+
+	/* on copy do not scroll, we are already on screen */
+}
+
+void
+gtranslator_view_paste_clipboard (GtranslatorView *view)
+{
+  	GtkTextBuffer *buffer;
+	GtkClipboard *clipboard;
+
+	g_return_if_fail (GTR_IS_VIEW (view));
+
+	buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
+	g_return_if_fail (buffer != NULL);
+
+	clipboard = gtk_widget_get_clipboard (GTK_WIDGET (view),
+					      GDK_SELECTION_CLIPBOARD);
+
+	/* FIXME: what is default editability of a buffer? */
+  	gtk_text_buffer_paste_clipboard (buffer,
+					 clipboard,
+					 NULL,
+					 gtk_text_view_get_editable(
+						GTK_TEXT_VIEW (view)));
+
+	gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (view),
+				      gtk_text_buffer_get_insert (buffer),
+				      0.0,
+				      FALSE,
+				      0.0,
+				      0.0);
+}
+
+/**
+ * gtranslator_view_set_font:
+ * @view: a #GtranslatorView
+ * @def: TRUE if you want to use the default font
+ * @font_name: The name of the font you want to use in the #GtranslatorView
+ * 
+ * Sets the #GtranslatorView font.
+ **/
+void
+gtranslator_view_set_font (GtranslatorView *view, 
+			   gboolean     def, 
+			   const gchar *font_name)
+{
+	PangoFontDescription *font_desc = NULL;
+
+	g_return_if_fail (GTR_IS_VIEW (view));
+
+	if (def)
+		font_name = g_strdup(GPM_DEFAULT_EDITOR_FONT);
+
+	g_return_if_fail (font_name != NULL);
+
+	font_desc = pango_font_description_from_string (font_name);
+	g_return_if_fail (font_desc != NULL);
+
+	gtk_widget_modify_font (GTK_WIDGET (view), font_desc);
+
+	pango_font_description_free (font_desc);	
+}
+
+
+/*
+ * Search funcs
+ */
+void
+gtranslator_view_set_search_text (GtranslatorView *view,
+				  const gchar   *text,
+				  guint          flags)
+{
+	GtkSourceBuffer *doc;
+	gchar *converted_text;
+	gboolean notify = FALSE;
+	//gboolean update_to_search_region = FALSE;
+	
+	g_return_if_fail (GTR_IS_VIEW (view));
+	g_return_if_fail ((text == NULL) || (view->priv->search_text != text));
+	g_return_if_fail ((text == NULL) || g_utf8_validate (text, -1, NULL));
+
+	//gedit_debug_message (DEBUG_DOCUMENT, "text = %s", text);
+	doc = GTK_SOURCE_BUFFER(gtk_text_view_get_buffer(GTK_TEXT_VIEW(view)));
+
+	if (text != NULL)
+	{
+		if (*text != '\0')
+		{
+			converted_text = gtranslator_utils_unescape_search_text (text);
+			notify = !gtranslator_view_get_can_search_again (view);
+		}
+		else
+		{
+			converted_text = g_strdup("");
+			notify = gtranslator_view_get_can_search_again (view);
+		}
+		
+		g_free (view->priv->search_text);
+	
+		view->priv->search_text = converted_text;
+		//view->priv->num_of_lines_search_text = compute_num_of_lines (view->priv->search_text);
+		//update_to_search_region = TRUE;
+	}
+	
+	if (!GTR_SEARCH_IS_DONT_SET_FLAGS (flags))
+	{
+		/*if (view->priv->search_flags != flags)
+			update_to_search_region = TRUE;*/
+			
+		view->priv->search_flags = flags;
+
+	}
+
+	/*if (update_to_search_region)
+	{
+		GtkTextIter begin;
+		GtkTextIter end;
+		
+		gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (doc),
+					    &begin,
+					    &end);
+					    
+		to_search_region_range (doc,
+					&begin,
+					&end);
+	}*/
+	
+	if (notify)
+		g_object_notify (G_OBJECT (doc), "can-search-again");
+}
+
+gchar *
+gtranslator_view_get_search_text (GtranslatorView *view,
+				guint         *flags)
+{
+	g_return_val_if_fail (GTR_IS_VIEW (view), NULL);
+
+	if (flags != NULL)
+		*flags = view->priv->search_flags;
+
+	return gtranslator_utils_escape_search_text (view->priv->search_text);
+}
+
+gboolean
+gtranslator_view_get_can_search_again (GtranslatorView *view)
+{
+	g_return_val_if_fail (GTR_IS_VIEW (view), FALSE);
+
+	return ((view->priv->search_text != NULL) && 
+	        (*view->priv->search_text != '\0'));
+}
+
+gboolean
+gtranslator_view_search_forward (GtranslatorView     *view,
+				 const GtkTextIter *start,
+				 const GtkTextIter *end,
+				 GtkTextIter       *match_start,
+				 GtkTextIter       *match_end)
+{
+	GtkSourceBuffer *doc;
+	GtkTextIter iter;
+	GtkSourceSearchFlags search_flags;
+	gboolean found = FALSE;
+	GtkTextIter m_start;
+	GtkTextIter m_end;
+	
+	g_return_val_if_fail (GTR_IS_VIEW (view), FALSE);
+	
+	doc = GTK_SOURCE_BUFFER(gtk_text_view_get_buffer(GTK_TEXT_VIEW(view)));
+	
+	g_return_val_if_fail ((start == NULL) || 
+			      (gtk_text_iter_get_buffer (start) ==  GTK_TEXT_BUFFER (doc)), FALSE);
+	g_return_val_if_fail ((end == NULL) || 
+			      (gtk_text_iter_get_buffer (end) ==  GTK_TEXT_BUFFER (doc)), FALSE);
+		
+	if (view->priv->search_text == NULL)
+	{
+		//gedit_debug_message (DEBUG_DOCUMENT, "doc->priv->search_text == NULL\n");
+		return FALSE;
+	}
+	/*else
+		gedit_debug_message (DEBUG_DOCUMENT, "doc->priv->search_text == \"%s\"\n", doc->priv->search_text);*/
+				      
+	if (start == NULL)
+		gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (doc), &iter);
+	else
+		iter = *start;
+		
+	search_flags = GTK_SOURCE_SEARCH_VISIBLE_ONLY | GTK_SOURCE_SEARCH_TEXT_ONLY;
+
+	if (!GTR_SEARCH_IS_CASE_SENSITIVE (view->priv->search_flags))
+	{
+		search_flags = search_flags | GTK_SOURCE_SEARCH_CASE_INSENSITIVE;
+	}
+		
+	while (!found)
+	{
+		found = gtk_source_iter_forward_search (&iter,
+							view->priv->search_text, 
+							search_flags,
+                        	                	&m_start, 
+                        	                	&m_end,
+                                	               	end);
+      	               	
+		if (found && GTR_SEARCH_IS_ENTIRE_WORD (view->priv->search_flags))
+		{
+			found = gtk_text_iter_starts_word (&m_start) && 
+					gtk_text_iter_ends_word (&m_end);
+
+			if (!found) 
+				iter = m_end;
+		}
+		else
+			break;
+	}
+	
+	if (found && (match_start != NULL))
+		*match_start = m_start;
+	
+	if (found && (match_end != NULL))
+		*match_end = m_end;
+	
+	return found;			    
+}
+						 
+gboolean
+gtranslator_view_search_backward (GtranslatorView     *view,
+				  const GtkTextIter *start,
+				  const GtkTextIter *end,
+				  GtkTextIter       *match_start,
+				  GtkTextIter       *match_end)
+{
+	GtkSourceBuffer *doc;
+	GtkTextIter iter;
+	GtkSourceSearchFlags search_flags;
+	gboolean found = FALSE;
+	GtkTextIter m_start;
+	GtkTextIter m_end;
+	
+	g_return_val_if_fail (GTR_IS_VIEW (view), FALSE);
+	
+	doc = GTK_SOURCE_BUFFER(gtk_text_view_get_buffer(GTK_TEXT_VIEW(view)));
+	
+	g_return_val_if_fail ((start == NULL) || 
+			      (gtk_text_iter_get_buffer (start) ==  GTK_TEXT_BUFFER (doc)), FALSE);
+	g_return_val_if_fail ((end == NULL) || 
+			      (gtk_text_iter_get_buffer (end) ==  GTK_TEXT_BUFFER (doc)), FALSE);
+	
+	if (view->priv->search_text == NULL)
+	{
+		//gedit_debug_message (DEBUG_DOCUMENT, "doc->priv->search_text == NULL\n");
+		return FALSE;
+	}
+	/*else
+		gedit_debug_message (DEBUG_DOCUMENT, "doc->priv->search_text == \"%s\"\n", doc->priv->search_text);*/
+				      
+	if (end == NULL)
+		gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (doc), &iter);
+	else
+		iter = *end;
+		
+	search_flags = GTK_SOURCE_SEARCH_VISIBLE_ONLY | GTK_SOURCE_SEARCH_TEXT_ONLY;
+
+	if (!GTR_SEARCH_IS_CASE_SENSITIVE (view->priv->search_flags))
+	{
+		search_flags = search_flags | GTK_SOURCE_SEARCH_CASE_INSENSITIVE;
+	}
+
+	while (!found)
+	{
+		found = gtk_source_iter_backward_search (&iter,
+							 view->priv->search_text, 
+							 search_flags,
+                        	                	 &m_start, 
+                        	                	 &m_end,
+                                	               	 start);
+      	               	
+		if (found && GTR_SEARCH_IS_ENTIRE_WORD (view->priv->search_flags))
+		{
+			found = gtk_text_iter_starts_word (&m_start) && 
+					gtk_text_iter_ends_word (&m_end);
+
+			if (!found) 
+				iter = m_start;
+		}
+		else
+			break;
+	}
+	
+	if (found && (match_start != NULL))
+		*match_start = m_start;
+	
+	if (found && (match_end != NULL))
+		*match_end = m_end;
+	
+	return found;		      
+}
+
+gint 
+gtranslator_view_replace_all (GtranslatorView     *view,
+			      const gchar         *find, 
+			      const gchar         *replace, 
+			      guint                flags)
+{
+	GtkTextIter iter;
+	GtkTextIter m_start;
+	GtkTextIter m_end;
+	GtkSourceSearchFlags search_flags = 0;
+	gboolean found = TRUE;
+	gint cont = 0;
+	gchar *search_text;
+	gchar *replace_text;
+	gint replace_text_len;
+	GtkTextBuffer *buffer;
+
+	g_return_val_if_fail (GTR_IS_VIEW (view), 0);
+	
+	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW (view));
+	
+	g_return_val_if_fail (replace != NULL, 0);
+	g_return_val_if_fail ((find != NULL) || (view->priv->search_text != NULL), 0);
+
+	if (find == NULL)
+		search_text = g_strdup (view->priv->search_text);
+	else
+		search_text = gtranslator_utils_unescape_search_text (find);
+
+	replace_text = gtranslator_utils_unescape_search_text (replace);
+
+	gtk_text_buffer_get_start_iter (buffer, &iter);
+
+	search_flags = GTK_SOURCE_SEARCH_VISIBLE_ONLY | GTK_SOURCE_SEARCH_TEXT_ONLY;
+
+	if (!GTR_SEARCH_IS_CASE_SENSITIVE (flags))
+	{
+		search_flags = search_flags | GTK_SOURCE_SEARCH_CASE_INSENSITIVE;
+	}
+
+	replace_text_len = strlen (replace_text);
+
+	/* disable cursor_moved emission until the end of the
+	 * replace_all so that we don't spend all the time
+	 * updating the position in the statusbar
+	 */
+	//view->priv->stop_cursor_moved_emission = TRUE;
+
+	gtk_text_buffer_begin_user_action (buffer);
+
+	do
+	{
+		found = gtk_source_iter_forward_search (&iter,
+							search_text, 
+							search_flags,
+                        	                	&m_start, 
+                        	                	&m_end,
+                                	               	NULL);
+
+		if (found && GTR_SEARCH_IS_ENTIRE_WORD (flags))
+		{
+			gboolean word;
+
+			word = gtk_text_iter_starts_word (&m_start) && 
+			       gtk_text_iter_ends_word (&m_end);
+
+			if (!word)
+			{
+				iter = m_end;
+				continue;
+			}
+		}
+
+		if (found)
+		{
+			++cont;
+
+			gtk_text_buffer_delete (buffer, 
+						&m_start,
+						&m_end);
+			gtk_text_buffer_insert (buffer,
+						&m_start,
+						replace_text,
+						replace_text_len);
+
+			iter = m_start;
+		}		
+
+	} while (found);
+
+	gtk_text_buffer_end_user_action (buffer);
+
+	/* re-enable cursor_moved emission and notify
+	 * the current position 
+	 */
+	//view->priv->stop_cursor_moved_emission = FALSE;
+	//emit_cursor_moved (GTK_SOURCE_BUFFER(buffer));
+
+	g_free (search_text);
+	g_free (replace_text);
+
+	return cont;
+}

Modified: trunk/src/view.h
==============================================================================
--- trunk/src/view.h	(original)
+++ trunk/src/view.h	Sun Mar  2 21:32:24 2008
@@ -36,6 +36,14 @@
 #define GTR_IS_VIEW_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), GTR_TYPE_VIEW))
 #define GTR_VIEW_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GTR_TYPE_VIEW, GtranslatorViewClass))
 
+typedef enum
+{
+        GTR_SEARCH_DONT_SET_FLAGS     = 1 << 0, 
+        GTR_SEARCH_ENTIRE_WORD        = 1 << 1,
+        GTR_SEARCH_CASE_SENSITIVE     = 1 << 2
+
+} GtranslatorSearchFlags;
+
 /* Private structure type */
 typedef struct _GtranslatorViewPrivate	GtranslatorViewPrivate;
 
@@ -62,12 +70,57 @@
 	GtkSourceViewClass parent_class;
 };
 
+
 /*
  * Public methods
  */
-GType		 gtranslator_view_get_type	   (void) G_GNUC_CONST;
-GType		 gtranslator_view_register_type    (GTypeModule * module);
-GtkWidget	*gtranslator_view_new	           (void);
+GType		 gtranslator_view_get_type               (void) G_GNUC_CONST;
+
+GType		 gtranslator_view_register_type          (GTypeModule * module);
+
+GtkWidget	*gtranslator_view_new                    (void);
+
+gboolean         gtranslator_view_get_selected_text      (GtranslatorView *view,
+							  gchar         **selected_text,
+							  gint           *len);
+
+void             gtranslator_view_enable_spellcheck      (GtranslatorView *view,
+							  gboolean enable);
+
+void             gtranslator_view_enable_visible_whitespace
+                                                         (GtranslatorView *view,
+							  gboolean enable);
+
+void             gtranslator_view_cut_clipboard          (GtranslatorView *view);
+
+void             gtranslator_view_copy_clipboard         (GtranslatorView *view);
+
+void             gtranslator_view_paste_clipboard        (GtranslatorView *view);
+
+void             gtranslator_view_set_font               (GtranslatorView   *view, 
+							  gboolean     def, 
+							  const gchar *font_name);
+
+void             gtranslator_view_set_search_text        (GtranslatorView *view,
+							  const gchar   *text,
+							  guint          flags);
+
+gchar           *gtranslator_view_get_search_text        (GtranslatorView *view,
+							  guint         *flags);
+
+
+/* Search macros */
+#define GTR_SEARCH_IS_DONT_SET_FLAGS(sflags) ((sflags & GTR_SEARCH_DONT_SET_FLAGS) != 0)
+#define GTR_SEARCH_SET_DONT_SET_FLAGS(sflags,state) ((state == TRUE) ? \
+(sflags |= GTR_SEARCH_DONT_SET_FLAGS) : (sflags &= ~GTR_SEARCH_DONT_SET_FLAGS))
+
+#define GTR_SEARCH_IS_ENTIRE_WORD(sflags) ((sflags & GTR_SEARCH_ENTIRE_WORD) != 0)
+#define GTR_SEARCH_SET_ENTIRE_WORD(sflags,state) ((state == TRUE) ? \
+(sflags |= GTR_SEARCH_ENTIRE_WORD) : (sflags &= ~GTR_SEARCH_ENTIRE_WORD))
+
+#define GTR_SEARCH_IS_CASE_SENSITIVE(sflags) ((sflags &  GTR_SEARCH_CASE_SENSITIVE) != 0)
+#define GTR_SEARCH_SET_CASE_SENSITIVE(sflags,state) ((state == TRUE) ? \
+(sflags |= GTR_SEARCH_CASE_SENSITIVE) : (sflags &= ~GTR_SEARCH_CASE_SENSITIVE))
 
 G_END_DECLS
 



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