From 6e19413d219099dab4452d867cd488416b6374c8 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Mon, 4 Jun 2018 12:34:41 +0200 Subject: [PATCH] Revert "app: make gimp_data_factory_data_foreach() public" This reverts commit f521e92d35ecc3c7cf02cf7242678ee82859d6b7. --- app/core/Makefile.am | 2 -- app/core/core-types.h | 1 - app/core/gimpcontext.c | 11 +++++-- app/core/gimpdatafactory.c | 62 ++++++++++++++++++++------------------ app/core/gimpdatafactory.h | 23 +++++--------- 5 files changed, 49 insertions(+), 50 deletions(-) diff --git a/app/core/Makefile.am b/app/core/Makefile.am index 31392be3a2..54a6b92774 100644 --- a/app/core/Makefile.am +++ b/app/core/Makefile.am @@ -155,8 +155,6 @@ libappcore_a_sources = \ gimpdata.h \ gimpdatafactory.c \ gimpdatafactory.h \ - gimpdataloaderfactory.c \ - gimpdataloaderfactory.h \ gimpdocumentlist.c \ gimpdocumentlist.h \ gimpdrawable.c \ diff --git a/app/core/core-types.h b/app/core/core-types.h index a9709f53fa..fd16dfb0ec 100644 --- a/app/core/core-types.h +++ b/app/core/core-types.h @@ -131,7 +131,6 @@ typedef struct _GimpToolInfo GimpToolInfo; /* data objects */ typedef struct _GimpDataFactory GimpDataFactory; -typedef struct _GimpDataLoaderFactory GimpDataLoaderFactory; typedef struct _GimpData GimpData; typedef struct _GimpBrush GimpBrush; typedef struct _GimpBrushCache GimpBrushCache; diff --git a/app/core/gimpcontext.c b/app/core/gimpcontext.c index adba3c114d..2f2a773f33 100644 --- a/app/core/gimpcontext.c +++ b/app/core/gimpcontext.c @@ -1386,8 +1386,15 @@ gimp_context_deserialize_property (GimpConfig *object, if (! deserialize_obj) { - g_free (*name_loc); - *name_loc = g_strdup (object_name); + if (no_data) + { + g_free (*name_loc); + *name_loc = g_strdup (object_name); + } + else + { + deserialize_obj = current; + } } g_value_set_object (value, deserialize_obj); diff --git a/app/core/gimpdatafactory.c b/app/core/gimpdatafactory.c index 900c4a900e..3f6900188e 100644 --- a/app/core/gimpdatafactory.c +++ b/app/core/gimpdatafactory.c @@ -64,6 +64,11 @@ enum }; +typedef void (* GimpDataForeachFunc) (GimpDataFactory *factory, + GimpData *data, + gpointer user_data); + + struct _GimpDataFactoryPrivate { Gimp *gimp; @@ -120,6 +125,10 @@ static gboolean gimp_data_factory_real_data_delete (GimpDataFactory *fa static void gimp_data_factory_path_notify (GObject *object, const GParamSpec *pspec, GimpDataFactory *factory); +static void gimp_data_factory_data_foreach (GimpDataFactory *factory, + gboolean skip_internal, + GimpDataForeachFunc callback, + gpointer user_data); static void gimp_data_factory_data_load (GimpDataFactory *factory, GimpContext *context, @@ -870,35 +879,6 @@ gimp_data_factory_data_save_single (GimpDataFactory *factory, return TRUE; } -void -gimp_data_factory_data_foreach (GimpDataFactory *factory, - gboolean skip_internal, - GimpDataForeachFunc callback, - gpointer user_data) -{ - GList *list; - - g_return_if_fail (GIMP_IS_DATA_FACTORY (factory)); - g_return_if_fail (callback != NULL); - - list = GIMP_LIST (factory->priv->container)->queue->head; - - if (skip_internal) - { - while (list && gimp_data_is_internal (GIMP_DATA (list->data))) - list = g_list_next (list); - } - - while (list) - { - GList *next = g_list_next (list); - - callback (factory, list->data, user_data); - - list = next; - } -} - GType gimp_data_factory_get_data_type (GimpDataFactory *factory) { @@ -1000,6 +980,30 @@ gimp_data_factory_path_notify (GObject *object, gimp_unset_busy (priv->gimp); } +static void +gimp_data_factory_data_foreach (GimpDataFactory *factory, + gboolean skip_internal, + GimpDataForeachFunc callback, + gpointer user_data) +{ + GList *list = GIMP_LIST (factory->priv->container)->queue->head; + + if (skip_internal) + { + while (list && gimp_data_is_internal (GIMP_DATA (list->data))) + list = g_list_next (list); + } + + while (list) + { + GList *next = g_list_next (list); + + callback (factory, list->data, user_data); + + list = next; + } +} + static void gimp_data_factory_data_load (GimpDataFactory *factory, GimpContext *context, diff --git a/app/core/gimpdatafactory.h b/app/core/gimpdatafactory.h index 4f3f0036ff..2af6e42b87 100644 --- a/app/core/gimpdatafactory.h +++ b/app/core/gimpdatafactory.h @@ -25,17 +25,13 @@ #include "gimpobject.h" -typedef void (* GimpDataForeachFunc) (GimpDataFactory *factory, - GimpData *data, - gpointer user_data); - -typedef GimpData * (* GimpDataNewFunc) (GimpContext *context, - const gchar *name); -typedef GList * (* GimpDataLoadFunc) (GimpContext *context, - GFile *file, - GInputStream *input, - GError **error); -typedef GimpData * (* GimpDataGetStandardFunc) (GimpContext *context); +typedef GimpData * (* GimpDataNewFunc) (GimpContext *context, + const gchar *name); +typedef GList * (* GimpDataLoadFunc) (GimpContext *context, + GFile *file, + GInputStream *input, + GError **error); +typedef GimpData * (* GimpDataGetStandardFunc) (GimpContext *context); typedef struct _GimpDataFactoryLoaderEntry GimpDataFactoryLoaderEntry; @@ -127,11 +123,6 @@ gboolean gimp_data_factory_data_save_single (GimpDataFactory *factory, GimpData *data, GError **error); -void gimp_data_factory_data_foreach (GimpDataFactory *factory, - gboolean skip_internal, - GimpDataForeachFunc callback, - gpointer user_data); - GType gimp_data_factory_get_data_type (GimpDataFactory *factory); GimpContainer * gimp_data_factory_get_container (GimpDataFactory *factory); GimpContainer * gimp_data_factory_get_container_obsolete