On Nov 15, 2009, at 21:25, John Millikin wrote:

> I'm writing a binding for GNOME Keyring -- if the application and
> program name are not properly set, the "unlock keyring" window
> displays non-useful values. Additionally, the following warning is
> printed to the terminal when running without a set application name.
>
> ----------------------
> ** (process:3062): WARNING **: g_set_application_name not set.
> ----------------------
>
> The helper function is required because, to my knowledge, C2HS does
> not allow arbitrary expressions in the out-marshaler. So I can't just
> specify:
>
> ----------------------
> {# fun get_application_name as ^
>   {} -> `Maybe String' maybePeek peekUTFString* #}
> ----------------------

Well, except for Cairo, we usually bind the functions by writing all  
out and then use {#call #}. Thus:

-- | comment here
getApplicationName :: IO (Maybe String)
getApplicationName = maybePeek peekUTFString $ {#call unsafe  
g_get_application_name #}

I this particular case, the {# fun #} hook is simpler, but most of  
our functions have some type class constraint that c2hs wouldn't  
generated correctly.

I would prefer if you use the format above rather than introducing  
these new helper functions that are used nowhere but in your  
functions. It's a maintenance issue more than anything else.

Cheers,
Axel.

> If you'd rather, I can move it out of UTFString and make it private to
> .Utils, but it must exist somewhere.
>
> [1] http://library.gnome.org/devel/glib/unstable/glib-Miscellaneous- 
> Utility-Functions.html#g-get-application-name
>
> On Sun, Nov 15, 2009 at 12:17, Axel Simon <axel.si...@ens.fr> wrote:
>> I'm not so happy applying your patch since
>>
>> a) you introduce some new "helper" functions that are not really
>> necessary
>>
>> b) you bind functions that don't seem to be useful in a more general
>> context. I.e. you can set the program name in the AboutDialog  
>> directly
>> using the 'aboutDialogName' property. Why is this not sufficient?
>>
>> I've updated AboutDialog and pushed the results. However, it probably
>> won't affect your application since 'aboutDialogName' was already  
>> in the
>> 0.10.4 release.
>>
>> Cheers,
>> Axel.
>>
>> On Sun, 2009-11-15 at 11:06 -0800, John Millikin wrote:
>>> These are used in the "About" dialog, when interacting with the
>>> keyring, and probably in a few other places. Patch bundle from  
>>> "darcs
>>> send" is attached.
>>> -------------------------------------------------------------------- 
>>> ----------
>>> Let Crystal Reports handle the reporting - Free Crystal Reports  
>>> 2008 30-Day
>>> trial. Simplify your report design, integration and deployment -  
>>> and focus on
>>> what you do best, core application coding. Discover what's new with
>>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>>> _______________________________________________ Gtk2hs-devel  
>>> mailing list Gtk2hs-devel@lists.sourceforge.net https:// 
>>> lists.sourceforge.net/lists/listinfo/gtk2hs-devel
>>
>>


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gtk2hs-devel mailing list
Gtk2hs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel

Reply via email to