gmime r1409 - trunk/mono



Author: fejj
Date: Wed Aug 20 01:55:52 2008
New Revision: 1409
URL: http://svn.gnome.org/viewvc/gmime?rev=1409&view=rev

Log:
updated

Modified:
   trunk/mono/GMime.metadata
   trunk/mono/InternetAddressList.cs
   trunk/mono/Message.custom
   trunk/mono/gmime-api.raw

Modified: trunk/mono/GMime.metadata
==============================================================================
--- trunk/mono/GMime.metadata	(original)
+++ trunk/mono/GMime.metadata	Wed Aug 20 01:55:52 2008
@@ -137,16 +137,18 @@
   <!-- iconv-utils -->
 
   <!-- InternetAddress -->
-  <!-- The generator irritating always converts a method named GetType to a
-       GType property regardless of whether or not it's actually a glib type
-       So rename this one -->
-  <attr path="/api/namespace/struct[ cname='InternetAddress']/method[ cname='internet_address_get_type']" name="name">GetAddressType</attr>
-  <remove-node path="/api/namespace/struct[ cname='InternetAddress']/field[ cname='refcount']"/>
-  <remove-node path="/api/namespace/struct[ cname='InternetAddress']/field[ cname='type']"/>
-
+  <remove-node path="/api/namespace/object[ cname='InternetAddress']/signal[ name='Changed']"/>
+  
+  <!-- InternetAddressGroup -->
+  <remove-node path="/api/namespace/object[ cname='InternetAddressGroup']/method[ name='AddMember']"/>
+  
+  <!-- InternetAddressMailbox -->
+  <attr path="/api/namespace/object[ cname='InternetAddressMailbox']/method[ name='GetAddr']" name="name">GetAddress</attr>
+  <attr path="/api/namespace/object[ cname='InternetAddressMailbox']/method[ name='SetAddr']" name="name">SetAddress</attr>
+  
   <!-- InternetAddressList -->
   <!-- We implement this class by hand, remove it. -->
-  <remove-node path="/api/namespace/struct[ cname='InternetAddressList']"/>
+  <attr path="/api/namespace/object[ cname='InternetAddressList']" name="hidden">true</attr>
 
   <!-- Message -->
   <attr path="/api/namespace/object[ cname='GMimeMessage']/method[ name='GetMimePart']/return-type" name="owned">true</attr>

