Use of Glade3 + Anjuta (connection between controls and functions)
Source: Internet
Author: User
Use of Glade3 + Anjuta (connection between controls and functions)-Linux general technology-Linux programming and kernel information. For details, see the following. Glade 3 is a fully rewritten version. The biggest feature is that it removes the code generation function. This fully complies with the original intention of Glade: separation of the interface and code.
However, in Anjuta, there is no way to use g_signal_connect () to connect the controls generated by Glade 3 with the time. No useful information has been found on the Internet to compare the files generated by Glade2, it is found that Anjuta uses glade_xml_new and glade_xml_get_widget, which is different from the generated file of Glade2, but directly calls glade in XML format.
It seems that only the default generation function GtkWidget * create_window (void) of Anjuta is modified,
GtkWidget *
Create_window (void)
{
GtkWidget * window;
GladeXML * gxml;
GtkWidget * button;
Gxml = glade_xml_new (GLADE_FILE, NULL, NULL );
/* This is important */
Glade_xml_signal_autoconnect (gxml );
Window = glade_xml_get_widget (gxml, "window ");
Button = glade_xml_get_widget (gxml, "button1 ");
G_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL );
G_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (gtk_main_quit), NULL );
Return window;
}
The red part is the connection to the control you want to add. button1 is the button you created in Glade 3. You can also directly Delete the create_window function and call XML in the main function.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.