app: add the gradient editor submenu and a new concept of GimpRadioAction's…

… group name.

The gradient editor submenu add 2 submenus with changing names. It was using
again bogus actions: "gradient-editor-blending-func" and
"gradient-editor-coloring-type" do nothing except for being used as name
holders.

Instead I add the concept of group name for GimpRadioAction-s and when I use a
radio action attribute as <submenu>, this submenu will use the group name (and
sync with it, if it changes).
This commit is contained in:
Jehan 2023-02-28 13:51:09 +01:00
parent b1f022f144
commit 2335e14d59
6 changed files with 285 additions and 22 deletions

View file

@ -32,6 +32,7 @@
#include "widgets/gimpactiongroup.h"
#include "widgets/gimpgradienteditor.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpradioaction.h"
#include "data-editor-commands.h"
#include "gradient-editor-actions.h"
@ -60,6 +61,9 @@ static const GimpActionEntry gradient_editor_actions[] =
{ "gradient-editor-save-right-color", GIMP_ICON_DOCUMENT_SAVE,
NC_("gradient-editor-action", "Sa_ve Right Color To") },
/* TODO GMenu: remove these 2 bogus actions once old style XML menu files are
* deleted.
*/
{ "gradient-editor-blending-func", NULL, "blending-function" },
{ "gradient-editor-coloring-type", NULL, "coloring-type" },
@ -577,6 +581,9 @@ gradient_editor_actions_update (GimpActionGroup *group,
gimp_action_group_set_action_color (group, action, (color), (set_label))
#define SET_LABEL(action,label) \
gimp_action_group_set_action_label (group, action, (label))
#define SET_GROUP_LABEL(action,label) \
gimp_radio_action_set_group_label (GIMP_RADIO_ACTION (gimp_action_group_get_action (group, action)), \
label)
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0, NULL)
#define SET_VISIBLE(action,condition) \
@ -780,10 +787,10 @@ gradient_editor_actions_update (GimpActionGroup *group,
if (! selection)
{
SET_LABEL ("gradient-editor-blending-func",
_("_Blending Function for Segment"));
SET_LABEL ("gradient-editor-coloring-type",
_("Coloring _Type for Segment"));
SET_GROUP_LABEL ("gradient-editor-blending-linear",
_("_Blending Function for Segment"));
SET_GROUP_LABEL ("gradient-editor-coloring-rgb",
_("Coloring _Type for Segment"));
SET_LABEL ("gradient-editor-flip",
_("_Flip Segment"));
@ -802,10 +809,10 @@ gradient_editor_actions_update (GimpActionGroup *group,
}
else
{
SET_LABEL ("gradient-editor-blending-func",
_("_Blending Function for Selection"));
SET_LABEL ("gradient-editor-coloring-type",
_("Coloring _Type for Selection"));
SET_GROUP_LABEL ("gradient-editor-blending-linear",
_("_Blending Function for Selection"));
SET_GROUP_LABEL ("gradient-editor-coloring-rgb",
_("Coloring _Type for Selection"));
SET_LABEL ("gradient-editor-flip",
_("_Flip Selection"));