patch to use utf8 strings at gnome-control-center



Here you have a patch that must solve the problems with the HTML
renderization of locales != than iso-8859-1.


I don't know if it works, please, test it and tell me things ;-)


Thanks in advance.
--
Carlos Perelló Marín
mailto:carlos@gnome-db.org
mailto:carlos@hispalinux.es
http://www.gnome-db.org
http://www.Hispalinux.es
Valencia - Spain
Index: control-center/ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-control-center/control-center/ChangeLog,v
retrieving revision 1.38
diff -u -w -r1.38 ChangeLog
--- control-center/ChangeLog	2001/07/20 09:48:38	1.38
+++ control-center/ChangeLog	2001/07/24 00:08:54
@@ -1,3 +1,7 @@
+2001-07-24  Carlos Perelló Marín <carlos@gnome-db.org>
+
+	* capplet-dir-view-html.c: Now we use utf-8 strings
+
 2001-07-20  Chema Celorio  <chema@celorio.com>
 
 	* RELEASE : 1.5.0
Index: control-center/capplet-dir-view-html.c
===================================================================
RCS file: /cvs/gnome/gnome-control-center/control-center/capplet-dir-view-html.c,v
retrieving revision 1.7
diff -u -w -r1.7 capplet-dir-view-html.c
--- control-center/capplet-dir-view-html.c	2001/07/20 01:40:01	1.7
+++ control-center/capplet-dir-view-html.c	2001/07/24 00:08:55
@@ -23,6 +23,7 @@
 
 #include <config.h>
 #include <gtkhtml/gtkhtml.h>
+#include <gal/widgets/e-unicode.h>
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -107,7 +108,7 @@
 static void
 write_parent_html (CappletDir *dir, GtkHTML *html, GtkHTMLStream *stream)
 {
-	char *s;
+	char *s, *utfs;
 
 	if (!dir)
 		return;
@@ -117,8 +118,11 @@
 
 	write_parent_html (dir->entry.dir, html, stream);
 
+	utfs = e_utf8_from_locale_string (dir->entry.label);
 	s = g_strdup_printf ("%s <a href=\"%s\">%s</a>", dir->entry.dir ? " |" : "", 
-			     dir->entry.path, dir->entry.label);
+			     dir->entry.path, utfs);
+	g_free (utfs);
+	
 	gtk_html_write (html, stream, s, strlen (s));
 	g_free (s);	
 }
@@ -133,11 +137,14 @@
 {
 	GtkHTMLStream *stream;
 	HtmlViewData *data;
-	char *s;
+	char *s, *utf_title, *utf_path;
 
 	data = view->view_data;
 	stream = gtk_html_begin (data->top);
 
+	utf_title = e_utf8_from_locale_string (_("GNOME Control Center:"));
+	utf_path = e_utf8_from_locale_string (CAPPLET_DIR_ENTRY (view->capplet_dir)->label);
+	
 	s = g_strdup_printf (
 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"
 "<html>"
@@ -146,8 +153,10 @@
 "<body background=\"" ART_DIR "/bcg_top.png\" marginheight=\"0\" marginwidth=\"0\">"
 "<table border=\"0\" width=\"100%%\" cellspacing=\"0\" cellpadding=\"0\"><tr valign=\"center\"><td width=\"48\"><img src=\"" ART_DIR "/title.png\" alt=\"\" width=\"48\" height=\"48\"></td>"
 "<td><b><font face=\"Trebuchet MS CE,Trebuchet MS, Verdana CE, Verdana, Sans-Serif CE, Sans-Serif\" color=\"white\" size=\"+2\">%s&nbsp;&nbsp;&nbsp;</font></b><font face=\"Trebuchet MS CE,Trebuchet MS, Verdana CE, Verdana, Sans-Serif CE, Sans-Serif\" color=\"white\" align=\"left\" valign=\"center\">%s</font></td></tr></table>"
-"</body></html>",
-	_("GNOME Control Center:"), CAPPLET_DIR_ENTRY (view->capplet_dir)->label);
+"</body></html>", utf_title, utf_path);
+	g_free (utf_title);
+	g_free (utf_path);
+	
 	gtk_html_write (data->top, stream, s, strlen (s));
 	g_free (s);
 
@@ -183,12 +192,13 @@
 	HtmlViewData *data;
 	CappletDirEntry *entry;
 	GSList *item;
-	char *s;
+	char *s, *utfs;
 
 	data = view->view_data;
 	
 	stream = gtk_html_begin (data->sidebar);
 
