gtk-entry pointer problem



Hello,
I have a problem with my gtk entry widget. In my application I want to get the
path of a picture, entered by the user in this entry widget.

I have the following structure which is passed as argument

struct picture_s{
        unsigned char *y_pic;
        unsigned char *u_pic;
        unsigned char *v_pic;
        unsigned char *rgb_pic;
        int width;
        int height;
        char *path
};

struct picture_s *picture;

and my callback-function looks like

g_signal_connect(GTK_OBJECT(text_path),"activate",GTK_SIGNAL_FUNC(text_path_drawback),(gpointer)
picture);

gboolean text_path_drawback(GtkWidget*widget,GdkEvent *event,struct picture_s
*picture){

        const char *pathentered= gtk_entry_get_text (GTK_ENTRY (widget));
        picture->path=pathentered;
        printf("%sn",picture->path);

        return TRUE;

}

so this printf is done very well, but if I click now on my Load button widget
and i use absolutely the same printf,( printf("%sn",picture->path); )
so my element "path" seems to be a null pointer.

here the button widget stuff:

g_signal_connect
(GTK_OBJECT(button_load),"button-press-event",GTK_SIGNAL_FUNC(button_load_drawback),(gpointer)
picture);

gboolean button_load_drawback(GtkWidget*widget,GdkEventButton *event, struct
picture_s *picture){


        printf("%sn",picture->path);

        return TRUE;

}


I now, that it has to be a really stupid beginner mistake, but i can't find it,
so please help me a little bit!!
Thanks a lot Simon



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]