[gimp] app: remove undo_desc, icon_name, help_id stuff from GimpFilterTool
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: remove undo_desc, icon_name, help_id stuff from GimpFilterTool
- Date: Tue, 4 Jul 2017 18:44:03 +0000 (UTC)
commit 1f42d65e2147be6bfbdbe59057d759238bb7119f
Author: Michael Natterer <mitch gimp org>
Date: Tue Jul 4 20:42:09 2017 +0200
app: remove undo_desc, icon_name, help_id stuff from GimpFilterTool
and its subclasses. Simply use the new GimpTool APIs now.
app/tools/gimpbrightnesscontrasttool.c | 10 +---
app/tools/gimpcurvestool.c | 10 +---
app/tools/gimpfiltertool-settings.c | 2 +-
app/tools/gimpfiltertool.c | 100 +++++++++-----------------------
app/tools/gimpfiltertool.h | 6 --
app/tools/gimplevelstool.c | 10 +---
app/tools/gimpoperationtool.c | 67 ++-------------------
app/tools/gimpoperationtool.h | 3 -
app/tools/gimpthresholdtool.c | 10 +---
9 files changed, 44 insertions(+), 174 deletions(-)
---
diff --git a/app/tools/gimpbrightnesscontrasttool.c b/app/tools/gimpbrightnesscontrasttool.c
index d021f69..24edf5c 100644
--- a/app/tools/gimpbrightnesscontrasttool.c
+++ b/app/tools/gimpbrightnesscontrasttool.c
@@ -75,9 +75,6 @@ static gchar *
gimp_brightness_contrast_tool_get_operation (GimpFilterTool *filter_tool,
gchar **title,
gchar **description,
- gchar **undo_desc,
- gchar **icon_name,
- gchar **help_id,
gboolean *has_settings);
static void gimp_brightness_contrast_tool_dialog (GimpFilterTool *filter_tool);
@@ -163,13 +160,10 @@ static gchar *
gimp_brightness_contrast_tool_get_operation (GimpFilterTool *filter_tool,
gchar **title,
gchar **description,
- gchar **undo_desc,
- gchar **icon_name,
- gchar **help_id,
gboolean *has_settings)
{
- *description = g_strdup (_("Adjust Brightness and Contrast"));
- *has_settings = TRUE;
+ *description = g_strdup (_("Adjust Brightness and Contrast"));
+ *has_settings = TRUE;
return g_strdup ("gimp:brightness-contrast");
}
diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c
index 2c0c61b..70f66b0 100644
--- a/app/tools/gimpcurvestool.c
+++ b/app/tools/gimpcurvestool.c
@@ -83,9 +83,6 @@ static void gimp_curves_tool_oper_update (GimpTool *tool,
static gchar * gimp_curves_tool_get_operation (GimpFilterTool *filter_tool,
gchar **title,
gchar **description,
- gchar **undo_desc,
- gchar **icon_name,
- gchar **help_id,
gboolean *has_settings);
static void gimp_curves_tool_dialog (GimpFilterTool *filter_tool);
static void gimp_curves_tool_reset (GimpFilterTool *filter_tool);
@@ -349,13 +346,10 @@ static gchar *
gimp_curves_tool_get_operation (GimpFilterTool *filter_tool,
gchar **title,
gchar **description,
- gchar **undo_desc,
- gchar **icon_name,
- gchar **help_id,
gboolean *has_settings)
{
- *description = g_strdup (_("Adjust Color Curves"));
- *has_settings = TRUE;
+ *description = g_strdup (_("Adjust Color Curves"));
+ *has_settings = TRUE;
return g_strdup ("gimp:curves");
}
diff --git a/app/tools/gimpfiltertool-settings.c b/app/tools/gimpfiltertool-settings.c
index ef14036..f22bded 100644
--- a/app/tools/gimpfiltertool-settings.c
+++ b/app/tools/gimpfiltertool-settings.c
@@ -78,7 +78,7 @@ gimp_filter_tool_get_settings_box (GimpFilterTool *filter_tool)
filter_tool->settings,
import_title,
export_title,
- filter_tool->help_id,
+ gimp_tool_get_help_id (GIMP_TOOL (filter_tool)),
settings_folder,
NULL);
diff --git a/app/tools/gimpfiltertool.c b/app/tools/gimpfiltertool.c
index 7107e84..9062fef 100644
--- a/app/tools/gimpfiltertool.c
+++ b/app/tools/gimpfiltertool.c
@@ -266,24 +266,6 @@ gimp_filter_tool_finalize (GObject *object)
filter_tool->description = NULL;
}
- if (filter_tool->undo_desc)
- {
- g_free (filter_tool->undo_desc);
- filter_tool->undo_desc = NULL;
- }
-
- if (filter_tool->icon_name)
- {
- g_free (filter_tool->icon_name);
- filter_tool->icon_name = NULL;
- }
-
- if (filter_tool->help_id)
- {
- g_free (filter_tool->help_id);
- filter_tool->help_id = NULL;
- }
-
if (filter_tool->gui)
{
g_object_unref (filter_tool->gui);
@@ -360,8 +342,8 @@ gimp_filter_tool_initialize (GimpTool *tool,
gimp_tool_gui_new (tool_info,
filter_tool->title,
filter_tool->description,
- filter_tool->icon_name,
- filter_tool->help_id,
+ gimp_tool_get_icon_name (tool),
+ gimp_tool_get_help_id (tool),
gtk_widget_get_screen (GTK_WIDGET (shell)),
gimp_widget_get_monitor (GTK_WIDGET (shell)),
filter_tool->overlay,
@@ -473,10 +455,12 @@ gimp_filter_tool_initialize (GimpTool *tool,
}
else
{
- gimp_tool_gui_set_title (filter_tool->gui, filter_tool->title);
+ gimp_tool_gui_set_title (filter_tool->gui, filter_tool->title);
gimp_tool_gui_set_description (filter_tool->gui, filter_tool->description);
- gimp_tool_gui_set_icon_name (filter_tool->gui, filter_tool->icon_name);
- gimp_tool_gui_set_help_id (filter_tool->gui, filter_tool->help_id);
+ gimp_tool_gui_set_icon_name (filter_tool->gui,
+ gimp_tool_get_icon_name (tool));
+ gimp_tool_gui_set_help_id (filter_tool->gui,
+ gimp_tool_get_help_id (tool));
}
gimp_tool_gui_set_shell (filter_tool->gui, shell);
@@ -1084,6 +1068,7 @@ gimp_filter_tool_reset (GimpFilterTool *filter_tool)
static void
gimp_filter_tool_create_filter (GimpFilterTool *filter_tool)
{
+ GimpTool *tool = GIMP_TOOL (filter_tool);
GimpFilterOptions *options = GIMP_FILTER_TOOL_GET_OPTIONS (filter_tool);
if (filter_tool->filter)
@@ -1095,9 +1080,9 @@ gimp_filter_tool_create_filter (GimpFilterTool *filter_tool)
g_assert (filter_tool->operation);
filter_tool->filter = gimp_drawable_filter_new (filter_tool->drawable,
- filter_tool->undo_desc,
+ gimp_tool_get_undo_desc (tool),
filter_tool->operation,
- filter_tool->icon_name);
+ gimp_tool_get_icon_name (tool));
gimp_drawable_filter_set_region (filter_tool->filter,
options->region);
@@ -1112,7 +1097,7 @@ gimp_filter_tool_create_filter (GimpFilterTool *filter_tool)
gimp_gegl_progress_connect (filter_tool->operation,
GIMP_PROGRESS (filter_tool),
- filter_tool->undo_desc);
+ gimp_tool_get_undo_desc (tool));
if (options->preview)
gimp_drawable_filter_apply (filter_tool->filter, NULL);
@@ -1317,16 +1302,15 @@ gimp_filter_tool_response (GimpToolGui *gui,
void
gimp_filter_tool_get_operation (GimpFilterTool *filter_tool)
{
+ GimpTool *tool;
GimpFilterToolClass *klass;
- GimpToolInfo *tool_info;
gchar *operation_name;
g_return_if_fail (GIMP_IS_FILTER_TOOL (filter_tool));
+ tool = GIMP_TOOL (filter_tool);
klass = GIMP_FILTER_TOOL_GET_CLASS (filter_tool);
- tool_info = GIMP_TOOL (filter_tool)->tool_info;
-
if (filter_tool->filter)
{
gimp_drawable_filter_abort (filter_tool->filter);
@@ -1374,59 +1358,28 @@ gimp_filter_tool_get_operation (GimpFilterTool *filter_tool)
filter_tool->description = NULL;
}
- if (filter_tool->undo_desc)
- {
- g_free (filter_tool->undo_desc);
- filter_tool->undo_desc = NULL;
- }
-
- if (filter_tool->icon_name)
- {
- g_free (filter_tool->icon_name);
- filter_tool->icon_name = NULL;
- }
-
- if (filter_tool->help_id)
- {
- g_free (filter_tool->help_id);
- filter_tool->help_id = NULL;
- }
-
operation_name = klass->get_operation (filter_tool,
&filter_tool->title,
&filter_tool->description,
- &filter_tool->undo_desc,
- &filter_tool->icon_name,
- &filter_tool->help_id,
&filter_tool->has_settings);
if (! operation_name)
operation_name = g_strdup ("gegl:nop");
if (! filter_tool->title)
- filter_tool->title = g_strdup (tool_info->blurb);
+ filter_tool->title = g_strdup (tool->tool_info->blurb);
if (! filter_tool->description)
filter_tool->description = g_strdup (filter_tool->title);
- if (! filter_tool->undo_desc)
- filter_tool->undo_desc = g_strdup (tool_info->blurb);
-
- if (! filter_tool->icon_name)
- filter_tool->icon_name =
- g_strdup (gimp_viewable_get_icon_name (GIMP_VIEWABLE (tool_info)));
-
- if (! filter_tool->help_id)
- filter_tool->help_id = g_strdup (tool_info->help_id);
-
filter_tool->operation = gegl_node_new_child (NULL,
"operation", operation_name,
NULL);
filter_tool->config =
- g_object_new (gimp_operation_config_get_type (tool_info->gimp,
+ g_object_new (gimp_operation_config_get_type (tool->tool_info->gimp,
operation_name,
- filter_tool->icon_name,
+ gimp_tool_get_icon_name (tool),
GIMP_TYPE_SETTINGS),
NULL);
@@ -1436,7 +1389,7 @@ gimp_filter_tool_get_operation (GimpFilterTool *filter_tool)
filter_tool->operation);
filter_tool->settings =
- gimp_operation_config_get_container (tool_info->gimp,
+ gimp_operation_config_get_container (tool->tool_info->gimp,
G_TYPE_FROM_INSTANCE (filter_tool->config),
(GCompareFunc) gimp_settings_compare);
g_object_ref (filter_tool->settings);
@@ -1445,8 +1398,10 @@ gimp_filter_tool_get_operation (GimpFilterTool *filter_tool)
{
gimp_tool_gui_set_title (filter_tool->gui, filter_tool->title);
gimp_tool_gui_set_description (filter_tool->gui, filter_tool->description);
- gimp_tool_gui_set_icon_name (filter_tool->gui, filter_tool->icon_name);
- gimp_tool_gui_set_help_id (filter_tool->gui, filter_tool->help_id);
+ gimp_tool_gui_set_icon_name (filter_tool->gui,
+ gimp_tool_get_icon_name (tool));
+ gimp_tool_gui_set_help_id (filter_tool->gui,
+ gimp_tool_get_help_id (tool));
}
gimp_filter_tool_set_has_settings (filter_tool,
@@ -1498,11 +1453,12 @@ gimp_filter_tool_set_has_settings (GimpFilterTool *filter_tool,
{
if (filter_tool->has_settings)
{
- GQuark quark = g_quark_from_static_string ("settings-folder");
- GType type = G_TYPE_FROM_INSTANCE (filter_tool->config);
- GFile *settings_folder;
- gchar *import_title;
- gchar *export_title;
+ GimpTool *tool = GIMP_TOOL (filter_tool);
+ GQuark quark = g_quark_from_static_string ("settings-folder");
+ GType type = G_TYPE_FROM_INSTANCE (filter_tool->config);
+ GFile *settings_folder;
+ gchar *import_title;
+ gchar *export_title;
settings_folder = g_type_get_qdata (type, quark);
@@ -1515,7 +1471,7 @@ gimp_filter_tool_set_has_settings (GimpFilterTool *filter_tool,
"visible", TRUE,
"config", filter_tool->config,
"container", filter_tool->settings,
- "help-id", filter_tool->help_id,
+ "help-id", gimp_tool_get_help_id (tool),
"import-title", import_title,
"export-title", export_title,
"default-folder", settings_folder,
diff --git a/app/tools/gimpfiltertool.h b/app/tools/gimpfiltertool.h
index e4f1501..846b8ed 100644
--- a/app/tools/gimpfiltertool.h
+++ b/app/tools/gimpfiltertool.h
@@ -47,9 +47,6 @@ struct _GimpFilterTool
gchar *title;
gchar *description;
- gchar *undo_desc;
- gchar *icon_name;
- gchar *help_id;
gboolean has_settings;
@@ -80,9 +77,6 @@ struct _GimpFilterToolClass
gchar * (* get_operation) (GimpFilterTool *filter_tool,
gchar **title,
gchar **description,
- gchar **undo_desc,
- gchar **icon_name,
- gchar **help_id,
gboolean *has_settings);
void (* dialog) (GimpFilterTool *filter_tool);
void (* reset) (GimpFilterTool *filter_tool);
diff --git a/app/tools/gimplevelstool.c b/app/tools/gimplevelstool.c
index 89d343f..7a9a731 100644
--- a/app/tools/gimplevelstool.c
+++ b/app/tools/gimplevelstool.c
@@ -74,9 +74,6 @@ static gboolean gimp_levels_tool_initialize (GimpTool *tool,
static gchar * gimp_levels_tool_get_operation (GimpFilterTool *filter_tool,
gchar **title,
gchar **description,
- gchar **undo_desc,
- gchar **icon_name,
- gchar **help_id,
gboolean *has_settings);
static void gimp_levels_tool_dialog (GimpFilterTool *filter_tool);
static void gimp_levels_tool_reset (GimpFilterTool *filter_tool);
@@ -243,13 +240,10 @@ static gchar *
gimp_levels_tool_get_operation (GimpFilterTool *filter_tool,
gchar **title,
gchar **description,
- gchar **undo_desc,
- gchar **icon_name,
- gchar **help_id,
gboolean *has_settings)
{
- *description = g_strdup (_("Adjust Color Levels"));
- *has_settings = TRUE;
+ *description = g_strdup (_("Adjust Color Levels"));
+ *has_settings = TRUE;
return g_strdup ("gimp:levels");
}
diff --git a/app/tools/gimpoperationtool.c b/app/tools/gimpoperationtool.c
index 9919007..14ba1c8 100644
--- a/app/tools/gimpoperationtool.c
+++ b/app/tools/gimpoperationtool.c
@@ -86,9 +86,6 @@ static void gimp_operation_tool_options_notify (GimpTool *tool,
static gchar * gimp_operation_tool_get_operation (GimpFilterTool *filter_tool,
gchar **title,
gchar **description,
- gchar **undo_desc,
- gchar **icon_name,
- gchar **help_id,
gboolean *has_settings);
static void gimp_operation_tool_dialog (GimpFilterTool *filter_tool);
static void gimp_operation_tool_reset (GimpFilterTool *filter_tool);
@@ -187,24 +184,6 @@ gimp_operation_tool_finalize (GObject *object)
tool->description = NULL;
}
- if (tool->undo_desc)
- {
- g_free (tool->undo_desc);
- tool->undo_desc = NULL;
- }
-
- if (tool->icon_name)
- {
- g_free (tool->icon_name);
- tool->icon_name = NULL;
- }
-
- if (tool->help_id)
- {
- g_free (tool->help_id);
- tool->help_id = NULL;
- }
-
g_list_free_full (tool->aux_inputs,
(GDestroyNotify) gimp_operation_tool_aux_input_free);
tool->aux_inputs = NULL;
@@ -293,19 +272,13 @@ static gchar *
gimp_operation_tool_get_operation (GimpFilterTool *filter_tool,
gchar **title,
gchar **description,
- gchar **undo_desc,
- gchar **icon_name,
- gchar **help_id,
gboolean *has_settings)
{
GimpOperationTool *tool = GIMP_OPERATION_TOOL (filter_tool);
- *title = g_strdup (tool->title);
- *description = g_strdup (tool->description);
- *undo_desc = g_strdup (tool->undo_desc);
- *icon_name = g_strdup (tool->icon_name);
- *help_id = g_strdup (tool->help_id);
- *has_settings = FALSE;
+ *title = g_strdup (tool->title);
+ *description = g_strdup (tool->description);
+ *has_settings = FALSE;
return g_strdup (tool->operation);
}
@@ -479,24 +452,6 @@ gimp_operation_tool_halt (GimpOperationTool *op_tool)
op_tool->description = NULL;
}
- if (op_tool->undo_desc)
- {
- g_free (op_tool->undo_desc);
- op_tool->undo_desc = NULL;
- }
-
- if (op_tool->icon_name)
- {
- g_free (op_tool->icon_name);
- op_tool->icon_name = NULL;
- }
-
- if (op_tool->help_id)
- {
- g_free (op_tool->help_id);
- op_tool->help_id = NULL;
- }
-
g_list_foreach (op_tool->aux_inputs,
(GFunc) gimp_operation_tool_aux_input_free, NULL);
op_tool->aux_inputs = NULL;
@@ -727,21 +682,13 @@ gimp_operation_tool_set_operation (GimpOperationTool *tool,
if (tool->description)
g_free (tool->description);
- if (tool->undo_desc)
- g_free (tool->undo_desc);
-
- if (tool->icon_name)
- g_free (tool->icon_name);
-
- if (tool->help_id)
- g_free (tool->help_id);
-
tool->operation = g_strdup (operation);
tool->title = g_strdup (title);
tool->description = g_strdup (description);
- tool->undo_desc = g_strdup (undo_desc);
- tool->icon_name = g_strdup (icon_name);
- tool->help_id = g_strdup (help_id);
+
+ gimp_tool_set_undo_desc (GIMP_TOOL (tool), undo_desc);
+ gimp_tool_set_icon_name (GIMP_TOOL (tool), icon_name);
+ gimp_tool_set_help_id (GIMP_TOOL (tool), help_id);
g_list_free_full (tool->aux_inputs,
(GDestroyNotify) gimp_operation_tool_aux_input_free);
diff --git a/app/tools/gimpoperationtool.h b/app/tools/gimpoperationtool.h
index 3ed81d1..9670476 100644
--- a/app/tools/gimpoperationtool.h
+++ b/app/tools/gimpoperationtool.h
@@ -40,9 +40,6 @@ struct _GimpOperationTool
gchar *operation;
gchar *title;
gchar *description;
- gchar *undo_desc;
- gchar *icon_name;
- gchar *help_id;
GList *aux_inputs;
diff --git a/app/tools/gimpthresholdtool.c b/app/tools/gimpthresholdtool.c
index 81e568d..7a4a31f 100644
--- a/app/tools/gimpthresholdtool.c
+++ b/app/tools/gimpthresholdtool.c
@@ -54,9 +54,6 @@ static gboolean gimp_threshold_tool_initialize (GimpTool *tool,
static gchar * gimp_threshold_tool_get_operation (GimpFilterTool *filter_tool,
gchar **title,
gchar **description,
- gchar **undo_desc,
- gchar **icon_name,
- gchar **help_id,
gboolean *has_settings);
static void gimp_threshold_tool_dialog (GimpFilterTool *filter_tool);
static void gimp_threshold_tool_config_notify (GimpFilterTool *filter_tool,
@@ -158,13 +155,10 @@ static gchar *
gimp_threshold_tool_get_operation (GimpFilterTool *filter_tool,
gchar **title,
gchar **description,
- gchar **undo_desc,
- gchar **icon_name,
- gchar **help_id,
gboolean *has_settings)
{
- *description = g_strdup (_("Apply Threshold"));
- *has_settings = TRUE;
+ *description = g_strdup (_("Apply Threshold"));
+ *has_settings = TRUE;
return g_strdup ("gimp:threshold");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]