Re: multiple data args to gtk_signal_connect
- From: fritz jetzek <fritz jetzek cycosmos de>
- To: John R Sheets <dusk ravendusk org>
- CC: gnome-devel-list gnome org
- Subject: Re: multiple data args to gtk_signal_connect
- Date: Mon, 02 Aug 1999 18:13:58 +0200
John R Sheets wrote:
>
> fritz jetzek wrote:
> >
> > to make the question clear by code:
> >
> > (example)
> >
> > bla = g_string_new("asdf");
> > blub = g_string_new("hi");
> >
> > gtk_signal_connect(GTK_OBJECT(some_button), "clicked",
> > GTK_SIGNAL_FUNC(my_func), bla, blub);
> >
> > ^^^^^^^^^
> >
> > illegal
>
> Why not use a struct?
>
> typedef _MyParams MyParams;
> struct _MyParams
> {
> GString *str1;
> GString *str2;
> };
>
> ....
>
> MyParams bla;
> bla.str1 = g_string_new("asdf");
> bla.str2 = g_string_new("hi");
>
> gtk_signal_connect(GTK_OBJECT(some_button), "clicked",
> GTK_SIGNAL_FUNC(my_func), &bla);
>
> John
>
hm... yes i thought of that, too, but i would expect that a function
which is as basic as gtk_signal_connect should provide some way of
passing multiple args. i have this problem quite often and defining a
struct every time doesn't seem the most elegant way... however, i'll
make use of your suggestion as i can't think for a better solution for
myself. by the way, is it possible creating and passing a struct on the
fly (in the call of gtk_signal_func)? it wouldn't probably look that
nice but saves lines ;)
at least it seems my question wasn't that silly =)
best wishes,
fritz
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]