diff -uNr galeon-0.10.5/src/bookmarks_menus.c galeon-0.10.5patch/src/bookmarks_menus.c --- galeon-0.10.5/src/bookmarks_menus.c Sat Apr 28 00:18:07 2001 +++ galeon-0.10.5patch/src/bookmarks_menus.c Wed May 2 18:13:29 2001 @@ -545,21 +545,7 @@ if (bm->pixmap_data == NULL) { - l = gtk_label_new (""); - if (strlen (bm->name) > BOOKMARKS_MENU_MAX_LENGTH) - { - gchar *s, *t; - - s = g_strndup(bm->name, BOOKMARKS_MENU_MAX_LENGTH); - t = g_strconcat (s, "...", NULL); - label_set_accel_text (t, l, GTK_WIDGET (menu), m); - g_free (t); - g_free (s); - } - else - { - label_set_accel_text (bm->name, l, GTK_WIDGET (menu), m); - } + l = gtk_label_new (mozilla_shorten_name(bm->name, BOOKMARKS_MENU_MAX_LENGTH)); gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 2); } else diff -uNr galeon-0.10.5/src/galeon-wrapper.cpp galeon-0.10.5patch/src/galeon-wrapper.cpp --- galeon-0.10.5/src/galeon-wrapper.cpp Mon Apr 30 17:46:07 2001 +++ galeon-0.10.5patch/src/galeon-wrapper.cpp Wed May 2 17:10:13 2001 @@ -499,8 +499,7 @@ { nsCOMPtr finder(do_GetInterface(mWebBrowser)); - nsString searchString; - searchString.AssignWithConversion(exp); + nsString searchString(mozilla_locale_to_unicode(exp)); finder->SetSearchString(searchString.GetUnicode()); finder->SetFindBackwards(search_backwards); finder->SetMatchCase(matchcase); diff -uNr galeon-0.10.5/src/galeon_types.h galeon-0.10.5patch/src/galeon_types.h --- galeon-0.10.5/src/galeon_types.h Mon Apr 30 17:46:08 2001 +++ galeon-0.10.5patch/src/galeon_types.h Thu May 3 16:50:50 2001 @@ -423,6 +423,7 @@ NS_FOLDER, NS_FOLDER_END, NS_SEPARATOR, + NS_CHARSET, NS_UNKNOWN } NSItemType; diff -uNr galeon-0.10.5/src/misc.c galeon-0.10.5patch/src/misc.c --- galeon-0.10.5/src/misc.c Fri Apr 27 22:09:46 2001 +++ galeon-0.10.5patch/src/misc.c Wed May 2 18:15:03 2001 @@ -1268,20 +1268,7 @@ } /* just chop off and add ellipsis */ - for (i = 0; i < 3; i++) - { - /* don't overflow string length */ - if (name[target_length + i] == '\0') - break; - - name[target_length + i] = '.'; - } - - /* terminate string */ - name[target_length + i] = '\0'; - - /* return it */ - return name; + return mozilla_shorten_name(name, target_length); } /** diff -uNr galeon-0.10.5/src/mozcallbacks.c galeon-0.10.5patch/src/mozcallbacks.c --- galeon-0.10.5/src/mozcallbacks.c Mon Apr 30 17:46:09 2001 +++ galeon-0.10.5patch/src/mozcallbacks.c Wed May 2 17:53:26 2001 @@ -187,7 +187,7 @@ { g_free (embed->site_title); } - embed->site_title = gtk_moz_embed_get_title (embed->mozEmbed); + embed->site_title = mozilla_document_title_encode (embed->mozEmbed); /* update in gui */ embed_update_page_title (embed); diff -uNr galeon-0.10.5/src/mozilla.cpp galeon-0.10.5patch/src/mozilla.cpp --- galeon-0.10.5/src/mozilla.cpp Mon Apr 30 17:46:29 2001 +++ galeon-0.10.5patch/src/mozilla.cpp Wed May 2 18:55:39 2001 @@ -40,6 +40,11 @@ static NS_DEFINE_CID(kPrintOptionsCID, NS_PRINTOPTIONS_CID); #endif +#include "nsIDocShellTreeItem.h" +#include "nsIDocShellTreeOwner.h" +#include "nsIDocument.h" +#include + /* local function prototypes */ static gboolean mozilla_find_setup(nsITextServicesDocument *aDoc, PRInt32 *outBlockOffset, @@ -1195,3 +1200,67 @@ g_free (wide); return uniStr; } + +/** + * mozilla_document_title_encode: + */ +extern "C" gchar * +mozilla_document_title_encode (GtkMozEmbed *b) +{ + nsresult result; + + // mozilla_get_primary_docshell() + nsIWebBrowser *wb; + gtk_moz_embed_get_nsIWebBrowser (b, &wb); + + nsCOMPtr browserAsItem = do_QueryInterface(wb); + if (!browserAsItem) return NULL; + + // get the tree owner for that item + nsCOMPtr treeOwner; + result = browserAsItem->GetTreeOwner(getter_AddRefs(treeOwner)); + if (!NS_SUCCEEDED (result) || ! treeOwner) return NULL; + + // get the primary content shell as an item + nsCOMPtr contentItem; + result = treeOwner->GetPrimaryContentShell(getter_AddRefs(contentItem)); + if (!NS_SUCCEEDED (result) || ! contentItem) return NULL; + + nsCOMPtr ds; + // QI that back to a docshell + ds = do_QueryInterface(contentItem); + if (!ds) return NULL; + + // mozilla_get_dom_document() + nsCOMPtr cv; + result = ds->GetContentViewer (getter_AddRefs(cv)); + if (!NS_SUCCEEDED (result) || !cv) return NULL; + + nsCOMPtr domDoc; + result = cv->GetDOMDocument (getter_AddRefs(domDoc)); + if (!NS_SUCCEEDED (result)) return NULL; + if (!domDoc) return NULL; + + nsCOMPtr doc = do_QueryInterface(domDoc); + const nsString *doc_title = doc->GetDocumentTitle(); + if (!doc_title) return NULL; + + return mozilla_unicode_to_locale (doc_title->GetUnicode()); +} + +/** + * mozilla_shorten_name: + */ +extern "C" gchar * +mozilla_shorten_name(const gchar *str, int length) +{ + nsAutoString nss(mozilla_locale_to_unicode(str)); + + if(nss.Length() > length){ + nss.SetLength(length); + nss.AppendWithConversion("...", 3); + } + + return mozilla_unicode_to_locale(nss.GetUnicode()); +} + diff -uNr galeon-0.10.5/src/mozilla.h galeon-0.10.5patch/src/mozilla.h --- galeon-0.10.5/src/mozilla.h Mon Apr 30 17:46:09 2001 +++ galeon-0.10.5patch/src/mozilla.h Thu May 3 17:37:49 2001 @@ -131,10 +131,13 @@ GaleonEmbed *dest); extern gboolean mozilla_get_favicon_location (GaleonEmbed *embed, gchar **url); -#ifdef __cplusplus +/*#ifdef __cplusplus*/ #include extern gchar *mozilla_unicode_to_utf8 (const PRUnichar *uniStr); extern gchar *mozilla_unicode_to_locale (const PRUnichar *uniStr); extern PRUnichar *mozilla_utf8_to_unicode (const gchar *utfStr); extern PRUnichar *mozilla_locale_to_unicode (const gchar *locStr); -#endif +/*#endif*/ + +extern gchar *mozilla_document_title_encode (GtkMozEmbed *b); +extern gchar *mozilla_shorten_name(const gchar *str, int length); diff -uNr galeon-0.10.5/src/netscape.c galeon-0.10.5patch/src/netscape.c --- galeon-0.10.5/src/netscape.c Fri Apr 27 00:43:29 2001 +++ galeon-0.10.5patch/src/netscape.c Thu May 3 17:50:12 2001 @@ -63,6 +63,8 @@ GSList *urls, *l; int dup = 0; GSList * folders; + GString *charset = g_string_new (NULL); + NSItemType result; if (!(bf = fopen (filename->str, "r"))) { g_warning ("Failed to open file: %s\n", filename->str); @@ -83,7 +85,12 @@ parent = bookmarks_root; while (!feof (bf)) { - switch (ns_get_bookmark_item(bf, name, url)) { + result = ns_get_bookmark_item(bf, name, url); + if(!strcmp(charset->str, "UTF-8")){ + g_string_assign(name, mozilla_unicode_to_locale( + mozilla_utf8_to_unicode(name->str))); + } + switch (result) { case NS_FOLDER: newcat = NULL; @@ -162,6 +169,9 @@ if (parent != bookmarks_root) parent = parent->parent; break; + case NS_CHARSET: + g_string_assign(charset, name->str); + break; default: break; } @@ -209,8 +219,11 @@ return NS_FOLDER_END; } else if ((found = (char *) g_strcasestr (line, "
"))) { /* separator */ return NS_SEPARATOR; - } - + }else if ((found = (char *) g_strcasestr (line, "str); + return NS_CHARSET; + } return NS_UNKNOWN; }