From ef9009254c3f13682ec4c7807b592c339898d791 Mon Sep 17 00:00:00 2001 From: kloczek Date: Mon, 10 Mar 2003 18:25:22 +0000 Subject: [PATCH] - outdated. Changed files: dillo-0.6.6-charset.patch -> 1.2 dillo-encodings.patch -> 1.2 dillo-localedir.patch -> 1.2 --- dillo-0.6.6-charset.patch | 156 -------- dillo-encodings.patch | 732 -------------------------------------- dillo-localedir.patch | 10 - 3 files changed, 898 deletions(-) delete mode 100644 dillo-0.6.6-charset.patch delete mode 100644 dillo-encodings.patch delete mode 100644 dillo-localedir.patch diff --git a/dillo-0.6.6-charset.patch b/dillo-0.6.6-charset.patch deleted file mode 100644 index 3bd4e4e..0000000 --- a/dillo-0.6.6-charset.patch +++ /dev/null @@ -1,156 +0,0 @@ -diff -BurN dillo-0.6.6.old/dillorc dillo-0.6.6/dillorc ---- dillo-0.6.6.old/dillorc Thu May 30 01:36:08 2002 -+++ dillo-0.6.6/dillorc Sat Jun 1 17:31:30 2002 -@@ -35,6 +35,9 @@ - # If you prefer oblique over italic fonts, uncoment next line - #use_oblique=YES - -+# Use this value as charset part of font for loading. (default is iso8859-1) -+# font_charset=iso8859-5 -+ - # Show ALT popup for images? - show_alt=YES - -diff -BurN dillo-0.6.6.old/src/dw_style.c dillo-0.6.6/src/dw_style.c ---- dillo-0.6.6.old/src/dw_style.c Tue May 28 05:14:03 2002 -+++ dillo-0.6.6/src/dw_style.c Sat Jun 1 17:31:30 2002 -@@ -243,45 +243,44 @@ - { - char fontname[256], *ItalicChar; - -- ItalicChar = prefs.use_oblique ? "o" : "i"; -- sprintf (fontname, "-*-%s-%s-%s-*-*-%d-*-75-75-*-*-iso8859-1", -- font->name, -- font->bold ? "bold" : "medium", -- font->italic ? ItalicChar : "r", -- font->size); -- font->font = gdk_font_load(fontname); -- -- if (font->font == NULL && font->italic) { -- sprintf(fontname, "-*-%s-%s-%s-*-*-%d-*-75-75-*-*-iso8859-1", -+ ItalicChar = prefs.use_oblique ? "o" : "i"; -+ sprintf (fontname, "-*-%s-%s-%s-*-*-%d-*-75-75-*-*-%s", - font->name, - font->bold ? "bold" : "medium", -- (*ItalicChar == 'o') ? "i" : "o", -- font->size); -- font->font = gdk_font_load(fontname); -- } -- -- if (try_all) { -- if (font->font == NULL) { -- /* Can't load the font - substitute the default instead. */ -- font->font = -- gdk_font_load -- ("-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-iso8859-1"); -- } -- -- if (font->font == NULL) { -- /* Try another platform-font that should be available. (iPaq) */ -- font->font = -- gdk_font_load -- ("-misc-fixed-medium-r-normal--13-120-75-75-c-80-iso8859-1"); -- } -- -- if (font->font == NULL) { -- /* Can't load any suitable font! */ -- g_warning ("Can't load any ISO8859-1 font!?! :("); -- font->font = -- gdk_font_load("-adobe-helvetica-*-*-*--*-*-*-*-*-*-*-*"); -- } -- } -+ font->italic ? ItalicChar : "r", -+ font->size, -+ prefs.font_charset); -+ font->font = gdk_font_load(fontname); -+ -+ if (font->font == NULL && font->italic) { -+ sprintf(fontname, "-*-%s-%s-%s-*-*-%d-*-75-75-*-*-%s", -+ font->name, -+ font->bold ? "bold" : "medium", -+ (*ItalicChar == 'o') ? "i" : "o", -+ font->size, -+ prefs.font_charset); -+ font->font = gdk_font_load(fontname); -+ } -+ -+ if (try_all) { -+ if (font->font == NULL) { -+ /* Can't load the font - substitute the default instead. */ -+ sprintf(fontname,"-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-%s",prefs.font_charset); -+ font->font = gdk_font_load (fontname); -+ } -+ -+ if (font->font == NULL) { -+ /* Try another platform-font that should be available. (iPaq) */ -+ sprintf(fontname,"-misc-fixed-medium-r-normal--13-120-75-75-c-80-%s",prefs.font_charset); -+ font->font = gdk_font_load (fontname); -+ } -+ -+ if (font->font == NULL) { -+ /* Can't load any suitable font! */ -+ g_warning ("Can't load any font with charset '%s'!?! :(",prefs.font_charset); -+ font->font = gdk_fontset_load("-adobe-helvetica-*-*-*--*-*-*-*-*-*-*-*,-misc-fixed-*,*"); -+ } -+ } - - if (font->font) { - font->space_width = gdk_char_width (font->font, ' '); -diff -BurN dillo-0.6.6.old/src/prefs.c dillo-0.6.6/src/prefs.c ---- dillo-0.6.6.old/src/prefs.c Wed Apr 3 20:31:46 2002 -+++ dillo-0.6.6/src/prefs.c Sat Jun 1 17:31:30 2002 -@@ -52,6 +52,7 @@ - { "small_icons", DRC_TOKEN_SMALL_ICONS }, - { "limit_text_width", DRC_TOKEN_LIMIT_TEXT_WIDTH }, - { "font_factor", DRC_TOKEN_FONT_FACTOR }, -+ { "font_charset", DRC_TOKEN_FONT_CHARSET }, - { "use_dicache", DRC_TOKEN_USE_DICACHE }, - { "show_back", DRC_TOKEN_SHOW_BACK }, - { "show_forw", DRC_TOKEN_SHOW_FORW }, -@@ -172,6 +173,10 @@ - case DRC_TOKEN_FONT_FACTOR: - prefs.font_factor = strtod(scanner->value.v_string, NULL); - break; -+ case DRC_TOKEN_FONT_CHARSET: -+ if (prefs.font_charset) g_free(prefs.font_charset); -+ prefs.font_charset = g_strdup(scanner->value.v_string); -+ break; - case DRC_TOKEN_LIMIT_TEXT_WIDTH: - prefs.limit_text_width = (strcmp(scanner->value.v_string, "YES") == 0); - break; -@@ -338,6 +343,7 @@ - prefs.small_icons = FALSE; - prefs.limit_text_width = FALSE; - prefs.font_factor = 1.0; -+ prefs.font_charset = g_strdup("iso8859-1"); - prefs.use_dicache = FALSE; - prefs.show_back=TRUE; - prefs.show_forw=TRUE; -@@ -374,6 +380,8 @@ - g_free(prefs.no_proxy); - if (prefs.no_proxy_vec) - g_strfreev(prefs.no_proxy_vec); -+ if (prefs.font_charset) -+ g_free (prefs.font_charset); - a_Url_free(prefs.http_proxy); - g_free(prefs.fw_fontname); - g_free(prefs.vw_fontname); -diff -BurN dillo-0.6.6.old/src/prefs.h dillo-0.6.6/src/prefs.h ---- dillo-0.6.6.old/src/prefs.h Wed Apr 3 20:31:46 2002 -+++ dillo-0.6.6/src/prefs.h Sat Jun 1 17:31:30 2002 -@@ -40,6 +40,7 @@ - DRC_TOKEN_PANEL_SIZE, - DRC_TOKEN_SMALL_ICONS, - DRC_TOKEN_FONT_FACTOR, -+ DRC_TOKEN_FONT_CHARSET, - DRC_TOKEN_SHOW_ALT, - DRC_TOKEN_LIMIT_TEXT_WIDTH, - DRC_TOKEN_USE_DICACHE, -@@ -84,6 +85,7 @@ - gboolean small_icons; - gboolean limit_text_width; - gdouble font_factor; -+ char *font_charset; - gboolean use_dicache; - gboolean show_back; - gboolean show_forw; diff --git a/dillo-encodings.patch b/dillo-encodings.patch deleted file mode 100644 index d68085f..0000000 --- a/dillo-encodings.patch +++ /dev/null @@ -1,732 +0,0 @@ -diff -BurN dillo-0.6.6.old/Makefile.am dillo-0.6.6/Makefile.am ---- dillo-0.6.6.old/Makefile.am Sat Jun 1 18:00:09 2002 -+++ dillo-0.6.6/Makefile.am Sat Jun 1 18:02:02 2002 -@@ -1,17 +1,21 @@ - SUBDIRS = doc src - --EXTRA_DIST = dillorc -+EXTRA_DIST = dillorc encodings - - install-data-local: dillorc - -if [ -d $(DESTDIR)$(sysconfdir) ]; then \ - $(INSTALL_DATA) --backup=t $(srcdir)/dillorc $(DESTDIR)$(sysconfdir)/; \ -+ $(INSTALL_DATA) --backup=t $(srcdir)/encodings $(DESTDIR)$(sysconfdir)/; \ - elif [ -d /etc/ ]; then \ - $(INSTALL_DATA) --backup=t $(srcdir)/dillorc /etc/; \ -+ $(INSTALL_DATA) --backup=t $(srcdir)/encodings /etc/; \ - fi - - uninstall-local: - -if [ -d $(DESTDIR)$(sysconfdir) ]; then \ - rm -f $(DESTDIR)$(sysconfdir)/dillorc*; \ -+ rm -f $(DESTDIR)$(sysconfdir)/encodings*; \ - elif [ -d /etc/ ]; then \ -- rm -f /etc/dillorc* -+ rm -f /etc/dillorc*; \ -+ rm -f /etc/encodings* ;\ - fi -diff -BurN dillo-0.6.6.old/encodings dillo-0.6.6/encodings ---- dillo-0.6.6.old/encodings Thu Jan 1 03:00:00 1970 -+++ dillo-0.6.6/encodings Sat Jun 1 18:02:02 2002 -@@ -0,0 +1,18 @@ -+7-bit ASCII -+Western European (ISO 8859-1) -+Western European (ISO 8859-15) -+Western European (CodePage1252) -+Central European (ISO 8859-2) -+Central European (CodePage1250) -+Southern European (ISO 8859-3) -+Cyrillic (KOI8-R) -+Cyrillic (CodePage1251) -+Cyrillic (IBM866) -+Baltic (ISO 8859-13) -+Baltic (ISO 8859-4) -+Baltic (CodePage1257) -+Nordic (ISO 8859-10) -+Celtic (ISO 8859-14) -+Ukraine (KOI8-U) -+Unicode (UTF-8) -+Unicode (UTF-16) -diff -BurN dillo-0.6.6.old/src/Makefile.am dillo-0.6.6/src/Makefile.am ---- dillo-0.6.6.old/src/Makefile.am Sat Jun 1 18:00:09 2002 -+++ dillo-0.6.6/src/Makefile.am Sat Jun 1 18:02:03 2002 -@@ -51,6 +51,9 @@ - dw_tooltip.h \ - dw_widget.c \ - dw_widget.h \ -+ encodings.c \ -+ encodings.h \ -+ encoding-types.h \ - findtext.c \ - findtext.h \ - web.c \ -diff -BurN dillo-0.6.6.old/src/browser.h dillo-0.6.6/src/browser.h ---- dillo-0.6.6.old/src/browser.h Sat Jun 1 18:00:09 2002 -+++ dillo-0.6.6/src/browser.h Sat Jun 1 18:02:03 2002 -@@ -4,10 +4,8 @@ - #include - #include - #include -- - #include "url.h" /* for DilloUrl */ -- -- -+#include "encodings-types.h" - typedef struct _BrowserWindow BrowserWindow; - typedef struct _DilloMenuPopup DilloMenuPopup; - -@@ -58,6 +56,9 @@ - /* The bookmarks menu so that we can add things to it. */ - GtkWidget *bookmarks_menu; - -+ /* The encoding menu */ -+ GtkWidget *enc_menu; -+ - /* The "Headings" and "Anchors" menus */ - GtkWidget *pagemarks_menuitem; - GtkWidget *pagemarks_menu; -@@ -118,6 +119,10 @@ - - /* The tag for the idle function that sets button sensitivity. */ - gint sens_idle_tag; -+ -+ /* encodings variable */ -+ gchar* encoding; /* the selected character set (pointer to static content -don't free it*/ -+ deConversion dcv; /* handle for character set conversion */ - }; - - -diff -BurN dillo-0.6.6.old/src/dillo.c dillo-0.6.6/src/dillo.c ---- dillo-0.6.6.old/src/dillo.c Sat Jun 1 18:00:09 2002 -+++ dillo-0.6.6/src/dillo.c Sat Jun 1 18:02:03 2002 -@@ -22,6 +22,13 @@ - #include - #include - -+#ifdef HAVE_LANGINFO -+#include -+#if ! defined(CODESET) && defined (_NL_CTYPE_CODESET_NAME) -+#define CODESET _NL_CTYPE_CODESET_NAME -+#endif -+#endif -+ - #include - #include - #include -@@ -37,6 +44,7 @@ - #include "nav.h" - #include "history.h" - #include "bookmark.h" -+#include "encodings.h" - #include "dicache.h" - #include "dns.h" - #include "IO/Url.h" -@@ -61,6 +69,7 @@ - { - gchar *file; - gchar *dillo_text_domain; -+ gchar *loctmp; - DilloUrl *start_url; - BrowserWindow *bw; - -@@ -68,7 +77,21 @@ - * todo: implement a cleaner mechanism (in file.c) */ - signal(SIGPIPE, SIG_IGN); - -- g_print("Setting locale to %s\n", gtk_set_locale()); -+ curr_locale=gtk_set_locale(); -+#ifdef HAVE_LANGINFO -+ curr_locale = nl_langinfo(CODESET); -+#else -+ loctmp = strchr(curr_locale, '.'); -+ if (loctmp != NULL) { -+ gchar** trk = g_strsplit(++loctmp, ";", 1); -+ curr_locale = g_strdup(trk[0]); -+ g_strfreev(trk); -+ } else { -+ curr_locale = "ASCII"; -+ } -+#endif -+ -+ g_print("Setting locale to %s\n",curr_locale); - - /* binding the textdomain for GNU gettext: should return "dillo" */ - dillo_text_domain = textdomain("dillo"); -@@ -92,6 +115,7 @@ - bw = a_Interface_browser_window_new(prefs.width, prefs.height); - - a_Bookmarks_init(); -+ a_Encodings_init(); - - /* Send dillo startup screen */ - start_url = a_Url_new("splash", "about:", 0, 0); -diff -BurN dillo-0.6.6.old/src/dillo.h dillo-0.6.6/src/dillo.h ---- dillo-0.6.6.old/src/dillo.h Sat Jun 1 18:00:09 2002 -+++ dillo-0.6.6/src/dillo.h Sat Jun 1 18:02:03 2002 -@@ -6,4 +6,5 @@ - - #define DILLO_HOME "http://dillo.cipsga.org.br/" - -+char* curr_locale; - #endif /* __DILLO_H__ */ -diff -BurN dillo-0.6.6.old/src/encodings-types.h dillo-0.6.6/src/encodings-types.h ---- dillo-0.6.6.old/src/encodings-types.h Thu Jan 1 03:00:00 1970 -+++ dillo-0.6.6/src/encodings-types.h Sat Jun 1 18:02:03 2002 -@@ -0,0 +1,19 @@ -+#ifndef __DILLO_ENCODING_TYPES_H__ -+#define __DILLO_ENCODING_TYPES_H__ -+#include -+/* Copyright (C) 2002 Grigory Bakunov */ -+ -+typedef struct _deConversion deConversion; -+ -+struct _deConversion { -+ iconv_t c_from; -+ iconv_t c_to; -+}; -+ -+ -+typedef enum { -+ DE_DECODE, -+ DE_ENCODE -+} deDirection; -+ -+#endif /* __DILLO_ENCODING_TYPES_H__ */ -diff -BurN dillo-0.6.6.old/src/encodings.c dillo-0.6.6/src/encodings.c ---- dillo-0.6.6.old/src/encodings.c Thu Jan 1 03:00:00 1970 -+++ dillo-0.6.6/src/encodings.c Sat Jun 1 18:02:03 2002 -@@ -0,0 +1,376 @@ -+/* cruelty :) */ -+ -+/* Copyright (C) 2002 Grigory Bakunov */ -+ -+/* Copyright (C) 1997 Ian Main -+ * -+ * 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 2 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 -+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "list.h" -+#include "interface.h" -+#include "dillo.h" -+#include "nav.h" -+#include "browser.h" -+#include "menu.h" -+#include "misc.h" -+#include "url.h" -+ -+#define LOAD_ENCODINGS 1 -+#define SAVE_ENCODING 2 -+#define CLOSE_ENCODINGS 3 -+ -+/* this #define will cut page title if > 39 chars */ -+#define TITLE39 -+ -+/* double quote */ -+#define D_QUOTE 0x22 -+ -+/* Data types */ -+ -+typedef struct _Encoding Encoding; -+typedef struct _CallbackInfo CallbackInfo; -+ -+struct _Encoding { -+ char *title; -+ char *iconv_name; -+ GtkWidget *menuitem; -+}; -+ -+struct _CallbackInfo { -+ BrowserWindow *bw; -+ guint index; -+}; -+ -+/* -+ * Forward declarations -+ */ -+static void -+ Encodings_load_to_menu(FILE *fp), -+ Encodings_file_op(gint operation, const char *title, const char *iconv_name), -+ Encodings_save_to_file(FILE *fp, const char *title, const char *iconv_name); -+ -+static char* -+ Encodings_search_line(char *line, char *start_text, char *end_text); -+ -+/* -+ * Local data -+ */ -+static Encoding *encodings = NULL; -+static gint num_encodings = 0; -+static gint num_encodings_max = 16; -+ -+ -+/* -+ * Allocate memory and load the encodings list -+ */ -+void a_Encodings_init(void) -+{ -+ gchar *file; -+ -+ /* Here we load and set the encodings */ -+ file = a_Misc_prepend_user_home(".dillo/encodings"); -+ Encodings_file_op(LOAD_ENCODINGS, file, NULL); -+ g_free(file); -+} -+ -+/* -+ * ? -+ */ -+void Encodings_set_encoding(GtkWidget *widget, CallbackInfo *CbInfo) -+{ -+ if (CbInfo->index >= num_encodings) { -+ g_warning("encoding not found!\n"); -+ return; -+ } -+ g_print("Selected encoding: %s\n",encodings[CbInfo->index].iconv_name); -+ CbInfo->bw->encoding=encodings[CbInfo->index].iconv_name; -+ a_Nav_reload(CbInfo->bw); -+ /*HERE!!! LOOKOUT!!!! */ -+} -+ -+/* -+ * Add a encoding to the encodings menu of a particular browser window -+ */ -+void Encodings_add_to_menu(BrowserWindow *bw, GtkWidget *menuitem, guint index) -+{ -+ CallbackInfo *CbInfo; -+ -+ gtk_menu_append(GTK_MENU(bw->enc_menu), menuitem); -+ -+ CbInfo = g_new(CallbackInfo, 1); -+ CbInfo->bw = bw; -+ CbInfo->index = index; -+ -+ /* accelerator goes here */ -+ gtk_signal_connect(GTK_OBJECT (menuitem), "activate", -+ (GtkSignalFunc)Encodings_set_encoding, CbInfo); -+} -+ -+/* -+ * ? -+ */ -+static GtkWidget *Encodings_insert(const char *title, const char *iconv_name) -+{ -+ GtkWidget *menuitem; -+ -+ menuitem = gtk_menu_item_new_with_label(title); -+ gtk_widget_show(menuitem); -+ -+ a_List_add(encodings, num_encodings, num_encodings_max); -+ encodings[num_encodings].title = g_strdup(title); -+ encodings[num_encodings].iconv_name = g_strdup(iconv_name); -+ encodings[num_encodings].menuitem = menuitem; -+ num_encodings++; -+ return menuitem; -+} -+ -+/* -+ * Add the new encoding to encodings menu of _all_ browser windows and then -+ * write the new encoding to file -+ */ -+/* -+void a_Encodings_add(GtkWidget *widget, gpointer client_data) -+{ -+ BrowserWindow *bw = (BrowserWindow *)client_data; -+ gint i; -+#ifdef TITLE39 -+ gboolean allocated = FALSE; -+#endif -+ char *title; -+ char *iconv_name; -+ GtkWidget *menuitem; -+ -+ title = bw->menu_popup.info.title; -+ iconv_name = bw->menu_popup.info.iconv_name; -+ -+#ifdef TITLE39 -+ if (strlen (title) > 39) { -+ char buf1[20]; -+ char buf2[20]; -+ -+ memcpy (buf1, title, 18); -+ buf1[18] = '\0'; -+ strcpy (buf2, title + strlen (title) - 18); -+ buf2[18] = '\0'; -+ title = g_strconcat (buf1, "...", buf2, NULL); -+ allocated = TRUE; -+ } -+#endif -+ -+ menuitem = Encodings_insert(title, iconv_name); -+ Encodings_add_to_menu(browser_window[0], menuitem, num_encodings-1); -+ for (i = 1; i < num_bw; i++) { -+ menuitem= gtk_menu_item_new_with_label(encodings[num_encodings-1].title); -+ gtk_widget_show(menuitem); -+ Encodings_add_to_menu(browser_window[i], menuitem, num_encodings-1); -+ } -+ -+ Encodings_file_op(SAVE_ENCODING, title, iconv_name); -+ -+#ifdef TITLE39 -+ if (allocated) -+ g_free (title); -+#endif -+} -+*/ -+/* -+ * Never called (the file remains open all the time) --Jcid -+ */ -+void Encodings_close(void) -+{ -+ Encodings_file_op(CLOSE_ENCODINGS, NULL, NULL); -+} -+ -+/* -+ * Performs operations on the encoding file.. -+ * for first call, title is the filename -+ */ -+static void -+ Encodings_file_op(gint operation, const char *title, const char *iconv_name) -+{ -+ static FILE *fp; -+ static gint initialized = 0; -+ -+ if (!initialized) { -+ if (operation == LOAD_ENCODINGS) { -+ if ((fp = fopen(title, "a+")) == NULL) -+ g_print("dillo: opening encoding file %s: %s\n", -+ title, strerror(errno)); -+ else -+ initialized = 1; -+ } else -+ g_print("Error: invalid call to Encodings_file_op.\n"); -+ } -+ -+ g_return_if_fail( initialized ); -+ -+ switch (operation) { -+ case LOAD_ENCODINGS: -+ Encodings_load_to_menu(fp); -+ break; -+ -+ case SAVE_ENCODING: -+ Encodings_save_to_file(fp, title, iconv_name); -+ break; -+ -+ case CLOSE_ENCODINGS: -+ fclose(fp); -+ break; -+ -+ default: -+ break; -+ } -+} -+ -+/* -+ * Save encodings to ~/.dillo/encodings -+ */ -+static void -+ Encodings_save_to_file(FILE *fp, const char *title, const char* iconv_name) -+{ -+ fseek(fp, 0L, SEEK_END); -+ fprintf(fp, "%s\n", iconv_name,title); -+ fflush(fp); -+} -+ -+/* -+ * Load encodings -+ */ -+static void Encodings_load_to_menu(FILE *fp) -+{ -+ gchar *title=NULL; -+ gchar *iconv_name=NULL; -+ char buf[4096]; -+ gint i = 0; -+ GtkWidget *menuitem; -+ -+ rewind(fp); -+ -+ g_print("Loading encodings...\n"); -+ while (1) { -+ /* Read a whole line from the file */ -+ if ((fgets(buf, 4096, fp)) == NULL) -+ break; -+ -+ /* get url from line */ -+ if ( !(iconv_name = Encodings_search_line(buf, "=\"", "\">")) ) -+ continue; -+ -+ /* get title from line */ -+ if ( !(title = Encodings_search_line(buf, "\">", "dcv.c_from=iconv_open(curr_locale,charset); -+ bw->dcv.c_to=iconv_open(charset,curr_locale); -+ if (bw->dcv.c_from == (iconv_t)-1 || bw->dcv.c_to == (iconv_t)-1) -+ g_warning ("could not allocate character encoding converter."); -+ return; -+}; -+ -+#define MAX_CHAR_SIZE 4 -+gchar *a_Encoding_translate_encoding(deConversion dcv, gchar *buf, gint bufsize,deDirection dir) { -+ char *result, *source, *dest; -+ size_t s_left, d_left; -+ iconv_t conversion; -+ if (dir==DE_DECODE) -+ conversion=dcv.c_from; -+ else -+ conversion=dcv.c_to; -+ /* no conversion is needed, or none is available */ -+ if (conversion == (iconv_t)-1) -+ return g_strndup(buf, bufsize); -+ -+ /* Note that for some conversions, the translated buffer can be larger -+ * than the input buffer. This is particularly important for conversions -+ * to UTF8 (check the unicode standard to find out the scale factor). */ -+ result = g_malloc((bufsize + 1)*MAX_CHAR_SIZE); -+ -+ source = buf; -+ dest = result; -+ s_left = bufsize; -+ d_left = bufsize*MAX_CHAR_SIZE; -+ if (iconv(conversion, &source, &s_left, &dest, &d_left) -+ == (size_t)-1) { -+ g_warning ("unable to fully convert page to native character set"); -+ /* This just skips past unconvertable characters, putting "?" in the -+ * output, then retries the conversion. This is a hack, but it seems -+ * like the best course of action in the circumstances. */ -+ while (s_left > 0 && d_left > 0 && errno == EILSEQ) { -+ source++; -+ s_left--; -+ *dest = '?'; -+ dest++; -+ d_left--; -+ if (s_left > 0 && d_left > 0) -+ iconv(conversion, &source, &s_left, &dest, &d_left); -+ } -+ } -+ *dest = 0; /* terminate the string */ -+ return result; -+} -diff -BurN dillo-0.6.6.old/src/encodings.h dillo-0.6.6/src/encodings.h ---- dillo-0.6.6.old/src/encodings.h Thu Jan 1 03:00:00 1970 -+++ dillo-0.6.6/src/encodings.h Sat Jun 1 18:02:03 2002 -@@ -0,0 +1,18 @@ -+#ifndef __DILLO_ENCODING_H__ -+#define __DILLO_ENCODING_H__ -+#include -+#include -+#include "browser.h" -+#include "encodings-types.h" -+ -+ -+/* Copyright (C) 2002 Grigory Bakunov */ -+ -+void a_Encodings_init(); -+void a_Encodings_add(GtkWidget *widget, gpointer client_data); -+void a_Encodings_fill_new_menu(BrowserWindow *bw); -+void a_Encoding_get_conversion(BrowserWindow *bw, char* charset); -+char *a_Encoding_translate_encoding(deConversion dcv, char *buf, -+ gint bufsize,deDirection dir); -+ -+#endif /* __DILLO_ENCODING_H__ */ -diff -BurN dillo-0.6.6.old/src/html.c dillo-0.6.6/src/html.c ---- dillo-0.6.6.old/src/html.c Sat Jun 1 18:00:09 2002 -+++ dillo-0.6.6/src/html.c Sat Jun 1 18:02:03 2002 -@@ -21,6 +21,7 @@ - #include - #include /* for sprintf */ - #include /* for rint */ -+#include /* for iconv error codes */ - - #include - -@@ -47,6 +48,7 @@ - #include "progressbar.h" - #include "prefs.h" - #include "misc.h" -+#include "encodings.h" - - //#define DEBUG_LEVEL 3 - #include "debug.h" -@@ -2675,7 +2677,7 @@ - if ((form->method == DILLO_HTML_METHOD_GET) || - (form->method == DILLO_HTML_METHOD_POST)) { - GString *DataStr = g_string_sized_new(4096); -- -+ GString *DataStrEnc; - DEBUG_MSG(3,"Html_submit_form form->action=%s\n",URL_STR_(form->action)); - - for (input_index = 0; input_index < form->num_inputs; input_index++) { -@@ -2732,6 +2734,12 @@ - break; - } /* switch */ - } /* for (inputs) */ -+ DataStrEnc = g_string_new(a_Encoding_translate_encoding(html_lb->bw->dcv, -+ DataStr -> str, -+ DataStr -> len, -+ DE_ENCODE)); -+ g_string_free(DataStr,TRUE); -+ DataStr = DataStrEnc; - - if ( DataStr->str[DataStr->len - 1] == '&' ) - g_string_truncate(DataStr, DataStr->len - 1); -@@ -3766,6 +3774,22 @@ - Html_write(Client->CbData, Client->Buf, Client->BufSize, 0); - } - -+static void Html_set_encoding(DilloHtml *html, char *buf, gint bufsize) { -+ /* only do _anything_ if told so */ -+ if (html->bw->encoding != NULL) -+ a_Encoding_get_conversion(html->bw, html->bw->encoding); -+ return; -+} -+ -+static char *Html_translate_encoding(DilloHtml *html, char *buf, -+ gint bufsize) { -+ char* result=a_Encoding_translate_encoding(html->bw->dcv, -+ buf, bufsize, -+ DE_DECODE); -+ return result; -+ -+} -+ - /* - * Here's where we parse the html and put it into the page structure. - * (This function is called by Html_callback whenever there's new data) -@@ -3777,12 +3801,18 @@ - char completestr[32]; - gint token_start, buf_index; - char *buf = Buf + html->Start_Ofs; -+ char *buf_encoded; - gint bufsize = BufSize - html->Start_Ofs; -- -+ - g_return_if_fail ( (page = DW_PAGE (html->dw)) != NULL ); - - buf = g_strndup(buf, bufsize); - -+ Html_set_encoding(html, buf, bufsize); -+ buf_encoded=buf; -+ buf = Html_translate_encoding(html, buf, bufsize); -+ g_free(buf_encoded); -+ - /* Now, 'buf' and 'bufsize' define a buffer aligned to start at a token - * boundary. Iterate through tokens until end of buffer is reached. */ - buf_index = 0; -diff -BurN dillo-0.6.6.old/src/interface.c dillo-0.6.6/src/interface.c ---- dillo-0.6.6.old/src/interface.c Sat Jun 1 18:00:09 2002 -+++ dillo-0.6.6/src/interface.c Sat Jun 1 18:02:37 2002 -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - - #include "list.h" - #include "dillo.h" -@@ -765,6 +766,9 @@ - bw->question_dialog_window = NULL; - bw->question_dialog_data = NULL; - bw->viewsource_window = NULL; -+ bw->encoding=NULL; -+ bw->dcv.c_from = (iconv_t)-1; /* no conversion yet */ -+ bw->dcv.c_from = (iconv_t)-1; - - /* now that the bw is made, let's customize it.. */ - Interface_browser_window_customize(bw); -diff -BurN dillo-0.6.6.old/src/menu.c dillo-0.6.6/src/menu.c ---- dillo-0.6.6.old/src/menu.c Sat Jun 1 18:00:09 2002 -+++ dillo-0.6.6/src/menu.c Sat Jun 1 18:02:03 2002 -@@ -31,6 +31,7 @@ - #include "dw_page.h" /* for a_Dw_page_add_anchor */ - #include "bookmark.h" - #include "interface.h" -+#include "encodings.h" - - /* - * Forward declarations -@@ -121,6 +122,8 @@ - GtkWidget *menubar; - GtkWidget *file_menu; - GtkWidget *bookmarks_menu; -+ GtkWidget *enc_menu; -+ - /* GtkWidget *help_menu; */ - - bw->menubar = menubar = gtk_menu_bar_new(); -@@ -158,6 +161,10 @@ - Menu_add(help_menu, "Dillo _Manual", NULL, bw, - a_Commands_manual_callback, bw); - */ -+ enc_menu = Menu_new(menubar, tiny ? "_E" : "_Encodings", FALSE, bw); -+ bw->enc_menu = enc_menu; -+ a_Encodings_fill_new_menu(bw); -+ - return menubar; - } - diff --git a/dillo-localedir.patch b/dillo-localedir.patch deleted file mode 100644 index 38a5e2d..0000000 --- a/dillo-localedir.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- dillo-0.6.6/src/dillo.c.orig Sat Jul 6 18:16:10 2002 -+++ dillo-0.6.6/src/dillo.c Sat Jul 6 18:38:47 2002 -@@ -95,6 +95,7 @@ - g_print("Setting locale to %s\n",curr_locale); - - /* binding the textdomain for GNU gettext: should return "dillo" */ -+ bindtextdomain("dillo", "/usr/X11R6/share/locale"); - dillo_text_domain = textdomain("dillo"); - if (strcmp(dillo_text_domain, "dillo") != 0) g_print("Translation error: will continue in english\n"); - -- 2.44.0