|
Packit |
1470ea |
|
|
Packit |
1470ea |
<page xmlns="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" type="topic" id="tech-gobject" xml:lang="sv">
|
|
Packit |
1470ea |
<info>
|
|
Packit |
1470ea |
<link type="guide" xref="tech" group="gobject"/>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<credit type="author copyright">
|
|
Packit |
1470ea |
<name>Federico Mena Quintero</name>
|
|
Packit |
1470ea |
<email its:translate="no">federico@gnome.org</email>
|
|
Packit |
1470ea |
<years>2013</years>
|
|
Packit |
1470ea |
</credit>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<include xmlns="http://www.w3.org/2001/XInclude" href="cc-by-sa-3-0.xml"/>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<desc>C-based object and type system with signals and slots</desc>
|
|
Packit |
1470ea |
</info>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<title>GObject</title>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
GObject is the part of the <link xref="tech-glib">GLib</link> library that
|
|
Packit |
1470ea |
provides an object and type system for C programs. Although C as a language
|
|
Packit |
1470ea |
does not provide objects or classes, GObject makes it possible to write
|
|
Packit |
1470ea |
object-oriented C programs.
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
GObject provides a fundamental GType, the base for the whole type system,
|
|
Packit |
1470ea |
from which types such as ints and strings are derived. Then, there is
|
|
Packit |
1470ea |
GObject itself, the base class for all other classes. Objects can emit
|
|
Packit |
1470ea |
signals to notify the caller when something interesting happens.
|
|
Packit |
1470ea |
For example, a Button object could emit a clicked
|
|
Packit |
1470ea |
signal to indicate that it has been pressed and released.
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
GObject is introspectable, which means that you can ask the
|
|
Packit |
1470ea |
GObject system for the class types that are defined, the methods they
|
|
Packit |
1470ea |
support, their signals, etc. GNOME's language bindings are built on top of
|
|
Packit |
1470ea |
this introspection information. Instead of writing wrappers by hand to let
|
|
Packit |
1470ea |
GNOME APIs be called from other programming languages, language bindings
|
|
Packit |
1470ea |
use the introspection information from GObject to auto-generate those
|
|
Packit |
1470ea |
wrappers themselves.
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
You normally don't need to be concerned with GObject itself if you are
|
|
Packit |
1470ea |
programming for GNOME with an object-oriented language. However, making
|
|
Packit |
1470ea |
yourself familiar with GObject's concepts, such as signals and slots, will
|
|
Packit |
1470ea |
make your life easier as a GNOME programmer.
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<list style="compact">
|
|
Packit |
1470ea |
<item><link href="http://developer.gnome.org/gobject/stable/">GObject reference manual</link> </item>
|
|
Packit |
1470ea |
</list>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
</page>
|