Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Gtk+/Gnome Application Development
Prev Home Next

GtkWidget In Detail

This section catalogs the functions in GtkWidgetClass more rigorously, and describes the default implementation of each.


Widget destruction is not significantly different from object destruction in general, as described in the section called Object Finalization in the chapter called The GTK+ Object and Type System. As always, there are three phases: shutdown, destroy, and finalize. Only the destroy method is a signal; the others are class functions only. If you override any of the three, you must "chain up" to the parent class implementation.

GtkWidget has default implementations of all three; you should know what they do:

  • In its shutdown method, a GtkWidget removes itself from its parent container (if any), and then unrealizes itself. This implies that widgets are always unrealized inside their destroy methods. It chains up to the GtkObject shutdown method which emits the "destroy" signal.

  • In its destroy method, a GtkWidget releases the grab if it has it, unreferences its style and sets widget->style to NULL, and gives up any connections it had to the current selection. (GtkEntry and other editable-text widgets allow you to select and paste text.) It chains up to the GtkObject destroy method which disconnects any signal handlers for the object.

  • In its finalize method, a GtkWidget frees a number of private data structures (stored as object data, see the section called Attaching Data to Objects in the chapter called The GTK+ Object and Type System), and frees widget->name. It chains up to the GtkObject finalize method which frees the instance struct.

Gtk+/Gnome Application Development
Prev Home Next

  Published under free license. Design by Interspire