[amtk] Factory: remove mnemonic from label when setting shortcut title
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [amtk] Factory: remove mnemonic from label when setting shortcut title
- Date: Sat, 14 Apr 2018 10:12:03 +0000 (UTC)
commit 3e1d0b6f7e0b3d223c0f2479e549cba20059356e
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Apr 14 12:06:35 2018 +0200
Factory: remove mnemonic from label when setting shortcut title
amtk/amtk-factory.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/amtk/amtk-factory.c b/amtk/amtk-factory.c
index f85e0e0..0c88845 100644
--- a/amtk/amtk-factory.c
+++ b/amtk/amtk-factory.c
@@ -21,6 +21,7 @@
#include "amtk-action-info.h"
#include "amtk-action-info-central-store.h"
#include "amtk-menu-item.h"
+#include "amtk-utils.h"
#include "amtk-enum-types.h"
/**
@@ -1006,7 +1007,8 @@ amtk_factory_create_shortcut (AmtkFactory *factory,
* This function creates a new #GtkShortcutsShortcut for @action_name.
*
* For the #GtkShortcutsShortcut:title, the tooltip has the priorioty, with the
- * label as fallback if the tooltip is %NULL. This can be controlled with the
+ * label as fallback if the tooltip is %NULL (the mnemonic is removed from the
+ * label with amtk_utils_remove_mnemonic()). This can be controlled with the
* %AMTK_FACTORY_IGNORE_TOOLTIP and %AMTK_FACTORY_IGNORE_LABEL flags.
*
* The #GtkShortcutsShortcut:accelerator property is set with only the *first*
@@ -1059,10 +1061,15 @@ amtk_factory_create_shortcut_full (AmtkFactory *factory,
else if ((flags & AMTK_FACTORY_IGNORE_LABEL) == 0 &&
label != NULL)
{
- /* TODO remove mnemonic. */
+ gchar *label_without_mnemonic;
+
+ label_without_mnemonic = amtk_utils_remove_mnemonic (label);
+
g_object_set (shortcut,
- "title", label,
+ "title", label_without_mnemonic,
NULL);
+
+ g_free (label_without_mnemonic);
}
if ((flags & AMTK_FACTORY_IGNORE_ACCELS) == 0 &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]