gimp r25355 - in trunk: . app/pdb tools/pdbgen/pdb
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r25355 - in trunk: . app/pdb tools/pdbgen/pdb
- Date: Fri, 4 Apr 2008 08:11:13 +0100 (BST)
Author: neo
Date: Fri Apr 4 08:11:13 2008
New Revision: 25355
URL: http://svn.gnome.org/viewvc/gimp?rev=25355&view=rev
Log:
2008-04-04 Sven Neumann <sven gimp org>
* tools/pdbgen/pdb/image.pdb: improved error handling.
* app/pdb/image_cmds.c: regenerated.
Modified:
trunk/ChangeLog
trunk/app/pdb/gimppdb-utils.c
trunk/app/pdb/image_cmds.c
trunk/tools/pdbgen/pdb/image.pdb
Modified: trunk/app/pdb/gimppdb-utils.c
==============================================================================
--- trunk/app/pdb/gimppdb-utils.c (original)
+++ trunk/app/pdb/gimppdb-utils.c Fri Apr 4 08:11:13 2008
@@ -364,8 +364,8 @@
return TRUE;
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
- _("Image '%s' (%d) is of type %s, "
- "but an image of type %s is expected"),
+ _("Image '%s' (%d) is of type '%s', "
+ "but an image of type '%s' is expected"),
gimp_object_get_name (GIMP_OBJECT (image)),
gimp_image_get_ID (image),
gimp_pdb_enum_value_get_nick (GIMP_TYPE_IMAGE_BASE_TYPE,
@@ -387,7 +387,7 @@
return TRUE;
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
- _("Image '%s' (%d) is already of type %s"),
+ _("Image '%s' (%d) is already of type '%s'"),
gimp_object_get_name (GIMP_OBJECT (image)),
gimp_image_get_ID (image),
gimp_pdb_enum_value_get_nick (GIMP_TYPE_IMAGE_BASE_TYPE, type));
Modified: trunk/app/pdb/image_cmds.c
==============================================================================
--- trunk/app/pdb/image_cmds.c (original)
+++ trunk/app/pdb/image_cmds.c Fri Apr 4 08:11:13 2008
@@ -54,6 +54,7 @@
#include "gimppdb.h"
#include "gimppdberror.h"
+#include "gimppdb-utils.h"
#include "gimpprocedure.h"
#include "internal_procs.h"
@@ -841,15 +842,25 @@
if (success)
{
- if (! g_object_is_floating (layer) ||
- GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (layer))) !=
- gimp_image_base_type (image))
- {
- success = FALSE;
- }
- else
+ success = gimp_pdb_image_is_base_type (image,
+ GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (layer))),
+ error);
+
+ if (success)
{
- success = gimp_image_add_layer (image, layer, MAX (position, -1));
+ if (g_object_is_floating (layer))
+ {
+ success = gimp_image_add_layer (image, layer, MAX (position, -1));
+ }
+ else
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
+ _("Layer '%s' (%d) has already been added to an image"),
+ gimp_object_get_name (GIMP_OBJECT (layer)),
+ gimp_item_get_ID (GIMP_ITEM (layer)));
+
+ success = FALSE;
+ }
}
}
@@ -1847,11 +1858,11 @@
if (success)
{
if (component == GIMP_GRAY_CHANNEL)
- success = gimp_image_base_type (image) == GIMP_GRAY;
+ success = gimp_pdb_image_is_base_type (image, GIMP_GRAY, error);
else if (component == GIMP_INDEXED_CHANNEL)
- success = gimp_image_base_type (image) == GIMP_INDEXED;
+ success = gimp_pdb_image_is_base_type (image, GIMP_INDEXED, error);
else
- success = gimp_image_base_type (image) == GIMP_RGB;
+ success = gimp_pdb_image_is_base_type (image, GIMP_RGB, error);
if (success)
active = gimp_image_get_component_active (image, component);
@@ -1885,11 +1896,11 @@
if (success)
{
if (component == GIMP_GRAY_CHANNEL)
- success = gimp_image_base_type (image) == GIMP_GRAY;
+ success = gimp_pdb_image_is_base_type (image, GIMP_GRAY, error);
else if (component == GIMP_INDEXED_CHANNEL)
- success = gimp_image_base_type (image) == GIMP_INDEXED;
+ success = gimp_pdb_image_is_base_type (image, GIMP_INDEXED, error);
else
- success = gimp_image_base_type (image) == GIMP_RGB;
+ success = gimp_pdb_image_is_base_type (image, GIMP_RGB, error);
if (success)
gimp_image_set_component_active (image, component, active);
@@ -1918,11 +1929,11 @@
if (success)
{
if (component == GIMP_GRAY_CHANNEL)
- success = gimp_image_base_type (image) == GIMP_GRAY;
+ success = gimp_pdb_image_is_base_type (image, GIMP_GRAY, error);
else if (component == GIMP_INDEXED_CHANNEL)
- success = gimp_image_base_type (image) == GIMP_INDEXED;
+ success = gimp_pdb_image_is_base_type (image, GIMP_INDEXED, error);
else
- success = gimp_image_base_type (image) == GIMP_RGB;
+ success = gimp_pdb_image_is_base_type (image, GIMP_RGB, error);
if (success)
visible = gimp_image_get_component_visible (image, component);
@@ -1956,11 +1967,11 @@
if (success)
{
if (component == GIMP_GRAY_CHANNEL)
- success = gimp_image_base_type (image) == GIMP_GRAY;
+ success = gimp_pdb_image_is_base_type (image, GIMP_GRAY, error);
else if (component == GIMP_INDEXED_CHANNEL)
- success = gimp_image_base_type (image) == GIMP_INDEXED;
+ success = gimp_pdb_image_is_base_type (image, GIMP_INDEXED, error);
else
- success = gimp_image_base_type (image) == GIMP_RGB;
+ success = gimp_pdb_image_is_base_type (image, GIMP_RGB, error);
if (success)
gimp_image_set_component_visible (image, component, visible);
Modified: trunk/tools/pdbgen/pdb/image.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/image.pdb (original)
+++ trunk/tools/pdbgen/pdb/image.pdb Fri Apr 4 08:11:13 2008
@@ -963,15 +963,25 @@
$invoke{code} = <<'CODE';
{
- if (! g_object_is_floating (layer) ||
- GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (layer))) !=
- gimp_image_base_type (image))
- {
- success = FALSE;
- }
- else
+ success = gimp_pdb_image_is_base_type (image,
+ GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (layer))),
+ error);
+
+ if (success)
{
- success = gimp_image_add_layer (image, layer, MAX (position, -1));
+ if (g_object_is_floating (layer))
+ {
+ success = gimp_image_add_layer (image, layer, MAX (position, -1));
+ }
+ else
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
+ _("Layer '%s' (%d) has already been added to an image"),
+ gimp_object_get_name (GIMP_OBJECT (layer)),
+ gimp_item_get_ID (GIMP_ITEM (layer)));
+
+ success = FALSE;
+ }
}
}
CODE
@@ -1936,11 +1946,11 @@
code => <<'CODE'
{
if (component == GIMP_GRAY_CHANNEL)
- success = gimp_image_base_type (image) == GIMP_GRAY;
+ success = gimp_pdb_image_is_base_type (image, GIMP_GRAY, error);
else if (component == GIMP_INDEXED_CHANNEL)
- success = gimp_image_base_type (image) == GIMP_INDEXED;
+ success = gimp_pdb_image_is_base_type (image, GIMP_INDEXED, error);
else
- success = gimp_image_base_type (image) == GIMP_RGB;
+ success = gimp_pdb_image_is_base_type (image, GIMP_RGB, error);
if (success)
active = gimp_image_get_component_active (image, component);
@@ -1974,11 +1984,11 @@
code => <<'CODE'
{
if (component == GIMP_GRAY_CHANNEL)
- success = gimp_image_base_type (image) == GIMP_GRAY;
+ success = gimp_pdb_image_is_base_type (image, GIMP_GRAY, error);
else if (component == GIMP_INDEXED_CHANNEL)
- success = gimp_image_base_type (image) == GIMP_INDEXED;
+ success = gimp_pdb_image_is_base_type (image, GIMP_INDEXED, error);
else
- success = gimp_image_base_type (image) == GIMP_RGB;
+ success = gimp_pdb_image_is_base_type (image, GIMP_RGB, error);
if (success)
gimp_image_set_component_active (image, component, active);
@@ -2015,11 +2025,11 @@
code => <<'CODE'
{
if (component == GIMP_GRAY_CHANNEL)
- success = gimp_image_base_type (image) == GIMP_GRAY;
+ success = gimp_pdb_image_is_base_type (image, GIMP_GRAY, error);
else if (component == GIMP_INDEXED_CHANNEL)
- success = gimp_image_base_type (image) == GIMP_INDEXED;
+ success = gimp_pdb_image_is_base_type (image, GIMP_INDEXED, error);
else
- success = gimp_image_base_type (image) == GIMP_RGB;
+ success = gimp_pdb_image_is_base_type (image, GIMP_RGB, error);
if (success)
visible = gimp_image_get_component_visible (image, component);
@@ -2053,11 +2063,11 @@
code => <<'CODE'
{
if (component == GIMP_GRAY_CHANNEL)
- success = gimp_image_base_type (image) == GIMP_GRAY;
+ success = gimp_pdb_image_is_base_type (image, GIMP_GRAY, error);
else if (component == GIMP_INDEXED_CHANNEL)
- success = gimp_image_base_type (image) == GIMP_INDEXED;
+ success = gimp_pdb_image_is_base_type (image, GIMP_INDEXED, error);
else
- success = gimp_image_base_type (image) == GIMP_RGB;
+ success = gimp_pdb_image_is_base_type (image, GIMP_RGB, error);
if (success)
gimp_image_set_component_visible (image, component, visible);
@@ -2551,6 +2561,7 @@
"core/gimplist.h"
"core/gimpunit.h"
"gimppdberror.h"
+ "gimppdb-utils.h"
"gimp-intl.h");
@procs = qw(image_is_valid
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]