+	utfs = e_utf8_from_locale_string (CAPPLET_DIR_ENTRY (data->root_dir)->label);
 	s = g_strdup_printf (
 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"
 "<html>"
@@ -197,7 +207,8 @@
 "<body bgcolor=\"#d9d9d9\" marginheight=\"0\" marginwidth=\"0\">"
 "<table border=\"0\" width=\"100%%\" cellspacing=\"1\" cellpadding=\"4\">"
 "<tr><td colspan=\"3\">&nbsp;</td></tr>"
-"<tr valign=\"center\"><td width=\"48\"><a href=\"%s\"><img src=\"%s\" alt=\"\" border=\"0\" align=\"center\"/></a></td><td><a href=\"%s\"><b>%s</b></a></td><td width=\"8\"><img src=\"%s\" alt=\"\" border=\"0\" align=\"right\"></tr>", CAPPLET_DIR_ENTRY (data->root_dir)->path, CAPPLET_DIR_ENTRY (data->root_dir)->icon, CAPPLET_DIR_ENTRY (data->root_dir)->path, CAPPLET_DIR_ENTRY (data->root_dir)->label, (data->root_dir == view->capplet_dir) ? ART_DIR "/active.png" : ART_DIR "/blank.png");
+"<tr valign=\"center\"><td width=\"48\"><a href=\"%s\"><img src=\"%s\" alt=\"\" border=\"0\" align=\"center\"/></a></td><td><a href=\"%s\"><b>%s</b></a></td><td width=\"8\"><img src=\"%s\" alt=\"\" border=\"0\" align=\"right\"></tr>", CAPPLET_DIR_ENTRY (data->root_dir)->path, CAPPLET_DIR_ENTRY (data->root_dir)->icon, CAPPLET_DIR_ENTRY (data->root_dir)->path, utfs, (data->root_dir == view->capplet_dir) ? ART_DIR "/active.png" : ART_DIR "/blank.png");
+	g_free (utfs);
 	gtk_html_write (data->sidebar, stream, s, strlen (s));
 	g_free (s);
 
@@ -208,7 +219,10 @@
 		if (total_num_items (CAPPLET_DIR (entry)->entries) < 1)
 			continue;
 
-		s = g_strdup_printf ("<tr valign=\"center\"><td width=\"48\"><a href=\"%s\"><img src=\"%s\" alt=\"\" border=\"0\" align=\"center\"/></a></td><td><a href=\"%s\"><b>%s</b></a></td><td width=\"8\"><img src=\"%s\" alt=\"\" border=\"0\" align=\"center\"></tr>", entry->path, entry->icon, entry->path, entry->label, (CAPPLET_DIR (entry) == view->capplet_dir) ? ART_DIR "/active.png" : ART_DIR "/blank.png");
+		utfs = e_utf8_from_locale_string (entry->label);
+		
+		s = g_strdup_printf ("<tr valign=\"center\"><td width=\"48\"><a href=\"%s\"><img src=\"%s\" alt=\"\" border=\"0\" align=\"center\"/></a></td><td><a href=\"%s\"><b>%s</b></a></td><td width=\"8\"><img src=\"%s\" alt=\"\" border=\"0\" align=\"center\"></tr>", entry->path, entry->icon, entry->path, utfs, (CAPPLET_DIR (entry) == view->capplet_dir) ? ART_DIR "/active.png" : ART_DIR "/blank.png");
+		g_free (utfs);
 		gtk_html_write (data->sidebar, stream, s, strlen (s));
 		g_free (s);
 	}
@@ -224,7 +238,7 @@
 {
 	CappletDirEntry *entry;
 	int i;
-	char *s;
+	char *s, *utfs;
 	GSList *item;
 	
 	g_return_val_if_fail (list != NULL, NULL);
@@ -257,7 +271,9 @@
 		entry = CAPPLET_DIR_ENTRY (item->data);
 		if (entry->type != TYPE_CAPPLET)
 			continue;
-		s = g_strdup_printf ("<td><center><a href=\"%s\">%s</a></center></td><td><img src=\"" ART_DIR "/blank.png\" height=\"1\" width=\"8\"></td>", entry->path, entry->label);
+		utfs = e_utf8_from_locale_string (entry->label);
+		s = g_strdup_printf ("<td><center><a href=\"%s\">%s</a></center></td><td><img src=\"" ART_DIR "/blank.png\" height=\"1\" width=\"8\"></td>", entry->path, utfs);
+		g_free (utfs);
 		gtk_html_write (html, stream, s, strlen (s));
 		g_free (s);
 
@@ -359,6 +375,8 @@
 	vbox = gtk_vbox_new (FALSE, 0);
 	/* top widget */
 	data->top = GTK_HTML (gtk_html_new ());
+	gtk_html_set_default_content_type (GTK_HTML (data->top),
+					   "text/html; charset=utf-8");
 	sw = gtk_scrolled_window_new (NULL, NULL);
 	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
 					GTK_POLICY_NEVER,
@@ -372,6 +390,8 @@
 
 	/* sidebar */
 	data->sidebar = GTK_HTML (gtk_html_new ());
+	gtk_html_set_default_content_type (GTK_HTML (data->sidebar),
+					   "text/html; charset=utf-8");
 	sw = gtk_scrolled_window_new (NULL, NULL);
 	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
 					GTK_POLICY_NEVER,
@@ -382,6 +402,8 @@
 
 	/* main widget */
 	data->main = GTK_HTML (gtk_html_new ());
+	gtk_html_set_default_content_type (GTK_HTML (data->main),
+					   "text/html; charset=utf-8");
 	sw = gtk_scrolled_window_new (NULL, NULL);
 	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
 					GTK_POLICY_NEVER,


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