# Core Technologies

## Графические интерфейсы

Большинству приложений необходимо предоставлять графический интерфейс для для взаимодействия с пользователями. Графические интерфейсы могут создавать интуитивное и воспринимаемое окружения для взаимодействия с программным обеспечением и пользователи ожидают, что приложения будут обеспечивать удобный и привлекательный интерфейс.

The GNOME Platform features sophisticated graphics and user interface technology, from standard user interface controls to an API for drawing high-quality graphics to the screen. Using the graphics technologies in GNOME allows you to create applications that are consistent, intuitive, and aesthetically pleasing.

### Layered Look at Graphics Libraries

### GTK+

GTK+ - это основная библиотека, используемая для построения интерфейсов пользователя. Она предоставляет все графические элементы управления пользователя или виджеты, используемые в графических приложениях. Современнные объектно-ориентированные программные интерфейсы позволяют конструировать привлекательные и естественные интерфейсы для пользователя без необходимости иметь дело с тем, как этот интерфейс рисуется на низком уровне и какие при этом взаимодействуют устройства.

In addition to basic widgets, such as buttons, check boxes, and text entries, GTK+ also provides powerful Model-View-Controller (MVC) APIs for tree views, multi-line text fields, and menu and toolbar actions.

Widgets in GTK+ are placed on windows using a box-packing model. Programmers specify only how to pack widgets together in container boxes, rather than position them directly with absolute coordinates. GTK+ ensures that windows are sized correctly to fit their contents, and it automatically handles window resizing.

Because GTK+ offers a flexible API, developing additional widgets for use in GTK+ applications is easy. A number of third-party libraries exist which provide additional widgets, and many developers have created custom, special-purpose widgets for their applications.

GTK+ handles the difficult details of user interfaces and user interaction, and provides a simple yet powerful API which allows you to focus on the details of your application. Applications developed with GTK+ will automatically follow the user's theme and font settings, will interact properly with accessibility technologies, and will behave as users expect.

For more information on GTK+, see the GTK+ Reference Manual or visit the GTK+ web site.

### Libglade

Libglade - это библиотека для построения интерфейса пользователя динамически из описаний на языке XML. Вы можете использовать дизайнер интерфейсов, например Glade, для конструирования вашего интерфейса пользователя и затем импортировать описание интерфейса в ваше приложение. Это делает простым конструирование сложных разметок и выравнивания элементов разметок.

Libglade allows programmers to focus their code on the logic of their applications, keeping it uncluttered by the actual construction of the interface. Graphical interface builders also make it easy for dedicated interface designers to construct the interfaces without having to know how to program.

For more information on Libglade, see the Libglade Reference Manual.

### Pango

Pango is the core text and font handling library in the GNOME platform. It is responsible for laying out and rendering text, and is used throughout GTK+. The Pango layout engine can be used with different font backends and drawing backends. On most GNOME systems, Pango will use FreeType, fontconfig, and Cairo to access fonts and render text. On other systems, Pango will use the native font systems, such as Uniscribe on Microsoft Windows and ATSUI on MacOS

Pango has extensive support for the various writing systems used throughout the world. Many of the writing systems used for languages have complex rules for laying out glyphs and composing characters. With Pango, nearly all languages can be written and displayed correctly, allowing users everywhere to view text in their native languages. Pango support for multiple writing systems is automatic; application developers do not have to write any special code to support other languages.

#### Displaying Multiple Languages With Pango

Screenshot of the gedit text editor displaying phrases from multiple languages and writing systems.

Pango supports the text styling used in typical documents and interfaces, including italics, font weights, and underlines. Pango uses a simple XML-like vocabulary called PangoMarkup which enables you to set font size, color, styles, and other text attributes. Using PangoMarkup, you can specify inline styles without manually iterating over text blocks. PangoMarkup can be used directly from GTK+, enabling you to style text in your graphical interfaces easily.

You should use Pango directly whenever you need to lay text out on the screen or on a different medium. Using Pango will allow your text layout to work seamlessly with GTK+ and the rest of the GNOME platform. It will help you create portable code, and most importantly, it will ensure that your application can render text correctly in hundreds of different languages.

For more information on Pango, see the Pango Reference Manual.

### GDK

