[gtk-server] R: How to bind varargs functions

  • From: "Leonardo Cecchi" <l.cecchi@xxxxxxxxxxxxxxxxxxxx>
  • To: "'Peter van Eerten'" <turtle@xxxxxx>, <gtk-server@xxxxxxxxxxxxx>
  • Date: Tue, 20 Dec 2005 23:16:41 +0100

Hi Peter,

Thanks for the prompt reply!
I think I will follow the gtk_server_redefine route and I will redefining
the function checking the number of arguments of the calling program.

You have written:

gtk_server_redefine gtk_list_store_new, NONE, WIDGET, 3, LONG, LONG, LONG

but, if I have understood the gtk-server manpage correctly, it should be:

gtk_server_redefine gtk_list_store_new NONE WIDGET 3 LONG LONG LONG

Where I'm wrong?


-----Messaggio originale-----
Da: Peter van Eerten [mailto:turtle@xxxxxx] 
Inviato: martedì 20 dicembre 2005 19.17
A: gtk-server@xxxxxxxxxxxxx
Oggetto: Re: [gtk-server] How to bind varargs functions

Hi Leonardo,

Indeed this is a problem for interpreted programming. During execution the
interpreted program must know in advance the amount of columns in order to
the GtkListStore successfully. In the configfile this could look like:

GTK_LIB_FUNCTION = gtk_list_store_new, NONE, WIDGET, 2, LONG, LONG

Here, we define gtk_list_store as a function with 2 arguments, the latter
the actual type, which is a C number (e.g. G_TYPE_STRING, G_TYPE_INT etc).
the function is using 1 column.

But at another instance the same program would like to call GtkListStore
with 2
columns, for example. Especially for these type of situations the GTK-server
a possibility to redefine the GTK function:

gtk_server_redefine gtk_list_store_new, NONE, WIDGET, 3, LONG, LONG, LONG

As soon the GTK-server encounters this call then from this point on the
'gtk_list_store' will be defined using 2 columns. In case of creating a
you probably need to catch this function yourself first; then check the
of columns being used by the client program, then redefine the call, and
actually realize the GTK function.

Another solution is to follow the original design of the GTK server, by
presenting an individual configfile for each distributed program. So a
particular program can use the definition mentioned in a configfile, while
another program can use another definition mentioned in the configfile which
belongs to this program. (If the configfile resides in the same directory as
client program, this file will be used by the GTK-server.)

Hope this helps,

Citeren Leonardo Cecchi <l.cecchi@xxxxxxxxxxxxxxxxxxxx>:

> Hi all,
> I would like to have a list-like component in my Gtk-Server wrapper
> I think it's really useful.
> So I have to bind some functions of the GtkListStore object in order to
> the GtkTreeView component with Gtk-Server.
> In the constructor list I see:
> GtkListStore* gtk_list_store_new            (gint n_columns, ...);
> GtkListStore* gtk_list_store_newv           (gint n_columns, GType
> How can I bind one of the two calls without setting a constant number of
> columns?
> Excuse me if this question has already been answered.
> Thanks in advance,
> Leonardo

Other related posts: