[gimp] app: change gimp_operation_config_new() to _get_type()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: change gimp_operation_config_new() to _get_type()
- Date: Mon, 29 May 2017 06:07:19 +0000 (UTC)
commit 90698524d9cc376082fc430784ecdcaefa9e78b2
Author: Michael Natterer <mitch gimp org>
Date: Mon May 29 08:04:52 2017 +0200
app: change gimp_operation_config_new() to _get_type()
Return only the config object's GType and do the g_object_new() in the
caller (one caller only needs the type, there is no need to create a
dummy object just to get to its type).
app/actions/gimpgeglprocedure.c | 14 ++++++--------
app/operations/gimp-operation-config.c | 18 +++++++++---------
app/operations/gimp-operation-config.h | 2 +-
app/tools/gimpfiltertool.c | 9 +++++----
4 files changed, 21 insertions(+), 22 deletions(-)
---
diff --git a/app/actions/gimpgeglprocedure.c b/app/actions/gimpgeglprocedure.c
index 0494417..a599489 100644
--- a/app/actions/gimpgeglprocedure.c
+++ b/app/actions/gimpgeglprocedure.c
@@ -250,19 +250,17 @@ gimp_gegl_procedure_execute_async (GimpProcedure *procedure,
GimpObject *settings;
GimpContainer *container;
GimpTool *active_tool;
+ GType config_type;
- settings = gimp_operation_config_new (gimp,
- procedure->original_name,
- gimp_viewable_get_icon_name (GIMP_VIEWABLE (procedure)),
- GIMP_TYPE_SETTINGS);
+ config_type = gimp_operation_config_get_type (gimp,
+ procedure->original_name,
+ gimp_viewable_get_icon_name (GIMP_VIEWABLE (procedure)),
+ GIMP_TYPE_SETTINGS);
container =
- gimp_operation_config_get_container (gimp,
- G_TYPE_FROM_INSTANCE (settings),
+ gimp_operation_config_get_container (gimp, config_type,
(GCompareFunc) gimp_settings_compare);
- g_object_unref (settings);
-
/* the last used settings */
settings = gimp_container_get_child_by_index (container, 0);
diff --git a/app/operations/gimp-operation-config.c b/app/operations/gimp-operation-config.c
index 92f023a..219e9ad 100644
--- a/app/operations/gimp-operation-config.c
+++ b/app/operations/gimp-operation-config.c
@@ -260,18 +260,18 @@ gimp_operation_config_register (Gimp *gimp,
(gpointer) config_type);
}
-GimpObject *
-gimp_operation_config_new (Gimp *gimp,
- const gchar *operation,
- const gchar *icon_name,
- GType parent_type)
+GType
+gimp_operation_config_get_type (Gimp *gimp,
+ const gchar *operation,
+ const gchar *icon_name,
+ GType parent_type)
{
GHashTable *config_types;
GType config_type;
- g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
- g_return_val_if_fail (operation != NULL, NULL);
- g_return_val_if_fail (g_type_is_a (parent_type, GIMP_TYPE_OBJECT), NULL);
+ g_return_val_if_fail (GIMP_IS_GIMP (gimp), G_TYPE_NONE);
+ g_return_val_if_fail (operation != NULL, G_TYPE_NONE);
+ g_return_val_if_fail (g_type_is_a (parent_type, GIMP_TYPE_OBJECT), G_TYPE_NONE);
config_types = gimp_operation_config_get_type_table (gimp);
@@ -331,7 +331,7 @@ gimp_operation_config_new (Gimp *gimp,
}
}
- return g_object_new (config_type, NULL);
+ return config_type;
}
GimpContainer *
diff --git a/app/operations/gimp-operation-config.h b/app/operations/gimp-operation-config.h
index f8471a2..dfd84a4 100644
--- a/app/operations/gimp-operation-config.h
+++ b/app/operations/gimp-operation-config.h
@@ -23,7 +23,7 @@ void gimp_operation_config_register (Gimp *gimp,
const gchar *operation,
GType config_type);
-GimpObject * gimp_operation_config_new (Gimp *gimp,
+GType gimp_operation_config_get_type (Gimp *gimp,
const gchar *operation,
const gchar *icon_name,
GType parent_type);
diff --git a/app/tools/gimpfiltertool.c b/app/tools/gimpfiltertool.c
index f858f27..a72a45e 100644
--- a/app/tools/gimpfiltertool.c
+++ b/app/tools/gimpfiltertool.c
@@ -1379,10 +1379,11 @@ gimp_filter_tool_get_operation (GimpFilterTool *filter_tool)
NULL);
filter_tool->config =
- G_OBJECT (gimp_operation_config_new (tool_info->gimp,
- operation_name,
- filter_tool->icon_name,
- GIMP_TYPE_SETTINGS));
+ g_object_new (gimp_operation_config_get_type (tool_info->gimp,
+ operation_name,
+ filter_tool->icon_name,
+ GIMP_TYPE_SETTINGS),
+ NULL);
gimp_operation_config_sync_node (GIMP_OBJECT (filter_tool->config),
filter_tool->operation);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]