GObject 参考手册:概念:基类 GObject:对象属性

One of GObject’s nice features is its generic get/set mechanism for object properties. When an object is instantiated, the object’s class_init handler should be used to register the object’s properties with g_object_class_install_property (implemented in gobject.c).
GObject的其中一个漂亮特性就是它那为对象属性准备的通用get/set机制。当一个对象被实例化以后,对象的类初始化处理将用g_object_class_install_property来注册对象的属性(由gobject.c中实现)。
Continue reading GObject 参考手册:概念:基类 GObject:对象属性

GObject 参考手册:概念:基类 GObject:对象内存管理

The memory-management API for GObjects is a bit complicated but the idea behind it is pretty simple: the goal is to provide a flexible model based on reference counting which can be integrated in applications which use or require different memory management models (such as garbage collection, aso…). The methods which are used to manipulate this reference count are described below.
GObject的内存管理相关的API有一点复杂,但是背后的主旨是相当简单的:它的目的是提供一个灵活的基于引用计数的、可以集成在使用或需要各种不同的内存管理模型(就像垃圾回收)的应用程序的模型。这些方法被用来操作它的引用数。
Continue reading GObject 参考手册:概念:基类 GObject:对象内存管理

GObject 参考手册:概念:基类 GObject

The two previous chapters discussed the details of GLib’s Dynamic Type System and its signal control system. The GObject library also contains an implementation for a base fundamental type named GObject.
前面两个章节讨论了Glib动态类型系统的细节和它的信号控制系统。GObject库同时也包括了一个最基本的类型即基类,即为GObject。
Continue reading GObject 参考手册:概念:基类 GObject

GObject 参考手册:概念:GLib 动态类型系统:不可实例的类型:接口

GType’s interfaces are very similar to Java’s interfaces. They allow to describe a common API that several classes will adhere to. Imagine the play, pause and stop buttons on hi-fi equipment – those can be seen as a playback interface. Once you know what they do, you can control your CD player, MP3 player or anything that uses these symbols. To declare an interface you have to register a non-instantiable classed type which derives from GTypeInterface. The following piece of code declares such an interface.
GType的接口(Interface)与Java的接口非常类似。它允许描述一个通用的API,使得多个类可以粘合在一起。想像一下,Hi-Fi音响设备中的暂停和播放按钮──这可以被视做一个回放接口。如果你知道你要做什么,你可以用来这个接口来控制你的CD机,MP3或其他使用相同符号的东西。要声明一个接口,你需要注册一个从GTypeInterface继承的不可实例的类型。下面的代码声明了这样的一个接口:
Continue reading GObject 参考手册:概念:GLib 动态类型系统:不可实例的类型:接口

GObject 参考手册:概念:GLib 动态类型系统:可实例化的类型:对象

Types which are registered with a class and are declared instantiable are what most closely resembles an object. Although GObjects (detailed in The GObject base class) are the most well known type of instantiable classed types, other kinds of similar objects used as the base of an inheritance hierarchy have been externally developed and they are all built on the fundamental features described below.
一个以类来注册,并声明为可实例化的类型常常称作对象。GObject(定义在 The GObject base class 中)是最有名的一个可实例化的类了,其他相似的类都继承于这个基本类来进行开发,他们都基于下面所述的基本特征。
Continue reading GObject 参考手册:概念:GLib 动态类型系统:可实例化的类型:对象

GObject 参考手册:概念:GLib 动态类型系统:不可实例化和不可类化的基础类型

A lot of types are not instantiable by the type system and do not have a class. Most of these types are fundamental trivial types such as gchar, registered in g_value_types_init (in gvaluetypes.c).
在类型系统中,许多类型是不可实例化而且没有父类的。大多数这些类型是最基础的基本类型,如 gchar,它由 g_value_types_init 注册(在gvaluetypes.c中)。
Continue reading GObject 参考手册:概念:GLib 动态类型系统:不可实例化和不可类化的基础类型

GObject 参考手册:概念:GLib 动态类型系统:约定

There are a number of conventions users are expected to follow when creating new types which are to be exported in a header file:
当用户在头文件中创建新类型时,有一些规范用户需要注意:
Continue reading GObject 参考手册:概念:GLib 动态类型系统:约定

GObject 参考手册:概念:GLib 动态类型系统:复制函数

The major common point between all GLib types (fundamental and non-fundamental, classed and non-classed, instantiable and non-instantiable) is that they can all be manipulated through a single API to copy/assign them.
所有的 Glib 类型(基本和非基本,类化和非类化,可实例化和不可实例化)的最大共同点是都可以通过单一的 API 来复制或指定它们。
Continue reading GObject 参考手册:概念:GLib 动态类型系统:复制函数

GObject 参考手册:概念:GLib 动态类型系统

A type, as manipulated by the GLib type system, is much more generic than what is usually understood as an Object type. It is best explained by looking at the structure and the functions used to register new types in the type system.
由 Glib 类型系统操作的一个类型,比传统上所讲的 Object 类型更具一般化。下面查看类型系统中有关类结构和注册新类型的函数,是会对此最好的解释。
Continue reading GObject 参考手册:概念:GLib 动态类型系统

GObject 参考手册:概念:背景

GObject, and its lower-level type system, GType, are used by GTK+ and most GNOME libraries to provide:
GTK+ 和大多数 GNOME 库因为使用了 GObject 和比它更低一级的类型系统── GType,从而具有下面的特性:

  • object-oriented C-based APIs and
  • 面向对象的基于 C 的 API。
  • automatic transparent API bindings to other compiled or interpreted languages.
  • 封装成其他编译型语言或动态解释语言的能力。

Continue reading GObject 参考手册:概念:背景