From: Florian Brosch Date: Sat, 18 Aug 2012 01:00:43 +0000 (+0200) Subject: doclets/gtkdoc: Fix [Deprecated] X-Git-Tag: 0.37.1~3^2~139 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d7827a824e958123bd43df53d8d3019decd4b3d;p=thirdparty%2Fvala.git doclets/gtkdoc: Fix [Deprecated] --- diff --git a/src/doclets/gtkdoc/generator.vala b/src/doclets/gtkdoc/generator.vala index 4c929ab7a..75b3b1e10 100644 --- a/src/doclets/gtkdoc/generator.vala +++ b/src/doclets/gtkdoc/generator.vala @@ -998,7 +998,7 @@ It is important that your GValue ho replacement_symbol_name = replacement_symbol_name[0:-2]; } - replacement_symbol = current_tree.search_symbol_str (sym, replacement.value); + replacement_symbol = current_tree.search_symbol_str (sym, replacement_symbol_name); } if (replacement != null && replacement_symbol == null) { @@ -1008,11 +1008,11 @@ It is important that your GValue ho var deprecation_string = "No replacement specified."; if (since != null && replacement_symbol != null) { - deprecation_string = "%s: Replaced by %s.".printf (since, get_docbook_link (replacement_symbol)); + deprecation_string = "%s: Replaced by %s.".printf (since, get_gtkdoc_link (replacement_symbol)); } else if (since != null && replacement_symbol == null) { deprecation_string = "%s: No replacement specified.".printf (since); } else if (since == null && replacement_symbol != null) { - deprecation_string = "Replaced by %s.".printf (get_docbook_link (replacement_symbol)); + deprecation_string = "Replaced by %s.".printf (get_gtkdoc_link (replacement_symbol)); } else { reporter.simple_warning ("Missing ‘since’ and ‘replacement’ arguments to ‘Deprecated’ attribute on %s.", sym.get_full_name ()); } diff --git a/src/doclets/gtkdoc/utils.vala b/src/doclets/gtkdoc/utils.vala index 9bd2df5a9..93037d665 100644 --- a/src/doclets/gtkdoc/utils.vala +++ b/src/doclets/gtkdoc/utils.vala @@ -60,6 +60,8 @@ namespace Gtkdoc { return ((Api.Delegate)item).get_cname (); } else if (item is Api.Enum) { return ((Api.Enum)item).get_cname (); + } else if (item is Api.EnumValue) { + return ((Api.EnumValue)item).get_cname (); } return null; } @@ -77,6 +79,39 @@ namespace Gtkdoc { return """%s""".printf (to_docbook_id (cls.get_type_id ()), cls.get_type_id ()); } + public string? get_gtkdoc_link (Api.Node symbol) { + if (symbol is Class || symbol is Interface || symbol is Struct || symbol is Enum || symbol is ErrorDomain) { + return "#%s".printf (get_cname (symbol)); + } + + if (symbol is Method) { + return "%s ()".printf (((Method) symbol).get_cname ()); + } + + if (symbol is Constant || symbol is Api.EnumValue || symbol is ErrorCode) { + return "%%%s".printf (get_cname (symbol)); + } + + if (symbol is Api.Signal) { + return "#%s::%s".printf (get_cname (symbol.parent), ((Api.Signal) symbol).get_cname ()); + } + + if (symbol is Property) { + return "#%s:%s".printf (get_cname (symbol.parent), ((Property) symbol).get_cname ()); + } + + if (symbol is Field && (symbol.parent is Class || symbol.parent is Struct)) { + var field = symbol as Field; + if (field.is_static) { + return field.get_cname (); + } else { + return "#%s.%s".printf (get_cname (symbol.parent), field.get_cname ()); + } + } + + return get_cname (symbol) ?? symbol.get_full_name (); + } + public string? get_docbook_link (Api.Item item, bool is_dbus = false, bool is_async_finish = false) { if (item is Api.Method) { string name;