From: Daiki Ueno Date: Fri, 19 Dec 2014 06:49:53 +0000 (+0900) Subject: gtkmodule: Respect "alias" attribute in gresource X-Git-Tag: 0.27.1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c268a67864fe594371925549b6fc94cfb25314f;p=thirdparty%2Fvala.git gtkmodule: Respect "alias" attribute in gresource Though undocumented, glib-compile-resources looks at "alias" attribute of "file" element and maps the physical file name to a logical path name. https://bugzilla.gnome.org/show_bug.cgi?id=741743 --- diff --git a/codegen/valagtkmodule.vala b/codegen/valagtkmodule.vala index deb070455..ecc709f64 100644 --- a/codegen/valagtkmodule.vala +++ b/codegen/valagtkmodule.vala @@ -70,16 +70,22 @@ public class Vala.GtkModule : GSignalModule { int state = 0; string prefix = null; + string alias = null; MarkupTokenType current_token = reader.read_token (null, null); while (current_token != MarkupTokenType.EOF) { if (current_token == MarkupTokenType.START_ELEMENT && reader.name == "gresource") { prefix = reader.get_attribute ("prefix"); } else if (current_token == MarkupTokenType.START_ELEMENT && reader.name == "file") { + alias = reader.get_attribute ("alias"); state = 1; } else if (state == 1 && current_token == MarkupTokenType.TEXT) { var name = reader.content; - gresource_to_file_map.set (Path.build_filename (prefix, name), Path.build_filename (gresource_dir, name)); + var filename = Path.build_filename (gresource_dir, name); + if (alias != null) { + gresource_to_file_map.set (Path.build_filename (prefix, alias), filename); + } + gresource_to_file_map.set (Path.build_filename (prefix, name), filename); state = 0; } current_token = reader.read_token (null, null);