]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
doclets/gtkdoc: Fix [Deprecated]
authorFlorian Brosch <flo.brosch@gmail.com>
Sat, 18 Aug 2012 01:00:43 +0000 (03:00 +0200)
committerFlorian Brosch <flo.brosch@gmail.com>
Sat, 18 Aug 2012 01:04:19 +0000 (03:04 +0200)
src/doclets/gtkdoc/generator.vala
src/doclets/gtkdoc/utils.vala

index 4c929ab7a2200a7ac8616a3a642a1ac288ece40b..75b3b1e10f9d1ab2b9ba114d7d74afc734b08736 100644 (file)
@@ -998,7 +998,7 @@ It is important that your <link linkend=\"GValue\"><type>GValue</type></link> 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 <link linkend=\"GValue\"><type>GValue</type></link> 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 ());
                        }
index 9bd2df5a924c13939022bf0c4d18e6d8572ce234..93037d6658f935e12a03d12d06c3280aec863fc7 100644 (file)
@@ -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 """<link linkend="%s:CAPS"><literal>%s</literal></link>""".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;