[vala] pango: fix Pango.Attribute constructors' transfer of ownership and Pango.Scale



commit 4fb1dbe8ed8ed12ab558f9808266b08b7fda6fee
Author: Philipp Zabel <philipp zabel gmail com>
Date:   Fri Nov 6 19:43:24 2009 +0100

    pango: fix Pango.Attribute constructors' transfer of ownership and Pango.Scale
    
    The Pango.attr_*_new constructors return owned Pango.Attribute references.
    Pango.Scale is not an enum. Turn it into a namespace with double constants.
    The latter is needed so for Pango.attr_scale_new, because it is impossible
    to convert from enum Pango.Scale to double.
    
    Fixes bug 600993.

 vapi/packages/pango/pango-custom.vala |   25 +++++++++-----
 vapi/packages/pango/pango.metadata    |   18 ++++++++++
 vapi/pango.vapi                       |   61 ++++++++++++++++++--------------
 3 files changed, 68 insertions(+), 36 deletions(-)
---
diff --git a/vapi/packages/pango/pango-custom.vala b/vapi/packages/pango/pango-custom.vala
index f8f9893..5da8cf6 100644
--- a/vapi/packages/pango/pango-custom.vala
+++ b/vapi/packages/pango/pango-custom.vala
@@ -21,14 +21,21 @@
  */
 
 namespace Pango {
-	[CCode (cprefix = "PANGO_SCALE_", cheader_filename = "pango/pango.h")]
-	public enum Scale {
-		XX_SMALL,
-		X_SMALL,
-		SMALL,
-		MEDIUM,
-		LARGE,
-		X_LARGE,
-		XX_LARGE
+	[CCode (cheader_filename = "pango/pango.h")]
+	namespace Scale {
+		[CCode (cname = "PANGO_SCALE_XX_SMALL")]
+		public const double XX_SMALL;
+		[CCode (cname = "PANGO_SCALE_X_SMALL")]
+		public const double X_SMALL;
+		[CCode (cname = "PANGO_SCALE_SMALL")]
+		public const double SMALL;
+		[CCode (cname = "PANGO_SCALE_MEDIUM")]
+		public const double MEDIUM;
+		[CCode (cname = "PANGO_SCALE_LARGE")]
+		public const double LARGE;
+		[CCode (cname = "PANGO_SCALE_X_LARGE")]
+		public const double X_LARGE;
+		[CCode (cname = "PANGO_SCALE_XX_LARGE")]
+		public const double XX_LARGE;
 	}
 }
diff --git a/vapi/packages/pango/pango.metadata b/vapi/packages/pango/pango.metadata
index d2da571..7402339 100644
--- a/vapi/packages/pango/pango.metadata
+++ b/vapi/packages/pango/pango.metadata
@@ -18,6 +18,24 @@ PangoAttrSize base_class="PangoAttribute" free_function="pango_attribute_destroy
 PangoAttrSize.attr hidden="1"
 PangoAttrString base_class="PangoAttribute" free_function="pango_attribute_destroy"
 PangoAttrString.attr hidden="1"
+pango_attr_background_new transfer_ownership="1"
+pango_attr_fallback_new transfer_ownership="1"
+pango_attr_family_new transfer_ownership="1"
+pango_attr_foreground_new transfer_ownership="1"
+pango_attr_gravity_hint_new transfer_ownership="1"
+pango_attr_gravity_new transfer_ownership="1"
+pango_attr_letter_spacing_new transfer_ownership="1"
+pango_attr_rise_new transfer_ownership="1"
+pango_attr_scale_new transfer_ownership="1"
+pango_attr_stretch_new transfer_ownership="1"
+pango_attr_font_desc_new transfer_ownership="1"
+pango_attr_strikethrough_color_new transfer_ownership="1"
+pango_attr_strikethrough_new transfer_ownership="1"
+pango_attr_style_new transfer_ownership="1"
+pango_attr_underline_color_new transfer_ownership="1"
+pango_attr_underline_new transfer_ownership="1"
+pango_attr_variant_new transfer_ownership="1"
+pango_attr_weight_new transfer_ownership="1"
 pango_attr_iterator_copy transfer_ownership="1"
 pango_coverage_copy transfer_ownership="1"
 pango_font_description_copy transfer_ownership="1"
diff --git a/vapi/pango.vapi b/vapi/pango.vapi
index 0fb6ecb..ede0818 100644
--- a/vapi/pango.vapi
+++ b/vapi/pango.vapi
@@ -2,6 +2,23 @@
 
 [CCode (cprefix = "Pango", lower_case_cprefix = "pango_")]
 namespace Pango {
+	[CCode (cprefix = "PangoScale", lower_case_cprefix = "pango_scale_")]
+	namespace Scale {
+		[CCode (cheader_filename = "pango/pango.h")]
+		public const double LARGE;
+		[CCode (cheader_filename = "pango/pango.h")]
+		public const double MEDIUM;
+		[CCode (cheader_filename = "pango/pango.h")]
+		public const double SMALL;
+		[CCode (cheader_filename = "pango/pango.h")]
+		public const double XX_LARGE;
+		[CCode (cheader_filename = "pango/pango.h")]
+		public const double XX_SMALL;
+		[CCode (cheader_filename = "pango/pango.h")]
+		public const double X_LARGE;
+		[CCode (cheader_filename = "pango/pango.h")]
+		public const double X_SMALL;
+	}
 	[Compact]
 	[CCode (cheader_filename = "pango/pango.h")]
 	public class Analysis {
@@ -658,16 +675,6 @@ namespace Pango {
 		UNDERLINE,
 		STRIKETHROUGH
 	}
-	[CCode (cprefix = "PANGO_SCALE_", cheader_filename = "pango/pango.h")]
-	public enum Scale {
-		XX_SMALL,
-		X_SMALL,
-		SMALL,
-		MEDIUM,
-		LARGE,
-		X_LARGE,
-		XX_LARGE
-	}
 	[CCode (cprefix = "PANGO_SCRIPT_", cheader_filename = "pango/pango.h")]
 	public enum Script {
 		INVALID_CODE,
@@ -836,43 +843,43 @@ namespace Pango {
 	[CCode (cheader_filename = "pango/pango.h")]
 	public const string VERSION_STRING;
 	[CCode (cheader_filename = "pango/pango.h")]
-	public static unowned Pango.Attribute attr_background_new (uint16 red, uint16 green, uint16 blue);
+	public static Pango.Attribute attr_background_new (uint16 red, uint16 green, uint16 blue);
 	[CCode (cheader_filename = "pango/pango.h")]
-	public static unowned Pango.Attribute attr_fallback_new (bool enable_fallback);
+	public static Pango.Attribute attr_fallback_new (bool enable_fallback);
 	[CCode (cheader_filename = "pango/pango.h")]
-	public static unowned Pango.Attribute attr_family_new (string family);
+	public static Pango.Attribute attr_family_new (string family);
 	[CCode (cheader_filename = "pango/pango.h")]
-	public static unowned Pango.Attribute attr_foreground_new (uint16 red, uint16 green, uint16 blue);
+	public static Pango.Attribute attr_foreground_new (uint16 red, uint16 green, uint16 blue);
 	[CCode (cheader_filename = "pango/pango.h")]
-	public static unowned Pango.Attribute attr_gravity_hint_new (Pango.GravityHint hint);
+	public static Pango.Attribute attr_gravity_hint_new (Pango.GravityHint hint);
 	[CCode (cheader_filename = "pango/pango.h")]
-	public static unowned Pango.Attribute attr_gravity_new (Pango.Gravity gravity);
+	public static Pango.Attribute attr_gravity_new (Pango.Gravity gravity);
 	[CCode (cheader_filename = "pango/pango.h")]
-	public static unowned Pango.Attribute attr_letter_spacing_new (int letter_spacing);
+	public static Pango.Attribute attr_letter_spacing_new (int letter_spacing);
 	[CCode (cheader_filename = "pango/pango.h")]
-	public static unowned Pango.Attribute attr_rise_new (int rise);
+	public static Pango.Attribute attr_rise_new (int rise);
 	[CCode (cheader_filename = "pango/pango.h")]
-	public static unowned Pango.Attribute attr_scale_new (double scale_factor);
+	public static Pango.Attribute attr_scale_new (double scale_factor);
 	[CCode (cheader_filename = "pango/pango.h")]
-	public static unowned Pango.Attribute attr_stretch_new (Pango.Stretch stretch);
+	public static Pango.Attribute attr_stretch_new (Pango.Stretch stretch);
 	[CCode (cheader_filename = "pango/pango.h")]
-	public static unowned Pango.Attribute attr_strikethrough_color_new (uint16 red, uint16 green, uint16 blue);
+	public static Pango.Attribute attr_strikethrough_color_new (uint16 red, uint16 green, uint16 blue);
 	[CCode (cheader_filename = "pango/pango.h")]
-	public static unowned Pango.Attribute attr_strikethrough_new (bool strikethrough);
+	public static Pango.Attribute attr_strikethrough_new (bool strikethrough);
 	[CCode (cheader_filename = "pango/pango.h")]
-	public static unowned Pango.Attribute attr_style_new (Pango.Style style);
+	public static Pango.Attribute attr_style_new (Pango.Style style);
 	[CCode (cheader_filename = "pango/pango.h")]
 	public static unowned string attr_type_get_name (Pango.AttrType type);
 	[CCode (cheader_filename = "pango/pango.h")]
 	public static Pango.AttrType attr_type_register (string name);
 	[CCode (cheader_filename = "pango/pango.h")]
-	public static unowned Pango.Attribute attr_underline_color_new (uint16 red, uint16 green, uint16 blue);
+	public static Pango.Attribute attr_underline_color_new (uint16 red, uint16 green, uint16 blue);
 	[CCode (cheader_filename = "pango/pango.h")]
-	public static unowned Pango.Attribute attr_underline_new (Pango.Underline underline);
+	public static Pango.Attribute attr_underline_new (Pango.Underline underline);
 	[CCode (cheader_filename = "pango/pango.h")]
-	public static unowned Pango.Attribute attr_variant_new (Pango.Variant variant);
+	public static Pango.Attribute attr_variant_new (Pango.Variant variant);
 	[CCode (cheader_filename = "pango/pango.h")]
-	public static unowned Pango.Attribute attr_weight_new (Pango.Weight weight);
+	public static Pango.Attribute attr_weight_new (Pango.Weight weight);
 	[CCode (cheader_filename = "pango/pango.h")]
 	public static Pango.BidiType bidi_type_for_unichar (unichar ch);
 	[CCode (cheader_filename = "pango/pango.h")]



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