<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" type="topic" id="tech-gobject" lang="zh-CN">
  <info>
    <link type="guide" xref="tech" group="gobject"/>

    <credit type="author copyright">
      <name>Federico Mena Quintero</name>
      <email its:translate="no">federico@gnome.org</email>
      <years>2013</years>
    </credit>

    <license xmlns="http://projectmallard.org/1.0/" href="http://creativecommons.org/licenses/by-sa/3.0/us/">
<p>This work is licensed under a
<link href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons
Attribution-Share Alike 3.0 United States License</link>.</p>
<p>As a special exception, the copyright holders give you permission to copy,
modify, and distribute the example code contained in this document under the
terms of your choosing, without restriction.</p>
</license>

    <desc>C-based object and type system with signals and slots</desc>
  </info>

<title>GObject</title>

  <p>GObject is the part of the <link xref="tech-glib">GLib</link> library that
  provides an object and type system for C programs. Although C as a language
  does not provide objects or classes, GObject makes it possible to write
  object-oriented C programs.</p>

  <p>
    GObject provides a fundamental GType, the base for the whole type system,
    from which types such as ints and strings are derived.  Then, there is
    GObject itself, the base class for all other classes.  Objects can emit
    <em>signals</em> to notify the caller when something interesting happens.
    For example, a <code>Button</code> object could emit a <code>clicked</code>
    signal to indicate that it has been pressed and released.
  </p>

  <p>
    GObject is <em>introspectable</em>, which means that you can ask the
    GObject system for the class types that are defined, the methods they
    support, their signals, etc.  GNOME's language bindings are built on top of
    this introspection information.  Instead of writing wrappers by hand to let
    GNOME APIs be called from other programming languages, language bindings
    use the introspection information from GObject to auto-generate those
    wrappers themselves.
  </p>

  <p>
    You normally don't need to be concerned with GObject itself if you are
    programming for GNOME with an object-oriented language.  However, making
    yourself familiar with GObject's concepts, such as signals and slots, will
    make your life easier as a GNOME programmer.
  </p>

  <list style="compact">
    <item><p><link href="http://developer.gnome.org/gobject/stable/">GObject reference manual</link></p></item>
  </list>

</page>
