On Fri, Mar 13, 2009 at 04:54:06PM -0400, Barry deFreese wrote:
> Attached is a patch that will build with Gtk 2 as well as some packaging  
> fixes.  Probably needs better testing as Spanish is not my first 
> language.

I have played with the patch a little bit and it does not work. I fixed the
issue with i2e not showing properly accented characters by converting the PO
file (for spanish) to UTF-8 and then fixing how the locale is set in the
program.

But I have been unable to make it work to get it to translate a simple word,
the changes for GTK+2 support break its functionality (it doesn't show
anything in the window frame and spouts a lot of gtk errors).

Since upstream is no longer active I'm tempted to ask for the removal of this
package. There are probably better alternatives out there (ktranslator in GUI
or translate in text-mode).

I'm going to tag this bug as help needed since I don't have the GTK
experience to fix this issue. If no help is forthcoming I will ask for its
removal.

Regards

Javier
diff -Nru i2e-0.5.1/debian/changelog i2e-0.5.1-gtk2/debian/changelog
--- i2e-0.5.1/debian/changelog	2009-03-14 18:14:34.000000000 +0100
+++ i2e-0.5.1-gtk2/debian/changelog	2009-03-14 13:43:11.000000000 +0100
@@ -1,3 +1,16 @@
+i2e (0.5.1-3) unstable; urgency=low
+
+  * Use patch provided by Barry deFreese (Debian QA):
+    * Build with Gtk2. (Closes: #515323).
+      * Make clean not ignore errors.
+      * Bump debhelper build-dep to >> 5.0.0.
+      * Add debian/compat and set to 5.
+      * Bump Standards Version to 3.8.0.
+        + Menu policy transition.
+  * Convert es.po file to UTF-8 
+
+ -- Javier Fernandez-Sanguino Pen~a <j...@debian.org>  Sat, 14 Mar 2009 13:43:06 +0100
+
 i2e (0.5.1-2) unstable; urgency=low
 
   * Lintian fixes:
diff -Nru i2e-0.5.1/debian/compat i2e-0.5.1-gtk2/debian/compat
--- i2e-0.5.1/debian/compat	1970-01-01 01:00:00.000000000 +0100
+++ i2e-0.5.1-gtk2/debian/compat	2009-03-14 13:23:06.000000000 +0100
@@ -0,0 +1 @@
+5
diff -Nru i2e-0.5.1/debian/control i2e-0.5.1-gtk2/debian/control
--- i2e-0.5.1/debian/control	2009-03-14 18:14:34.000000000 +0100
+++ i2e-0.5.1-gtk2/debian/control	2009-03-14 13:23:06.000000000 +0100
@@ -2,12 +2,12 @@
 Section: text
 Priority: optional
 Maintainer: Javier Fernandez-Sanguino Pen~a <j...@computer.org>
-Build-Depends: gettext, libgtk1.2-dev, debhelper (>> 3.0.0)
-Standards-Version: 3.5.8.0
+Build-Depends: debhelper (>> 5.0.0), gettext, libgtk2.0-dev
+Standards-Version: 3.8.0
 
 Package: i2e
 Architecture: any
-Depends: gettext,${shlibs:Depends}
+Depends: gettext,${shlibs:Depends}, ${misc:Depends}
 Description: English-Spanish translation dictionary
  English to Spanish (and viceversa) translation dictionary. 
  It can be used both in X and text mode and has a learning
diff -Nru i2e-0.5.1/debian/menu i2e-0.5.1-gtk2/debian/menu
--- i2e-0.5.1/debian/menu	2009-03-14 18:14:34.000000000 +0100
+++ i2e-0.5.1-gtk2/debian/menu	2009-03-14 13:23:06.000000000 +0100
@@ -1,6 +1,6 @@
 ?package(i2e):\
   needs="X11"\
-  section="Apps/Text"\
+  section="Applications/Text"\
   description="English-Spanish dictionary"\
   title="i2e"\
   command="/usr/bin/i2e"
diff -Nru i2e-0.5.1/debian/rules i2e-0.5.1-gtk2/debian/rules
--- i2e-0.5.1/debian/rules	2009-03-14 18:14:34.000000000 +0100
+++ i2e-0.5.1-gtk2/debian/rules	2009-03-14 13:23:06.000000000 +0100
@@ -22,7 +22,7 @@
 	rm -f build-stamp install-stamp
 
 	# Add here commands to clean up after the build process.
-	-$(MAKE) clean
+	$(MAKE) clean
 
 	dh_clean
 
@@ -34,7 +34,7 @@
 	dh_installdirs
 
 	# Add here commands to install the package into debian/tmp.
-	$(MAKE) install DESTDIR=`pwd`/debian/tmp
+	$(MAKE) install DESTDIR=$(CURDIR)/debian/i2e
 
 	touch install-stamp
 
diff -Nru i2e-0.5.1/i2e.c i2e-0.5.1-gtk2/i2e.c
--- i2e-0.5.1/i2e.c	2009-03-14 18:14:34.000000000 +0100
+++ i2e-0.5.1-gtk2/i2e.c	2009-03-14 15:30:43.000000000 +0100
@@ -43,7 +43,7 @@
     return;
   }
 