Modified: trunk/mono/InternetAddressList.cs
==============================================================================
--- trunk/mono/InternetAddressList.cs	(original)
+++ trunk/mono/InternetAddressList.cs	Wed Aug 20 01:55:52 2008
@@ -3,18 +3,12 @@
 using System.Runtime.InteropServices;
 
 namespace GMime {
-	public class InternetAddressList : IDisposable, IList {
-		IntPtr list;
-		bool owner;
-		
+	public sealed class InternetAddressList : GLib.Object, IList {
 #region Native Methods
 		[DllImport("gmime")]
 		static extern IntPtr internet_address_list_new ();
 		
 		[DllImport("gmime")]
-		static extern void internet_address_list_destroy (IntPtr list);
-		
-		[DllImport("gmime")]
 		static extern int internet_address_list_length (IntPtr list);
 		
 		[DllImport("gmime")]
@@ -52,28 +46,16 @@
 		
 		[DllImport("gmime")]
 		static extern IntPtr internet_address_list_parse_string (IntPtr str);
-		
-		[DllImport("gmime")]
-		static extern void internet_address_ref (IntPtr raw);
 #endregion
 		
-		public InternetAddressList () : this (internet_address_list_new (), true)
+		public InternetAddressList ()
 		{
-			
+			Raw = internet_address_list_new ();
 		}
 		
-		internal InternetAddressList (IntPtr raw, bool owner)
+		internal InternetAddressList (IntPtr raw) : base (raw)
 		{
-			this.owner = owner;
-			list = raw;
-		}
-		
-		public void Dispose ()
-		{
-			if (owner && list != IntPtr.Zero)
-				internet_address_list_destroy (list);
 			
-			list = IntPtr.Zero;
 		}
 		
 		Exception CannotAdd (object value)
@@ -120,9 +102,8 @@
 			return new InvalidOperationException (message);
 		}
 		
-#region IList
 		public int Count { 
-			get { return internet_address_list_length (list); }
+			get { return internet_address_list_length (Handle); }
 		}
 		
 		public bool IsFixedSize {
@@ -141,29 +122,40 @@
 			get { return this; }
 		}
 		
-		public int Add (object value)
+		public int Add (InternetAddress addr)
+		{
+			if (addr == null)
+				throw CannotAdd (addr);
+			
+			return internet_address_list_add (Handle, addr.Handle);
+		}
+		
+		int IList.Add (object value)
 		{
 			InternetAddress addr = value as InternetAddress;
 			
 			if (addr == null)
 				throw CannotAdd (value);
 			
-			return internet_address_list_add (list, addr.Handle);
+			return Add (value as InternetAddress);
 		}
 		
 		public void Clear ()
 		{
-			internet_address_list_clear (list);
+			internet_address_list_clear (Handle);
 		}
 		
-		public bool Contains (object value)
+		public bool Contains (InternetAddress addr)
 		{
-			InternetAddress addr = value as InternetAddress;
-			
 			if (addr == null)
 				return false;
 			
-			return internet_address_list_contains (list, addr.Handle);
+			return internet_address_list_contains (Handle, addr.Handle);
+		}
+		
+		bool IList.Contains (object value)
+		{
+			return Contains (value as InternetAddress);
 		}
 		
 		public void CopyTo (Array array, int index)
@@ -185,37 +177,56 @@
 			return new InternetAddressListIterator (this);
 		}
 		
-		public int IndexOf (object value)
+		public int IndexOf (InternetAddress addr)
 		{
-			InternetAddress addr = value as InternetAddress;
-			
 			if (addr == null)
 				return -1;
 			
-			return internet_address_list_index_of (list, addr.Handle);
+			return internet_address_list_index_of (Handle, addr.Handle);
+		}
+		
+		int IList.IndexOf (object value)
+		{
+			return IndexOf (value as InternetAddress);
 		}
 		
-		public void Insert (int index, object value)
+		public void Insert (int index, InternetAddress addr)
+		{
+			if (addr == null)
+				throw CannotInsert (addr);
+			
+			if (index < 0)
+				throw new ArgumentOutOfRangeException ("index");
+			
+			internet_address_list_insert (Handle, index, addr.Handle);
+		}
+		
+		void IList.Insert (int index, object value)
 		{
 			InternetAddress addr = value as InternetAddress;
 			
 			if (addr == null)
 				throw CannotInsert (value);
 			
-			if (index < 0)
-				throw new ArgumentOutOfRangeException ("index");
+			Insert (index, addr);
+		}
+		
+		public void Remove (InternetAddress addr)
+		{
+			if (addr == null)
+				throw CannotRemove (addr);
 			
-			internet_address_list_insert (list, index, addr.Handle);
+			internet_address_list_remove (Handle, addr.Handle);
 		}
 		
-		public void Remove (object value)
+		void IList.Remove (object value)
 		{
 			InternetAddress addr = value as InternetAddress;
 			
 			if (addr == null)
 				throw CannotRemove (value);
 			
-			internet_address_list_remove (list, addr.Handle);
+			Remove (addr);
 		}
 		
 		public void RemoveAt (int index)
@@ -223,35 +234,36 @@
 			if (index < 0 || index >= Count)
 				throw new ArgumentOutOfRangeException ("index");
 			
-			internet_address_list_remove_at (list, index);
+			internet_address_list_remove_at (Handle, index);
 		}
 		
