[tepl] Amtk stores: do not return const values for lookup()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tepl] Amtk stores: do not return const values for lookup()
- Date: Sun, 16 Jul 2017 17:39:51 +0000 (UTC)
commit 63782cfceedc49f5c5a9f7687885de6d5aefa095
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Jul 16 19:37:22 2017 +0200
Amtk stores: do not return const values for lookup()
Since we need to be able to call amtk_action_info_mark_as_used().
amtk/amtk-action-info-central-store.c | 2 +-
amtk/amtk-action-info-central-store.h | 3 +--
amtk/amtk-action-info-store.c | 2 +-
amtk/amtk-action-info-store.h | 2 +-
amtk/amtk-menu-factory.c | 7 ++-----
testsuite/amtk/test-action-info-store.c | 4 ++--
6 files changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/amtk/amtk-action-info-central-store.c b/amtk/amtk-action-info-central-store.c
index 13226f1..8ef76fd 100644
--- a/amtk/amtk-action-info-central-store.c
+++ b/amtk/amtk-action-info-central-store.c
@@ -140,7 +140,7 @@ _amtk_action_info_central_store_add (AmtkActionInfoCentralStore *central_store,
* Returns: (transfer none): the found #AmtkActionInfo, or %NULL.
* Since: 2.0
*/
-const AmtkActionInfo *
+AmtkActionInfo *
amtk_action_info_central_store_lookup (AmtkActionInfoCentralStore *central_store,
const gchar *action_name)
{
diff --git a/amtk/amtk-action-info-central-store.h b/amtk/amtk-action-info-central-store.h
index 3fd85f2..7f2a861 100644
--- a/amtk/amtk-action-info-central-store.h
+++ b/amtk/amtk-action-info-central-store.h
@@ -58,8 +58,7 @@ GType amtk_action_info_central_store_get_type (void) G_GNUC_CONST;
AmtkActionInfoCentralStore *
amtk_action_info_central_store_get_instance (void);
-const AmtkActionInfo *
- amtk_action_info_central_store_lookup (AmtkActionInfoCentralStore *central_store,
+AmtkActionInfo *amtk_action_info_central_store_lookup (AmtkActionInfoCentralStore *central_store,
const gchar *action_name);
G_GNUC_INTERNAL
diff --git a/amtk/amtk-action-info-store.c b/amtk/amtk-action-info-store.c
index 9ed150b..be06d0a 100644
--- a/amtk/amtk-action-info-store.c
+++ b/amtk/amtk-action-info-store.c
@@ -180,7 +180,7 @@ amtk_action_info_store_add_entries (AmtkActionInfoStore *store,
* Returns: (transfer none): the found #AmtkActionInfo, or %NULL.
* Since: 2.0
*/
-const AmtkActionInfo *
+AmtkActionInfo *
amtk_action_info_store_lookup (AmtkActionInfoStore *store,
const gchar *action_name)
{
diff --git a/amtk/amtk-action-info-store.h b/amtk/amtk-action-info-store.h
index fa4d97f..9462ec8 100644
--- a/amtk/amtk-action-info-store.h
+++ b/amtk/amtk-action-info-store.h
@@ -65,7 +65,7 @@ void amtk_action_info_store_add_entries (AmtkActionInfoStore
*store,
gint n_entries,
const gchar
*translation_domain);
-const AmtkActionInfo * amtk_action_info_store_lookup (AmtkActionInfoStore *store,
+AmtkActionInfo * amtk_action_info_store_lookup (AmtkActionInfoStore *store,
const gchar *action_name);
void amtk_action_info_store_check_all_used (AmtkActionInfoStore *store);
diff --git a/amtk/amtk-menu-factory.c b/amtk/amtk-menu-factory.c
index b1cc527..0e5ee80 100644
--- a/amtk/amtk-menu-factory.c
+++ b/amtk/amtk-menu-factory.c
@@ -213,7 +213,7 @@ amtk_menu_factory_create_menu_item (AmtkMenuFactory *factory,
const gchar *action_name)
{
AmtkActionInfoCentralStore *central_store;
- const AmtkActionInfo *action_info;
+ AmtkActionInfo *action_info;
GtkMenuItem *menu_item;
const gchar * const *accels;
const gchar *icon_name;
@@ -283,10 +283,7 @@ amtk_menu_factory_create_menu_item (AmtkMenuFactory *factory,
accels);
}
- /* FIXME: we are cheating a little here. Maybe the lookup functions
- * should not return const values.
- */
- amtk_action_info_mark_as_used ((AmtkActionInfo *) action_info);
+ amtk_action_info_mark_as_used (action_info);
return GTK_WIDGET (menu_item);
}
diff --git a/testsuite/amtk/test-action-info-store.c b/testsuite/amtk/test-action-info-store.c
index 1bade3a..4a10bb0 100644
--- a/testsuite/amtk/test-action-info-store.c
+++ b/testsuite/amtk/test-action-info-store.c
@@ -24,8 +24,8 @@ test_add_entries (void)
{
AmtkActionInfoStore *store;
AmtkActionInfoCentralStore *central_store;
- const AmtkActionInfo *info1;
- const AmtkActionInfo *info2;
+ AmtkActionInfo *info1;
+ AmtkActionInfo *info2;
const AmtkActionInfoEntry entries[] =
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]