-  str = (char *)g_malloc( strlen( clip->data ) + 1 );
+  str = (char *)g_malloc( strlen((char *)clip->data ) + 1 );
   strcpy( str, (char *)clip->data );
   ptr = strtrim( str );
 
@@ -80,13 +80,14 @@
 /* sigue el estado del togglebutton traducir */
 static void cambiaTraducir( GtkWidget *widget, gpointer data )
 {
-  char *direccion[2] = { _(" Spanish -> English "), _(" English -> Spanish ") };
 
   parametros *datos = (parametros *)data;
-  datos->i2c = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( widget ));
   datos->cambiado = TRUE;
-  gtk_label_set_text( GTK_LABEL( GTK_TOGGLE_BUTTON( widget )->button.bin.child ),
-      direccion[datos->i2c] );
+  if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( widget )) ) 
+
+      gtk_label_set_text( GTK_LABEL( GTK_TOGGLE_BUTTON( widget )->button.bin.child ), _(" English -> Spanish "));
+  else 
+      gtk_label_set_text( GTK_LABEL( GTK_TOGGLE_BUTTON( widget )->button.bin.child ), _(" Spanish -> English "));
 
   gtk_entry_select_region( GTK_ENTRY( datos->entrada ), 0,
       strlen( gtk_entry_get_text( GTK_ENTRY( datos->entrada ))));
@@ -159,10 +160,11 @@
   char *busqueda[2];
   size_t cpl;    /* caracteres por linea */
 
-  setlocale( LC_ALL, "es_ES.ISO-8859-1" );
-/*  setlocale( LC_MESSAGES, "" );*/
+  gtk_set_locale();
+  bind_textdomain_codeset (PACKAGE, "UTF-8");
   bindtextdomain( PACKAGE, LOCALEDIR );
   textdomain( PACKAGE );
+  gtk_init( &argc, &argv );
 
   direccion[0] = _(" Spanish -> English ");
   direccion[1] = _(" English -> Spanish ");
@@ -213,8 +215,6 @@
     return 0;
   }*/
 
-/*  gtk_set_locale();*/
-  gtk_init( &argc, &argv );
 
   /* crea la ventana principal */
   ventana = gtk_window_new( GTK_WINDOW_TOPLEVEL );
@@ -262,21 +262,30 @@
   gtk_widget_show( subtabla );  
 
   /* widget para el texto de la traduccion en la subtabla */
