[gimp] app: make gimp_data_factory_data_foreach() public
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: make gimp_data_factory_data_foreach() public
- Date: Mon, 4 Jun 2018 10:34:04 +0000 (UTC)
commit f521e92d35ecc3c7cf02cf7242678ee82859d6b7
Author: Michael Natterer <mitch gimp org>
Date: Mon Jun 4 12:33:09 2018 +0200
app: make gimp_data_factory_data_foreach() public
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, 50 insertions(+), 49 deletions(-)
---
diff --git a/app/core/Makefile.am b/app/core/Makefile.am
index 54a6b92774..31392be3a2 100644
--- a/app/core/Makefile.am
+++ b/app/core/Makefile.am
@@ -155,6 +155,8 @@ 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 fd16dfb0ec..a9709f53fa 100644
--- a/app/core/core-types.h
+++ b/app/core/core-types.h
@@ -131,6 +131,7 @@ 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 2f2a773f33..adba3c114d 100644
--- a/app/core/gimpcontext.c
+++ b/app/core/gimpcontext.c
@@ -1386,15 +1386,8 @@ gimp_context_deserialize_property (GimpConfig *object,
if (! deserialize_obj)
{
- if (no_data)
- {
- g_free (*name_loc);
- *name_loc = g_strdup (object_name);
- }
- else
- {
- deserialize_obj = current;
- }
+ g_free (*name_loc);
+ *name_loc = g_strdup (object_name);
}
g_value_set_object (value, deserialize_obj);
diff --git a/app/core/gimpdatafactory.c b/app/core/gimpdatafactory.c
index 3f6900188e..900c4a900e 100644
--- a/app/core/gimpdatafactory.c
+++ b/app/core/gimpdatafactory.c
@@ -64,11 +64,6 @@ enum
};
-typedef void (* GimpDataForeachFunc) (GimpDataFactory *factory,
- GimpData *data,
- gpointer user_data);
-
-
struct _GimpDataFactoryPrivate
{
Gimp *gimp;
@@ -125,10 +120,6 @@ 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,
@@ -879,6 +870,35 @@ 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)
{
@@ -980,30 +1000,6 @@ 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 2af6e42b87..4f3f0036ff 100644
--- a/app/core/gimpdatafactory.h
+++ b/app/core/gimpdatafactory.h
@@ -25,13 +25,17 @@
#include "gimpobject.h"
-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 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 struct _GimpDataFactoryLoaderEntry GimpDataFactoryLoaderEntry;
@@ -123,6 +127,11 @@ 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]