From 84269cc608281a82b6f92166ccaf0f41c6a9fa3e Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Wed, 5 Jul 2017 20:33:11 +0200 Subject: [PATCH] app: move the add_controller() callback to GimpFilterTool Why I added it to GimpOperationTool first, I have no idea... --- app/tools/gimpfiltertool.c | 30 ++++++++++++++++++++++++++++++ app/tools/gimpfiltertool.h | 6 ++++++ app/tools/gimpoperationtool.c | 28 +--------------------------- 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/app/tools/gimpfiltertool.c b/app/tools/gimpfiltertool.c index e14220bd00..1265960658 100644 --- a/app/tools/gimpfiltertool.c +++ b/app/tools/gimpfiltertool.c @@ -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) diff --git a/app/tools/gimpfiltertool.h b/app/tools/gimpfiltertool.h index 90cccc774a..0ce0c5eb6d 100644 --- a/app/tools/gimpfiltertool.h +++ b/app/tools/gimpfiltertool.h @@ -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); diff --git a/app/tools/gimpoperationtool.c b/app/tools/gimpoperationtool.c index 3995a9500c..e2664fe48a 100644 --- a/app/tools/gimpoperationtool.c +++ b/app/tools/gimpoperationtool.c @@ -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),