[gimp] app: simplify handling of a GimpDataFactory's writable_path
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: simplify handling of a GimpDataFactory's writable_path
- Date: Sat, 26 Jul 2014 12:23:15 +0000 (UTC)
commit e618a2866c46152c541b9ed9b8f8abb13434aa51
Author: Michael Natterer <mitch gimp org>
Date: Sat Jul 26 14:21:39 2014 +0200
app: simplify handling of a GimpDataFactory's writable_path
Simply keep it around in GimpDataLoadContext during loading, instead
of g_object_set/getting it on the factory.
app/core/gimpdatafactory.c | 22 ++++++----------------
1 files changed, 6 insertions(+), 16 deletions(-)
---
diff --git a/app/core/gimpdatafactory.c b/app/core/gimpdatafactory.c
index 169f9c6..f5bbf71 100644
--- a/app/core/gimpdatafactory.c
+++ b/app/core/gimpdatafactory.c
@@ -41,8 +41,6 @@
#include "gimp-intl.h"
-#define WRITABLE_PATH_KEY "gimp-data-factory-writable-path"
-
/* Data files that have this string in their path are considered
* obsolete and are only kept around for backwards compatibility
*/
@@ -311,6 +309,7 @@ typedef struct
GimpContext *context;
GHashTable *cache;
const gchar *top_directory;
+ GList *writable_path;
} GimpDataLoadContext;
static void
@@ -328,9 +327,8 @@ gimp_data_factory_data_load (GimpDataFactory *factory,
if (path && strlen (path))
{
- GList *writable_list = NULL;
- gchar *tmp;
GimpDataLoadContext load_context = { 0, };
+ gchar *tmp;
load_context.factory = factory;
load_context.context = context;
@@ -346,10 +344,8 @@ gimp_data_factory_data_load (GimpDataFactory *factory,
g_free (writable_path);
writable_path = tmp;
- writable_list = gimp_path_parse (writable_path, 256, TRUE, NULL);
-
- g_object_set_data (G_OBJECT (factory),
- WRITABLE_PATH_KEY, writable_list);
+ load_context.writable_path = gimp_path_parse (writable_path,
+ 256, TRUE, NULL);
}
gimp_datafiles_read_directories (path, G_FILE_TEST_IS_REGULAR,
@@ -362,8 +358,7 @@ gimp_data_factory_data_load (GimpDataFactory *factory,
if (writable_path)
{
- gimp_path_free (writable_list);
- g_object_set_data (G_OBJECT (factory), WRITABLE_PATH_KEY, NULL);
+ gimp_path_free (load_context.writable_path);
}
}
@@ -929,14 +924,9 @@ gimp_data_factory_load_data (const GimpDatafileData *file_data,
/* obsolete files are immutable, don't check their writability */
if (! obsolete)
{
- GList *writable_list;
-
- writable_list = g_object_get_data (G_OBJECT (factory),
- WRITABLE_PATH_KEY);
-
deletable = (g_list_length (data_list) == 1 &&
gimp_data_factory_is_dir_writable (file_data->dirname,
- writable_list));
+ context->writable_path));
writable = (deletable && loader->writable);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]