View Single Post
Posts: 6 | Thanked: 0 times | Joined on Sep 2009 @ Finland
#1
Iam using Glade for GUI building and Gtkbuilder for connecting signals.

As a newbie i got confused with the parameter type of 'data' in the code
Code:
	gtk_builder_connect_signals( builder, data);
'data' is a struct where i have my UIdata stored eg data->button1 ,data->label1........data->label4

Code:
/* Main data structure definition */

typedef struct _ChData ChData;
struct _ChData
{
	/* Widgets */

	GtkWidget *window1;  /* Main application window */
	GtkWidget *label1;
	GtkWidget *label2;
	GtkWidget *label3;
	GtkWidget *label4;
};

#endif /* __SUPPORT_H__ */
i have added the Gobject pointers properly with the ChData

Main window has a button and i need to update label4 upon the click of the button . as show below

Code:
G_MODULE_EXPORT gboolean
button1_clicked_cb( GtkWidget   *widget,
				 GdkEventExpose *event,
				 ChData         *data )
{	
	
	g_print ("DAQ started now\n");
	gtk_label_set_text (GTK_LABEL(data->label4), g_strdup_printf ("DAQ started now"));
	
	return( TRUE );
	
}

All the code compiles without error

but when i run it

g_print is working but gtk_label runs into segmentation fault!!


Can some one throw some light on passing UI data to callbacks?

Last edited by rajasekaran; 2009-09-30 at 20:21.