[gimp] app: add gimp_data_factory_get_data_path[_writable]()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add gimp_data_factory_get_data_path[_writable]()
- Date: Sun, 3 Jun 2018 18:46:48 +0000 (UTC)
commit 68cf2641f8a8109d438587591fd147a992cab189
Author: Michael Natterer <mitch gimp org>
Date: Sun Jun 3 20:42:21 2018 +0200
app: add gimp_data_factory_get_data_path[_writable]()
which return GLists of GFiles. Use the new API in GimpDataFactory's
default implementations.
app/core/gimpdatafactory.c | 72 ++++++++++++++++++++++++++++++----------------
app/core/gimpdatafactory.h | 5 ++++
2 files changed, 53 insertions(+), 24 deletions(-)
---
diff --git a/app/core/gimpdatafactory.c b/app/core/gimpdatafactory.c
index 0a073de932..3baaaca111 100644
--- a/app/core/gimpdatafactory.c
+++ b/app/core/gimpdatafactory.c
@@ -882,6 +882,50 @@ gimp_data_factory_has_data_new_func (GimpDataFactory *factory)
return factory->priv->data_new_func != NULL;
}
+GList *
+gimp_data_factory_get_data_path (GimpDataFactory *factory)
+{
+ GimpDataFactoryPrivate *priv = GET_PRIVATE (factory);
+ gchar *path = NULL;
+ GList *list = NULL;
+
+ g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), NULL);
+
+ g_object_get (priv->gimp->config,
+ priv->path_property_name, &path,
+ NULL);
+
+ if (path)
+ {
+ list = gimp_config_path_expand_to_files (path, NULL);
+ g_free (path);
+ }
+
+ return list;
+}
+
+GList *
+gimp_data_factory_get_data_path_writable (GimpDataFactory *factory)
+{
+ GimpDataFactoryPrivate *priv = GET_PRIVATE (factory);
+ gchar *path = NULL;
+ GList *list = NULL;
+
+ g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), NULL);
+
+ g_object_get (priv->gimp->config,
+ priv->writable_property_name, &path,
+ NULL);
+
+ if (path)
+ {
+ list = gimp_config_path_expand_to_files (path, NULL);
+ g_free (path);
+ }
+
+ return list;
+}
+
/* private functions */
@@ -928,22 +972,12 @@ gimp_data_factory_data_load (GimpDataFactory *factory,
GimpContext *context,
GHashTable *cache)
{
- gchar *p;
- gchar *wp;
GList *path;
GList *writable_path;
GList *list;
- g_object_get (factory->priv->gimp->config,
- factory->priv->path_property_name, &p,
- factory->priv->writable_property_name, &wp,
- NULL);
-
- path = gimp_config_path_expand_to_files (p, NULL);
- writable_path = gimp_config_path_expand_to_files (wp, NULL);
-
- g_free (p);
- g_free (wp);
+ path = gimp_data_factory_get_data_path (factory);
+ writable_path = gimp_data_factory_get_data_path_writable (factory);
for (list = path; list; list = g_list_next (list))
{
@@ -967,22 +1001,12 @@ static GFile *
gimp_data_factory_get_save_dir (GimpDataFactory *factory,
GError **error)
{
- gchar *p;
- gchar *wp;
GList *path;
GList *writable_path;
GFile *writable_dir = NULL;
- g_object_get (factory->priv->gimp->config,
- factory->priv->path_property_name, &p,
- factory->priv->writable_property_name, &wp,
- NULL);
-
- path = gimp_config_path_expand_to_files (p, NULL);
- writable_path = gimp_config_path_expand_to_files (wp, NULL);
-
- g_free (p);
- g_free (wp);
+ path = gimp_data_factory_get_data_path (factory);
+ writable_path = gimp_data_factory_get_data_path_writable (factory);
if (writable_path)
{
diff --git a/app/core/gimpdatafactory.h b/app/core/gimpdatafactory.h
index 8e1abcaf90..397ac14554 100644
--- a/app/core/gimpdatafactory.h
+++ b/app/core/gimpdatafactory.h
@@ -126,6 +126,7 @@ GimpData * gimp_data_factory_data_get_standard (GimpDataFactory *factory,
gboolean gimp_data_factory_data_save_single (GimpDataFactory *factory,
GimpData *data,
GError **error);
+
GType gimp_data_factory_get_data_type (GimpDataFactory *factory);
GimpContainer * gimp_data_factory_get_container (GimpDataFactory *factory);
GimpContainer * gimp_data_factory_get_container_obsolete
@@ -133,5 +134,9 @@ GimpContainer * gimp_data_factory_get_container_obsolete
Gimp * gimp_data_factory_get_gimp (GimpDataFactory *factory);
gboolean gimp_data_factory_has_data_new_func (GimpDataFactory *factory);
+GList * gimp_data_factory_get_data_path (GimpDataFactory *factory);
+GList * gimp_data_factory_get_data_path_writable
+ (GimpDataFactory *factory);
+
#endif /* __GIMP_DATA_FACTORY_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]