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

  • From: "Leonardo Cecchi" <l.cecchi@xxxxxxxxxxxxxxxxxxxx>
  • To: <gtk-server@xxxxxxxxxxxxx>, "'Peter van Eerten'" <turtle@xxxxxx>
  • Date: Wed, 21 Dec 2005 09:44:03 +0100

Hi Peter.

I tried your solution and I think gtk_server_redefine works perfectly.
I have another strange issue: gtk-server core dumps where I call the
redefined gtk_list_store_new.

I attach a file with the communication between gtk-server and the wrapper:

Then the gtk-server goes to core dump.
64 is the number for G_TYPE_STRING: i've checked with a c program.
I'm in windows with gtk-server 2.0.6 and gtk 2.6.7.
Probably the solution is easy....
When I've more time I will check on linux in order to see the stack trace.
Thanks again,

Leonardo


-----Messaggio originale-----
Da: gtk-server-bounce@xxxxxxxxxxxxx [mailto:gtk-server-bounce@xxxxxxxxxxxxx]
Per conto di Peter van Eerten
Inviato: mercoledì 21 dicembre 2005 6.31
A: gtk-server@xxxxxxxxxxxxx
Oggetto: [gtk-server] Re: R: How to bind varargs functions

Hi Leonardo,

Well, you are completely right there! I have cut and pasted from old code.
But
the GTK-server expects the incoming call without commas.

Sorry for the confusion.

Regards
Peter


Citeren Leonardo Cecchi <l.cecchi@xxxxxxxxxxxxxxxxxxxx>:

> 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?
> Thanks,
>
> Leonardo
>
> -----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
> 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,
> Peter
>
> 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
> >

-- 
http://www.gtk-server.org

Send: gtk_init NULL NULL 
Received: ok
Send: gtk_server_enable_c_string_escaping 
Received: ok
Send: gtk_window_new 0  
Received: 16376968
Send: gtk_vbox_new 0   2  
Received: 16396048
Send: gtk_button_new_with_label "Quit"  
Received: 16445976
Send: gtk_tree_view_new 
Received: 16490872
Send: gtk_cell_renderer_text_new 
Received: 16374976
Send: gtk_tree_view_insert_column_with_attributes 16490872   -1   "Nome"   
16374976  
Received: 1
Send: gtk_tree_view_insert_column_with_attributes 16490872   -1   "Cognome"   
16374976  
Received: 2
Send: gtk_server_redefine gtk_list_store_new NONE WIDGET 2 LONG LONG  
Received: ok
Send: gtk_list_store_new 1 64  

Other related posts: