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).
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.
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.
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.
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 参考手册:概念:背景