-  datos.salida = gtk_text_new( NULL, NULL );
-  gtk_text_set_editable( GTK_TEXT( datos.salida ), FALSE );
-  gtk_text_set_word_wrap( GTK_TEXT( datos.salida ), FALSE );
+/* BDD */
+/*  datos.salida = gtk_text_new( NULL, NULL ); */
+  datos.salida = gtk_text_view_new();
+/* BDD */
+/*  gtk_text_set_editable( GTK_TEXT( datos.salida ), FALSE ); */
+/*  gtk_text_set_word_wrap( GTK_TEXT( datos.salida ), FALSE ); */
+  gtk_text_view_set_editable( GTK_TEXT_VIEW( datos.salida ), FALSE );
+  gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( datos.salida ), GTK_WRAP_WORD );
   gtk_table_attach_defaults( GTK_TABLE( subtabla ), datos.salida, 0, 1, 0, 1);
   gtk_widget_show( datos.salida );
 
   /* scroll horizontal en la subtabla */
-  barra = gtk_hscrollbar_new( GTK_TEXT( datos.salida )->hadj );
+/* BDD */
+/*  barra = gtk_hscrollbar_new( GTK_TEXT( datos.salida )->hadj ); */
+  barra = gtk_hscrollbar_new( GTK_TEXT_VIEW( datos.salida )->hadjustment );
   GTK_WIDGET_UNSET_FLAGS( GTK_HSCROLLBAR( barra ), GTK_CAN_FOCUS );
   gtk_table_attach( GTK_TABLE( subtabla ), barra, 0, 1, 1, 2,
       GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0 );
   gtk_widget_show( barra ); 
                                                 
   /* scroll vertical en la subtabla */
-  barra = gtk_vscrollbar_new( GTK_TEXT( datos.salida )->vadj );
+/* BDD */
+/*  barra = gtk_vscrollbar_new( GTK_TEXT( datos.salida )->vadj ); */
+  barra = gtk_vscrollbar_new( GTK_TEXT_VIEW( datos.salida )->vadjustment );
   GTK_WIDGET_UNSET_FLAGS( GTK_VSCROLLBAR( barra ), GTK_CAN_FOCUS );
   gtk_table_attach( GTK_TABLE( subtabla ), barra, 1, 2, 0, 1,
       GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0 );
diff -Nru i2e-0.5.1/Makefile i2e-0.5.1-gtk2/Makefile
--- i2e-0.5.1/Makefile	2009-03-14 18:14:34.000000000 +0100
+++ i2e-0.5.1-gtk2/Makefile	2009-03-14 13:23:06.000000000 +0100
@@ -9,22 +9,22 @@
 OBJS = i2e.o traduce.o mensaje.o aprende.o funciones.o
 
 i2e :  po/es.mo $(OBJS) Makefile
-	$(CC) $(CFLAG) $(OBJS) -o i2e `gtk-config --libs`
+	$(CC) $(CFLAG) $(OBJS) -o i2e `pkg-config --libs gtk+-2.0`
 
 i2e.o : i2e.c i2e.h 
-	$(CC) $(CFLAG) -c i2e.c -o i2e.o `gtk-config --cflags`
+	$(CC) $(CFLAG) -c i2e.c -o i2e.o `pkg-config --cflags gtk+-2.0`
 
 traduce.o : traduce.c i2e.h
-	$(CC) $(CFLAG) -c traduce.c -o traduce.o `gtk-config --cflags`
+	$(CC) $(CFLAG) -c traduce.c -o traduce.o `pkg-config --cflags gtk+-2.0`
 
 mensaje.o : mensaje.c i2e.h
-	$(CC) $(CFLAG) -c mensaje.c -o mensaje.o `gtk-config --cflags`
+	$(CC) $(CFLAG) -c mensaje.c -o mensaje.o `pkg-config --cflags gtk+-2.0`
 
 aprende.o : aprende.c i2e.h
-	$(CC) $(CFLAG) -c aprende.c -o aprende.o `gtk-config --cflags`
+	$(CC) $(CFLAG) -c aprende.c -o aprende.o `pkg-config --cflags gtk+-2.0`
 
 funciones.o : funciones.c i2e.h
-	$(CC) $(CFLAG) -c funciones.c -o funciones.o `gtk-config --cflags`
+	$(CC) $(CFLAG) -c funciones.c -o funciones.o `pkg-config --cflags gtk+-2.0`
 
 po/es.mo : po/es.po
 	msgfmt -o po/es.mo po/es.po
