diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-07-31 20:47:10 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-07-31 20:47:10 +0800 |
commit | 814d4259404ed6275ae48f2ebd4d2f1cc9597ecb (patch) | |
tree | ff9809587896646a012f5083ecdbf0bf7996dfe4 | |
parent | a1708ca0d9f45fd662e13012d8265c9f15413f3d (diff) | |
download | gsoc2013-epiphany-814d4259404ed6275ae48f2ebd4d2f1cc9597ecb.tar.gz 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.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-menu.c | 47 |
2 files changed, 24 insertions, 30 deletions
@@ -1,5 +1,12 @@ 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. + +2004-07-31 Christian Persch <chpe@cvs.gnome.org> + * src/bookmarks/ephy-bookmark-action.c: (drag_data_get_cb): * src/bookmarks/ephy-bookmarks-export.c: (write_topics_list), (ephy_bookmarks_export_rdf): 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 |