<?xml version='1.0'?>
<!-- vim: set ai tw=80 ts=3 sw=3 et: -->
<!DOCTYPE slides PUBLIC "-//Norman Walsh//DTD Slides Full XML V3.3.0//EN"
       "http://docbook.sourceforge.net/release/slides/3.3.0/schema/dtd/slides.dtd" >

<slides>
   <slidesinfo>
      <title>Introduction To GNOME Development</title>
      <author>
         <firstname>Malcolm</firstname><surname>Tredinnick</surname>
         <affiliation>
            <address><email>malcolm@commsecure.com.au</email></address>
         </affiliation>
      </author>
      <confgroup>
         <conftitle>linux.conf.au</conftitle>
      </confgroup>
      <pubdate>Wednesday 14 January 2004</pubdate>
      <!--
      <copyright>
         <year>2003, 2004</year>
         <holder>Malcolm Tredinnick</holder>
      </copyright>
      -->
   </slidesinfo>

   <foil id="first-conclusion">
      <title>Conclusion</title>

      <itemizedlist>
         <listitem>
            <para>You now have enough knowledge to be able to learn the details
            of areas that are needed for your applications.</para>
         </listitem>
         <listitem>
            <para>Tutorial notes contain links to reference documentation and
            tutorials for many of the areas mentioned here.</para>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="goals">
      <title>Goals</title>

      <para>(Three hours earlier...)</para>

      <itemizedlist>
         <listitem>
            <para>GNOME provides a large number of support libraries for
            building applications.</para>
         </listitem>
         <listitem>
            <para>Each piece can be understood (at least partially) in
            isolation.</para>
         </listitem>
         <listitem>
            <para>Working out the bigger picture can be difficult.</para>
         </listitem>
         <listitem>
            <para>Learning from existing applications does not always provide
            clear guidelines.</para>
            <itemizedlist>
               <listitem>
                  <para>Unless there is something similar to copy, where to get
                  inspiration?</para>
               </listitem>
            </itemizedlist>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="big-picture">
      <title>The Big Picture</title>

      <mediaobject>
         <imageobject>
            <imagedata width="512" depth="480" format="PNG"
                                      fileref="graphics/desktop.png"/>
         </imageobject>
      </mediaobject>
   </foil>

   <foil id="gtk-1">
      <title>Basic Onscreen Elements (GTK+)</title>

      <para>GTK+ provides a basic collection of user interface widgets.</para>

      <itemizedlist>
         <listitem>
            <para>Basic window types</para>
         </listitem>
         <listitem>
            <para>Some standard dialogs</para>
         </listitem>
         <listitem>
            <para>Input and display widgets</para>
            <itemizedlist>
               <listitem>
                  <para>Short string input (e.g. name)</para>
               </listitem>
               <listitem>
                  <para>Larger text input and display (including markup).</para>
               </listitem>
               <listitem>
                  <para>Numerical input via sliders.</para>
               </listitem>
            </itemizedlist>
         </listitem>
         <listitem>
            <para>Tree and list displays.</para>
            <itemizedlist>
               <listitem>
                  <para>Based on a model/view architecture, so highly
                  customisable.</para>
               </listitem>
            </itemizedlist>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="gtk-2">
      <title>GTK+ Layout Philosophy</title>

      <itemizedlist>
         <listitem>
            <para>Layout based on a compose-and-pack model.</para>
            <itemizedlist>
               <listitem>
                  <para>Containers contain other widgets.</para>
                  <itemizedlist>
                     <listitem>
                        <para>Can have one (GtkBin, GtkRange) or multiple
                        children (GtkVBox)</para>
                     </listitem>
                  </itemizedlist>
               </listitem>
               <listitem>
                  <para>Placing a larger widget inside a smaller one is not
                  difficult (GtkScrolledWindow, GtkViewport).</para>
               </listitem>
            </itemizedlist>
         </listitem>
         <listitem>
            <para>Constructing layouts best done using Glade</para>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="glade">
      <title>Glade and Libglade</title>

      <itemizedlist>
         <listitem>
            <para>Glade is a tool for designing user interfaces that use GTK+
            and GNOME widgets.</para>
         </listitem>
         <listitem>
            <para>Libglade is a library that reads the XML produced by Glade (or
            another conformant tool) and constructs the usre interface when a
            program is run.</para>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="glade-code">
      <title>(Lib)Glade XML</title>

