How to create customized widget in glade project.

1. Create a new glade project, either Gnome or Gtk+.

2. In "Gtk+ Addtional" tab, click the "Custom Widget" button labeled with "C", and add this DUMMY widget into any container of a top-level window.

3. In "Properties" dialog, fill the "Name" field, and then fill the "Creation Function" field (e.g., create_gtksrcview), other arguments can be ignored.

4. Save the glade file, and DO NOT compile the glade to C/C++ source code.

5. Initialize the UI from glade file, and show the main window, as following:

ui = glade_xml_new("./sunny.glade", NULL, NULL);
main_wnd = glade_xml_get_widget (ui, "main_wnd");
gtk_widget_show (main_wnd);
glade_xml_signal_autoconnect(ui);

6. Define the customized widget create function in C file, the function name must equal to the one you setup in glade file, and this function will be invoked automaticlly by libglade, and at last, you must SHOW the widget you created.

GtkWidget*
create_gtksrcview (gchar *widget_name, gchar *string1, gchar *string2, gint int1, gint int2)
{
GtkWidget *view;
GtkSourceBuffer *buffer;
... ...
view = gtk_source_view_new_with_buffer (buffer);
... ...
gtk_widget_show (view);
return view;
}