diff -Nru i2e-0.5.1/po/es.po i2e-0.5.1-gtk2/po/es.po
--- i2e-0.5.1/po/es.po	2009-03-14 18:14:34.000000000 +0100
+++ i2e-0.5.1-gtk2/po/es.po	2009-03-14 13:42:50.000000000 +0100
@@ -1,4 +1,4 @@
-# Mensajes en Español para i2e e i2e-cli
+# Mensajes en Español para i2e e i2e-cli
 # Alfredo Casademunt <da...@wanadoo.es>, 1999.
 # Revisado por Amaya Rodrigo Sastre <barbwi...@bigfoot.com>
 # Spanish messages for i2e and i2e.sh
@@ -11,23 +11,23 @@
 "Project-Id-Version: i2e 0.5\n"
 "POT-Creation-Date: 1999-12-17 18:22+0200\n"
 "PO-Revision-Date: 2004-01-03 18:52:50+0100\n"
-"Last-Translator: Javier Fernandez-Sanguino Peña <j...@debian.org>\n"
+"Last-Translator: Javier Fernandez-Sanguino Peña <j...@debian.org>\n"
 "Language-Team: Debian Spanish <debian-l10n-span...@lists.debian.org>\n"
 "MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=ISO-8859-1\n"
+"Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8-bit\n"
 
 msgid " Spanish -> English "
-msgstr " Español -> Inglés "
+msgstr " Español -> Inglés "
 
 msgid " English -> Spanish "
-msgstr " Inglés -> Español "
+msgstr " Inglés -> Español "
 
 msgid " Raw search "
-msgstr " Búsqueda  bruta "
+msgstr " Búsqueda  bruta "
 
 msgid " Exact search "
-msgstr " Búsqueda exacta "
+msgstr " Búsqueda exacta "
 
 msgid "Translate"
 msgstr "Traducir"
@@ -42,7 +42,7 @@
 msgstr "Error"
 
 msgid "Add text to both inputs."
-msgstr "Añade texto en las dos entradas"
+msgstr "Añade texto en las dos entradas"
 
 msgid "I cannot open file "
 msgstr "No puedo abrir el fichero "
@@ -57,10 +57,10 @@
 msgstr "Aprendiendo"
 
 msgid "English"
-msgstr "Inglés"
+msgstr "Inglés"
 
 msgid "Spanish"
-msgstr "Español"
+msgstr "Español"
 
 msgid "Cancel"
 msgstr "Cancelar"
@@ -72,10 +72,10 @@
 msgstr "Aceptar"
 
 msgid "In function regcomp()=="
-msgstr "En la función regcomp()=="
+msgstr "En la función regcomp()=="
 
 msgid "In function regexec()=="
-msgstr "En la función regexec()=="
+msgstr "En la función regexec()=="
 
 msgid "\nAt line: "
 msgstr "\nEn la linea: "
@@ -96,25 +96,25 @@
 msgstr "i2e-cli [-re] [palabra]"
 
 msgid "By default, i2e-cli translates from English into Spanish with"
-msgstr "Por defecto i2e-cli traduce del Inglés al Español con"
+msgstr "Por defecto i2e-cli traduce del Inglés al Español con"
 
 msgid " a \"raw\" search."
-msgstr " una búsqueda «bruta»."
+msgstr " una búsqueda «bruta»."
 
 msgid "With -r option word is translated from Spanish into English."
-msgstr "Con la opción -r traduce del Español al Inglés."
+msgstr "Con la opción -r traduce del Español al Inglés."
 
 msgid "With -e option an \"exact\" search will be performed."
-msgstr "Con la opción -e hace una búsqueda «exacta»."
+msgstr "Con la opción -e hace una búsqueda «exacta»."
 
 msgid "Option"
-msgstr "Opción"
+msgstr "Opción"
 
 msgid "not valid."
 msgstr "no valida."
 
 msgid "Not found in Spanish"
