aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-07-31 20:47:10 +0800
committerChristian Persch <chpe@src.gnome.org>2004-07-31 20:47:10 +0800
commit814d4259404ed6275ae48f2ebd4d2f1cc9597ecb (patch)
treeff9809587896646a012f5083ecdbf0bf7996dfe4 /src/bookmarks
parenta1708ca0d9f45fd662e13012d8265c9f15413f3d (diff)
downloadgsoc2013-epiphany-814d4259404ed6275ae48f2ebd4d2f1cc9597ecb.tar
gsoc2013-epiphany-814d4259404ed6275ae48f2ebd4d2f1cc9597ecb.tar.gz
gsoc2013-epiphany-814d4259404ed6275ae48f2ebd4d2f1cc9597ecb.tar.bz2
gsoc2013-epiphany-814d4259404ed6275ae48f2ebd4d2f1cc9597ecb.tar.lz
gsoc2013-epiphany-814d4259404ed6275ae48f2ebd4d2f1cc9597ecb.tar.xz
gsoc2013-epiphany-814d4259404ed6275ae48f2ebd4d2f1cc9597ecb.tar.zst
gsoc2013-epiphany-814d4259404ed6275ae48f2ebd4d2f1cc9597ecb.zip
Fix submenu creation with non-ascii topic names. Fixes bug #147469.
2004-07-31 Christian Persch <chpe@cvs.gnome.org> * src/bookmarks/ephy-bookmarks-menu.c: (ensure_folder), (create_submenu): Fix submenu creation with non-ascii topic names. Fixes bug #147469.
Diffstat (limited to 'src/bookmarks')
-rw-r--r--src/bookmarks/ephy-bookmarks-menu.c47
1 files changed, 17 insertions, 30 deletions
diff --git a/src/bookmarks/ephy-bookmarks-menu.c b/src/bookmarks/ephy-bookmarks-menu.c
index 77427c4d2..2d383c850 100644
--- a/src/bookmarks/ephy-bookmarks-menu.c
+++ b/src/bookmarks/ephy-bookmarks-menu.c
@@ -244,8 +244,6 @@ ensure_folder (EphyBookmarksMenu *menu, const char *path, const char *folder)
if (action == NULL)
{
- char *full_path;
-
action = g_object_new (GTK_TYPE_ACTION,
"name", action_name,
"label", folder,
@@ -254,12 +252,9 @@ ensure_folder (EphyBookmarksMenu *menu, const char *path, const char *folder)
gtk_action_group_add_action (p->action_group, action);
g_object_unref (action);
- full_path = g_strdup_printf (BOOKMARKS_MENU_PATH "/%s", path);
- gtk_ui_manager_add_ui (p->merge, p->ui_id, full_path,
+ gtk_ui_manager_add_ui (p->merge, p->ui_id, path,
folder, action_name,
GTK_UI_MANAGER_MENU, FALSE);
-
- g_free (full_path);
}
g_free (action_name);
@@ -269,42 +264,34 @@ static char *
create_submenu (EphyBookmarksMenu *menu, EphyNode *topic)
{
const char *tmp;
- char *title, *path, *p, *p2;
+ char *title, *folder;
+ char **folders;
+ GString *path;
+ int i;
tmp = ephy_node_get_property_string (topic, EPHY_NODE_KEYWORD_PROP_NAME);
title = ephy_string_double_underscores (tmp);
g_return_val_if_fail (title != NULL, NULL);
- p = p2 = title;
- while (p)
- {
- if (*p == '\0' || g_utf8_get_char (p) == '/')
- {
- char *folder, *path;
- glong offset;
-
- offset = g_utf8_pointer_to_offset (title, p2);
- path = g_strndup (title, offset);
-
- offset = g_utf8_pointer_to_offset (p2, p);
- folder = g_strndup (p2, offset);
-
- ensure_folder (menu, path, folder);
+ folders = g_strsplit (title, "/", -1);
+ g_free (title);
+ g_return_val_if_fail (folders != NULL, NULL); /* FIXME */
- g_free (folder);
- g_free (path);
+ path = g_string_new (BOOKMARKS_MENU_PATH);
+ for (i = 0; folders[i] != NULL; i++)
+ {
+ folder = folders[i];
- p2 = p + 1;
- }
+ ensure_folder (menu, path->str, folder);
- p = (*p != '\0') ? g_utf8_next_char (p) : NULL;
+ g_string_append (path, "/");
+ g_string_append (path, folder);
}
- path = g_strdup_printf (BOOKMARKS_MENU_PATH "/%s", title);
- g_free (title);
+ g_strfreev (folders);
- return path;
+ return g_string_free (path, FALSE);
}
static void