summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-bonobo-extensions.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnautilus-private/nautilus-bonobo-extensions.c')
-rw-r--r--libnautilus-private/nautilus-bonobo-extensions.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libnautilus-private/nautilus-bonobo-extensions.c b/libnautilus-private/nautilus-bonobo-extensions.c
index 1b7f93c8e..d40cff35a 100644
--- a/libnautilus-private/nautilus-bonobo-extensions.c
+++ b/libnautilus-private/nautilus-bonobo-extensions.c
@@ -26,6 +26,7 @@
#include <config.h>
#include "nautilus-bonobo-extensions.h"
+#include "nautilus-string.h"
#include <bonobo/bonobo-ui-util.h>
#include <libgnomevfs/gnome-vfs-utils.h>
@@ -390,6 +391,30 @@ nautilus_bonobo_remove_menu_items_and_commands (BonoboUIComponent *ui,
g_free (remove_wildcard);
}
+/* Call to set the user-visible label of a menu item to a string
+ * containing an underscore accelerator. The underscore is stripped
+ * off before setting the label of the command, because pop-up menu
+ * and tool bar button labels shouldn't have the underscore.
+ */
+void
+nautilus_bonobo_set_label_for_menu_item_and_command (BonoboUIComponent *ui,
+ const char *menu_item_path,
+ const char *command_path,
+ const char *label_with_underscore)
+{
+ char *label_no_underscore;
+
+ label_no_underscore = nautilus_str_strip_chr (label_with_underscore, '_');
+ nautilus_bonobo_set_label (ui,
+ menu_item_path,
+ label_with_underscore);
+ nautilus_bonobo_set_label (ui,
+ command_path,
+ label_no_underscore);
+
+ g_free (label_no_underscore);
+}
+
void
nautilus_bonobo_set_icon (BonoboUIComponent *ui,
const char *path,