[Glade-users] glade 3.6 and user data in callback function



Tristan Van Berkom wrote:
On Wed, May 6, 2009 at 2:34 PM, daniel <drmartens at gnu.univ.gda.pl> wrote:

Yes, I'm using GtkBuilder. In Glade, when I start typing in "user data"
column, I can see the list of objects I can choose from (e.g. the models
I have already defined), so I simply choose one.
But if I add an additional argument to my callback function that would
reflect the change in glade, I get 'too many arguments' error, which

Just to be clear, you get the error "too many arguments" from GtkBuilder
at startup time ?

Could you file a bug against Glade ? then I will look at it and if its
a bug in GtkBuilder I'll forward it to GTK+ bugzilla.


I'm sorry for not being clear. This is not a startup error. The error is
simply thrown, when the specific signal is emitted and the handler called.

So for example, I have toggle in a treeview. And the "toggled" signal
has "user data" column filled with a name of some object.
So my callback function is something like:
def on_toggled(self, cell, path, user_data)

When I run my app and click the toggle, I will get:
TypeError: on_toggled() takes exactly 4 arguments (3 given)

However, when I remove "user_data" param from my callback definition,
everything works. So maybe the "user data" param is never passed?

The relevant part from the builder file (different names):
<object class="GtkCellRendererToggle" id="task_toggle">
<signal name="toggled" handler="on_task_completed" object="tasks_model"/>
</object>

So I guess it's not a bug in glade...

daniel





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