Merge branch 'master' into gobject-introspection

This commit is contained in:
John Cupitt 2011-06-22 10:31:33 +01:00
commit cc330b3cbf
5 changed files with 29 additions and 28 deletions

2
.gitignore vendored
View File

@ -8,6 +8,8 @@ Vips-8.0.typelib
.*.swp
*.lo
*.la
Vips-8.0.gir
Vips-8.0.typelib
*.pc
*.pyc
.deps

View File

@ -230,9 +230,10 @@ G_DEFINE_TYPE( VipsFormatTiff, vips_format_tiff, VIPS_TYPE_FORMAT );
static void *
format_add_class( VipsFormatClass *format, GSList **formats )
{
/* Append so we don't reverse the list of formats.
*/
*formats = g_slist_append( *formats, format );
if( !G_TYPE_IS_ABSTRACT( G_OBJECT_CLASS_TYPE( format ) ) )
/* Append so we don't reverse the list of formats.
*/
*formats = g_slist_append( *formats, format );
return( NULL );
}
@ -267,7 +268,7 @@ vips_format_map( VSListMap2Fn fn, void *a, void *b )
void *result;
formats = NULL;
(void) vips_class_map_concrete_all( g_type_from_name( "VipsFormat" ),
(void) vips_class_map_all( g_type_from_name( "VipsFormat" ),
(VipsClassMap) format_add_class, (void *) &formats );
formats = g_slist_sort( formats, (GCompareFunc) format_compare );

View File

@ -1544,19 +1544,16 @@ vips_type_map( GType base, VipsTypeMap2 fn, void *a, void *b )
return( result );
}
/* Loop over all the concrete subtypes of a base type.
/* Loop over all the subtypes of a base type.
*/
void *
vips_type_map_concrete_all( GType base, VipsTypeMap fn, void *a )
vips_type_map_all( GType base, VipsTypeMap fn, void *a )
{
void *result;
result = NULL;
if( !G_TYPE_IS_ABSTRACT( base ) )
result = fn( base, a );
if( !result )
if( !(result = fn( base, a )) )
result = vips_type_map( base,
(VipsTypeMap2) vips_type_map_concrete_all, fn, a );
(VipsTypeMap2) vips_type_map_all, fn, a );
return( result );
}
@ -1564,20 +1561,16 @@ vips_type_map_concrete_all( GType base, VipsTypeMap fn, void *a )
/* Loop over all the subclasses of a base type.
*/
void *
vips_class_map_concrete_all( GType type, VipsClassMap fn, void *a )
vips_class_map_all( GType type, VipsClassMap fn, void *a )
{
void *result;
result = NULL;
if( !G_TYPE_IS_ABSTRACT( type ) )
/* We never unref this ref, but we never unload classes
* anyway, so so what.
*/
result = fn( VIPS_OBJECT_CLASS( g_type_class_ref( type ) ), a );
if( !result )
/* We never unref this ref, but we never unload classes
* anyway, so so what.
*/
if( !(result = fn( VIPS_OBJECT_CLASS( g_type_class_ref( type ) ), a )) )
result = vips_type_map( type,
(VipsTypeMap2) vips_class_map_concrete_all, fn, a );
(VipsTypeMap2) vips_class_map_all, fn, a );
return( result );
}
@ -1611,7 +1604,7 @@ vips_class_find( const char *basename, const char *nickname )
return( NULL );
}
if( !(class = vips_class_map_concrete_all( base,
if( !(class = vips_class_map_all( base,
(VipsClassMap) test_name, (void *) nickname )) ) {
vips_error( "VipsObject",
_( "class \"%s\" not found" ), nickname );
@ -1629,10 +1622,7 @@ vips_type_find( const char *basename, const char *nickname )
if( !(class = vips_class_find( "VipsObject", nickname )) )
return( 0 );
/* FIXME ... we've not supposed to use G_TYPE_FROM_CLASS(), I think.
* I'm not sure what the alternative is.
*/
return( G_TYPE_FROM_CLASS( class ) );
return( G_OBJECT_CLASS_TYPE( class ) );
}
void

View File

@ -170,6 +170,8 @@ vips_interpolate_real_get_window_offset( VipsInterpolate *interpolate )
static void
vips_interpolate_class_init( VipsInterpolateClass *class )
{
VipsObjectClass *vobject_class = VIPS_OBJECT_CLASS( class );
#ifdef DEBUG
GObjectClass *gobject_class = G_OBJECT_CLASS( class );
#endif /*DEBUG*/
@ -178,6 +180,9 @@ vips_interpolate_class_init( VipsInterpolateClass *class )
gobject_class->finalize = vips_interpolate_finalize;
#endif /*DEBUG*/
vobject_class->nickname = "interpolate";
vobject_class->description = _( "VIPS interpolation class" );
class->interpolate = NULL;
class->get_window_size = vips_interpolate_real_get_window_size;
class->get_window_offset = vips_interpolate_real_get_window_offset;

View File

@ -168,7 +168,10 @@ list_function( im_function *func )
static void *
list_class( VipsObjectClass *class )
{
vips_object_print_class( class );
/* Ignore abstract classes.
*/
if( !G_TYPE_IS_ABSTRACT( G_OBJECT_CLASS_TYPE( class ) ) )
vips_object_print_class( class );
return( NULL );
}
@ -179,7 +182,7 @@ print_list( int argc, char **argv )
if( !argv[0] || strcmp( argv[0], "packages" ) == 0 )
im_map_packages( (VSListMap2Fn) list_package, NULL );
else if( strcmp( argv[0], "classes" ) == 0 )
vips_class_map_concrete_all( g_type_from_name( "VipsObject" ),
vips_class_map_all( g_type_from_name( "VipsObject" ),
(VipsClassMap) list_class, NULL );
else {
if( map_name( argv[0], list_function ) )