Re: FOSDEM GTK+ brochure
- From: Olav Vitters <olav vitters nl>
- To: engagement-list gnome org
- Subject: Re: FOSDEM GTK+ brochure
- Date: Thu, 8 Jan 2015 17:12:28 +0100
On Thu, Jan 08, 2015 at 03:48:35PM +0100, Sébastien Wilmet wrote:
I've finished an initial version:
https://people.gnome.org/~swilmet/gtk-brochure.pdf
https://github.com/swilmet/gtk-brochure
As text to make it easier for members to review and respond:
WARNING: THE COPY/PASTE IS NOT PERFECT, SOMETIMES IT COMBINED WORDS!
The GLib/GTK+ Development
Platform
GTK+, or the GIMP ToolKit, is a multi-platform
toolkit for creating graphical user interfaces. Offering
a complete set of widgets, GTK+ is suitable for
projects ranging from small one-off tools to complete
application suites.
GTK+ is written in C but has been designed from the
ground up to support a wide range of languages, not
only C/C++. Using GTK+ from languages such as
Python and JavaScript (especially in combination with
the Glade GUI builder) provides an effective method
of application development.
GTK+ is free software and part of the GNU Project.
However, the licensing terms for GTK+, the GNU
LGPL, allow it to be used by all developers, including
those developing proprietary software, without any
license fees or royalties.
GTK+ has been created in 1996 for the GIMP — the
GNU Image Manipulation Program — but has quickly
become a general-purpose library used by a large
number of applications including the GNU project’s
GNOME desktop.
Architecture Overview
Over time GTK+ has been built up to be based on
other libraries, also developed by the GTK+ team:
• GLib, a low-level core library that forms the basis
of GTK+. It provides data structure handling
for C, portability wrappers and interfaces for such
run-time functionality as an event loop, threads,
dynamic loading, an object system (GObject) and
high-level input/output APIs (GIO).
• Pango, a library for layout and rendering of text
with an emphasis on internationalization. It forms
the core of text and font handling for GTK+.
• Cairo, a library for 2D graphics with support for
multiple output devices (including the X Window
System, Win32) while producing a consistent output
on all media while taking advantage of display
hardware acceleration when available.
• ATK, a library for a set of interfaces providing
accessibility. By supporting the ATK interfaces, an
application or toolkit can be used with tools such
as screen readers, magnifiers, and alternative input
devices.
• GDK, or the GIMP Drawing Kit, is the abstraction
layer that allows GTK+ to support multiple
windowing systems. GDK provides backends for
X11, Windows, Mac OS X, Wayland, Mir, and a
web browser.
GLib – the Core Library
Firstly, GLib provides common data structures:
• Single and doubly linked lists.
• Hash tables.
• Balanced binary trees.
• N-ary trees: trees of data with any number of
branches.
• Strings with text buffers which grow automatically
as text is added.
• Arrays of arbitrary elements which grow automatically
as elements are added.
• GVariant, a generic data type that stores a value
along with information about the type of that
value.
• And a few other data structures.
GLib contains also lots of utilities:
• String and Unicode manipulation.
• Date and time functions.
• A command-line option parser.
• Perl-compatible regular expressions.
• An XML parser.
• A unit-test framework.
• And many other utilities.
Last, but not least, GLib provides some core event-driven
programming features, with a main event loop,
support for threads and asynchronous communication
between threads. An event loop listens some sources of
events, that can come from file descriptors (plain files,
pipes or sockets), timeouts, or other custom sources. A
priority is associated with each source of events. When
an event arrives, the event loop dispatches it to the
application. The event can then be taken into account,
either in the same thread or another thread.
Event-driven programming is not only useful for graphical
user interfaces (with user events such as key presses
and mouse clicks), but also for daemons that respond
to hardware changes (a USB stick inserted, a second
monitor connected, a printer low on paper), or software
that listen to network connections or messages
from other processes, and so on.
GObject – an Object System
Most modern programming languages come with their
own native object systems and additional fundamental
algorithmic language constructs. Just as GLib
serves as an implementation of such fundamental types
and algorithms (linked lists, hash tables and so forth),
GObject provides the required implementations of a
flexible, extensible, and intentionally easy to map (into
other languages) object-oriented framework for C. The
substantial elements that are provided can be summarized
as:
• A generic type system to register arbitrary single-inherited
flat and deep derived types as well as
interfaces for structured types. It takes care of
creation, initialization and memory management
of the assorted object and class structures, maintains
parent/child relationships and deals with dynamic
implementations of such types. That is,
their type specific implementations are relocatable/
unloadable during runtime.
• A collection of fundamental type implementations,
such as integers, doubles, enums and structured
types, to name a few.
• A fundamental type implementation to base object
hierarchies upon – the GObject base class.
• A signal system that allows very flexible user customization
of virtual/overridable object methods
and can serve as a powerful notification mechanism.
For example a GTK+ widget displaying text can
send a signal when some text is inserted, so the application
can connect to the signal by attaching a
callback function that is called when the signal is
emitted.
• An extensible parameter/value system, supporting
all the provided fundamental types that can be used
to generically handle object properties or otherwise
parameterized types. A property is like an object
attribute, but a signal is emitted when its value
changes. For instance a check button in GTK+ has
the active boolean property that tells whether the
check button is checked or not. An application can
attach a callback to the notify signal to be notified
when the state of the check button is modified.
GIO – Input/Output on Steroids
GIO is striving to provide a modern, easy-to-use Virtual
File System (VFS) API that sits at the right level
in the library stack, as well as other generally useful
APIs for desktop applications (such as networking and
D-Bus support). The goal is to provide an API that
is so good that developers prefer it over raw POSIX
calls. Among other things that means using GObject.
It also means not cloning the POSIX API, but providing
higher-level, document-centric interfaces.
The abstract file system model of GIO consists of a
number of interfaces and base classes for I/O and files.
Then there is a number of stream classes, similar to the
input and output stream hierarchies that can be found
in frameworks like Java. There is a framework for storing
and retrieving application settings. There is support
for network programming, including connectivity
monitoring, name resolution, lowlevel socket APIs and
highlevel client and server helper classes. There is support
for connecting to the D-Bus inter-process communication
system: sending and receiving messages,
owning and watching bus names, and making objects
available on the bus. Beyond these, GIO provides: file
monitoring; utility classes to implement asynchronous
and/or cancellable operations; an easy-to-use API to
launch and interact with child processes; and more.
In addition to the interfaces, GIO provides implementations
for the local case. Implementations for various
network file systems are provided by the GVFS package
as loadable modules. Another design choice is to
move backends out-of-process, which minimizes the dependency
bloat and makes the whole system more robust.
The backends are not included in GIO, but in the
separate GVFS package. The GVFS package also contains
a daemon which spawn further mount daemons
for each individual connection.
The GTK+ Widget Toolkit
On top of GLib/GObject/GIO sits GTK+, a library
containing a wide range of widgets. A widget is a basic
component of a graphical user interface, for instance a
button, some text, a menu, etc. A container is a special
widget that can contain other widgets. Another special
type of widget is a toplevel widget, i.e. a window. All
these widgets are (indirect) subclasses of the GObject
base class.
Although widgets can be created, configured and assembled
programmatically, the Glade interface builder
can be used to create the user interface graphically.
The Glade application creates an XML file that can be
loaded with GTK+.
GTK+ provides a flexible theming system with a CSSlike
syntax. The default theme is Adwaita, used by the
GNOME desktop, but other themes can be created
so an application can be well integrated with other
desktop environments or mobile devices.
About Versions
There are new GLib, GObject, GIO, GTK+ and
GNOME stable releases every six months, around
March and September. A version number has the form
X.Y.Z, where “Y” is even for stable versions and is
odd for unstable versions. A new minor stable version
(e.g. 3.14.0 ! 3.14.1) doesn’t add new features,
only translation updates, bug fixes and performance
improvements. For a library, a new major version number
(“X” in X.Y.Z) generally means there has been an
API break, but fortunately previous major versions are
parallel-installable with the latest version.
It’s recommended to use the latest versions for newly-
written code.
More information: http://www.gtk.org/
--
Regards,
Olav
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]