app: move the add_controller() callback to GimpFilterTool

Why I added it to GimpOperationTool first, I have no idea...
This commit is contained in:
Michael Natterer 2017-07-05 20:33:11 +02:00
parent 3f6e9e429d
commit 84269cc608
3 changed files with 37 additions and 27 deletions

View File

@ -69,6 +69,7 @@
#include "gimpfilteroptions.h"
#include "gimpfiltertool.h"
#include "gimpfiltertool-settings.h"
#include "gimpfiltertool-widgets.h"
#include "gimpguidetool.h"
#include "gimptoolcontrol.h"
#include "tool_manager.h"
@ -1675,6 +1676,35 @@ gimp_filter_tool_add_color_picker (GimpFilterTool *filter_tool,
return button;
}
GCallback
gimp_filter_tool_add_controller (GimpFilterTool *filter_tool,
GimpControllerType controller_type,
const gchar *status_title,
GCallback callback,
gpointer callback_data,
gpointer *set_func_data)
{
GimpToolWidget *widget;
GCallback set_func;
g_return_val_if_fail (GIMP_IS_FILTER_TOOL (filter_tool), NULL);
g_return_val_if_fail (callback != NULL, NULL);
g_return_val_if_fail (callback_data != NULL, NULL);
g_return_val_if_fail (set_func_data != NULL, NULL);
widget = gimp_filter_tool_create_widget (filter_tool,
controller_type,
status_title,
callback,
callback_data,
&set_func,
set_func_data);
gimp_filter_tool_set_widget (filter_tool, widget);
g_object_unref (widget);
return set_func;
}
void
gimp_filter_tool_set_widget (GimpFilterTool *filter_tool,
GimpToolWidget *widget)

View File

@ -130,6 +130,12 @@ GtkWidget * gimp_filter_tool_add_color_picker (GimpFilterTool *filter_too
const gchar *icon_name,
const gchar *tooltip,
gboolean pick_abyss);
GCallback gimp_filter_tool_add_controller (GimpFilterTool *filter_tool,
GimpControllerType controller_type,
const gchar *status_title,
GCallback callback,
gpointer callback_data,
gpointer *set_func_data);
void gimp_filter_tool_set_widget (GimpFilterTool *filter_tool,
GimpToolWidget *widget);

View File

@ -52,7 +52,6 @@
#include "display/gimptoolgui.h"
#include "gimpfilteroptions.h"
#include "gimpfiltertool-widgets.h"
#include "gimpoperationtool.h"
#include "gimp-intl.h"
@ -502,31 +501,6 @@ gimp_operation_tool_sync_op (GimpOperationTool *op_tool,
g_free (pspecs);
}
static GCallback
gimp_operation_tool_add_controller (GimpOperationTool *op_tool,
GimpControllerType controller_type,
const gchar *status_title,
GCallback callback,
gpointer callback_data,
gpointer *set_func_data)
{
GimpFilterTool *filter_tool = GIMP_FILTER_TOOL (op_tool);
GimpToolWidget *widget;
GCallback set_func;
widget = gimp_filter_tool_create_widget (filter_tool,
controller_type,
status_title,
callback,
callback_data,
&set_func,
set_func_data);
gimp_filter_tool_set_widget (filter_tool, widget);
g_object_unref (widget);
return set_func;
}
static void
gimp_operation_tool_create_gui (GimpOperationTool *tool)
{
@ -542,7 +516,7 @@ gimp_operation_tool_create_gui (GimpOperationTool *tool)
&area,
GIMP_CONTEXT (GIMP_TOOL_GET_OPTIONS (tool)),
(GimpCreatePickerFunc) gimp_filter_tool_add_color_picker,
(GimpCreateControllerFunc) gimp_operation_tool_add_controller,
(GimpCreateControllerFunc) gimp_filter_tool_add_controller,
tool);
g_object_add_weak_pointer (G_OBJECT (tool->options_gui),