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

  • From: Peter van Eerten <administrator@xxxxxxxxxxxxxx>
  • To: gtk-server@xxxxxxxxxxxxx
  • Date: Tue, 20 Dec 2005 19:18:07 +0100

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 call
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 being
the actual type, which is a C number (e.g. G_TYPE_STRING, G_TYPE_INT etc). So
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 has
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 wrapper,
you probably need to catch this function yourself first; then check the amount
of columns being used by the client program, then redefine the call, and finally
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 the
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 because
> I think it's really useful.
> So I have to bind some functions of the GtkListStore object in order to use
> 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 *types);
> 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: