app: rename GimpTool::get_undo_desc() and ::get_redo_desc()

to ::can_undo() and ::can_redo(). They still return description
strings and the new naming is slightly off :) but get_undo_desc() will
be needed for something else soon, and half of the time the functions
are indeed used to check whether there are undo/redo staps at all.
This commit is contained in:
Michael Natterer 2017-07-04 18:48:03 +02:00
parent c734f3a96b
commit 54683840e3
10 changed files with 78 additions and 80 deletions

View File

@ -305,10 +305,8 @@ edit_actions_update (GimpActionGroup *group,
if (display)
{
tool_undo = tool_manager_get_undo_desc_active (image->gimp,
display);
tool_redo = tool_manager_get_redo_desc_active (image->gimp,
display);
tool_undo = tool_manager_can_undo_active (image->gimp, display);
tool_redo = tool_manager_can_redo_active (image->gimp, display);
}
if (tool_undo)

View File

@ -94,9 +94,9 @@ static void gimp_blend_tool_cursor_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display);
static const gchar * gimp_blend_tool_get_undo_desc(GimpTool *tool,
static const gchar * gimp_blend_tool_can_undo (GimpTool *tool,
GimpDisplay *display);
static const gchar * gimp_blend_tool_get_redo_desc(GimpTool *tool,
static const gchar * gimp_blend_tool_can_redo (GimpTool *tool,
GimpDisplay *display);
static gboolean gimp_blend_tool_undo (GimpTool *tool,
GimpDisplay *display);
@ -121,7 +121,7 @@ static void gimp_blend_tool_line_response (GimpToolWidget *widget
static void gimp_blend_tool_precalc_shapeburst (GimpBlendTool *blend_tool);
static void gimp_blend_tool_create_graph (GimpBlendTool *blend_tool);
static void gimp_blend_tool_update_graph (GimpBlendTool *blend_tool);
static void gimp_blend_tool_update_graph (GimpBlendTool *blend_tool);
static void gimp_blend_tool_gradient_dirty (GimpBlendTool *blend_tool);
static void gimp_blend_tool_set_gradient (GimpBlendTool *blend_tool,
@ -181,8 +181,8 @@ gimp_blend_tool_class_init (GimpBlendToolClass *klass)
tool_class->button_release = gimp_blend_tool_button_release;
tool_class->motion = gimp_blend_tool_motion;
tool_class->cursor_update = gimp_blend_tool_cursor_update;
tool_class->get_undo_desc = gimp_blend_tool_get_undo_desc;
tool_class->get_redo_desc = gimp_blend_tool_get_redo_desc;
tool_class->can_undo = gimp_blend_tool_can_undo;
tool_class->can_redo = gimp_blend_tool_can_redo;
tool_class->undo = gimp_blend_tool_undo;
tool_class->redo = gimp_blend_tool_redo;
tool_class->options_notify = gimp_blend_tool_options_notify;
@ -439,8 +439,8 @@ gimp_blend_tool_cursor_update (GimpTool *tool,
}
static const gchar *
gimp_blend_tool_get_undo_desc (GimpTool *tool,
GimpDisplay *display)
gimp_blend_tool_can_undo (GimpTool *tool,
GimpDisplay *display)
{
GimpBlendTool *blend_tool = GIMP_BLEND_TOOL (tool);
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
@ -452,8 +452,8 @@ gimp_blend_tool_get_undo_desc (GimpTool *tool,
}
static const gchar *
gimp_blend_tool_get_redo_desc (GimpTool *tool,
GimpDisplay *display)
gimp_blend_tool_can_redo (GimpTool *tool,
GimpDisplay *display)
{
GimpBlendTool *blend_tool = GIMP_BLEND_TOOL (tool);
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
@ -471,7 +471,7 @@ gimp_blend_tool_undo (GimpTool *tool,
GimpBlendTool *blend_tool = GIMP_BLEND_TOOL (tool);
BlendInfo *info;
if (! gimp_blend_tool_get_undo_desc (tool, display))
if (! gimp_blend_tool_can_undo (tool, display))
return FALSE;
info = blend_info_new (blend_tool->start_x,
@ -502,7 +502,7 @@ gimp_blend_tool_redo (GimpTool *tool,
GimpBlendTool *blend_tool = GIMP_BLEND_TOOL (tool);
BlendInfo *info;
if (! gimp_blend_tool_get_redo_desc (tool, display))
if (! gimp_blend_tool_can_redo (tool, display))
return FALSE;
info = blend_info_new (blend_tool->start_x,

View File

@ -122,10 +122,10 @@ static void gimp_foreground_select_tool_cursor_update (GimpTool *tool
const GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display);
static const gchar * gimp_foreground_select_tool_get_undo_desc
static const gchar * gimp_foreground_select_tool_can_undo
(GimpTool *tool,
GimpDisplay *display);
static const gchar * gimp_foreground_select_tool_get_redo_desc
static const gchar * gimp_foreground_select_tool_can_redo
(GimpTool *tool,
GimpDisplay *display);
static gboolean gimp_foreground_select_tool_undo (GimpTool *tool,
@ -216,8 +216,8 @@ gimp_foreground_select_tool_class_init (GimpForegroundSelectToolClass *klass)
tool_class->active_modifier_key = gimp_foreground_select_tool_active_modifier_key;
tool_class->oper_update = gimp_foreground_select_tool_oper_update;
tool_class->cursor_update = gimp_foreground_select_tool_cursor_update;
tool_class->get_undo_desc = gimp_foreground_select_tool_get_undo_desc;
tool_class->get_redo_desc = gimp_foreground_select_tool_get_redo_desc;
tool_class->can_undo = gimp_foreground_select_tool_can_undo;
tool_class->can_redo = gimp_foreground_select_tool_can_redo;
tool_class->undo = gimp_foreground_select_tool_undo;
tool_class->redo = gimp_foreground_select_tool_redo;
tool_class->options_notify = gimp_foreground_select_tool_options_notify;
@ -667,8 +667,8 @@ gimp_foreground_select_tool_cursor_update (GimpTool *tool,
}
static const gchar *
gimp_foreground_select_tool_get_undo_desc (GimpTool *tool,
GimpDisplay *display)
gimp_foreground_select_tool_can_undo (GimpTool *tool,
GimpDisplay *display)
{
GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (tool);
@ -688,8 +688,8 @@ gimp_foreground_select_tool_get_undo_desc (GimpTool *tool,
}
static const gchar *
gimp_foreground_select_tool_get_redo_desc (GimpTool *tool,
GimpDisplay *display)
gimp_foreground_select_tool_can_redo (GimpTool *tool,
GimpDisplay *display)
{
GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (tool);

View File

@ -149,9 +149,9 @@ static void gimp_iscissors_tool_cursor_update (GimpTool *
static gboolean gimp_iscissors_tool_key_press (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *display);
static const gchar * gimp_iscissors_tool_get_undo_desc (GimpTool *tool,
static const gchar * gimp_iscissors_tool_can_undo (GimpTool *tool,
GimpDisplay *display);
static const gchar * gimp_iscissors_tool_get_redo_desc (GimpTool *tool,
static const gchar * gimp_iscissors_tool_can_redo (GimpTool *tool,
GimpDisplay *display);
static gboolean gimp_iscissors_tool_undo (GimpTool *tool,
GimpDisplay *display);
@ -316,8 +316,8 @@ gimp_iscissors_tool_class_init (GimpIscissorsToolClass *klass)
tool_class->key_press = gimp_iscissors_tool_key_press;
tool_class->oper_update = gimp_iscissors_tool_oper_update;
tool_class->cursor_update = gimp_iscissors_tool_cursor_update;
tool_class->get_undo_desc = gimp_iscissors_tool_get_undo_desc;
tool_class->get_redo_desc = gimp_iscissors_tool_get_redo_desc;
tool_class->can_undo = gimp_iscissors_tool_can_undo;
tool_class->can_redo = gimp_iscissors_tool_can_redo;
tool_class->undo = gimp_iscissors_tool_undo;
tool_class->redo = gimp_iscissors_tool_redo;
@ -1108,8 +1108,8 @@ gimp_iscissors_tool_key_press (GimpTool *tool,
}
static const gchar *
gimp_iscissors_tool_get_undo_desc (GimpTool *tool,
GimpDisplay *display)
gimp_iscissors_tool_can_undo (GimpTool *tool,
GimpDisplay *display)
{
GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (tool);
@ -1120,8 +1120,8 @@ gimp_iscissors_tool_get_undo_desc (GimpTool *tool,
}
static const gchar *
gimp_iscissors_tool_get_redo_desc (GimpTool *tool,
GimpDisplay *display)
gimp_iscissors_tool_can_redo (GimpTool *tool,
GimpDisplay *display)
{
GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (tool);
@ -1137,7 +1137,7 @@ gimp_iscissors_tool_undo (GimpTool *tool,
{
GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (tool);
if (! gimp_iscissors_tool_get_undo_desc (tool, display))
if (! gimp_iscissors_tool_can_undo (tool, display))
return FALSE;
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
@ -1168,7 +1168,7 @@ gimp_iscissors_tool_redo (GimpTool *tool,
{
GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (tool);
if (! gimp_iscissors_tool_get_redo_desc (tool, display))
if (! gimp_iscissors_tool_can_redo (tool, display))
return FALSE;
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));

View File

@ -114,9 +114,9 @@ static void gimp_tool_real_cursor_update (GimpTool *tool,
const GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display);
static const gchar * gimp_tool_real_get_undo_desc (GimpTool *tool,
static const gchar * gimp_tool_real_can_undo (GimpTool *tool,
GimpDisplay *display);
static const gchar * gimp_tool_real_get_redo_desc (GimpTool *tool,
static const gchar * gimp_tool_real_can_redo (GimpTool *tool,
GimpDisplay *display);
static gboolean gimp_tool_real_undo (GimpTool *tool,
GimpDisplay *display);
@ -170,8 +170,8 @@ gimp_tool_class_init (GimpToolClass *klass)
klass->active_modifier_key = gimp_tool_real_active_modifier_key;
klass->oper_update = gimp_tool_real_oper_update;
klass->cursor_update = gimp_tool_real_cursor_update;
klass->get_undo_desc = gimp_tool_real_get_undo_desc;
klass->get_redo_desc = gimp_tool_real_get_redo_desc;
klass->can_undo = gimp_tool_real_can_undo;
klass->can_redo = gimp_tool_real_can_redo;
klass->undo = gimp_tool_real_undo;
klass->redo = gimp_tool_real_redo;
klass->get_popup = gimp_tool_real_get_popup;
@ -434,15 +434,15 @@ gimp_tool_real_cursor_update (GimpTool *tool,
}
static const gchar *
gimp_tool_real_get_undo_desc (GimpTool *tool,
GimpDisplay *display)
gimp_tool_real_can_undo (GimpTool *tool,
GimpDisplay *display)
{
return NULL;
}
static const gchar *
gimp_tool_real_get_redo_desc (GimpTool *tool,
GimpDisplay *display)
gimp_tool_real_can_redo (GimpTool *tool,
GimpDisplay *display)
{
return NULL;
}
@ -1056,27 +1056,27 @@ gimp_tool_cursor_update (GimpTool *tool,
}
const gchar *
gimp_tool_get_undo_desc (GimpTool *tool,
GimpDisplay *display)
gimp_tool_can_undo (GimpTool *tool,
GimpDisplay *display)
{
g_return_val_if_fail (GIMP_IS_TOOL (tool), NULL);
g_return_val_if_fail (GIMP_IS_DISPLAY (display), NULL);
if (display == tool->display)
return GIMP_TOOL_GET_CLASS (tool)->get_undo_desc (tool, display);
return GIMP_TOOL_GET_CLASS (tool)->can_undo (tool, display);
return NULL;
}
const gchar *
gimp_tool_get_redo_desc (GimpTool *tool,
GimpDisplay *display)
gimp_tool_can_redo (GimpTool *tool,
GimpDisplay *display)
{
g_return_val_if_fail (GIMP_IS_TOOL (tool), NULL);
g_return_val_if_fail (GIMP_IS_DISPLAY (display), NULL);
if (display == tool->display)
return GIMP_TOOL_GET_CLASS (tool)->get_redo_desc (tool, display);
return GIMP_TOOL_GET_CLASS (tool)->can_redo (tool, display);
return NULL;
}

View File

@ -135,9 +135,9 @@ struct _GimpToolClass
GdkModifierType state,
GimpDisplay *display);
const gchar * (* get_undo_desc) (GimpTool *tool,
const gchar * (* can_undo) (GimpTool *tool,
GimpDisplay *display);
const gchar * (* get_redo_desc) (GimpTool *tool,
const gchar * (* can_redo) (GimpTool *tool,
GimpDisplay *display);
gboolean (* undo) (GimpTool *tool,
GimpDisplay *display);
@ -214,9 +214,9 @@ void gimp_tool_cursor_update (GimpTool *tool,
GdkModifierType state,
GimpDisplay *display);
const gchar * gimp_tool_get_undo_desc (GimpTool *tool,
const gchar * gimp_tool_can_undo (GimpTool *tool,
GimpDisplay *display);
const gchar * gimp_tool_get_redo_desc (GimpTool *tool,
const gchar * gimp_tool_can_redo (GimpTool *tool,
GimpDisplay *display);
gboolean gimp_tool_undo (GimpTool *tool,
GimpDisplay *display);

View File

@ -95,9 +95,9 @@ static void gimp_transform_tool_cursor_update (GimpTool
const GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display);
static const gchar * gimp_transform_tool_get_undo_desc (GimpTool *tool,
static const gchar * gimp_transform_tool_can_undo (GimpTool *tool,
GimpDisplay *display);
static const gchar * gimp_transform_tool_get_redo_desc (GimpTool *tool,
static const gchar * gimp_transform_tool_can_redo (GimpTool *tool,
GimpDisplay *display);
static gboolean gimp_transform_tool_undo (GimpTool *tool,
GimpDisplay *display);
@ -178,8 +178,8 @@ gimp_transform_tool_class_init (GimpTransformToolClass *klass)
tool_class->modifier_key = gimp_transform_tool_modifier_key;
tool_class->active_modifier_key = gimp_transform_tool_modifier_key;
tool_class->cursor_update = gimp_transform_tool_cursor_update;
tool_class->get_undo_desc = gimp_transform_tool_get_undo_desc;
tool_class->get_redo_desc = gimp_transform_tool_get_redo_desc;
tool_class->can_undo = gimp_transform_tool_can_undo;
tool_class->can_redo = gimp_transform_tool_can_redo;
tool_class->undo = gimp_transform_tool_undo;
tool_class->redo = gimp_transform_tool_redo;
tool_class->options_notify = gimp_transform_tool_options_notify;
@ -529,8 +529,8 @@ gimp_transform_tool_cursor_update (GimpTool *tool,
}
static const gchar *
gimp_transform_tool_get_undo_desc (GimpTool *tool,
GimpDisplay *display)
gimp_transform_tool_can_undo (GimpTool *tool,
GimpDisplay *display)
{
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (tool);
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
@ -543,8 +543,8 @@ gimp_transform_tool_get_undo_desc (GimpTool *tool,
}
static const gchar *
gimp_transform_tool_get_redo_desc (GimpTool *tool,
GimpDisplay *display)
gimp_transform_tool_can_redo (GimpTool *tool,
GimpDisplay *display)
{
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (tool);
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
@ -562,7 +562,7 @@ gimp_transform_tool_undo (GimpTool *tool,
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (tool);
GList *item;
if (! gimp_transform_tool_get_undo_desc (tool, display))
if (! gimp_transform_tool_can_undo (tool, display))
return FALSE;
item = g_list_next (tr_tool->undo_list);
@ -595,7 +595,7 @@ gimp_transform_tool_redo (GimpTool *tool,
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (tool);
GList *item;
if (! gimp_transform_tool_get_redo_desc (tool, display))
if (! gimp_transform_tool_can_redo (tool, display))
return FALSE;
item = tr_tool->redo_list;

View File

@ -88,9 +88,9 @@ static void gimp_warp_tool_cursor_update (GimpTool *tool
const GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display);
const gchar * gimp_warp_tool_get_undo_desc (GimpTool *tool,
const gchar * gimp_warp_tool_can_undo (GimpTool *tool,
GimpDisplay *display);
const gchar * gimp_warp_tool_get_redo_desc (GimpTool *tool,
const gchar * gimp_warp_tool_can_redo (GimpTool *tool,
GimpDisplay *display);
static gboolean gimp_warp_tool_undo (GimpTool *tool,
GimpDisplay *display);
@ -173,8 +173,8 @@ gimp_warp_tool_class_init (GimpWarpToolClass *klass)
tool_class->key_press = gimp_warp_tool_key_press;
tool_class->oper_update = gimp_warp_tool_oper_update;
tool_class->cursor_update = gimp_warp_tool_cursor_update;
tool_class->get_undo_desc = gimp_warp_tool_get_undo_desc;
tool_class->get_redo_desc = gimp_warp_tool_get_redo_desc;
tool_class->can_undo = gimp_warp_tool_can_undo;
tool_class->can_redo = gimp_warp_tool_can_redo;
tool_class->undo = gimp_warp_tool_undo;
tool_class->redo = gimp_warp_tool_redo;
tool_class->options_notify = gimp_warp_tool_options_notify;
@ -469,8 +469,8 @@ gimp_warp_tool_cursor_update (GimpTool *tool,
}
const gchar *
gimp_warp_tool_get_undo_desc (GimpTool *tool,
GimpDisplay *display)
gimp_warp_tool_can_undo (GimpTool *tool,
GimpDisplay *display)
{
GimpWarpTool *wt = GIMP_WARP_TOOL (tool);
GeglNode *to_delete;
@ -489,8 +489,8 @@ gimp_warp_tool_get_undo_desc (GimpTool *tool,
}
const gchar *
gimp_warp_tool_get_redo_desc (GimpTool *tool,
GimpDisplay *display)
gimp_warp_tool_can_redo (GimpTool *tool,
GimpDisplay *display)
{
GimpWarpTool *wt = GIMP_WARP_TOOL (tool);
@ -1095,7 +1095,7 @@ gimp_warp_tool_animate (GimpWarpTool *wt)
GtkWidget *widget;
gint i;
if (! gimp_warp_tool_get_undo_desc (tool, tool->display))
if (! gimp_warp_tool_can_undo (tool, tool->display))
{
gimp_tool_message_literal (tool, tool->display,
_("Please add some warp strokes first."));

View File

@ -480,8 +480,8 @@ tool_manager_cursor_update_active (Gimp *gimp,
}
const gchar *
tool_manager_get_undo_desc_active (Gimp *gimp,
GimpDisplay *display)
tool_manager_can_undo_active (Gimp *gimp,
GimpDisplay *display)
{
GimpToolManager *tool_manager;
@ -491,16 +491,16 @@ tool_manager_get_undo_desc_active (Gimp *gimp,
if (tool_manager->active_tool)
{
return gimp_tool_get_undo_desc (tool_manager->active_tool,
display);
return gimp_tool_can_undo (tool_manager->active_tool,
display);
}
return NULL;
}
const gchar *
tool_manager_get_redo_desc_active (Gimp *gimp,
GimpDisplay *display)
tool_manager_can_redo_active (Gimp *gimp,
GimpDisplay *display)
{
GimpToolManager *tool_manager;
@ -510,8 +510,8 @@ tool_manager_get_redo_desc_active (Gimp *gimp,
if (tool_manager->active_tool)
{
return gimp_tool_get_redo_desc (tool_manager->active_tool,
display);
return gimp_tool_can_redo (tool_manager->active_tool,
display);
}
return NULL;

View File

@ -77,9 +77,9 @@ void tool_manager_cursor_update_active (Gimp *gimp,
GdkModifierType state,
GimpDisplay *display);
const gchar * tool_manager_get_undo_desc_active (Gimp *gimp,
const gchar * tool_manager_can_undo_active (Gimp *gimp,
GimpDisplay *display);
const gchar * tool_manager_get_redo_desc_active (Gimp *gimp,
const gchar * tool_manager_can_redo_active (Gimp *gimp,
GimpDisplay *display);
gboolean tool_manager_undo_active (Gimp *gimp,
GimpDisplay *display);