<programlisting><![CDATA[
<widget class="GtkWindow" id="listview_test">
  <property name="visible">True</property>
  <property name="title" translatable="yes">ListView Test Application</property>
  <property name="type">GTK_WINDOW_TOPLEVEL</property>
  <property name="window_position">GTK_WIN_POS_NONE</property>
  <property name="modal">False</property>
  <property name="resizable">True</property>
  <property name="destroy_with_parent">False</property>

  <child>
    <widget class="GtkScrolledWindow" id="scrolledwindow1">
      <property name="visible">True</property>
      <property name="can_focus">True</property>
      ...
      <child>
          <widget class="GtkTreeView" id="treeview1">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="headers_visible">True</property>
             ...
          </widget>
      </child>
    </widget>
  </child>
</widget>
]]>
</programlisting>
   </foil>

   <foil id="glade-output">
      <title>Resulting Output</title>

      <mediaobject>
         <imageobject>
            <imagedata width="255" depth="281" format="PNG"
                                          fileref="graphics/glade-design.png"/>
         </imageobject>
      </mediaobject>
   </foil>

   <foil id="pango-1">
      <title>Pango and Text Widgets</title>

      <itemizedlist>
         <listitem>
            <para>Nice, easy to read text display is important.</para>
         </listitem>
         <listitem>
            <para>Internationalisation is important.</para>
         </listitem>
         <listitem>
            <para>Pango handles the layout of text.</para>
            <itemizedlist>
               <listitem>
                  <para>Direct interaction usually not needed</para>
               </listitem>
               <listitem>
                  <para>...but it does have a documented, public API if
                  required.</para>
               </listitem>
            </itemizedlist>
         </listitem>
         <listitem>
            <para>GtkTextView is the widget to use to display text.</para>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="pango-output">
      <title>Pango Rendering</title>

      <mediaobject>
         <imageobject>
            <imagedata width="460" depth="477" format="PNG"
                                           fileref="graphics/pango-display.png"/>
         </imageobject>
      </mediaobject>
   </foil>

   <foil id="textview-example">
      <title>GtkTextView Bells And Whistles</title>

      <mediaobject>
         <imageobject>
            <imagedata width="460" depth="477" format="PNG"
                                      fileref="graphics/textview-example.png"/>
         </imageobject>
      </mediaobject>
   </foil>

   <foil id="glib-1">
      <title>GLib</title>

      <para>Portability layer.</para>
      <itemizedlist>
         <listitem>
            <para>Constants and macros for data sizes, byte ordering, print
            format specifiers, ...</para>
         </listitem>
         <listitem>
            <para>Useful data structures and algorithms for working with
            them.</para>

            <itemizedlist>
               <listitem>
                  <para>Lists (single- and double-linked)</para>
               </listitem>
               <listitem>
                  <para>Hash tables</para>
               </listitem>
               <listitem>
                  <para>Trees</para>
               </listitem>
               <listitem>
                  <para>Memory management assistance: various caching structures
                  and helper functions.</para>
               </listitem>
            </itemizedlist>
         </listitem>
         <listitem>
            <para>String functions (including Unicode support).</para>
         </listitem>
         <listitem>
            <para>Filesystem and process support.</para>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="glib-threads">
      <title>Thread Support</title>

      <itemizedlist>
         <listitem>
            <para>GLib (via GThread) provides an abtraction over common
            threading implementations: POSIX, Solaris.</para>
         </listitem>
         <listitem>
            <para>Code can be written to run with or without thread
            support.</para>
         </listitem>
         <listitem>
            <para>Libraries can be written to run correctly whether or not
            threads have been initialised.</para>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="glib-mainloop">
      <title>GLib Main Loop</title>

      <itemizedlist>
         <listitem>
            <para>Event-based applications have many things waiting for
            something to happen.</para>
         </listitem>
         <listitem>
            <para>GLib main loop (<literal>g_main_*()</literal>) coordinates all
            of this activity.</para>
         </listitem>
         <listitem>
            <para>Functions can be called based on various triggers:</para>
            <itemizedlist>
               <listitem>
                  <para>During idle moments (priorities against other idle
                  functions can be set).</para>
               </listitem>
               <listitem>
                  <para>On a scheduled basis (using timeouts)</para>
               </listitem>
               <listitem>
                  <para>When input arrives or output is ready to be sent
                  (controlled by polling file descriptors).</para>
               </listitem>
            </itemizedlist>
         </listitem>
         <listitem>
            <para>Not all external libraries fit into the GLib main loop
            structure easily. This can be a hinderance when leveraging existing
            work.</para>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="gobjects-1">
      <title>GObject</title>

      <itemizedlist>
         <listitem>
            <para>Started out as a way to do object oriented C. Has grown into
            benefits beyond that.</para>
         </listitem>
         <listitem>
            <para>Objects have parameters which can be accessed
            controlled</para>
            <itemizedlist>
               <listitem>
                  <para>Read-only</para>
               </listitem>
               <listitem>
                  <para>Read / write</para>
               </listitem>
               <listitem>
                  <para>Write only at construction time, read any time.</para>
               </listitem>
            </itemizedlist>
         </listitem>
         <listitem>
            <para>Parameter values can have a known type or be "boxed", making
            them opaque to applications.</para>
         </listitem>
         <listitem>
            <para>Objects can have descriptive enums associated with them.
            Slightly more powerful than the corrseponding C construct.</para>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="gobjects-2">
      <title>GObject Signals</title>

      <itemizedlist>
         <listitem>
            <para>Objects (can) communicate with other objects by emitting
            signals.</para>
         </listitem>
         <listitem>
            <para>Signals can be anything (new ones can easily be
            created).</para>
               <itemizedlist>
               <listitem>
                  <para>GTK+ widgets emit signals when they are deleted,
                  changed, resized, edited, focused, clicked, dragged,
                  ...</para>
               </listitem>
            </itemizedlist>
         </listitem>
         <listitem>
            <para>Handlers for signals can be changed. Priorities can be
            assigned and bubbling of signals can be terminated.</para>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="gobjects-3">
      <title>Why GObjects?</title>

      <itemizedlist>
         <listitem>
            <para>Very friendly to language bindings and dynamic
            programming.</para>
            <itemizedlist>
               <listitem>
                  <para>Introspection is possible (e.g. see gtk-doc)</para>
               </listitem>
               <listitem>
                  <para>Parameters and signals comes with description strings
                  (which should be filled in). Presenting help and tooltips is
                  therefore simple.</para>
               </listitem>
            </itemizedlist>
         </listitem>
         <listitem>
            <para>Some restraint is required!</para>
            <itemizedlist>
               <listitem>
                  <para>Not everything should be a GObject. Some performance
                  impact (but don't overrate this problem.</para>
               </listitem>
               <listitem>
                  <para>As a general rule: use GObjects for externally visible
                  data structures. They are a bit more powerful than straight C
                  structures (more language-binding friendly, for a
                  start).</para>
               </listitem>
               <listitem>
                  <para>Use GObjects when using signals + callbacks to
                  communicate data and state changes is a good idea.</para>
               </listitem>
            </itemizedlist>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="gconf">
      <title>GConf</title>

      <itemizedlist>
         <listitem>
            <para>A standardised daemon and API for storing configuration
            information.</para>
         </listitem>
         <listitem>
            <para>Information stored under a path into a registry-like
            structure.</para>
         </listitem>
         <listitem>
            <para>Originally designed to store parameters for running
            applications, not so much for persistent state.</para>

            <para>That is changing a bit now, since there is nothing else to
            server the "persistent state" requirement.</para>
         </listitem>
         <listitem>
            <para>Best description and overview of GConf is Havoc Pennington's
            paper from OLS 2002.</para>
         </listitem>
      </itemizedlist>

      <warning>
         <para>Do not be tempted to use gnome-config in place of GConf. The
         former is not safe except when the user is only logged in once and
         running a single copy of the application.</para>
      </warning>
   </foil>

   <foil id="bonobo">
      <title>Bonobo</title>

      <itemizedlist>
         <listitem>
            <para>The bonobo infrastructure (named after the monkeys) provide a
            way to create reusable, composable components.</para>
         </listitem>
         <listitem>
            <para>Libbonobo provides the mechanism to create the components
            themselves.</para>
            <itemizedlist>
               <listitem>  
                  <para>Factory management and object creation.</para>
               </listitem>
               <listitem>
                  <para>Components can be activated by names based on the type
                  of service interface they provide. This permits multiple
                  implementations of an interface, although that feature is not
                  really used in GNOME.</para>
               </listitem>
            </itemizedlist>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="bonoboui">
      <title>Libbonoboui</title>

      <itemizedlist>
         <listitem>
            <para>A way to embed widgets managed by one application into another
            application.</para>
         </listitem>
         <listitem>
            <para>This is not too difficult. For example, to embed a PDF viewing
            component (in C):</para>
<programlisting>
GtkWidget *widget;
widget = bonobo_widget_new_control ("OAFIID:GNOME_PDF_Server");
gtk_container_add (GTK_CONTAINER (container), frame_widget);
gtk_widget_show (frame_widget);
</programlisting>
         </listitem>
         <listitem>
            <para>For good example code of how to effectively use bonoboui and
            pluggable components, have a look at GEdit.</para>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="libgnome">
      <title>Libgnome</title>

      <itemizedlist>
         <listitem>
            <para>High level application management.</para>
            <itemizedlist>
               <listitem>
                  <para>Program initialisation</para>
               </listitem>
               <listitem>
                  <para>Help support</para>
               </listitem>
               <listitem>
                  <para>High score handling for games</para>
               </listitem>
               <listitem>
                  <para>Displaying URLs in configured application</para>
               </listitem>
               <listitem>
                  <para>Some generic process management support (forking /
                  execing programs).</para>
               </listitem>
            </itemizedlist>
         </listitem>
         <listitem>
            <para>Obviously does not <emphasis>have</emphasis> to be used, since
            many programs exist that do not depend upon libgnome.</para>
         </listitem>
         <listitem>
            <para>Don't try to be too cute. Use it unless you have a good reason
            not to.</para>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="libgnomeui">
      <title>Libgnomeui</title>

      <itemizedlist>
         <listitem>
            <para>Some extra widgets that are not currently available in GTK+ or
            that require extra dependencies above GTK+ in the stack.</para>
         </listitem>
         <listitem>
            <para>Plans to move as much as possible down into GTK+ in the future
            (much of this happening already).</para>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="gnome-vfs">
      <title>libgnomevfs</title>

      <itemizedlist>
         <listitem>
            <para>Generic filesystem layer. Makes manu resources accesible with
            Unix-like file commands.</para>
         </listitem>
         <listitem>
            <para>Lots of MIME-type detection knowledge.</para>
         </listitem>
         <listitem>
            <para>Support for finding standard directories such as the Desktop
            and Trash folders.</para>
         </listitem>
         <listitem>
            <para>Writing new modules is not difficult, but does not need to be
            done very often.</para>
         </listitem>
         <listitem>
            <para>Modules can be written and made available without needing to
            recompile the library.</para>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="multimedia support">
      <title>Multimedia Support</title>

      <para>Provided by GStreamer</para>

      <itemizedlist>
         <listitem>
            <para>Pluggable architecture. Components are strung together as a
            pipeline (which can branch and merge).</para>
         </listitem>
         <listitem>
            <para>Handles audio and video formats. Many different formats
            available. Writing new modules is not too difficult.</para>
         </listitem>
         <listitem>
            <para>Thursday 13:45 in Napier: Steve Baker talks about "The
            GStreamer Multimedia Architecture".</para>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="xml-support">
      <title>XML Support</title>

      <itemizedlist>
         <listitem>
            <para>Libxml is an extremely fast, highly correct implementation of
            a number of XML-related specifications.</para>

            <itemizedlist>
               <listitem>
                  <para>XML and XML Namespaces</para>
               </listitem>
               <listitem>
                  <para>Schema support (in progress)</para>
               </listitem>
               <listitem>
                  <para>Relax NG</para>
               </listitem>
            </itemizedlist>
         </listitem>
         <listitem>
            <para>Used in a number of applications that require heavy XML
            processing: Gnumeric, Yelp, libbonobo</para>
         </listitem>
         <listitem>
            <para>Libxslt is an XSLT processor built upon libxml. Correctness
            and speed are the design goals and are well met.</para>
         </listitem>
         <listitem>
            <para>Active mailing list, good documentation (from beginner-level
            tutorial up to API documentation), very readable code.</para>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="printing">
      <title>Printing</title>

      <itemizedlist>
         <listitem>
            <para>Libgnomeprint provides the application-level support.
            Libgnomeprintui provides the user interface portions.</para>
         </listitem>
         <listitem>
            <para>Suffered from some teething problems. Climbing back into
            respectability and acceptance.</para>
         </listitem>
         <listitem>
            <para>Future looks good with Cairo support in the pipeline.</para>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="random-modules">
      <title>Some Other Random Modules</title>

      <itemizedlist>
         <listitem>
            <para>vte</para>
            <itemizedlist>
               <listitem>
                  <para>Embeddable terminal widget. Accesible,
                  internationalisation support.</para>
               </listitem>
               <listitem>
                  <para>Written as an experiment in reversing the purpose of
                  termcap.</para>
               </listitem>
               <listitem>
                  <para>Obvious example of use is gnome-terminal (which is vte
                  in a window with a menu bar).</para>
               </listitem>
            </itemizedlist>
         </listitem>
         <listitem>
            <para>gtksourceview</para>
            <itemizedlist>
               <listitem>
                  <para>Source code colouring (based on syntax file). Easily
                  configurable.</para>
               </listitem>
               <listitem>
                  <para>Look at source code highlightin plugin in GEdit.</para>
               </listitem>
            </itemizedlist>
         </listitem>
         <listitem>
            <para>libwnck</para>
            <itemizedlist>
               <listitem>
                  <para>Common window-manager utility functions. Any utility
                  that wants to work with desktop windows needs to use
                  this.</para>
               </listitem>
            </itemizedlist>
         </listitem>
         <listitem>
            <para>panel applets</para>
            <itemizedlist>
               <listitem>
                  <para>libpanelapplet provides common functions for creating
                  these.</para>
               </listitem>
            </itemizedlist>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="language-bindings">
      <title>Language Bindings</title>

      <itemizedlist>
         <listitem>
            <para>The ability to use GNOME functionality through many languages
            is a real benefit.</para>
         </listitem>
         <listitem>
            <para>Extensive bindings exist for large portions of the
            platform.</para>
            <itemizedlist>
               <listitem>
                  <para>Python</para>
                  <itemizedlist>
                     <listitem>
                        <para>11:00 on Friday in Napier: James Henstridge talks
                        about GNOME + Python</para>
                     </listitem>
                  </itemizedlist>
               </listitem>
               <listitem>
                  <para>C++</para>
               </listitem>
               <listitem>
                  <para>C#</para>
               </listitem>
               <listitem>
                  <para>Java</para>
               </listitem>
               <listitem>
                  <para>Ruby</para>
               </listitem>
               <listitem>
                  <para>Perl</para>
               </listitem>
               <listitem>
                  <para>...</para>
               </listitem>
            </itemizedlist>
         </listitem>
         <listitem>
            <para>"Language Bindings" bundle being released. Does not contain
            all important bindings, but does have a good cross-section.</para>
         </listitem>
      </itemizedlist>
   </foil>

   <foil id="final-conclusion">
      <title>Conclusion</title>

      <itemizedlist>
         <listitem>
            <para>You now hopefully have enough knowledge to be able to learn
            the details of areas that are needed for your applications.</para>
         </listitem>
         <listitem>
            <para>Tutorial notes contain links to reference documentation and
            tutorials for many of the areas mentioned here.</para>
         </listitem>
      </itemizedlist>
   </foil>

</slides>
