Hi,

I've been working on Clutter bindings, and I ran into an issue where the
functions for setting/getting Gvalues with Char and UChar were commented
out in Gtk2hs. Here's a patch which uncomments them and adds the
necessary type conversion. 

        Thanks,
                Matt Arsenault
[UncommentGValueCharFunctions
[email protected]**20091010214130
 Ignore-this: 40983acf515caedccf561ebb50bd927a
] {
hunk ./glib/System/Glib/GValueTypes.chs 25
--- This is used by the implementation of properties and by the 
+-- This is used by the implementation of properties and by the
hunk ./glib/System/Glib/GValueTypes.chs 38
---  valueSetUChar,
---  valueGetUChar,
---  valueSetChar,
---  valueGetChar,
+  valueSetUChar,
+  valueGetUChar,
+  valueSetChar,
+  valueGetChar,
hunk ./glib/System/Glib/GValueTypes.chs 112
-{-
hunk ./glib/System/Glib/GValueTypes.chs 114
-  {# call unsafe value_set_uchar #} gvalue value
+  {# call unsafe value_set_uchar #} gvalue (fromIntegral value)
hunk ./glib/System/Glib/GValueTypes.chs 118
-  {# call unsafe value_get_uchar #} gvalue
+  liftM fromIntegral $ {# call unsafe value_get_uchar #} gvalue
hunk ./glib/System/Glib/GValueTypes.chs 120
-valueSetChar :: GValue -> {#type gchar#} -> IO ()
+--these belong somewhere else, are in new c2hs's C2HS module
+cToEnum :: (Integral i, Enum e) => i -> e
+cToEnum  = toEnum . fromIntegral
+
+cFromEnum :: (Enum e, Integral i) => e -> i
+cFromEnum  = fromIntegral . fromEnum
+
+--valueSetChar :: GValue -> {#type gchar#} -> IO ()
+valueSetChar :: GValue -> Char -> IO ()
hunk ./glib/System/Glib/GValueTypes.chs 130
-  {# call unsafe value_set_char #} gvalue value
+  {# call unsafe value_set_char #} gvalue (cFromEnum value)
hunk ./glib/System/Glib/GValueTypes.chs 132
-valueGetChar :: GValue -> IO {#type gchar#}
+--valueGetChar :: GValue -> IO {#type gchar#}
+valueGetChar :: GValue -> IO Char
hunk ./glib/System/Glib/GValueTypes.chs 135
-  {# call unsafe value_get_char #} gvalue
--}
+  liftM cToEnum $ {# call unsafe value_get_char #} gvalue
hunk ./glib/System/Glib/GValueTypes.chs 254
+
}
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gtk2hs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel

Reply via email to