aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-09-24 20:45:45 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-09-24 20:45:45 +0800
commitda6333c06e51b7c4447d6d534d301c3f728679d9 (patch)
tree6bb3fe88d45e9f75bece2938f6b2396d58932e81
parent3844f2dc783a6e505e7f114bc1a747e5c040021c (diff)
downloadgsoc2013-epiphany-da6333c06e51b7c4447d6d534d301c3f728679d9.tar
gsoc2013-epiphany-da6333c06e51b7c4447d6d534d301c3f728679d9.tar.gz
gsoc2013-epiphany-da6333c06e51b7c4447d6d534d301c3f728679d9.tar.bz2
gsoc2013-epiphany-da6333c06e51b7c4447d6d534d301c3f728679d9.tar.lz
gsoc2013-epiphany-da6333c06e51b7c4447d6d534d301c3f728679d9.tar.xz
gsoc2013-epiphany-da6333c06e51b7c4447d6d534d301c3f728679d9.tar.zst
gsoc2013-epiphany-da6333c06e51b7c4447d6d534d301c3f728679d9.zip
Do not use _ as accellerators in bookmarks menus.
2003-09-24 Marco Pesenti Gritti <marco@gnome.org> * lib/ephy-string.c: (ephy_string_double_underscores): * lib/ephy-string.h: * src/bookmarks/ephy-bookmark-action.c: (sync_bookmark_properties): * src/bookmarks/ephy-bookmarks-menu.c: (ephy_bookmarks_menu_rebuild): * src/bookmarks/ephy-topic-action.c: (create_menu_item), (sync_topic_properties): Do not use _ as accellerators in bookmarks menus.
-rw-r--r--ChangeLog12
-rw-r--r--lib/ephy-string.c39
-rw-r--r--lib/ephy-string.h2
-rw-r--r--src/bookmarks/ephy-bookmark-action.c10
-rw-r--r--src/bookmarks/ephy-bookmarks-menu.c9
-rw-r--r--src/bookmarks/ephy-topic-action.c18
6 files changed, 80 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index eb4bfbaea..30972f748 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,16 @@
2003-09-24 Marco Pesenti Gritti <marco@gnome.org>
+
+ * lib/ephy-string.c: (ephy_string_double_underscores):
+ * lib/ephy-string.h:
+ * src/bookmarks/ephy-bookmark-action.c: (sync_bookmark_properties):
+ * src/bookmarks/ephy-bookmarks-menu.c:
+ (ephy_bookmarks_menu_rebuild):
+ * src/bookmarks/ephy-topic-action.c: (create_menu_item),
+ (sync_topic_properties):
+
+ Do not use _ as accellerators in bookmarks menus.
+
+2003-09-24 Marco Pesenti Gritti <marco@gnome.org>
Dave Bordoley <bordoley@msu.edu>
* src/ephy-tab.c: (ephy_tab_action_activate_cb), (ephy_tab_init):
diff --git a/lib/ephy-string.c b/lib/ephy-string.c
index fdadfbd17..1c4ff358d 100644
--- a/lib/ephy-string.c
+++ b/lib/ephy-string.c
@@ -156,3 +156,42 @@ ephy_string_elide_underscores (const gchar *original)
return result;
}
+
+char *
+ephy_string_double_underscores (const char *string)
+{
+ int underscores;
+ const char *p;
+ char *q;
+ char *escaped;
+
+ if (string == NULL)
+ {
+ return NULL;
+ }
+
+ underscores = 0;
+ for (p = string; *p != '\0'; p++)
+ {
+ underscores += (*p == '_');
+ }
+
+ if (underscores == 0)
+ {
+ return g_strdup (string);
+ }
+
+ escaped = g_new (char, strlen (string) + underscores + 1);
+ for (p = string, q = escaped; *p != '\0'; p++, q++)
+ {
+ /* Add an extra underscore. */
+ if (*p == '_') {
+ *q++ = '_';
+ }
+ *q = *p;
+ }
+ *q = '\0';
+
+ return escaped;
+}
+
diff --git a/lib/ephy-string.h b/lib/ephy-string.h
index a7d083457..89aa4564c 100644
--- a/lib/ephy-string.h
+++ b/lib/ephy-string.h
@@ -34,6 +34,8 @@ char *ephy_string_shorten (const gchar *str,
char *ephy_string_elide_underscores (const gchar *original);
+char *ephy_string_double_underscores (const char *string);
+
G_END_DECLS
#endif
diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c
index 96c07822d..f805109d4 100644
--- a/src/bookmarks/ephy-bookmark-action.c
+++ b/src/bookmarks/ephy-bookmark-action.c
@@ -484,17 +484,19 @@ ephy_bookmark_action_class_init (EphyBookmarkActionClass *class)
static void
sync_bookmark_properties (GtkAction *action, EphyNode *bmk)
{
- const char *title, *location, *icon;
+ const char *tmp, *location, *icon;
+ char *title;
gboolean smart_url;
icon = ephy_node_get_property_string
(bmk, EPHY_NODE_BMK_PROP_ICON);
- title = ephy_node_get_property_string
- (bmk, EPHY_NODE_BMK_PROP_TITLE);
location = ephy_node_get_property_string
(bmk, EPHY_NODE_BMK_PROP_LOCATION);
smart_url = ephy_node_get_property_boolean
(bmk, EPHY_NODE_BMK_PROP_HAS_SMART_ADDRESS);
+ tmp = ephy_node_get_property_string
+ (bmk, EPHY_NODE_BMK_PROP_TITLE);
+ title = ephy_string_double_underscores (tmp);
g_object_set (action,
"label", title,
@@ -502,6 +504,8 @@ sync_bookmark_properties (GtkAction *action, EphyNode *bmk)
"smarturl", smart_url,
"icon", icon,
NULL);
+
+ g_free (title);
}
static void
diff --git a/src/bookmarks/ephy-bookmarks-menu.c b/src/bookmarks/ephy-bookmarks-menu.c
index 6c1b2d86d..58d6c529a 100644
--- a/src/bookmarks/ephy-bookmarks-menu.c
+++ b/src/bookmarks/ephy-bookmarks-menu.c
@@ -24,6 +24,7 @@
#include "ephy-bookmark-action.h"
#include "ephy-shell.h"
#include "ephy-node-common.h"
+#include "ephy-string.h"
#include "ephy-debug.h"
//#include <libxml/entities.h>
@@ -296,13 +297,16 @@ ephy_bookmarks_menu_rebuild (EphyBookmarksMenu *menu)
for (l = node_list; l != NULL; l = l->next)
{
char verb[30], name[30], path[60];
- const char *title;
+ const char *tmp;
+ char *title;
EphyNode *child;
GtkAction *action;
child = l->data;
- title = ephy_node_get_property_string (child, EPHY_NODE_KEYWORD_PROP_NAME);
+ tmp = ephy_node_get_property_string (child, EPHY_NODE_KEYWORD_PROP_NAME);
+ title = ephy_string_double_underscores (tmp);
+
g_sprintf (verb, "OpenTopic%ld", ephy_node_get_id (child));
g_sprintf (name, "%sName", verb);
g_sprintf (path, "%s/%s", BOOKMARKS_MENU_PATH, name);
@@ -313,6 +317,7 @@ ephy_bookmarks_menu_rebuild (EphyBookmarksMenu *menu)
NULL);
gtk_action_group_add_action (p->action_group, action);
g_object_unref (action);
+ g_free (title);
gtk_ui_manager_add_ui (p->merge, p->ui_id,
BOOKMARKS_MENU_PATH,
diff --git a/src/bookmarks/ephy-topic-action.c b/src/bookmarks/ephy-topic-action.c
index 6de5ce28f..9d2d049a0 100644
--- a/src/bookmarks/ephy-topic-action.c
+++ b/src/bookmarks/ephy-topic-action.c
@@ -459,18 +459,21 @@ create_menu_item (GtkAction *action)
{
GtkWidget *menu, *menu_item;
GValue value = { 0, };
- const char *label_text;
+ const char *tmp;
+ char *label_text;
g_value_init (&value, G_TYPE_STRING);
g_object_get_property (G_OBJECT (action), "label", &value);
- label_text = g_value_get_string (&value);
+ tmp = g_value_get_string (&value);
+ label_text = ephy_string_double_underscores (tmp);
LOG ("create_menu_item action %p", action)
menu_item = gtk_menu_item_new_with_label (label_text);
g_value_unset (&value);
+ g_free (label_text);
menu = build_menu (EPHY_TOPIC_ACTION (action));
gtk_widget_show (menu);
@@ -608,7 +611,8 @@ ephy_topic_action_class_init (EphyTopicActionClass *class)
static void
sync_topic_properties (GtkAction *action, EphyNode *bmk)
{
- const char *title;
+ const char *tmp;
+ char *title;
int priority;
priority = ephy_node_get_property_int
@@ -616,15 +620,19 @@ sync_topic_properties (GtkAction *action, EphyNode *bmk)
if (priority == EPHY_NODE_ALL_PRIORITY)
{
- title = _("Bookmarks");
+ tmp = _("Bookmarks");
}
else
{
- title = ephy_node_get_property_string
+ tmp = ephy_node_get_property_string
(bmk, EPHY_NODE_KEYWORD_PROP_NAME);
}
+ title = ephy_string_double_underscores (tmp);
+
g_object_set (action, "label", title, NULL);
+
+ g_free (title);
}
static void