GDK is the low-level library used by GTK+ to interact with the system for graphics and input devices. Although you will rarely use GDK directly in application code, it contains all the necessary functionality to draw objects and text to the screen and to interact with the user with various input devices. GDK работает на разных платформах, включая the X Window System, Microsoft Windows, DirectFB и Quartz. Независимо от того, на какой платформе работает GDK, он имеет стабильный программный интерфейс, позволяя GTK+ и приложениям, написанным с использованием GTK+ запускаться без модификации на разных платформах.

GDK features a graphics context and drawing primitives that are suitable for drawing simple objects and rendering images on the screen. Since a more extensive drawing system is provided by Cairo, GDK provides hooks to use Cairo contexts within GDK.

GDK enables you to access events from keyboards, mice, and other input devices, rather than connect to the high-level signals used in GTK+. GDK also provides low-level routines to access drag and drop and clipboard data from the system. When implementing custom controls, you may need to access these features to implement proper user interaction behavior.

GDK provides other functionality which is needed to implement a complete graphical toolkit like GTK+. Since GDK acts as a platform abstraction, allowing GTK+ to run under multiple environments, it provides an API for all of the system functionality needed by GTK+. This includes information about multi-head displays, resolution and color depth, colormaps, and cursors.

You should use GDK whenever you need low-level access to the underlying windowing system, including low-level access to events, windows, and the clipboard. Using GDK for these tasks ensures that your code is portable and integrates with the rest of your GTK+ code. The simple drawing routines in GDK should generally not be used. Instead, you should use the extensive functionality provide by Cairo.

For more information on GDK, see the GDK Reference Manual.

### Cairo

Cairo is a 2D graphics library featuring a sophisticated API for drawing vector graphics, compositing images, and rendering anti-aliased text. Cairo provides support for multiple output devices, including the X Window System, Microsoft Windows, and image buffers, allowing you to write platform-independent code to draw graphics on different media.

The Cairo drawing model is similar to those provided by PostScript and PDF. The Cairo API provides such drawing operations as stroking and filling cubic Bézier splines, compositing images, and performing affine transformations. These vector operations allow for rich, anti-aliased graphics without using expensive pixel-based drawing in your application code.

Cairo's rich drawing model allows for high-quality rendering to multiple media. The same API can be used to create stunning on-screen graphics and text, to render images, or create crisp output suitable for printing.

You should use Cairo whenever you need to draw graphics in your application beyond the widgets provided by GTK+. Much of the drawing inside GTK+ is done using Cairo. Using Cairo for your custom drawing will allow your application to have high-quality, anti-aliased, and resolution-independent graphics.

For more information on Cairo, see Cairo: A Vector Graphics Library.

## Virtual File System

GIO, a part of GLib, is the core library used for file and folder operations in GNOME applications. GIO provides a unified file system abstraction layer with pluggable backends. In GNOME, the GVFS library provides a GIO backend implementing multiple network and local protocols. Using GIO with GVFS allows your application to work with files on remote machines as easily as local files.

GIO can provide extensive information about files and folders, including the MIME type and icon of a file and which applications can be used to open a file. Since the GVFS uses the standard from freedesktop.org to determine file types and associations, it works correctly on different free desktop environments, helping independent software developers create software that can be run in different environments.

GIO is used throughout the GNOME desktop. The file manager, Nautilus, uses GIO to display folders on local and remote systems. For the user, this means that network servers act just like local folders: They can drag and drop files between them, view the files' properties, and open the file with an application. Using GIO will allow your application to open all the files that users can access on their desktop.

For more information on GIO, see the GIO Reference Manual.

In previous versions of GNOME, the GnomeVFS library was used for access to files and folders. While GnomeVFS provided many of the same features, including transparent access to remote folders, it had a number of limitations which have been addressed in GIO. GnomeVFS is deprecated and should not be used in newly written code, although it will continue to be supported throughout the GNOME 2 lifetime. For information on GnomeVFS, see GnomeVFS - Filesystem Abstraction Library.

## Configuration and Lockdown

GConf - это система для хранения и получения данных о конфигурации GNOME. GConf состоит из двух частей: клиентской библиотеки для доступа к установкам и службы, которая отвечает за хранение и предоставление этих параметров. Использование службы позволяет GConf использовать различные внутренние интерфейсы для хранение параметров, проверки ввода и обеспечивать одновременный доступ разных приложений.

