And michaelcbr...@msn.com spoke on 08/12/2009 01:11 AM, saying:
> On Wed, 2009-08-12 at 00:52 -0700, Paul Aurich wrote:
>> On Aug 12, 2009, at 00:39, michaelcbr...@msn.com wrote:
>>> Thinking this was another casting issue, I tried casting the type for
>>> the callback to PurpleCallback, since that looks like the correct type
>>> in libpurple's source code, but I still get the same error that  
>>> there's
>>> too many arguments:
>>>
>>> ((PurpleCallback)menu_action->callback)((PurpleBlistNode *)buddy);
>>
>> It doesn't look like it's documented anywhere, but the function  
>> prototype that you want to be matching is:
>>      void callback(PurpleBlistNode*, gpointer cb_data)
>>
>> See, for example, gtkutils.c:menu_action_cb:
>>      static void
>>      menu_action_cb(GtkMenuItem *item, gpointer object)
>>      {
>>          gpointer data;
>>          void (*callback)(gpointer, gpointer);
>>
>>          callback = g_object_get_data(G_OBJECT(item), "purplecallback");
>>          data = g_object_get_data(G_OBJECT(item), "purplecallbackdata");
>>
>>          if (callback)
>>              callback(object, data);
>>      }
>>
>> (in your case, you'd have (PurpleBlistNode*)buddy and menu_action->data)
>>
>> ~Paul
>>
>>
> I think I get what you're saying, I gave the callback function a second
> argument for menu_action->data, but the compiler still says that I have
> too many arguments...why is it telling me this?
> 
> Here's my callback at the moment:
> menu_action->callback(((PurpleBlistNode *)buddy), menu_action->data);

You need to cast the callback (which is stored as a PurpleCallback, which
is just a generic type) to void (*callback)(gpointer, gointer) (like the
code above is doing -- although it retrieves the callback from a gobject)

> 
> -Michael
> 

~Paul

_______________________________________________
Support@pidgin.im mailing list
Want to unsubscribe?  Use this link:
http://pidgin.im/cgi-bin/mailman/listinfo/support

Reply via email to