[vala] girparser: Set GIR name when symbols get renamed



commit 2c54d56d6acd58d12d222ceda697ed97f546ad07
Author: Luca Bruno <lucabru src gnome org>
Date:   Thu Aug 4 09:04:35 2011 +0200

    girparser: Set GIR name when symbols get renamed

 vala/valagirparser.vala     |   18 ++++++++++++++----
 vapi/gtksourceview-3.0.vapi |   30 ++++++++++++++++++++++++++++++
 vapi/libsoup-2.4.vapi       |    2 ++
 3 files changed, 46 insertions(+), 4 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 38f091b..d02af03 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -567,6 +567,14 @@ public class Vala.GirParser : CodeVisitor {
 			}
 		}
 
+		public string get_gir_name () {
+			var gir_name = girdata["name"];
+			if (gir_name == null) {
+				gir_name = girdata["glib:name"];
+			}
+			return gir_name;
+		}
+
 		public string get_lower_case_cprefix () {
 			if (name == null) {
 				return "";
@@ -963,6 +971,11 @@ public class Vala.GirParser : CodeVisitor {
 				if (get_lower_case_csuffix () != get_default_lower_case_csuffix ()) {
 					symbol.set_attribute_string ("CCode", "lower_case_csuffix", get_lower_case_csuffix ());
 				}
+
+				// set gir name if the symbol has been renamed
+				if (is_container (symbol) && !(symbol is Namespace) && name != get_gir_name ()) {
+					symbol.set_attribute_string ("GIR", "name", get_gir_name ());
+				}
 			}
 
 			if (!(new_symbol && merged) && is_container (symbol)) {
@@ -1704,10 +1717,7 @@ public class Vala.GirParser : CodeVisitor {
 		node.metadata = metadata;
 		node.source_reference = get_current_src ();
 
-		var gir_name = node.girdata["name"];
-		if (gir_name == null) {
-			gir_name = node.girdata["glib:name"];
-		}
+		var gir_name = node.get_gir_name ();
 		if (parent != current || gir_name != name) {
 			set_symbol_mapping (new UnresolvedSymbol (null, gir_name), node.get_unresolved_symbol ());
 		}
diff --git a/vapi/gtksourceview-3.0.vapi b/vapi/gtksourceview-3.0.vapi
index 8ecfedf..0eb41e1 100644
--- a/vapi/gtksourceview-3.0.vapi
+++ b/vapi/gtksourceview-3.0.vapi
@@ -9,6 +9,7 @@ namespace Gtk {
 		public const string INTERACTIVE;
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_buffer_get_type ()")]
+	[GIR (name = "Buffer")]
 	public class SourceBuffer : Gtk.TextBuffer {
 		[CCode (has_construct_function = false)]
 		public SourceBuffer (Gtk.TextTagTable? table);
@@ -59,6 +60,7 @@ namespace Gtk {
 		public virtual signal void undo ();
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_get_type ()")]
+	[GIR (name = "Completion")]
 	public class SourceCompletion : GLib.Object {
 		[CCode (has_construct_function = false)]
 		protected SourceCompletion ();
@@ -100,6 +102,7 @@ namespace Gtk {
 		public virtual signal void show ();
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_context_get_type ()")]
+	[GIR (name = "CompletionContext")]
 	public class SourceCompletionContext : GLib.InitiallyUnowned {
 		[CCode (has_construct_function = false)]
 		protected SourceCompletionContext ();
@@ -115,6 +118,7 @@ namespace Gtk {
 		public virtual signal void cancelled ();
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_info_get_type ()")]
+	[GIR (name = "CompletionInfo")]
 	public class SourceCompletionInfo : Gtk.Window, Atk.Implementor, Gtk.Buildable {
 		[CCode (has_construct_function = false)]
 		public SourceCompletionInfo ();
@@ -124,6 +128,7 @@ namespace Gtk {
 		public virtual signal void before_show ();
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_item_get_type ()")]
+	[GIR (name = "CompletionItem")]
 	public class SourceCompletionItem : GLib.Object, Gtk.SourceCompletionProposal {
 		[CCode (has_construct_function = false)]
 		public SourceCompletionItem (string label, string text, Gdk.Pixbuf? icon, string? info);
@@ -143,6 +148,7 @@ namespace Gtk {
 		public string text { owned get; set; }
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_words_get_type ()")]
+	[GIR (name = "CompletionWords")]
 	public class SourceCompletionWords : GLib.Object, Gtk.SourceCompletionProvider {
 		[CCode (has_construct_function = false)]
 		public SourceCompletionWords (string? name, Gdk.Pixbuf? icon);
@@ -164,6 +170,7 @@ namespace Gtk {
 		public uint scan_batch_size { get; set construct; }
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_gutter_get_type ()")]
+	[GIR (name = "Gutter")]
 	public class SourceGutter : GLib.Object {
 		[CCode (has_construct_function = false)]
 		protected SourceGutter ();
@@ -184,6 +191,7 @@ namespace Gtk {
 		public int ypad { get; set construct; }
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_gutter_renderer_get_type ()")]
+	[GIR (name = "GutterRenderer")]
 	public abstract class SourceGutterRenderer : GLib.InitiallyUnowned {
 		[CCode (has_construct_function = false)]
 		protected SourceGutterRenderer ();
@@ -234,6 +242,7 @@ namespace Gtk {
 		public virtual signal void queue_draw ();
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_gutter_renderer_pixbuf_get_type ()")]
+	[GIR (name = "GutterRendererPixbuf")]
 	public class SourceGutterRendererPixbuf : Gtk.SourceGutterRenderer {
 		[CCode (has_construct_function = false, type = "GtkSourceGutterRenderer*")]
 		public SourceGutterRendererPixbuf ();
@@ -251,6 +260,7 @@ namespace Gtk {
 		public string stock_id { get; set; }
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_gutter_renderer_text_get_type ()")]
+	[GIR (name = "GutterRendererText")]
 	public class SourceGutterRendererText : Gtk.SourceGutterRenderer {
 		[CCode (has_construct_function = false, type = "GtkSourceGutterRenderer*")]
 		public SourceGutterRendererText ();
@@ -264,6 +274,7 @@ namespace Gtk {
 		public string text { owned get; set construct; }
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_language_get_type ()")]
+	[GIR (name = "Language")]
 	public class SourceLanguage : GLib.Object {
 		[CCode (has_construct_function = false)]
 		protected SourceLanguage ();
@@ -285,6 +296,7 @@ namespace Gtk {
 		public string section { get; }
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_language_manager_get_type ()")]
+	[GIR (name = "LanguageManager")]
 	public class SourceLanguageManager : GLib.Object {
 		[CCode (has_construct_function = false)]
 		public SourceLanguageManager ();
@@ -302,6 +314,7 @@ namespace Gtk {
 		public string[] search_path { get; set; }
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_mark_get_type ()")]
+	[GIR (name = "Mark")]
 	public class SourceMark : Gtk.TextMark {
 		[CCode (has_construct_function = false)]
 		public SourceMark (string name, string category);
@@ -311,6 +324,7 @@ namespace Gtk {
 		public string category { get; construct; }
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_mark_attributes_get_type ()")]
+	[GIR (name = "MarkAttributes")]
 	public class SourceMarkAttributes : GLib.Object {
 		[CCode (has_construct_function = false)]
 		public SourceMarkAttributes ();
@@ -337,6 +351,7 @@ namespace Gtk {
 		public signal string query_tooltip_text (Gtk.SourceMark mark);
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_print_compositor_get_type ()")]
+	[GIR (name = "PrintCompositor")]
 	public class SourcePrintCompositor : GLib.Object {
 		[CCode (has_construct_function = false)]
 		public SourcePrintCompositor (Gtk.SourceBuffer buffer);
@@ -391,6 +406,7 @@ namespace Gtk {
 		public Gtk.WrapMode wrap_mode { get; set; }
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_style_get_type ()")]
+	[GIR (name = "Style")]
 	public class SourceStyle : GLib.Object {
 		[CCode (has_construct_function = false)]
 		protected SourceStyle ();
@@ -425,6 +441,7 @@ namespace Gtk {
 		public bool underline_set { get; construct; }
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_style_scheme_get_type ()")]
+	[GIR (name = "StyleScheme")]
 	public class SourceStyleScheme : GLib.Object {
 		[CCode (has_construct_function = false)]
 		protected SourceStyleScheme ();
@@ -441,6 +458,7 @@ namespace Gtk {
 		public string name { get; }
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_style_scheme_manager_get_type ()")]
+	[GIR (name = "StyleSchemeManager")]
 	public class SourceStyleSchemeManager : GLib.Object {
 		[CCode (has_construct_function = false)]
 		public SourceStyleSchemeManager ();
@@ -460,6 +478,7 @@ namespace Gtk {
 		public string[] search_path { get; set; }
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_view_get_type ()")]
+	[GIR (name = "View")]
 	public class SourceView : Gtk.TextView, Atk.Implementor, Gtk.Buildable, Gtk.Scrollable {
 		[CCode (has_construct_function = false, type = "GtkWidget*")]
 		public SourceView ();
@@ -515,6 +534,7 @@ namespace Gtk {
 		public virtual signal void undo ();
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_proposal_get_type ()")]
+	[GIR (name = "CompletionProposal")]
 	public interface SourceCompletionProposal : GLib.Object {
 		public virtual bool equal (Gtk.SourceCompletionProposal other);
 		public virtual unowned Gdk.Pixbuf get_icon ();
@@ -527,6 +547,7 @@ namespace Gtk {
 		public virtual signal void changed ();
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_provider_get_type ()")]
+	[GIR (name = "CompletionProvider")]
 	public interface SourceCompletionProvider : GLib.Object {
 		public virtual bool activate_proposal (Gtk.SourceCompletionProposal proposal, Gtk.TextIter iter);
 		public virtual Gtk.SourceCompletionActivation get_activation ();
@@ -541,6 +562,7 @@ namespace Gtk {
 		public virtual void update_info (Gtk.SourceCompletionProposal proposal, Gtk.SourceCompletionInfo info);
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_undo_manager_get_type ()")]
+	[GIR (name = "UndoManager")]
 	public interface SourceUndoManager : GLib.Object {
 		public abstract void begin_not_undoable_action ();
 		public abstract bool can_redo ();
@@ -554,6 +576,7 @@ namespace Gtk {
 		public virtual signal void can_undo_changed ();
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_BRACKET_MATCH_")]
+	[GIR (name = "BracketMatchType")]
 	public enum SourceBracketMatchType {
 		NONE,
 		OUT_OF_RANGE,
@@ -562,6 +585,7 @@ namespace Gtk {
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_COMPLETION_ACTIVATION_")]
 	[Flags]
+	[GIR (name = "CompletionActivation")]
 	public enum SourceCompletionActivation {
 		NONE,
 		INTERACTIVE,
@@ -569,6 +593,7 @@ namespace Gtk {
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_DRAW_SPACES_")]
 	[Flags]
+	[GIR (name = "DrawSpacesFlags")]
 	public enum SourceDrawSpacesFlags {
 		SPACE,
 		TAB,
@@ -580,6 +605,7 @@ namespace Gtk {
 		ALL
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_")]
+	[GIR (name = "GutterRendererAlignmentMode")]
 	public enum SourceGutterRendererAlignmentMode {
 		CELL,
 		FIRST,
@@ -587,6 +613,7 @@ namespace Gtk {
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_GUTTER_RENDERER_STATE_")]
 	[Flags]
+	[GIR (name = "GutterRendererState")]
 	public enum SourceGutterRendererState {
 		NORMAL,
 		CURSOR,
@@ -594,6 +621,7 @@ namespace Gtk {
 		SELECTED
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_SMART_HOME_END_")]
+	[GIR (name = "SmartHomeEndType")]
 	public enum SourceSmartHomeEndType {
 		DISABLED,
 		BEFORE,
@@ -601,11 +629,13 @@ namespace Gtk {
 		ALWAYS
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_VIEW_GUTTER_POSITION_")]
+	[GIR (name = "ViewGutterPosition")]
 	public enum SourceViewGutterPosition {
 		LINES,
 		MARKS
 	}
 	[CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_COMPLETION_ERROR_")]
+	[GIR (name = "CompletionError")]
 	public errordomain SourceCompletionError {
 		ALREADY_BOUND,
 		NOT_BOUND;
diff --git a/vapi/libsoup-2.4.vapi b/vapi/libsoup-2.4.vapi
index 3c3a400..cfcf119 100644
--- a/vapi/libsoup-2.4.vapi
+++ b/vapi/libsoup-2.4.vapi
@@ -26,11 +26,13 @@ namespace Soup {
 	}
 	namespace XMLRPC {
 		[CCode (cheader_filename = "libsoup/soup.h", cprefix = "SOUP_XMLRPC_ERROR_")]
+		[GIR (name = "XMLRPCError")]
 		public errordomain Error {
 			ARGUMENTS,
 			RETVAL
 		}
 		[CCode (cheader_filename = "libsoup/soup.h", cprefix = "SOUP_XMLRPC_FAULT_")]
+		[GIR (name = "XMLRPCFault")]
 		public errordomain Fault {
 			PARSE_ERROR_NOT_WELL_FORMED,
 			PARSE_ERROR_UNSUPPORTED_ENCODING,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]