Параметры, находящиеся в GConf, сохраняются и возвращаются с использованием уникального ключа или строки-идентификатора. Ключи использует простое иерархическое пространство имен для избежания конфликта между приложениями и средой. Вы можете предоставить файл схемы с описанием ваших ключей конфигурации. Это позволяет GConf проверять правильность ввода пользовательских данных и отображать локализованную документацию о ключах. Кроме того, это помогает системным администраторам, которые могут устанавливать несколько параметров за раз, без необходимости перемещаться между диалоговыми окнами.

GConf can look up settings from different settings at once, typically from different locations on the file system. By having appropriate system sources configured, GConf enables systems administrators to provide both default and mandatory settings for all users. Tools such as GNOME's Configuration Editor and Sabayon make it easy to deploy fully configured systems using GConf.

The GConf client library provides notifications of changes to settings, making it easy to provide instant-apply settings in your application, regardless if settings are changed from within your application or using another tool. Setting the value of a key will notify all interested applications, allowing desktop-wide and other cross-application settings to work instantly and effortlessly.

GConf makes it easy to lock down systems by setting particular keys read-only, preventing users from changing their values. In addition, GNOME provides a number of high-level keys that can be used to disable actions such as saving to disk and changing the panel layout. Tools such as Pessulus make it easy for administrators to find and lock down important keys.

Вам следует использовать GConf для хранения всех параметров приложения пользователя. Используя GConf вы делайте простым одновременный доступ к параметрами и делайте ваши параметры доступными для системных администраторов, а также для инструментов конфигурирования и резервирования.

For more information on GConf, see the GConf Reference Manual.

## Интернационализация

The GNOME Desktop and Developer Platform provides full support for internationalizing and localizing applications. Internationalization is the process of ensuring your application can be localized, including marking all strings for translations, using numbers and format strings correctly, and making adjustments for variations in conventions for times and dates, units, and formatting.

GNOME uses the standard gettext and related routines for accessing localizations. Support for localization using gettext is built into every component of the GNOME platform. Your source code can be scanned for specially-marked tools by automated tools. Those strings are then placed in PO files to allow translators to track their translations. Using gettext, you can easily and efficiently access translated versions of all user-visible strings in your application from translation domains installed along with your application.

These translation domains can be created using PO files, which can be used by translators to track string changes and update their translations accordingly. GNOME ships with intltool, a tool for managing translations in PO files. Using intltool, translators can use PO files to translate not only the strings in your application, but also other types of files that you use, such as GConf schema files, desktop entry files, and XML files.

GNOME also provides the xml2po tool as part of the gnome-doc-utils package. This tool allows translators to use PO files to create translated versions of documentation written in various XML formats, including XHTML and DocBook.

Internationalization involves more than just allowing strings to be translated, and GNOME supports your application development at every step of the process. GTK+ will automatically adjust its presentation for languages that are read right-to-left, and Pango has complete support for rendering bidirectional text and text in various different writing systems. GTK+ supports multiple input methods, allowing users from all language to input text efficiently with their keyboards. The entire GNOME platform uses the UTF-8 encoding of Unicode natively, providing access to the characters and writing systems of the entire world.

### Gnumeric in Multiple Languages

Screenshots of the Gnumeric spreadsheet application running in Hebrew, Japanese, and Serbian.

Internationalizing your application helps make it available to many more users across the world. While skilled translators must provide translations for any language, programmers must ensure the application is properly internationalized before it can be fully localized.

For more information on internationalization in GNOME, see Internationalizing GNOME Applications.

## Доступность

Доступность - это уверенность в том, что ваше приложение может использоваться людьми с ограниченными возможностями. Ограниченные возможности проявляются во многих формах: ограничения зрения, двигательные ограничения, ограничения слуха и языковые ограничения и другие. Существует много людей, у которых есть какие-либо ограничения и делая ваше приложение доступным, вы позволяйте большему количеству людей использовать ваше приложение более эффективно.

GNOME provides support for accessibility devices using the ATK framework. This framework defines a set of interfaces to which graphical interface components adhere. This allows, for instance, screen readers to read the text of an interface and interact with its controls. ATK support is built into GTK+ and the rest of the GNOME platform using the GAIL library, so any application using GTK+ will have reasonable accessibility support for free.

Nonetheless, you should be aware of accessibility issues when when developing your applications. Although GTK+ interfaces provide reasonable accessibility by default, you can often improve how well your program behaves with accessibility tools by providing additional information to ATK. If you develop custom widgets, you should ensure that they expose their properties to ATK. You should also avoid using sound, graphics, or color as the sole means of conveying information to the user.

