help......SEGMENTATION FAULT ERROR...



hi

i'm giving my simple source code below ..In that code if i make my Button References as a global ..it gives segmentation fault error ..I'm not getting why this is happening..because if button references are local then it work properly..

plz help me...

 

#include <gtk/gtk.h>

GtkWidget *window,*table;

int start_connection(GtkWidget *connect_w,gpointer data)

{

           gtk_widget_set_sensitive(connect_w,FALSE);

/*

I want to make dis_connect TRUE

****How can i do that???*****

*/

return 1;

}

int end_connection(GtkWidget *dis_connect_w,gpointer data)

{

}

int main(int argc , char *argv[])

{

GtkButton *connect;

GtkButton *dis_connect;

gtk_init(&argc,&argv);

window = gtk_window_new(GTK_WINDOW_DIALOG);

gtk_window_set_title(GTK_WINDOW(window),"PPPoE for LINUX...");

gtk_signal_connect(GTK_OBJECT(window),"destroy",GTK_SIGNAL_FUNC(gtk_main_quit),NULL);

gtk_widget_set_usize(window,300,300);

table = gtk_table_new(6, 3, TRUE);

gtk_container_add(GTK_CONTAINER(window), table);

connect = (GtkButton *)gtk_button_new_with_label("Connect");

gtk_table_attach(GTK_TABLE(table),(GtkWidget *)connect, 1, 2, 5, 6, GTK_FILL,GTK_FILL, 5,4);

gtk_signal_connect(GTK_OBJECT(connect), "clicked", GTK_SIGNAL_FUNC(start_connection), NULL );

dis_connect = (GtkButton *)gtk_button_new_with_label("Cancel");

gtk_table_attach(GTK_TABLE(table),(GtkWidget *)dis_connect, 2, 3, 5, 6, GTK_FILL,GTK_FILL, 5,4);

gtk_signal_connect(GTK_OBJECT(dis_connect), "clicked", GTK_SIGNAL_FUNC(end_connection), NULL );

gtk_widget_set_sensitive((GtkWidget *)dis_connect,FALSE);

gtk_window_set_policy(GTK_WINDOW(window),FALSE,FALSE,FALSE);

gtk_widget_show_all(window);

gtk_main();

return 0;

}

 



Do You Yahoo!?
For regular News updates go to Yahoo! News

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