-msgstr "No encontrado en Español"
+msgstr "No encontrado en Español"
 
 msgid "Not found in English"
-msgstr "No encontrado en Inglés"
+msgstr "No encontrado en Inglés"
diff -Nru i2e-0.5.1/po/es.po.lat1 i2e-0.5.1-gtk2/po/es.po.lat1
--- i2e-0.5.1/po/es.po.lat1	1970-01-01 01:00:00.000000000 +0100
+++ i2e-0.5.1-gtk2/po/es.po.lat1	2004-01-23 18:54:07.000000000 +0100
@@ -0,0 +1,120 @@
+# Mensajes en Español para i2e e i2e-cli
+# Alfredo Casademunt <da...@wanadoo.es>, 1999.
+# Revisado por Amaya Rodrigo Sastre <barbwi...@bigfoot.com>
+# Spanish messages for i2e and i2e.sh
+# Reviewed by Amaya Rodrigo Sastre <barbwi...@bigfoot.com>
+# Modified by Javier Fernandez-Sanguino for the Debian distribution
+# (i2e.sh -> i2e-cli
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: i2e 0.5\n"
+"POT-Creation-Date: 1999-12-17 18:22+0200\n"
+"PO-Revision-Date: 2004-01-03 18:52:50+0100\n"
+"Last-Translator: Javier Fernandez-Sanguino Peña <j...@debian.org>\n"
+"Language-Team: Debian Spanish <debian-l10n-span...@lists.debian.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO-8859-1\n"
+"Content-Transfer-Encoding: 8-bit\n"
+
+msgid " Spanish -> English "
+msgstr " Español -> Inglés "
+
+msgid " English -> Spanish "
+msgstr " Inglés -> Español "
+
+msgid " Raw search "
+msgstr " Búsqueda  bruta "
+
+msgid " Exact search "
+msgstr " Búsqueda exacta "
+
+msgid "Translate"
+msgstr "Traducir"
+
+msgid "Learn"
+msgstr "Aprender"
+
+msgid "Exit"
+msgstr "Salir"
+
+msgid "Error"
+msgstr "Error"
+
+msgid "Add text to both inputs."
+msgstr "Añade texto en las dos entradas"
+
+msgid "I cannot open file "
+msgstr "No puedo abrir el fichero "
+
+msgid "Warning"
+msgstr "Aviso"
+
+msgid "Already in dictionary"
+msgstr "Ya esta en el diccionario"
+
+msgid "Learning"
+msgstr "Aprendiendo"
+
+msgid "English"
+msgstr "Inglés"
+
+msgid "Spanish"
+msgstr "Español"
+
+msgid "Cancel"
+msgstr "Cancelar"
+
+msgid "\nError opening file %s\n"
+msgstr "\nError al abrir el fichero %s\n"
+
+msgid "Ok"
+msgstr "Aceptar"
+
+msgid "In function regcomp()=="
+msgstr "En la función regcomp()=="
+
+msgid "In function regexec()=="
+msgstr "En la función regexec()=="
+
+msgid "\nAt line: "
+msgstr "\nEn la linea: "
+
+msgid "Of file "
+msgstr "Del fichero "
+
+msgid "Not found in "
+msgstr "No encontrado en "
+
+msgid "Dictionary"
+msgstr "Diccionario"
+
+msgid "not found."
+msgstr "no encontrado."
+
+msgid "i2e-cli [-re] [word]"
+msgstr "i2e-cli [-re] [palabra]"
+
+msgid "By default, i2e-cli translates from English into Spanish with"
+msgstr "Por defecto i2e-cli traduce del Inglés al Español con"
+
+msgid " a \"raw\" search."
+msgstr " una búsqueda «bruta»."
+
+msgid "With -r option word is translated from Spanish into English."
+msgstr "Con la opción -r traduce del Español al Inglés."
+
+msgid "With -e option an \"exact\" search will be performed."
+msgstr "Con la opción -e hace una búsqueda «exacta»."
+
+msgid "Option"
+msgstr "Opción"
+
+msgid "not valid."
+msgstr "no valida."
+
+msgid "Not found in Spanish"
+msgstr "No encontrado en Español"
+
+msgid "Not found in English"
+msgstr "No encontrado en Inglés"
diff -Nru i2e-0.5.1/traduce.c i2e-0.5.1-gtk2/traduce.c
--- i2e-0.5.1/traduce.c	2000-01-08 02:21:49.000000000 +0100
+++ i2e-0.5.1-gtk2/traduce.c	2009-03-14 18:12:18.000000000 +0100
@@ -33,14 +33,22 @@
   FILE *f;
   int i;
   char *LENGUAJE[] = { _("English"), _("Spanish") };
