Editing the Code

Now, back at the Anjuta environment, you would be able to see a callbacks.c file in the left panel of the screen in the Source files section. Double click it to open it. Anjuta then opens the file into the right portion of the window for editing purposes.

It sometimes becomes easier and more exciting if thing are colorful. Such is the case with Anjuta's Syntax Hilite feature (from the Format menu). Many more features are provided with Anjuta, which you can make yourself comfortable with. Perhaps take a little time off and explore the environment till you are satisfied and things start appearing known to you.

Back, in the callbacks.c file, you might see two callback functions: on_BT_OK_clicked andon_BT_EXIT_clicked. In the latter, add a function gtk_main_quit() such that the entire function looks like this:

	void 
	on_BT_EXIT_clicked (GtkButton *button, gpointer user_data) 
	{ 

		gtk_main_quit(); 

	} 

This causes the program to end when the user clicks this button. Similarly, add the following code to the on_BT_OK_clicked function:

	void 
	on_BT_OK_clicked (GtkButton *button, gpointer user_data) 
	{ 

		GtkWidget *entry = lookup_widget (GTK_WIDGET(button), "ENTRY"); 
		GtkWidget *msgbox = gnome_app_new("Hello World", "Hello World"); 
		gchar *text1, *text2; 

		text1 = gtk_entry_get_text (GTK_ENTRY(entry)); 
		text2 = g_strconcat ("Hello, ", text1, NULL); 
		gnome_app_message (GNOME_APP(msgbox), text2);
		g_free (text2); 

	} 

After this save and close the callbacks.c (use the File menu or the toolbar icons for this purpose).