[amtk/wip/misc] Support detailed GAction names in factory functions



commit e2fcf43d97bae734312a8930c53467310e39ef52
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon Apr 27 17:39:04 2020 +0200

    Support detailed GAction names in factory functions

 amtk/NOTES              | 17 ++---------------
 amtk/amtk-action-info.c |  8 +++++---
 amtk/amtk-action-info.h |  7 ++++---
 amtk/amtk-factory.c     |  4 ++--
 amtk/amtk-factory.h     |  4 ++--
 5 files changed, 15 insertions(+), 25 deletions(-)
---
diff --git a/amtk/NOTES b/amtk/NOTES
index 64cc2e2..69355f4 100644
--- a/amtk/NOTES
+++ b/amtk/NOTES
@@ -1,21 +1,8 @@
 Amtk notes
 ==========
 
-TODO list
----------
-
-- Support detailed GAction names in factory functions:
-       - In AmtkActionInfo, document that the "action name" can be a detailed
-         action name, with a reference to g_action_parse_detailed_name().
-       - In AmtkFactory, call gtk_actionable_set_detailed_action_name() and
-         adapt docs.
-       - Adapt docs and code in other classes if needed (but I think it's only
-         in AmtkActionInfo and AmtkFactory).
-
-- Implement more factory functions.
-
-Other possible things to do
----------------------------
+Possible things to do
+---------------------
 
 - When calling amtk_menu_item_set_icon_name(), do not have a large margin on
   the left. GtkUIManager was able to put the icon without the large margin (in
diff --git a/amtk/amtk-action-info.c b/amtk/amtk-action-info.c
index cf517d6..371c8d8 100644
--- a/amtk/amtk-action-info.c
+++ b/amtk/amtk-action-info.c
@@ -1,7 +1,7 @@
 /*
  * This file is part of Amtk - Actions, Menus and Toolbars Kit
  *
- * Copyright 2017, 2018 - Sébastien Wilmet <swilmet gnome org>
+ * Copyright 2017, 2018, 2020 - Sébastien Wilmet <swilmet gnome org>
  *
  * Amtk is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the
@@ -211,7 +211,8 @@ amtk_action_info_copy (const AmtkActionInfo *info)
  * amtk_action_info_get_action_name:
  * @info: an #AmtkActionInfo.
  *
- * Returns: (nullable): the action name, or %NULL. Example: `"win.save"`.
+ * Returns: (nullable): the action name, or %NULL. Example: `"win.save"`. Can be
+ * a detailed action name, see g_action_parse_detailed_name().
  * Since: 2.0
  */
 const gchar *
@@ -227,7 +228,8 @@ amtk_action_info_get_action_name (const AmtkActionInfo *info)
  * @info: an #AmtkActionInfo.
  * @action_name: the action name.
  *
- * Sets the action name, for example `"win.save"`.
+ * Sets the action name, for example `"win.save"`. Can be a detailed action
+ * name, see g_action_parse_detailed_name().
  *
  * Since: 2.0
  */
diff --git a/amtk/amtk-action-info.h b/amtk/amtk-action-info.h
index 18058ca..8e54fbd 100644
--- a/amtk/amtk-action-info.h
+++ b/amtk/amtk-action-info.h
@@ -1,7 +1,7 @@
 /*
  * This file is part of Amtk - Actions, Menus and Toolbars Kit
  *
- * Copyright 2017 - Sébastien Wilmet <swilmet gnome org>
+ * Copyright 2017, 2020 - Sébastien Wilmet <swilmet gnome org>
  *
  * Amtk is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the
@@ -33,11 +33,12 @@ G_BEGIN_DECLS
 
 /**
  * AmtkActionInfoEntry:
- * @action_name: the action name.
+ * @action_name: the action name. Can be a detailed action name, see
+ *   g_action_parse_detailed_name().
  * @icon_name: the icon name, or %NULL.
  * @label: the label (i.e. a short description) with a mnemonic, or %NULL.
  * @accel: the accelerator, in the format understood by gtk_accelerator_parse().
- * Or %NULL.
+ *   Or %NULL.
  * @tooltip: the tooltip (i.e. a long description), or %NULL.
  *
  * This struct defines a set of information for a single action. It is for use
diff --git a/amtk/amtk-factory.c b/amtk/amtk-factory.c
index b0cd85a..267e252 100644
--- a/amtk/amtk-factory.c
+++ b/amtk/amtk-factory.c
@@ -1,7 +1,7 @@
 /*
  * This file is part of Amtk - Actions, Menus and Toolbars Kit
  *
- * Copyright 2017, 2018 - Sébastien Wilmet <swilmet gnome org>
+ * Copyright 2017, 2018, 2020 - Sébastien Wilmet <swilmet gnome org>
  *
  * Amtk is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the
@@ -464,7 +464,7 @@ common_create_widget (AmtkFactory       *factory,
 
        if ((flags & AMTK_FACTORY_IGNORE_GACTION) == 0)
        {
-               gtk_actionable_set_action_name (GTK_ACTIONABLE (*widget), action_name);
+               gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (*widget), action_name);
        }
 
        return action_info;
diff --git a/amtk/amtk-factory.h b/amtk/amtk-factory.h
index 75b3124..8aa0ea4 100644
--- a/amtk/amtk-factory.h
+++ b/amtk/amtk-factory.h
@@ -1,7 +1,7 @@
 /*
  * This file is part of Amtk - Actions, Menus and Toolbars Kit
  *
- * Copyright 2017, 2018 - Sébastien Wilmet <swilmet gnome org>
+ * Copyright 2017, 2018, 2020 - Sébastien Wilmet <swilmet gnome org>
  *
  * Amtk is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the
@@ -58,7 +58,7 @@ struct _AmtkFactoryClass
  * @AMTK_FACTORY_FLAGS_NONE: No flags.
  * @AMTK_FACTORY_IGNORE_GACTION: Do not associate the created object with the
  *   #GAction. For example if the object to create is a #GtkActionable, do not
- *   call gtk_actionable_set_action_name().
+ *   call gtk_actionable_set_detailed_action_name().
  * @AMTK_FACTORY_IGNORE_ICON: Do not set an icon.
  * @AMTK_FACTORY_IGNORE_LABEL: Do not set a label/short description.
  * @AMTK_FACTORY_IGNORE_TOOLTIP: Do not set a tooltip/long description.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]