+/* BDD */
+  GtkTextBuffer *salidasbuf;
+  GtkTextIter *salidasiter;
+  salidasiter = NULL;
 
   datos = (parametros *)data;
 
   texto = strtrim( gtk_entry_get_text( GTK_ENTRY( datos->entrada )));
   gtk_entry_set_text( GTK_ENTRY( datos->entrada ), texto );
 
-  gtk_text_backward_delete( GTK_TEXT( datos->salida ),
-      gtk_text_get_length( GTK_TEXT( datos->salida )));
+/* BDD */
+/*  gtk_text_backward_delete( GTK_TEXT( datos->salida ), */
+/*      gtk_text_get_length( GTK_TEXT( datos->salida ))); */
+
+  salidasbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(datos->salida));
+  gtk_text_buffer_set_text(salidasbuf, "", 0);
 
   if (! strlen( texto ))
   {
@@ -61,6 +69,7 @@
     {
       switch ( *(texto+i) )
       {
+      /* TODO: Use UTF-8 */
         case 'a':
         case 'á':
           g_string_append( patron, "[aá]" );
@@ -151,8 +160,13 @@
           strcat( tr, "\n" );
         }
         
-        gtk_text_insert( GTK_TEXT( datos->salida ), NULL, NULL, NULL,
-                         tr, strlen( tr ));
+/* BDD */
+/*        gtk_text_insert( GTK_TEXT( datos->salida ), NULL, NULL, NULL, */
+/*                         tr, strlen( tr )); */
+
+	gtk_text_buffer_get_end_iter(salidasbuf, salidasiter);
+	gtk_text_buffer_insert(salidasbuf, salidasiter, (gchar *)tr, strlen( tr ));
+
         if (! encontrado )
           encontrado = 1;
       }
@@ -181,7 +195,9 @@
   
   if ( encontrado )
   {
-    gtk_text_backward_delete( GTK_TEXT( datos->salida ), 1 );
+/* BDD */
+/*    gtk_text_backward_delete( GTK_TEXT( datos->salida ), 1 ); */
+    gtk_text_buffer_set_text(salidasbuf, "", 0);
   }
   else
   {
@@ -191,13 +207,19 @@
     g_string_append( patron, texto );
     g_string_append( patron, "\"" );
 
-    gtk_text_insert( GTK_TEXT( datos->salida ), NULL, NULL, NULL,
-        patron->str, patron->len );
+/* BDD */
+/*    gtk_text_insert( GTK_TEXT( datos->salida ), NULL, NULL, NULL, */
+/*        patron->str, patron->len );  */
+
+    gtk_text_buffer_get_end_iter( salidasbuf, salidasiter );
+    gtk_text_buffer_insert( salidasbuf, salidasiter, patron->str, patron->len );
 
     g_string_free( patron, TRUE );
   }
 
-  gtk_adjustment_set_value( GTK_TEXT( datos->salida )->vadj, 0.0 );
+/* BDD */
+/*  gtk_adjustment_set_value( GTK_TEXT( datos->salida )->vadj, 0.0 ); */
+  gtk_adjustment_set_value( GTK_TEXT_VIEW( datos->salida )->vadjustment, 0.0 );
 
   regfree( &buffer );
   g_free( linea );

Attachment: signature.asc
Description: Digital signature

Reply via email to