gtk+ 2.0 marshaller problems with passing non gpointer variables?
- From: safemode <safemode speakeasy net>
- To: gtk-app-devel-list gnome org
- Subject: gtk+ 2.0 marshaller problems with passing non gpointer variables?
- Date: Wed, 3 Oct 2001 10:32:13 -0400
I'm having a problem passing structures (well anything non-gpointer) to a
function called by gtk_signal_connect. It seems that the argument structure
is not passed or is somehow re-initialized. I cant tell. All i know is that
the value i get on the called function is always the same (due to nothing
overwriting the memory).
Note. chosen and chosen2 are global variables of type info which is a
structure.
<code snippit>
void test_func(info *chosen1)
{
printf("old name test: %s\n",chosen1->selected_oldfile);
}
void gtk_interface(int argc, char *argv[])
{
sprintf(chosen.selected_oldfile,"%s", "/\0");
sprintf(chosen2.selected_oldfile,"%s","/\0");
test_func(&chosen);
gtk_init (&argc, &argv);
<more code>
</code snippit>
Now here, chosen1->selected_oldfile has the correct value when printf'd of "/"
Exactly what i want.
<code snippit>
void create_file_select(info *chosen1)
{
printf("old name: %s\n",chosen1->selected_oldfile);
printf("old name: %s\n",chosen.selected_oldfile);
<more code>
}
<code snippit further down in gtk_interface>
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC(create_file_select), &chosen);
</code snippit in gtk_interface>
</code snippit>
Now here just to make sure chosen.selected_oldfile prints "/" as it should.
chosen1->selected_oldfile prints "]" no matter what value i initially make
chosen in gtk_interface.
So i have to come to the conclusion that either i'm
A. not getting the procedure you have to do in order to pass a structure
inside gtk_signal_connect or
B. the marshaller in gtk 2.0 is retarded when it comes to passing anything
non gpointer;
I've tried sending just normal characters and the same thing occurs. It gets
an uninitialized pointer to some place in memory. Not a pointer to the
variable i'm sending it in gtk_signal_connect.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]