Merge branch 'bug556331-includecleanup'

svn path=/trunk/; revision=724
This commit is contained in:
Colin Walters 2008-10-16 01:40:29 +00:00
parent cab23be329
commit 7db23628b0
2 changed files with 16 additions and 8 deletions

View File

@ -1060,7 +1060,7 @@ g_irepository_require (GIRepository *repository,
if (version != NULL) if (version != NULL)
g_set_error (error, G_IREPOSITORY_ERROR, g_set_error (error, G_IREPOSITORY_ERROR,
G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND, G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND,
"Typelib file %s for namespace '%s', version '%s' not found", "Typelib file for namespace '%s', version '%s' not found",
namespace, version); namespace, version);
else else
g_set_error (error, G_IREPOSITORY_ERROR, g_set_error (error, G_IREPOSITORY_ERROR,

View File

@ -130,7 +130,7 @@ static GMarkupParser firstpass_parser =
}; };
static char * static char *
locate_gir (const char *name, const char * const* extra_paths) locate_gir (const char *name, const char *version, const char * const* extra_paths)
{ {
const gchar *const *datadirs; const gchar *const *datadirs;
const gchar *const *dir; const gchar *const *dir;
@ -141,7 +141,7 @@ locate_gir (const char *name, const char * const* extra_paths)
datadirs = g_get_system_data_dirs (); datadirs = g_get_system_data_dirs ();
girname = g_strdup_printf ("%s.gir", name); girname = g_strdup_printf ("%s-%s.gir", name, version);
for (dir = datadirs; *dir; dir++) for (dir = datadirs; *dir; dir++)
{ {
@ -981,7 +981,6 @@ start_alias (GMarkupParseContext *context,
{ {
key = g_strdup (name); key = g_strdup (name);
} }
g_hash_table_insert (ctx->aliases, key, value); g_hash_table_insert (ctx->aliases, key, value);
return TRUE; return TRUE;
@ -2048,6 +2047,7 @@ static gboolean
parse_include (GMarkupParseContext *context, parse_include (GMarkupParseContext *context,
ParseContext *ctx, ParseContext *ctx,
const char *name, const char *name,
const char *version,
GError **error) GError **error)
{ {
ParseContext sub_ctx = { 0 }; ParseContext sub_ctx = { 0 };
@ -2056,7 +2056,7 @@ parse_include (GMarkupParseContext *context,
gsize length; gsize length;
char *girpath; char *girpath;
girpath = locate_gir (name, ctx->includes); girpath = locate_gir (name, version, ctx->includes);
if (girpath == NULL) if (girpath == NULL)
{ {
@ -2231,19 +2231,27 @@ start_element_handler (GMarkupParseContext *context,
ctx->state == STATE_REPOSITORY) ctx->state == STATE_REPOSITORY)
{ {
const gchar *name; const gchar *name;
const gchar *version;
name = find_attribute ("name", attribute_names, attribute_values); name = find_attribute ("name", attribute_names, attribute_values);
version = find_attribute ("version", attribute_names, attribute_values);
if (name == NULL) if (name == NULL)
{ {
MISSING_ATTRIBUTE (context, error, element_name, "name"); MISSING_ATTRIBUTE (context, error, element_name, "name");
break; break;
} }
if (version == NULL)
{
MISSING_ATTRIBUTE (context, error, element_name, "version");
break;
}
if (!parse_include (context, ctx, name, error)) if (!parse_include (context, ctx, name, version, error))
break; break;
ctx->dependencies = g_list_prepend (ctx->dependencies, g_strdup (name)); ctx->dependencies = g_list_prepend (ctx->dependencies,
g_strdup_printf ("%s-%s", name, version));
state_switch (ctx, STATE_INCLUDE); state_switch (ctx, STATE_INCLUDE);