The GNOME desktop ships with a number of accessibility tools which enable users with disabilities to take full advantage of their desktop and applications. Applications that fully implement ATK will be able to work with the accessibility tools. GNOME's accessibility tools include a screen reader, a screen magnifier, an on-screen keyboard, and Dasher, an innovative predictive text entry tool.

For extensive recommendations on accessibility, see GNOME Accessibility for Developers. See also ATK - Accessibility Toolkit and the GAIL Reference Manual.

## Аудио и видео

GStreamer is a powerful multimedia library for playing, creating, and manipulating sound, video, and other media. You can use GStreamer to provide sound and video playback, record input from multiple sources, and edit multimedia content. GStreamer supports encoding and decoding numerous formats by default, and support for additional formats can be added with plug-ins.

GStreamer provides a flexible architecture wherein media is processed through a pipeline of elements. Each element may apply filters to the content, such as encoding or decoding, combining multiple sources, or transforming the multimedia content. This architecture allows for an arbitrary arrangement of elements, so that you can accomplish virtually any effect using GStreamer. Furthermore, GStreamer is designed to have low overhead, so it can be used in applications with high demands on latency.

While GStreamer provides a powerful API for manipulating multimedia, it also provides convenient routines for simple playback. GStreamer can automatically construct a pipeline to read and playback files in any supported format, allowing you to use sound and video in your application easily.

The GStreamer architecture allows plugins to add encoders, decoders, and all sorts of content filters. Third-party developers can provide GStreamer plugins which will be automatically available to other applications using GStreamer. Plugins can provide support for other multimedia formats or provide additional functionality and effects.

You should use GStreamer whenever you need to read or play multimedia content in your application, or if your application needs to manipulate sound or video. Using GStreamer makes your application development easy, and it provides you well-tested elements for many of your needs.

For comprehensive information on GStreamer, see The GStreamer Application Development Manual, The GStreamer 0.10 Core Reference Manual, and the GStreamer documentation page.

## Печать

Most applications need to provide support for printing. Users expect to be able to print the contents they can view on-screen. The GNOME platform provides libraries to help you add support for high-quality printing to your application.

### GNOME Print

The GNOME print framework consists of two libraries which help you provide high-quality printing with a consistent interface in your application. At the core of the printing framework is libgnomeprint, a library for creating PostScript output to send to printers. On top of that is libgnomeprintui, which provides standard print controls for your user interface.

Work is currently underway to integrate printing directly into GTK+, provding a cross-platform print API that all applications can use. While the current GNOME print framework will be deprecated once GTK+ supports printing, API and ABI stability guarantees ensures that it will continue to be functional and supported throughout the GNOME 2 lifecycle.

The libgnomeprint library implements the PostScript imaging model, which is used by most printers. Printers which do not support PostScript can still be supported through CUPS, described below. In addition to the standard PostScript imaging, libgnomeprint also features alpha channel support and anti-aliasing.

The libgnomeprintui library provides a standard print dialog, a print preview dialog, and various other controls and functionality required to build printing into an intuitive user interface. The GNOME print framework handles the details of locating printers and spooling print jobs, and also provides PostScript and PDF export directly in the print dialog.

You should use libgnomeprint whenever you need to render content to PostScript for printing. You should use libgnomeprintui to construct your printing user interface, even if your rendered output comes from another source. Using the GNOME print framework provides your users a consistent user interface with the features they expect of printing appliations.

### CUPS

On most GNOME systems, CUPS (Common UNIX Printing System) acts as the low-level printing system. CUPS provides a modern, feature-rich architecture for printer discovery, printer option access, and spooling print jobs to different types of printers.

CUPS provides a set of utilities for automatically discovering printers locally and on the network. This allows users not only to see all available printers, but to use different types of printers without manual configuration.

CUPS provides a unified interface for printing, regardless of the location or type of the printer. Multiple print protocols are handled seamlessly by CUPS by automatically applying filters to content sent to the printers. Applications can simply provide PostScript output, and CUPS will automatically convert it for printers that do not support PostScript natively.

CUPS also provides printer configuration options in the form of PostScript Printer Description (PPD) files. PPD configurations allow applications to expose the capabilities of individual printers to the users with a consistent user interface. For instance, PPD allows you to detect whether a printer can collate and staple print jobs, and to provide an option in your user interface.

In most cases, you will not need to interface directly with CUPS in your applications. By using the GNOME print framework, you have access to the power and flexibility of CUPS automatically. Having CUPS underneath means a better user experience with less programming.