-		public object this[int index] {
+		public InternetAddress this[int index] {
 			get {
-				IntPtr raw = internet_address_list_get_address (list, index);
-				InternetAddress addr;
+				IntPtr raw = internet_address_list_get_address (Handle, index);
 				
 				if (raw == IntPtr.Zero)
 					return null;
 				
-				internet_address_ref (raw);
-				
-				addr = new InternetAddress (raw);
-				addr.Owned = true;
-				
-				return addr;
+				return GLib.Object.GetObject (raw) as InternetAddress;
 			}
 			
 			set {
-				InternetAddress addr = value as InternetAddress;
-				
-				if (addr == null)
+				if (value == null)
 					throw CannotSet (value);
 				
-				internet_address_list_set_address (list, index, addr.Handle);
+				internet_address_list_set_address (Handle, index, value.Handle);
+			}
+		}
+		
+		object IList.this[int index] {
+			get {
+				return this[index];
+			}
+			
+			set {
+				this[index] = value as InternetAddress;
 			}
 		}
-#endregion
 		
 		public static InternetAddressList Parse (string str)
 		{
@@ -260,7 +272,7 @@
 			InternetAddressList list = null;
 			
 			if (raw != IntPtr.Zero)
-				list = new InternetAddressList (raw, true);
+				list = new InternetAddressList (raw);
 			
 			GLib.Marshaller.Free (native_str);
 			
@@ -269,7 +281,7 @@
 		
 		public string ToString (bool encode)
 		{
-			IntPtr raw = internet_address_list_to_string (list, encode);
+			IntPtr raw = internet_address_list_to_string (Handle, encode);
 			
 			return GLib.Marshaller.PtrToStringGFree (raw);
 		}

Modified: trunk/mono/Message.custom
==============================================================================
--- trunk/mono/Message.custom	(original)
+++ trunk/mono/Message.custom	Wed Aug 20 01:55:52 2008
@@ -5,9 +5,20 @@
 {
 	IntPtr list = g_mime_message_get_recipients (Handle, (int) type);
 
-	return new InternetAddressList (list, false);
+	return new InternetAddressList (list);
 }
 
+public InternetAddressList To {
+       get { return GetRecipients (RecipientType.To); }
+}
+
+public InternetAddressList Cc {
+       get { return GetRecipients (RecipientType.Cc); }
+}
+
+public InternetAddressList Bcc {
+       get { return GetRecipients (RecipientType.Bcc); }
+}
 
 public System.Collections.IEnumerable References {
 	get {

Modified: trunk/mono/gmime-api.raw
==============================================================================
--- trunk/mono/gmime-api.raw	(original)
+++ trunk/mono/gmime-api.raw	Wed Aug 20 01:55:52 2008
@@ -89,11 +89,6 @@
       <member cname="GMIME_STREAM_BUFFER_BLOCK_READ" name="BlockRead" />
       <member cname="GMIME_STREAM_BUFFER_BLOCK_WRITE" name="BlockWrite" />
     </enum>
-    <enum name="InternetAddressType" cname="InternetAddressType" type="enum">
-      <member cname="INTERNET_ADDRESS_NONE" name="None" />
-      <member cname="INTERNET_ADDRESS_NAME" name="Name" />
-      <member cname="INTERNET_ADDRESS_GROUP" name="Group" />
-    </enum>
     <callback name="HeaderForeachFunc" cname="GMimeHeaderForeachFunc">
       <return-type type="void" />
       <parameters>
@@ -698,7 +693,7 @@
         <return-type type="GMimeObject*" />
       </method>
       <method name="GetRecipients" cname="g_mime_message_get_recipients">
-        <return-type type="const-InternetAddressList*" />
+        <return-type type="InternetAddressList*" />
         <parameters>
           <parameter type="GMimeRecipientType" name="type" />
         </parameters>
@@ -1807,6 +1802,182 @@
       </method>
       <constructor cname="g_mime_stream_null_new" />
     </object>
+    <object name="InternetAddressList" cname="InternetAddressList" parent="GObject">
+      <field name="Array" cname="array" type="GPtrArray*" />
+      <signal name="Changed" cname="changed" when="LAST">
+        <return-type type="void" />
+        <parameters>
+          <parameter type="InternetAddressList*" name="list" />
+        </parameters>
+      </signal>
+      <method name="Add" cname="internet_address_list_add">
+        <return-type type="int" />
+        <parameters>
+          <parameter type="InternetAddress*" name="ia" />
+        </parameters>
+      </method>
+      <method name="Clear" cname="internet_address_list_clear">
+        <return-type type="void" />
+      </method>
+      <method name="Concat" cname="internet_address_list_concat">
+        <return-type type="void" />
+        <parameters>
+          <parameter type="InternetAddressList*" name="concat" />
+        </parameters>
+      </method>
+      <method name="Contains" cname="internet_address_list_contains">
+        <return-type type="gboolean" />
+        <parameters>
+          <parameter type="InternetAddress*" name="ia" />
+        </parameters>
+      </method>
+      <method name="GetAddress" cname="internet_address_list_get_address">
+        <return-type type="InternetAddress*" />
+        <parameters>
+          <parameter type="int" name="index" />
+        </parameters>
+      </method>
+      <method name="GetType" cname="internet_address_list_get_type" shared="true">
+        <return-type type="GType" />
+      </method>
+      <method name="IndexOf" cname="internet_address_list_index_of">
+        <return-type type="int" />
+        <parameters>
+          <parameter type="InternetAddress*" name="ia" />
+        </parameters>
+      </method>
+      <method name="Insert" cname="internet_address_list_insert">
+        <return-type type="void" />
+        <parameters>
+          <parameter type="int" name="index" />
+          <parameter type="InternetAddress*" name="ia" />
+        </parameters>
+      </method>
+      <method name="Length" cname="internet_address_list_length">
+        <return-type type="int" />
+      </method>
+      <constructor cname="internet_address_list_new" />
+      <method name="ParseString" cname="internet_address_list_parse_string" shared="true">
+        <return-type type="InternetAddressList*" />
+        <parameters>
+          <parameter type="const-char*" name="str" />
+        </parameters>
+      </method>
+      <method name="Remove" cname="internet_address_list_remove">
+        <return-type type="gboolean" />
+        <parameters>
+          <parameter type="InternetAddress*" name="ia" />
+        </parameters>
+      </method>
+      <method name="RemoveAt" cname="internet_address_list_remove_at">
+        <return-type type="gboolean" />
+        <parameters>
+          <parameter type="int" name="index" />
+        </parameters>
+      </method>
+      <method name="SetAddress" cname="internet_address_list_set_address">
+        <return-type type="void" />
+        <parameters>
+          <parameter type="int" name="index" />
+          <parameter type="InternetAddress*" name="ia" />
+        </parameters>
+      </method>
+      <method name="ToString" cname="internet_address_list_to_string">
+        <return-type type="char*" />
+        <parameters>
+          <parameter type="gboolean" name="encode" />
+        </parameters>
+      </method>
+      <method name="Writer" cname="internet_address_list_writer">
+        <return-type type="void" />
+        <parameters>
+          <parameter type="GString*" name="str" />
+        </parameters>
+      </method>
+    </object>
+    <object name="InternetAddressGroup" cname="InternetAddressGroup" parent="InternetAddress">
+      <field name="Members" cname="members" type="InternetAddressList*" />
+      <method name="AddMember" cname="internet_address_group_add_member">
+        <return-type type="void" />
+        <parameters>
+          <parameter type="InternetAddress*" name="member" />
+        </parameters>
+      </method>
+      <method name="GetMembers" cname="internet_address_group_get_members">
+        <return-type type="InternetAddressList*" />
+      </method>
+      <method name="GetType" cname="internet_address_group_get_type" shared="true">
+        <return-type type="GType" />
+      </method>
+      <constructor cname="internet_address_group_new">
+        <parameters>
+          <parameter type="const-char*" name="name" />
+        </parameters>
+      </constructor>
+      <method name="SetMembers" cname="internet_address_group_set_members">
+        <return-type type="void" />
+        <parameters>
+          <parameter type="InternetAddressList*" name="members" />
+        </parameters>
+      </method>
+    </object>
+    <object name="InternetAddressMailbox" cname="InternetAddressMailbox" parent="InternetAddress">
+      <field name="Addr" cname="addr" type="char*" />
+      <method name="GetAddr" cname="internet_address_mailbox_get_addr">
+        <return-type type="const-char*" />
+      </method>
+      <method name="GetType" cname="internet_address_mailbox_get_type" shared="true">
+        <return-type type="GType" />
+      </method>
+      <constructor cname="internet_address_mailbox_new">
+        <parameters>
+          <parameter type="const-char*" name="name" />
+          <parameter type="const-char*" name="addr" />
+        </parameters>
+      </constructor>
+      <method name="SetAddr" cname="internet_address_mailbox_set_addr">
+        <return-type type="void" />
+        <parameters>
+          <parameter type="const-char*" name="addr" />
+        </parameters>
+      </method>
+    </object>
+    <object name="InternetAddress" cname="InternetAddress" parent="GObject">
+      <field name="Name" cname="name" type="char*" />
+      <signal name="Changed" cname="changed" when="LAST">
+        <return-type type="void" />
+        <parameters>
+          <parameter type="InternetAddress*" name="ia" />
+        </parameters>
+      </signal>
+      <virtual_method name="ToString" cname="to_string">
+        <return-type type="void" />
+        <parameters>
+          <parameter type="InternetAddress*" name="ia" />
+          <parameter type="guint32" name="flags" />
+          <parameter type="size_t*" name="linelen" />
+          <parameter type="GString*" name="out" />
+        </parameters>
+      </virtual_method>
+      <method name="GetName" cname="internet_address_get_name">
+        <return-type type="const-char*" />
+      </method>
+      <method name="GetType" cname="internet_address_get_type" shared="true">
+        <return-type type="GType" />
+      </method>
+      <method name="SetName" cname="internet_address_set_name">
+        <return-type type="void" />
+        <parameters>
+          <parameter type="const-char*" name="name" />
+        </parameters>
+      </method>
+      <method name="ToString" cname="internet_address_to_string">
+        <return-type type="char*" />
+        <parameters>
+          <parameter type="gboolean" name="encode" />
+        </parameters>
+      </method>
+    </object>
     <struct name="Charset" cname="GMimeCharset" opaque="true">
       <method name="Best" cname="g_mime_charset_best" shared="true">
         <return-type type="const-char*" />
@@ -2445,158 +2616,6 @@
       <field name="Data" cname="data" type="void*" />
       <field name="Len" cname="len" type="size_t" />
     </struct>
-    <struct name="InternetAddress" cname="InternetAddress" opaque="true">
-      <field name="Type" cname="type" type="InternetAddressType" access="public" writeable="true" />
-      <field name="Refcount" cname="refcount" type="unsigned int" access="public" writeable="true" />
-      <field name="Name" cname="name" type="char*" access="public" writeable="true" />
-      <field name="Addr" cname="addr" type="char*" access="public" writeable="true" />
-      <method name="AddMember" cname="internet_address_add_member">
-        <return-type type="void" />
-        <parameters>
-          <parameter type="InternetAddress*" name="member" />
-        </parameters>
-      </method>
-      <method name="GetAddr" cname="internet_address_get_addr">
-        <return-type type="const-char*" />
-      </method>
-      <method name="GetMembers" cname="internet_address_get_members">
-        <return-type type="const-InternetAddressList*" />
-      </method>
-      <method name="GetName" cname="internet_address_get_name">
-        <return-type type="const-char*" />
-      </method>
-      <method name="GetType" cname="internet_address_get_type">
-        <return-type type="InternetAddressType" />
-      </method>
-      <constructor cname="internet_address_new" />
-      <constructor cname="internet_address_new_group">
-        <parameters>
-          <parameter type="const-char*" name="name" />
-        </parameters>
-      </constructor>
-      <constructor cname="internet_address_new_name">
-        <parameters>
-          <parameter type="const-char*" name="name" />
-          <parameter type="const-char*" name="addr" />
-        </parameters>
-      </constructor>
-      <method name="Ref" cname="internet_address_ref">
-        <return-type type="void" />
-      </method>
-      <method name="SetAddr" cname="internet_address_set_addr">
-        <return-type type="void" />
-        <parameters>
-          <parameter type="const-char*" name="addr" />
-        </parameters>
-      </method>
-      <method name="SetGroup" cname="internet_address_set_group">
-        <return-type type="void" />
-        <parameters>
-          <parameter type="InternetAddressList*" name="group" />
-        </parameters>
-      </method>
-      <method name="SetName" cname="internet_address_set_name">
-        <return-type type="void" />
-        <parameters>
-          <parameter type="const-char*" name="name" />
-        </parameters>
-      </method>
-      <method name="ToString" cname="internet_address_to_string">
-        <return-type type="char*" />
-        <parameters>
-          <parameter type="gboolean" name="encode" />
-        </parameters>
-      </method>
-      <method name="Unref" cname="internet_address_unref">
-        <return-type type="void" />
-      </method>
-    </struct>
-    <struct name="InternetAddressList" cname="InternetAddressList" opaque="true">
-      <method name="Add" cname="internet_address_list_add">
-        <return-type type="int" />
-        <parameters>
-          <parameter type="InternetAddress*" name="ia" />
-        </parameters>
-      </method>
-      <method name="Clear" cname="internet_address_list_clear">
-        <return-type type="void" />
-      </method>
-      <method name="Concat" cname="internet_address_list_concat">
-        <return-type type="void" />
-        <parameters>
-          <parameter type="InternetAddressList*" name="concat" />
-        </parameters>
-      </method>
-      <method name="Contains" cname="internet_address_list_contains">
-        <return-type type="gboolean" />
-        <parameters>
-          <parameter type="const-InternetAddress*" name="ia" />
-        </parameters>
-      </method>
-      <method name="Destroy" cname="internet_address_list_destroy">
-        <return-type type="void" />
-      </method>
-      <method name="GetAddress" cname="internet_address_list_get_address">
-        <return-type type="const-InternetAddress*" />
-        <parameters>
-          <parameter type="int" name="index" />
-        </parameters>
-      </method>
-      <method name="IndexOf" cname="internet_address_list_index_of">
-        <return-type type="int" />
-        <parameters>
-          <parameter type="const-InternetAddress*" name="ia" />
-        </parameters>
-      </method>
-      <method name="Insert" cname="internet_address_list_insert">
-        <return-type type="void" />
-        <parameters>
-          <parameter type="int" name="index" />
-          <parameter type="InternetAddress*" name="ia" />
-        </parameters>
-      </method>
-      <method name="Length" cname="internet_address_list_length">
-        <return-type type="int" />
-      </method>
-      <constructor cname="internet_address_list_new" />
-      <method name="ParseString" cname="internet_address_list_parse_string" shared="true">
-        <return-type type="InternetAddressList*" />
-        <parameters>
-          <parameter type="const-char*" name="str" />
-        </parameters>
-      </method>
-      <method name="Remove" cname="internet_address_list_remove">
-        <return-type type="gboolean" />
-        <parameters>
-          <parameter type="InternetAddress*" name="ia" />
-        </parameters>
-      </method>
-      <method name="RemoveAt" cname="internet_address_list_remove_at">
-        <return-type type="gboolean" />
-        <parameters>
-          <parameter type="int" name="index" />
-        </parameters>
-      </method>
-      <method name="SetAddress" cname="internet_address_list_set_address">
-        <return-type type="void" />
-        <parameters>
-          <parameter type="int" name="index" />
-          <parameter type="InternetAddress*" name="ia" />
-        </parameters>
-      </method>
-      <method name="ToString" cname="internet_address_list_to_string">
-        <return-type type="char*" />
-        <parameters>
-          <parameter type="gboolean" name="encode" />
-        </parameters>
-      </method>
-      <method name="Writer" cname="internet_address_list_writer">
-        <return-type type="void" />
-        <parameters>
-          <parameter type="GString*" name="str" />
-        </parameters>
-      </method>
-    </struct>
     <class name="Global" cname="GMimeGlobal">
       <method name="CheckVersion" cname="g_mime_check_version" shared="true">
         <return-type type="gboolean" />



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