#include static gboolean connected = FALSE; static void connect_cb(GtkWidget *widget, gpointer data) { connected = !connected; if (connected) gtk_button_set_label(GTK_BUTTON(widget), "Disconnect"); else gtk_button_set_label(GTK_BUTTON(widget), "Connect"); } gint control_tab_init(GtkNotebook *notebook) { GtkWidget *table = gtk_table_new(10, 10, FALSE); gtk_container_set_border_width(GTK_CONTAINER(table), 10); GtkWidget *button = gtk_button_new_with_label("Connect"); gtk_table_attach(GTK_TABLE(table), button, 0, 1, 0, 1, 0, 0, 10, 10); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(connect_cb), NULL); GtkWidget *label = gtk_label_new(" Control "); return gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, label); }