Author: mkestner
Date: 2007-06-21 12:22:54 -0400 (Thu, 21 Jun 2007)
New Revision: 80494

Modified:
   branches/gtk-sharp-2-468-branch/gtk-sharp/ChangeLog
   branches/gtk-sharp-2-468-branch/gtk-sharp/glib/Value.cs
Log:

2007-06-21  Mike Kestner  <[EMAIL PROTECTED]>

        * glib/Value.cs : backport Boxed value mapping fix from trunk.


Modified: branches/gtk-sharp-2-468-branch/gtk-sharp/ChangeLog
===================================================================
--- branches/gtk-sharp-2-468-branch/gtk-sharp/ChangeLog 2007-06-21 16:22:27 UTC 
(rev 80493)
+++ branches/gtk-sharp-2-468-branch/gtk-sharp/ChangeLog 2007-06-21 16:22:54 UTC 
(rev 80494)
@@ -1,5 +1,9 @@
 2007-06-21  Mike Kestner  <[EMAIL PROTECTED]>
 
+       * glib/Value.cs : backport Boxed value mapping fix from trunk.
+
+2007-06-21  Mike Kestner  <[EMAIL PROTECTED]>
+
        * (glib|gdk|gtk)/* : port ExceptionManager feature back from trunk.
        Adds try/catch blocks for all native to managed callbacks.
 

Modified: branches/gtk-sharp-2-468-branch/gtk-sharp/glib/Value.cs
===================================================================
--- branches/gtk-sharp-2-468-branch/gtk-sharp/glib/Value.cs     2007-06-21 
16:22:27 UTC (rev 80493)
+++ branches/gtk-sharp-2-468-branch/gtk-sharp/glib/Value.cs     2007-06-21 
16:22:54 UTC (rev 80494)
@@ -303,6 +303,15 @@
                        return strings;
                }
 
+               object ToBoxed ()
+               {
+                       IntPtr boxed_ptr = g_value_get_boxed (ref this);
+                       Type t = GType.LookupType (type);
+                       if (t == null)
+                               throw new Exception ("Unknown type " + new 
GType (type).ToString ());
+                       return Marshal.PtrToStructure (boxed_ptr, t);
+               }
+
                public object Val
                {
                        get {
@@ -331,6 +340,8 @@
                                        return ManagedValue.ObjectForWrapper 
(g_value_get_boxed (ref this));
                                else if (g_type_is_a (type, GType.Object.Val))
                                        return (GLib.Object) this;
+                               else if (g_type_is_a (type, GType.Boxed.Val))
+                                       return ToBoxed ();
                                else
                                        throw new Exception ("Unknown type " + 
new GType (type).ToString ());
                        }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to