app: make GimpOperationTool manage an icon name for the GUI
and add an icon_name parameter to gimp_operation_tool_set_operation().
This commit is contained in:
@ -86,7 +86,8 @@ filters_filter_cmd_callback (GtkAction *action,
|
||||
}
|
||||
|
||||
gimp_operation_tool_set_operation (GIMP_OPERATION_TOOL (active_tool),
|
||||
operation, label);
|
||||
operation, label,
|
||||
gtk_action_get_icon_name (action));
|
||||
tool_manager_initialize_active (image->gimp, display);
|
||||
|
||||
g_free (label);
|
||||
|
||||
@ -421,7 +421,7 @@ gimp_gegl_tool_operation_changed (GtkWidget *widget,
|
||||
}
|
||||
|
||||
gimp_operation_tool_set_operation (GIMP_OPERATION_TOOL (tool),
|
||||
operation, NULL);
|
||||
operation, NULL, NULL);
|
||||
g_free (operation);
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,6 +163,12 @@ gimp_operation_tool_finalize (GObject *object)
|
||||
tool->undo_desc = NULL;
|
||||
}
|
||||
|
||||
if (tool->icon_name)
|
||||
{
|
||||
g_free (tool->icon_name);
|
||||
tool->icon_name = NULL;
|
||||
}
|
||||
|
||||
if (tool->config)
|
||||
{
|
||||
g_object_unref (tool->config);
|
||||
@ -285,6 +291,10 @@ gimp_operation_tool_dialog (GimpImageMapTool *image_map_tool)
|
||||
if (tool->undo_desc)
|
||||
gimp_tool_gui_set_description (GIMP_IMAGE_MAP_TOOL (tool)->gui,
|
||||
tool->undo_desc);
|
||||
|
||||
if (tool->icon_name)
|
||||
gimp_tool_gui_set_icon_name (GIMP_IMAGE_MAP_TOOL (tool)->gui,
|
||||
tool->icon_name);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -559,7 +569,8 @@ gimp_operation_tool_aux_notify (GimpPickableButton *button,
|
||||
void
|
||||
gimp_operation_tool_set_operation (GimpOperationTool *tool,
|
||||
const gchar *operation,
|
||||
const gchar *undo_desc)
|
||||
const gchar *undo_desc,
|
||||
const gchar *icon_name)
|
||||
{
|
||||
GimpImageMapTool *im_tool;
|
||||
|
||||
@ -574,8 +585,12 @@ gimp_operation_tool_set_operation (GimpOperationTool *tool,
|
||||
if (tool->undo_desc)
|
||||
g_free (tool->undo_desc);
|
||||
|
||||
if (tool->icon_name)
|
||||
g_free (tool->icon_name);
|
||||
|
||||
tool->operation = g_strdup (operation);
|
||||
tool->undo_desc = g_strdup (undo_desc);
|
||||
tool->icon_name = g_strdup (icon_name);
|
||||
|
||||
if (tool->config)
|
||||
g_object_unref (tool->config);
|
||||
@ -674,8 +689,14 @@ gimp_operation_tool_set_operation (GimpOperationTool *tool,
|
||||
}
|
||||
}
|
||||
|
||||
if (undo_desc && im_tool->gui)
|
||||
gimp_tool_gui_set_description (im_tool->gui, undo_desc);
|
||||
if (im_tool->gui)
|
||||
{
|
||||
if (undo_desc)
|
||||
gimp_tool_gui_set_description (im_tool->gui, undo_desc);
|
||||
|
||||
if (icon_name)
|
||||
gimp_tool_gui_set_icon_name (im_tool->gui, icon_name);
|
||||
}
|
||||
|
||||
if (GIMP_TOOL (tool)->drawable)
|
||||
{
|
||||
|
||||
@ -39,6 +39,7 @@ struct _GimpOperationTool
|
||||
|
||||
gchar *operation;
|
||||
gchar *undo_desc;
|
||||
gchar *icon_name;
|
||||
GimpObject *config;
|
||||
GeglNode *aux_input;
|
||||
|
||||
@ -62,7 +63,8 @@ GType gimp_operation_tool_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gimp_operation_tool_set_operation (GimpOperationTool *tool,
|
||||
const gchar *operation,
|
||||
const gchar *undo_desc);
|
||||
const gchar *undo_desc,
|
||||
const gchar *icon_name);
|
||||
|
||||
|
||||
#endif /* __GIMP_OPERATION_TOOL_H__ */
|
||||
|
||||
Reference in New Issue
Block a user