Commit c3807c6a authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

added gimp_data_factory_refresh().

2005-04-13  Sven Neumann  <sven@gimp.org>

	* app/core/gimpdatafactory.[ch]: added gimp_data_factory_refresh().

	* app/actions/data-commands.c
	* tools/pdbgen/pdb/brushes.pdb
	* tools/pdbgen/pdb/convert.pdb
	* tools/pdbgen/pdb/gradients.pdb
	* tools/pdbgen/pdb/palettes.pdb
	* tools/pdbgen/pdb/patterns.pdb: use the new function.

	* app/pdb/brushes_cmds.c
	* app/pdb/convert_cmds.c
	* app/pdb/gradients_cmds.c
	* app/pdb/palettes_cmds.c
	* app/pdb/patterns_cmds.c: regenerated.
parent 0c91d7d6
2005-04-13 Sven Neumann <sven@gimp.org>
* app/core/gimpdatafactory.[ch]: added gimp_data_factory_refresh().
* app/actions/data-commands.c
* tools/pdbgen/pdb/brushes.pdb
* tools/pdbgen/pdb/convert.pdb
* tools/pdbgen/pdb/gradients.pdb
* tools/pdbgen/pdb/palettes.pdb
* tools/pdbgen/pdb/patterns.pdb: use the new function.
* app/pdb/brushes_cmds.c
* app/pdb/convert_cmds.c
* app/pdb/gradients_cmds.c
* app/pdb/palettes_cmds.c
* app/pdb/patterns_cmds.c: regenerated.
2005-04-12 Sven Neumann <sven@gimp.org>
* app/core/gimpcontainer.[ch]: added gimp_container_is_empty().
......
......@@ -229,8 +229,7 @@ data_refresh_cmd_callback (GtkAction *action,
{
GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (user_data);
gimp_data_factory_data_save (view->factory);
gimp_data_factory_data_init (view->factory, FALSE);
gimp_data_factory_data_refresh (view->factory);
}
void
......
......@@ -50,6 +50,8 @@ static void gimp_data_factory_init (GimpDataFactory *factory);
static void gimp_data_factory_finalize (GObject *object);
static void gimp_data_factory_data_load (GimpDataFactory *factory);
static gint64 gimp_data_factory_get_memsize (GimpObject *object,
gint64 *gui_size);
......@@ -197,14 +199,41 @@ void
gimp_data_factory_data_init (GimpDataFactory *factory,
gboolean no_data /* FIXME */)
{
gchar *path;
gchar *writable_path;
g_return_if_fail (GIMP_IS_DATA_FACTORY (factory));
if (factory->gimp->be_verbose)
{
const gchar *name = gimp_object_get_name (GIMP_OBJECT (factory));
g_print ("%s: loading data\n", name ? name : "???");
}
gimp_container_freeze (factory->container);
gimp_data_factory_data_load (factory);
gimp_container_thaw (factory->container);
}
void
gimp_data_factory_data_refresh (GimpDataFactory *factory)
{
g_return_if_fail (GIMP_IS_DATA_FACTORY (factory));
gimp_container_freeze (factory->container);
gimp_data_factory_data_save (factory);
gimp_data_factory_data_free (factory);
gimp_data_factory_data_load (factory);
gimp_container_thaw (factory->container);
}
static void
gimp_data_factory_data_load (GimpDataFactory *factory)
{
gchar *path;
gchar *writable_path;
g_object_get (factory->gimp->config,
factory->path_property_name, &path,
......@@ -246,8 +275,6 @@ gimp_data_factory_data_init (GimpDataFactory *factory,
g_free (path);
g_free (writable_path);
gimp_container_thaw (factory->container);
}
void
......@@ -258,7 +285,7 @@ gimp_data_factory_data_save (GimpDataFactory *factory)
g_return_if_fail (GIMP_IS_DATA_FACTORY (factory));
if (gimp_container_num_children (factory->container) == 0)
if (gimp_container_is_empty (factory->container))
return;
writable_dir = gimp_data_factory_get_save_dir (factory);
......@@ -308,7 +335,7 @@ gimp_data_factory_data_free (GimpDataFactory *factory)
g_return_if_fail (GIMP_IS_DATA_FACTORY (factory));
if (gimp_container_num_children (factory->container) == 0)
if (gimp_container_is_empty (factory->container))
return;
list = GIMP_LIST (factory->container);
......@@ -486,9 +513,7 @@ gimp_data_factory_data_save_single (GimpDataFactory *factory,
if (! data->filename)
{
gchar *writable_dir;
writable_dir = gimp_data_factory_get_save_dir (factory);
gchar *writable_dir = gimp_data_factory_get_save_dir (factory);
if (! writable_dir)
return FALSE;
......@@ -554,10 +579,8 @@ gimp_data_factory_get_save_dir (GimpDataFactory *factory)
for (list = writable_list; list; list = g_list_next (list))
{
GList *found;
found = g_list_find_custom (path_list, list->data, (GCompareFunc) strcmp);
GList *found = g_list_find_custom (path_list,
list->data, (GCompareFunc) strcmp);
if (found)
{
writable_dir = g_strdup (found->data);
......@@ -598,11 +621,9 @@ gimp_data_factory_load_data (const GimpDatafileData *file_data,
insert:
{
GimpBaseConfig *base_config;
GimpBaseConfig *base_config = GIMP_BASE_CONFIG (factory->gimp->config);
GList *data_list;
GError *error = NULL;
base_config = GIMP_BASE_CONFIG (factory->gimp->config);
GError *error = NULL;
data_list =
(* factory->loader_entries[i].load_func) (file_data->filename,
......
......@@ -90,6 +90,7 @@ GimpDataFactory * gimp_data_factory_new (Gimp *
void gimp_data_factory_data_init (GimpDataFactory *factory,
gboolean no_data);
void gimp_data_factory_data_refresh (GimpDataFactory *factory);
void gimp_data_factory_data_save (GimpDataFactory *factory);
void gimp_data_factory_data_free (GimpDataFactory *factory);
......
......@@ -59,8 +59,7 @@ brushes_refresh_invoker (Gimp *gimp,
GimpProgress *progress,
Argument *args)
{
gimp_data_factory_data_save (gimp->brush_factory);
gimp_data_factory_data_init (gimp->brush_factory, FALSE);
gimp_data_factory_data_refresh (gimp->brush_factory);
return procedural_db_return_args (&brushes_refresh_proc, TRUE);
}
......
......@@ -196,7 +196,7 @@ image_convert_indexed_invoker (Gimp *gimp,
break;
case GIMP_CUSTOM_PALETTE:
if (! gimp->palette_factory->container->num_children)
if (gimp_container_is_empty (gimp->palette_factory->container))
gimp_data_factory_data_init (gimp->palette_factory, FALSE);
palette = (GimpPalette *)
......
......@@ -56,8 +56,7 @@ gradients_refresh_invoker (Gimp *gimp,
GimpProgress *progress,
Argument *args)
{
gimp_data_factory_data_save (gimp->gradient_factory);
gimp_data_factory_data_init (gimp->gradient_factory, FALSE);
gimp_data_factory_data_refresh (gimp->gradient_factory);
return procedural_db_return_args (&gradients_refresh_proc, TRUE);
}
......
......@@ -56,8 +56,7 @@ palettes_refresh_invoker (Gimp *gimp,
GimpProgress *progress,
Argument *args)
{
gimp_data_factory_data_save (gimp->palette_factory);
gimp_data_factory_data_init (gimp->palette_factory, FALSE);
gimp_data_factory_data_refresh (gimp->palette_factory);
return procedural_db_return_args (&palettes_refresh_proc, TRUE);
}
......
......@@ -55,8 +55,7 @@ patterns_refresh_invoker (Gimp *gimp,
GimpProgress *progress,
Argument *args)
{
gimp_data_factory_data_save (gimp->pattern_factory);
gimp_data_factory_data_init (gimp->pattern_factory, FALSE);
gimp_data_factory_data_refresh (gimp->pattern_factory);
return procedural_db_return_args (&patterns_refresh_proc, TRUE);
}
......
......@@ -88,13 +88,8 @@ HELP
$date = '1997';
%invoke = (
code => <<'CODE'
{
gimp_data_factory_data_save (gimp->brush_factory);
gimp_data_factory_data_init (gimp->brush_factory, FALSE);
}
CODE
);
code => 'gimp_data_factory_data_refresh (gimp->brush_factory);'
)
}
sub brushes_get_list {
......
......@@ -121,7 +121,7 @@ HELP
break;
case GIMP_CUSTOM_PALETTE:
if (! gimp->palette_factory->container->num_children)
if (gimp_container_is_empty (gimp->palette_factory->container))
gimp_data_factory_data_init (gimp->palette_factory, FALSE);
palette = (GimpPalette *)
......
......@@ -37,13 +37,8 @@ HELP
$date = '2002';
%invoke = (
code => <<'CODE'
{
gimp_data_factory_data_save (gimp->gradient_factory);
gimp_data_factory_data_init (gimp->gradient_factory, FALSE);
}
CODE
);
code => 'gimp_data_factory_data_refresh (gimp->gradient_factory);'
)
}
sub gradients_get_list {
......
......@@ -93,13 +93,8 @@ HELP
&adrian_misc;
%invoke = (
code => <<'CODE'
{
gimp_data_factory_data_save (gimp->palette_factory);
gimp_data_factory_data_init (gimp->palette_factory, FALSE);
}
CODE
);
code => 'gimp_data_factory_data_refresh (gimp->palette_factory);'
)
}
sub palettes_get_list {
......
......@@ -61,13 +61,8 @@ HELP
$date = '2002';
%invoke = (
code => <<'CODE'
{
gimp_data_factory_data_save (gimp->pattern_factory);
gimp_data_factory_data_init (gimp->pattern_factory, FALSE);
}
CODE
);
code => 'gimp_data_factory_data_refresh (gimp->pattern_factory);'
)
}
sub patterns_get_list {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment