[gtk-doc-cn] r292 committed - update gobject docs

2 views
Skip to first unread message

gtk-d...@googlecode.com

unread,
Apr 18, 2011, 6:16:19 AM4/18/11
to gtk-d...@googlegroups.com
Revision: 292
Author: yetist
Date: Mon Apr 18 03:15:15 2011
Log: update gobject docs
http://code.google.com/p/gtk-doc-cn/source/detail?r=292

Deleted:
/trunk/zh_CN/gobject/docs-2.28.5
Modified:
/trunk/zh_CN/gobject/AUTHORS
/trunk/zh_CN/gobject/gobject-docs-2.28.5.po

=======================================
--- /trunk/zh_CN/gobject/AUTHORS Sun Apr 17 09:09:31 2011
+++ /trunk/zh_CN/gobject/AUTHORS Mon Apr 18 03:15:15 2011
@@ -1,8 +1,34 @@
#!/bin/sh

####################################################################################
#一、[xmlpo 文件列表]
+#1. glib-genmarshal.po
+#2. glib-mkenums.po
+#3. gobject-docs.po
+#4. gobject-query.po
+#5. tut_gobject.po
+#6. tut_gsignal.po
+#7. tut_gtype.po (黑孩儿翻译,yetist整理)
+#8. tut_howto.po
+#9. tut_intro.po
+#10. tut_tools.po
#
#二、[po 文件列表]
+#1. gbinding.po
+#2. gboxed.po
+#3. gclosure.po
+#4. genums.po
+#5. gobject.po
+#6. gparam.po
+#7. gparamspecs.po
+#8. gsignal.po
+#9. gsourceclosure.po
+#10. gtypemodule.po
+#11. gtypeplugin.po
+#12. gtype.po
+#13. gvaluearray.po
+#14. gvaluecollector.po
+#15. gvalue.po
+#16. gvaluetypes.po
#

####################################################################################
#此文件的格式如下
@@ -11,7 +37,7 @@
#作者名为unknown表示计划翻译,但目前还无人认领
#作者名为finished表示内容已经翻译完成。
########已经和正在翻译的文档###############
-yetist yet...@gmail.com xmlpo_files=(gobject-docs.po,tut_gtype.po)
po_files=()
-黑孩儿 ad...@heiher.info xmlpo_files=(tut_gtype.po) po_files=()
+#yetist yet...@gmail.com xmlpo_files=(gobject-docs.po,tut_gtype.po)
po_files=()
+#黑孩儿 ad...@heiher.info xmlpo_files=(tut_gtype.po) po_files=()
########计划翻译的文档###############
unknown unk...@nomail.com sgml_files=() po_files=()
=======================================
--- /trunk/zh_CN/gobject/gobject-docs-2.28.5.po Sun Apr 17 09:09:31 2011
+++ /trunk/zh_CN/gobject/gobject-docs-2.28.5.po Mon Apr 18 03:15:15 2011
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: gtk+ 3.0.8\n"
"POT-Creation-Date: 2011-04-17 23:55+0800\n"
-"PO-Revision-Date: 2011-04-17 23:59+0800\n"
+"PO-Revision-Date: 2011-04-18 16:35+0800\n"
"Last-Translator: yetist <yet...@gmail.com>\n"
"Language-Team: LANGUAGE <L...@li.org>\n"
"Language: \n"
@@ -2545,10 +2545,11 @@
"type characteristic flags: <link
linkend=\"GTypeFlags\"><type>GTypeFlags</"
"type></link>."
msgstr ""
+"类的字符标志:<link
linkend=\"GTypeFlags\"><type>GTypeFlags</type></link>。"

#: tut_gtype.xml:114(title)
msgid "Copy functions"
-msgstr ""
+msgstr "复制函数"

#: tut_gtype.xml:116(para)
msgid ""
@@ -2557,6 +2558,8 @@
"non-instantiable) is that they can all be manipulated through a single
API "
"to copy/assign them."
msgstr ""
+"所有的 Glib 类型(基本和非基本,类化和非类化, 可实例化和不可实例化)的最
大共"
+"同点是都可以通过单一的 API 来复制或指定它们。"

#: tut_gtype.xml:12(programlisting)
#, no-wrap
@@ -2608,6 +2611,13 @@
"assignment which invokes the C++ copy operator to modify the default
bit-by-"
"bit copy semantics of C++/C structures/classes."
msgstr ""
+"<link linkend=\"GValue\"><type>GValue</type></link>结构被用作所有类型的抽
象的"
+"容器, 它的极度简化的 API(定义在
<filename>gobject/gvalue.h</filename>)可以"
+"被使用请求 value_table 函数被注册当类型注册中: 举个例
子,<function><link "
+"linkend=\"g-value-copy\">g_value_copy</link></function> 复制了 <link
linkend="
+"\"GValue\"><type>GValue</type></link>的内容至另一个<link linkend=\"GValue"
+"\"><type>GValue</type></link>。 这与 C++ 指派它的复制操作来修改默认的按位
复"
+"制 C++/C 结构是类似的。"

#: tut_gtype.xml:132(para)
msgid ""
@@ -2622,6 +2632,12 @@
"to simply increment the reference count of the instance and copy the "
"reference to the new GValue."
msgstr ""
+"下面的代码向你展示了你是如何复制一个64位的整型,同样 <link
linkend=\"GObject"
+"\"><type>GObject</type></link> 的实例指针也是这样(代码在
<filename>sample/"
+"gtype/test.c</filename>中): <placeholder-1/> 上面代码的重点是关于复制指
令的"
+"确切语义,并没有详细的定义复制是如何实现的。 复制函数的实现可能是决定请求
一新"
+"块的内存,并把数据从源复制到目的。 或者可能是简单的增加实例的引用数和复制
引用"
+"至新的 GValue。"

#: tut_gtype.xml:136(programlisting)
#, no-wrap
@@ -2687,6 +2703,12 @@
"value_table since you will inherit the value_table structure from your "
"parent type."
msgstr ""
+"value_table 用于详细说明这些定义在 <filename>gtype.h</filename> 的函数的使
用"
+"并彻底地描述在由 GObject 提供的API文档中,这是为什么我们不追究细节的原
因。 "
+"<placeholder-1/> 有趣的是,你同样不需要详细指定一个 value_table 在注册过
程"
+"中, 因为 value_tables 一般从非基本类型的父类中继承,这意味着除非你想写一
个基"
+"本类型, 否则你将不需要提供一个新的 value_table 因为它可以从父类继承 "
+"value_table。"

#: tut_gtype.xml:195(programlisting)
#, no-wrap
@@ -2717,7 +2739,7 @@

#: tut_gtype.xml:228(title)
msgid "Conventions"
-msgstr ""
+msgstr "约定"

#: tut_gtype.xml:231(para)
msgid ""
@@ -2728,6 +2750,10 @@
"we used above, we would write the following trivial code to declare the "
"macros: <placeholder-2/><placeholder-3/>"
msgstr ""
+"当用户在头文件中创建新类型时,有一些规范用户需要注意: <placeholder-1/> 至
于"
+"这些宏的实现是非常直观的: 一些数量的简单使用的宏由<filename>gtype.h</"
+"filename>提供。 针对上面我们兴趣的例子,我们写了下面的代码来声明这些宏: "
+"<placeholder-2/><placeholder-3/>"

#: tut_gtype.xml:235(para)
msgid ""
@@ -2735,6 +2761,8 @@
"invoke the method named foo on an instance of object type bar, call "
"<function>bar_foo</function>."
msgstr ""
+"使用 <function>object_method</function>的形式来定义函数名称: 例如在一个
bar "
+"类中定义一个名为 foo 的函数,则用 <function>bar_foo</function> 。"

#: tut_gtype.xml:240(para)
msgid ""
@@ -2743,12 +2771,17 @@
"> prefix all your function names with <emphasis>maman_</emphasis>. For "
"example: <function>maman_object_method</function>."
msgstr ""
+"使用前缀来避免与其他工程的命名空间冲突。 如果你的库(或应用程序)名为 "
+"<emphasis>Maman</emphasis>, <placeholder-1/> 那么所有的函数名称前缀为"
+"<emphasis>maman_</emphasis>。 举例:
<function>maman_object_method</function>."

#: tut_gtype.xml:243(para)
msgid ""
"<emphasis>Maman</emphasis> is the French word for
<emphasis>mum</emphasis> "
"or <emphasis>mother</emphasis> - nothing more and nothing less."
msgstr ""
+"<emphasis>Maman</emphasis>在法语中是<emphasis>妈妈</emphasis> 或
<emphasis>母"
+"亲</emphasis>的意思 - 仅此而已。"

#: tut_gtype.xml:252(para)
msgid ""
@@ -2760,6 +2793,12 @@
"variable or a function named <function>prefix_object_get_type</function>.
We "
"will follow the function pattern wherever possible in this document."
msgstr ""
+"创建一个宏命为 <function>PREFIX_TYPE_OBJECT</function>用来返回 GType 关联
的对"
+"象类型。 比如,<emphasis>Bar</emphasis>这个类在一个以 <emphasis>maman</"
+"emphasis>前缀的库中,则使用 <function>MAMAN_TYPE_BAR</function>。 另有一个
不"
+"成文的规定是,定义一个使用全局静态变或一个名为"
+"<function>prefix_object_get_type</function> 的函数来实现这个宏。我们将在后
面"
+"的章节中讨论这个函数。"

#: tut_gtype.xml:260(para)
msgid ""
@@ -2771,6 +2810,12 @@
"\">building glib</link>). For example, we would create
<function>MAMAN_BAR "
"(obj)</function> to keep the previous example."
msgstr ""
+"创建一个宏命名为 <function>PREFIX_OBJECT (obj)</function> 来返回一个指向"
+"<type>PrefixObject</type> 类型的指针。 这个宏用于必要时安全地强制转换一个
静态"
+"类型。 运行环境检查时,同样也是安全地执行动态类型。 在编译glib时是可以禁止
动"
+"态类型检查的(参见:<link linkend=\"glib-building\">编译glib</link>)。 在
处"
+"理过程中禁用动态类型检查是可行的。 例如,我们可以创建 MAMAN_BAR(obj) 来保
持先"
+"前的例子。"

#: tut_gtype.xml:268(para)
msgid ""
@@ -2781,6 +2826,10 @@
"<type>PrefixObjectClass</type>. Again, an example is: "
"<function>MAMAN_BAR_CLASS</function>."
msgstr ""
+"如果类型是类化的,那么创建一个命令为 <function>PREFIX_OBJECT_CLASS
(klass)</"
+"function>的宏。 这个宏与前面那个是非常相似的: 它以类结构的动态类型检查来
进行"
+"静态转换,并返回一个指向 <type>PrefixObjectClass</type> 这个类型的类结构的
指"
+"针。 同样,例子为:<function>MAMAN_BAR_CLASS</function>。"

#: tut_gtype.xml:275(para)
msgid ""
@@ -2788,6 +2837,8 @@
"expected to return a <type>gboolean</type> which indicates whether or
not "
"the input object instance pointer of type BAR."
msgstr ""
+"创建一个宏命名为<function>PREFIX_IS_BAR (obj)</function>: 这个宏的返回值
是 "
+"<type>gboolean</type> 类型的,用于判断输入的对象实例是否是 BAR类型的。"

#: tut_gtype.xml:279(para)
msgid ""
@@ -2795,6 +2846,8 @@
"<function>PREFIX_IS_OBJECT_CLASS (klass)</function> which, as above,
returns "
"a boolean if the input class pointer is a pointer to a class of type
OBJECT."
msgstr ""
+"如果类型是类化的,创建一个名为 <function>PREFIX_IS_OBJECT_CLASS (klass)</"
+"function> 的宏,与上面的类似,返回输入的类型指针是否是 OBJECT 类型。"

#: tut_gtype.xml:283(para)
msgid ""
@@ -2804,6 +2857,9 @@
"static and dynamic type safety purposes (just like the previous casting "
"macros)."
msgstr ""
+"如果类型是类化的,创建一个名为<function>PREFIX_OBJECT_GET_CLASS (obj)</"
+"function>,返回一个实例所属的类的类型指针。 这个宏因为安全的原因,被静态和
动"
+"态类型所使用,就像上面的转换宏一样。"

#: tut_gtype.xml:293(programlisting)
#, no-wrap
@@ -2822,12 +2878,16 @@
"Stick to the naming <varname>klass</varname> as <varname>class</varname>
is "
"a registered c++ keyword."
msgstr ""
+"这里使用<varname>klass</varname>这个名字,是因为
<varname>class</varname>已经"
+"被注册为 c++ 的关键字了。"

#: tut_gtype.xml:304(para)
msgid ""
"The following code shows how to implement the
<function>maman_bar_get_type</"
"function> function: <placeholder-1/>"
msgstr ""
+"下面的代码实现了<function>maman_bar_get_type</function>这个函数: "
+"<placeholder-1/>"

#: tut_gtype.xml:307(programlisting)
#, no-wrap
@@ -2853,6 +2913,8 @@
"When having no special requirements you also can use the "
"<function>G_DEFINE_TYPE</function> macro: <placeholder-1/>"
msgstr ""
+"如果没有特别需要,你也可以使用<function>G_DEFINE_TYPE</function> 宏: "
+"<placeholder-1/>"

#: tut_gtype.xml:327(programlisting)
#, no-wrap
@@ -2863,7 +2925,7 @@

#: tut_gtype.xml:335(title)
msgid "Non-instantiable non-classed fundamental types"
-msgstr ""
+msgstr "不可实例化和不可类化的基础类型"

#: tut_gtype.xml:337(para)
msgid ""
@@ -2872,6 +2934,9 @@
"<emphasis>gchar</emphasis>, registered in <function>g_value_types_init</"
"function> (in <filename>gvaluetypes.c</filename>)."
msgstr ""
+"在类型系统中,许多类型是不可实例化而且没有父类的。 大多数这些类型是最基础
的基"
+"本类型,如<emphasis>gchar</emphasis>,它由<function>g_value_types_init</"
+"function>注册(在<filename>gvaluetypes.c</filename>中)。"

#: tut_gtype.xml:343(para)
msgid ""
@@ -2879,6 +2944,8 @@
"linkend=\"GTypeInfo\"><type>GTypeInfo</type></link> structure with zeros "
"since these types are also most of the time fundamental: <placeholder-1/>"
msgstr ""
+"如果想在类型系统中注册这样一个类型,你仅仅需要用 0 来填充<link linkend="
+"\"GTypeInfo\"><type>GTypeInfo</type></link>结构。 <placeholder-1/>"

#: tut_gtype.xml:347(programlisting)
#, no-wrap
@@ -2922,10 +2989,15 @@
"types) are most useful when used in conjunction with object properties
and "
"signals."
msgstr ""
+"使用不可实例的类型似乎是无用的: 定义一个不能实例化的类型有什么好处呢? 大
多"
+"数这种类型与 <link linkend=\"GValue\"><type>GValue</type></link>用作一
块: 一"
+"个GValue由一个整型或一个字符串来初始化, 再被传递了一个已注册类型的 "
+"value_table 。 <link linkend=\"GValue\"><type>GValue</type></link>(以基本
类"
+"型延伸)最有用的时候是在与对象的属性和信号用在一块时。"

#: tut_gtype.xml:388(title)
msgid "Instantiable classed types: objects"
-msgstr ""
+msgstr "可实例化的类型:object"

#: tut_gtype.xml:390(para)
msgid ""
@@ -2937,6 +3009,10 @@
"hierarchy have been externally developed and they are all built on the "
"fundamental features described below."
msgstr ""
+"一个以类来注册,并声明为可实例化的类型常常称作
<emphasis>object</emphasis>。 "
+"<link linkend=\"GObject\"><type>GObject</type></link>(详见:<xref
linkend="
+"\"chapter-gobject\"/> 中)是最有名的一个可实例化的类了, 其他相似的类都继
承于"
+"这个基本类来进行开发,他们都基于下面所述的基本特征。"

#: tut_gtype.xml:400(para)
msgid ""
@@ -2946,6 +3022,9 @@
"emphasis> will be registered in the type system as inheriting from the
type "
"<emphasis>G_TYPE_OBJECT</emphasis>."
msgstr ""
+"下面的例子告诉你怎样才可以在类型系统中注册这样一个基本的类:
<placeholder-1/> "
+"在调用<function>maman_bar_get_type</function>之前, 名为
<emphasis>BarType</"
+"emphasis>的继承于<emphasis>G_TYPE_OBJECT</emphasis>的类将在类型系统中被注
册。"

#: tut_gtype.xml:403(programlisting)
#, no-wrap
@@ -3004,6 +3083,13 @@
"object's instance structure) contains in its first bytes a pointer to
the "
"object's class structure."
msgstr ""
+"每个对象必须定义为两个结构:它的类结构和它的实例结构。 所有的类结构的第一
个成"
+"员必须是一个<link linkend=\"GTypeClass\"><type>GTypeClass</type></link>
结"
+"构。 所有的实例结构的第一个成员必须是 <link linkend=\"GTypeInstance"
+"\"><type>GTypeInstance</type></link>结构。 下面显示了这些来自
<filename>gtype."
+"h</filename> 的 C 类型的声明: <placeholder-1/> 这些约束使得类型系统可以确
保"
+"每个对象的实例(由指向该对象的实例结构的指针所标识) 的首字节指向该对象的类
结"
+"构。"

#: tut_gtype.xml:454(programlisting)
#, no-wrap
@@ -3020,6 +3106,7 @@
msgstr ""

#: tut_gtype.xml:468(para)
+#, fuzzy
msgid ""
"This relationship is best explained by an example: let's take object B
which "
"inherits from object A: <placeholder-1/> The C standard mandates that
the "
@@ -3029,6 +3116,9 @@
"is GTypeInstance's first field which in turn is g_class, a pointer to
B's "
"class structure."
msgstr ""
+"这个关系可以由下面的例子来很好的解释:让我们来看看这个继承于对象A的对象
B: "
+"<placeholder-1/> 上述标准的C结构定义指示了这个C结构的第一个领域存储着类的
结"
+"构。"

#: tut_gtype.xml:47(para)
msgid ""
@@ -3043,6 +3133,15 @@
"Tim Janik to do that) but in case you want to, the last chapter explains
how "
"to create new fundamental types. <placeholder-1/>"
msgstr ""
+"<function><link
linkend=\"g-type-register-static\">g_type_register_static</"
+"link></function> 和 <function><link linkend=\"g-type-register-fundamental"
+"\">g_type_register_fundamental</link></function> 这两个C函数定义在"
+"<filename>gtype.h</filename> 中,并在<filename>gtype.c</filename> 中具体
实"
+"现。 你可以用来在程序的类型系统中注册一个新的 <link linkend=\"GType"
+"\"><type>GType</type></link>。 一般情况下你永远也不需要使用
<function><link "
+"linkend=\"g-type-register-fundamental\">g_type_register_fundamental</link></"
+"function> (除非你是Tim Janik才会这样做),但是这次你要做,在最后一章会向
你解"
+"释如何创建一个基本类型。 <placeholder-1/>"

#: tut_gtype.xml:471(programlisting)
#, no-wrap
@@ -3079,6 +3178,8 @@
"every object instance by doing: <placeholder-1/> or, more quickly: "
"<placeholder-2/>"
msgstr ""
+"多亏了这些简单的条件,所以按下面的方法来就可能取得每个对象实例的类型: "
+"<placeholder-1/> 或者,更快的: <placeholder-2/>"

#: tut_gtype.xml:506(programlisting)
#, no-wrap
@@ -3098,7 +3199,7 @@

#: tut_gtype.xml:518(title)
msgid "Initialization and Destruction"
-msgstr ""
+msgstr "初始化和销毁"

#: tut_gtype.xml:520(para)
msgid ""
@@ -3112,6 +3213,13 @@
"rather than mallocing for every instance) declared by the user are used
to "
"get a buffer to hold the object's instance structure."
msgstr ""
+"实例化这些类型可以用 <function><link linkend=\"g-type-create-instance"
+"\">g_type_create_instance</link></function>来完成: <placeholder-1/"
+"><function><link
linkend=\"g-type-create-instance\">g_type_create_instance</"
+"link></function> 将查找请求的类型所关联的类型信息结构。 然后由用户声明的实
例"
+"的大小和实例化策略(如果 n_preallocs 设置为一个非零值, 类型系统将会把对象
的"
+"实例结构分配在内存块上,而不将依次分配每个实例) 将得到一个缓存来保存对象
实例"
+"的结构。"

#: tut_gtype.xml:523(programlisting)
#, no-wrap
@@ -3135,6 +3243,14 @@
"class structure. Finally, the object's interfaces are initialized (we
will "
"discuss interface initialization in more detail later)."
msgstr ""
+"If this is the first instance of the object ever created, the type
system "
+"must create 如果实例是这个对象第一次创建的,那么类型系统必须创建一个类结
构: "
+"它为其分配一个缓冲来保存这个对象的类结构并初始化它。 它先用父类的类结构覆
盖"
+"(如果没有父类,它将初始化为零), 然后从最顶层的基本对象至最底层的对象调
用 "
+"base_class_initialization 函数(<link linkend=\"GBaseInitFunc"
+"\"><type>GBaseInitFunc</type></link>)。 对象的类初始化函数(<link
linkend="
+"\"GClassInitFunc\"><type>GClassInitFunc</type></link>)被调用来完成类结构
的初"
+"始化。 最终,这个类的接口被初始化了(我们将在后面讨论接口初始化)。"

#: tut_gtype.xml:548(para)
msgid ""
@@ -3144,6 +3260,9 @@
"\"><type>GInstanceInitFunc</type></link>)functions, from top-most "
"fundamental type to bottom-most most derived type."
msgstr ""
+"一旦类型系统有一个指向初始化的类结构的指针, 它设置对象的实例类指针指向对
象的"
+"类结构并调用实例的初始化函数(<link linkend=\"GInstanceInitFunc"
+"\"><type>GInstanceInitFunc</type></link>), 同样是从顶到底的顺序。"

#: tut_gtype.xml:555(para)
msgid ""
@@ -3152,6 +3271,9 @@
"instance structure is returned to the instance pool if there is one and
if "
"this was the last living instance of the object, the class is destroyed."
msgstr ""
+"对象的实例的销毁非常简单,通过<function><link
linkend=\"g-type-free-instance"
+"\">g_type_free_instance</link></function>即可: 实例结构被返回到实例池
中,如"
+"果这是对象的还有一个而且是最后一个存活的实例,那么这个类即被摧毁。"

#: tut_gtype.xml:562(para)
msgid ""
@@ -3164,6 +3286,11 @@
"Finally invoked from bottom-most most-derived type to top-most
fundamental "
"type and the class structure is freed."
msgstr ""
+"类的销毁(关于这个销毁的另一概念是 GType 的终结)的过程与初始化的刚好对
称: "
+"接口先被销毁。 然后,调用类终结函数 class_finalize(<link linkend="
+"\"ClassFinalizeFunc\"><type>ClassFinalizeFunc</type></link>)。 最终,将 "
+"base_class_finalize(<link linkend=\"GBaseFinalizeFunc"
+"\"><type>GBaseFinalizeFunc</type></link>) 从底至顶的调用,直到类结构被销
毁。"

#: tut_gtype.xml:573(para)
msgid ""
@@ -3177,6 +3304,15 @@
"base_init and class_init callbacks of GType is usually not needed because
C+"
"+ cannot really create object types at runtime."
msgstr ""
+"很多读者已经明白了,基本的初始化/终结化过程与C++的构造/析构函数非常相似。
实"
+"际上细节是非常不同的,千万不要被表现的相似所迷惑。 特别是,大多数用户开始
认识"
+"到GType中并不存在类似于C++的构造器(这实际上是一个方法列表, 由对象实例来
调用"
+"所有有继承关系的方法),它必须建立在由GType 提供的特定的设施里。 同样的,"
+"GType没有实例销毁机制。 这是用户的职责,在现存的GType代码的顶端来实现正确
的销"
+"毁(见:<xref linkend=\"chapter-gobject\"/>)。 举个例子,如果从A继承的对
象B"
+"被实例化了,GType将只调用对象B的instance_init回调函数, 而C++运行环境将先
调用"
+"对象A的构造器,接着再是对象B。 事实上,C++代码与GType的base_init和
class_init"
+"回调是等同的, 不过C++常常是不需要这些的,因为它并不能真的在运行时创建类
型。"

#: tut_gtype.xml:58(para)
msgid ""
@@ -3185,8 +3321,12 @@
"link></function>. We will not discuss this function here since its use
is "
"very similar to the <function>_static</function> version."
msgstr ""
+"请注意,另外一个注册函数是 <function><link
linkend=\"g-type-register-dynamic"
+"\">g_type_register_dynamic</link></function>。 我们将不讨论这个函数,因为
它"
+"与 <function>_static</function> 版本非常相似。"

#: tut_gtype.xml:586(para)
+#, fuzzy
msgid ""
"The instantiation/finalization process can be summarized as follows:
<table "
"id=\"gtype-init-fini-table\"><placeholder-1/><tgroup cols=\"3\"><colspec "
@@ -3215,6 +3355,32 @@
"base_finalize is invoked once for each class structure.</entry></row></"
"tbody></tgroup></table>"
msgstr ""
+"关于实例化和终结化的处理过程可以归纳如下: <table
id=\"gtype-init-fini-table"
+"\"><placeholder-1/><tgroup cols=\"3\"><colspec colwidth=\"*\"
colnum=\"1\" "
+"align=\"left\"/><colspec colwidth=\"*\" colnum=\"2\" align=\"left\"/"
+"><colspec colwidth=\"8*\" colnum=\"3\" align=\"left\"/"
+"><thead><row><entry>Invocation time</entry><entry>Function Invoked</"
+"entry><entry>Function's
parameters</entry></row></thead><tbody><row><entry "
+"morerows=\"2\">First call to <function><link
linkend=\"g-type-create-instance"
+"\">g_type_create_instance</link></function> for target type</"
+"entry><entry>type's base_init function</entry><entry>On the inheritance
tree "
+"of classes from fundamental type to target type. base_init is invoked
once "
+"for each class structure.</entry></row><row><entry>target type's
class_init "
+"function</entry><entry>On target type's class structure</entry></"
+"row><row><entry>interface initialization, see <xref linkend=\"gtype-non-"
+"instantiable-classed-init\"/></entry><entry/></row><row><entry>Each call
to "
+"<function><link
linkend=\"g-type-create-instance\">g_type_create_instance</"
+"link></function> for target type</entry><entry>target type's
instance_init "
+"function</entry><entry>On object's instance</entry></row><row><entry "
+"morerows=\"2\">Last call to <function><link
linkend=\"g-type-free-instance"
+"\">g_type_free_instance</link></function> for target type</"
+"entry><entry>interface destruction, see <xref linkend=\"gtype-non-"
+"instantiable-classed-dest\"/></entry><entry/></row><row><entry>target
type's "
+"class_finalize function</entry><entry>On target type's class structure</"
+"entry></row><row><entry>type's base_finalize function</entry><entry>On
the "
+"inheritance tree of classes from fundamental type to target type. "
+"base_finalize is invoked once for each class structure.</entry></row></"
+"tbody></tgroup></table>"

#: tut_gtype.xml:589(title)
msgid "GType Instantiation/Finalization"
@@ -3222,11 +3388,11 @@

#: tut_gtype.xml:6(title)
msgid "The GLib Dynamic Type System"
-msgstr ""
+msgstr "GLib动态类型系统"

#: tut_gtype.xml:652(title)
msgid "Non-instantiable classed types: interfaces"
-msgstr ""
+msgstr "不可实例的类型:接口"

#: tut_gtype.xml:654(para)
msgid ""
@@ -3244,6 +3410,17 @@
"G_TYPE_INTERFACE. All interfaces must be children of G_TYPE_INTERFACE in
the "
"inheritance tree."
msgstr ""
+"GType's interfaces are very similar to Java's interfaces. They allow
GType的"
+"接口(Interface)与Java的接口非常类似。 它允许描述一个通用的API,使得多个
类可"
+"以粘合在一起。 想像一下,Hi-Fi音响设备中的暂停和播放按钮──这可以被视做一个
回"
+"放接口。 如果你知道你要做什么,你可以用来这个接口来控制你的CD机,MP3或其他
使"
+"用相同符号的东西。 要声明一个接口,你需要注册一个从<link linkend="
+"\"GTypeInterface\"><type>GTypeInterface</type></link> 继承的不可实例的类
型。 "
+"下面的代码声明了这样的一个接口: <placeholder-1/> 这里用非常简单的方法来实
现"
+"<function>maman_ibaz_do_action</function>这个接口函数: <placeholder-2/"
+"><function>maman_ibaz_get_type</function> 注册了一个从G_TYPE_INTERFACE继承
的"
+"名为<emphasis>MamanIBaz</emphasis>的类型。 在继承树中,所有的接口必须是"
+"G_TYPE_INTERFACE的子类。"

#: tut_gtype.xml:663(programlisting)
#, no-wrap
@@ -3277,6 +3454,10 @@
"structures but it also registers a number of core types: some of these
are "
"fundamental types. Others are types derived from these fundamental types."
msgstr ""
+"基本类型是不需要从任何其他类型取得的最顶级的类型,相对的, 其他非基本类型
是继"
+"承于其他类型的。 在由 <function><link
linkend=\"g-type-init\">g_type_init</"
+"link></function>初始化时,类型系统不仅仅初始化它的内部数据结构, 同时也注
册一"
+"些核心类型:其中一些是基本类型,其他则是从基本类型继承的。"

#: tut_gtype.xml:684(programlisting)
#, no-wrap
@@ -3297,6 +3478,10 @@
"functions for each of the interface methods which simply call the
interface' "
"method directly: <function>maman_ibaz_do_action</function> is one of
these."
msgstr ""
+"一个接口只有一个包含<link
linkend=\"GTypeInterface\"><type>GTypeInterface</"
+"type></link>的结构来定义。 接口的结构应该要包含一个函数指针指向这个接口的
方"
+"法。 用类似于<function>maman_ibaz_do_action</function>的方法在每个接口方法
中"
+"定义帮助函数, 可以使得我们直接调用接口方法,这是一个良好的风格。"

#: tut_gtype.xml:704(para)
msgid ""
@@ -3306,6 +3491,10 @@
"\"GObject\"><type>GObject</type></link> and which implements the
interface "
"<type>MamanIBaz</type>. <placeholder-1/>"
msgstr ""
+"一旦一个接口的类型被注册后,你必须来实现这个接口。 其中,命名为"
+"<function>maman_baz_get_type</function> 注册一个名为
<type>MamanIBaz</type>的"
+"由<link linkend=\"GObject\"><type>GObject</type></link>继承来的新的
GType, 并"
+"在接口Interface中实现。 <placeholder-1/>"

#: tut_gtype.xml:709(programlisting)
#, no-wrap
@@ -3367,6 +3556,12 @@
"\"><type>GInterfaceInfo</type></link> structure holds information about
the "
"implementation of the interface: <placeholder-1/>"
msgstr ""
+"<function><link linkend=\"g-type-add-interface-static"
+"\">g_type_add_interface_static</link></function> 记录了在类型系统中如 "
+"<type>FooInterface</type>来实现的接口(<function>foo_interface_get_type</"
+"function>返回<type>FooInterface</type>的类型), <link linkend="
+"\"GInterfaceInfo\"><type>GInterfaceInfo</type></link>保存着关于接口实现的
信"
+"息: <placeholder-1/>"

#: tut_gtype.xml:76(para)
msgid ""
@@ -3380,6 +3575,14 @@
"\">g_type_register_static</link></function> and <function><link
linkend=\"g-"
"type-register-dynamic\">g_type_register_dynamic</link></function>."
msgstr ""
+"不论是基本还是非基本类型,均由下面的定义步骤: <placeholder-1/> 基本类型同
样"
+"可以由 <link
linkend=\"GTypeFundamentalFlags\"><type>GTypeFundamentalFlags</"
+"type></link> 来定义,并保存在 <link linkend=\"GTypeFundamentalInfo"
+"\"><type>GTypeFundamentalInfo</type></link> 中。非基本类型一般传递一个 "
+"parent_type 至<function><link linkend=\"g-type-register-static"
+"\">g_type_register_static</link></function> 和 <function><link
linkend=\"g-"
+"type-register-dynamic\">g_type_register_dynamic</link></function> 中,然后
交"
+"给父类来定义。"

#: tut_gtype.xml:764(programlisting)
#, no-wrap
@@ -3398,6 +3601,8 @@
"When having no special requirements you also can use the "
"<function>G_DEFINE_INTERFACE</function> macro: <placeholder-1/>"
msgstr ""
+"如果没有特殊的需求,你可以直接使用
<function>G_DEFINE_INTERFACE</function>这个"
+"宏: <placeholder-1/>"

#: tut_gtype.xml:775(programlisting)
#, no-wrap
@@ -3408,7 +3613,7 @@

#: tut_gtype.xml:782(title) tut_gtype.xml:839(title)
msgid "Interface Initialization"
-msgstr ""
+msgstr "接口初始化"

#: tut_gtype.xml:784(para)
msgid ""
@@ -3424,6 +3629,8 @@
"class size: the class_size field in <link linkend=\"GTypeInfo"
"\"><type>GTypeInfo</type></link>."
msgstr ""
+"类的大小:<link linkend=\"GTypeInfo\"><type>GTypeInfo</type></link>的 "
+"class_size。"

#: tut_gtype.xml:793(para)
msgid ""
@@ -3443,6 +3650,9 @@
"looking at the structure and the functions used to register new types in
the "
"type system. <placeholder-1/>"
msgstr ""
+"由 Glib 类型系统操作的一个类型,比传统上所讲的 Object 类型更具一般化。 下
面查"
+"看类型系统中有关类结构和注册新类型的函数,是会对此最好的解释。 "
+"<placeholder-1/>"

#: tut_gtype.xml:803(para)
msgid ""
@@ -3483,6 +3693,8 @@
"class_init fields in <link linkend=\"GTypeInfo\"><type>GTypeInfo</type></"
"link>."
msgstr ""
+"类的初始化函数(C++ 构造函数):<link
linkend=\"GTypeInfo\"><type>GTypeInfo</"
+"type></link>的 base_init 和 class_init。"

#: tut_gtype.xml:830(para)
msgid ""
@@ -3521,6 +3733,8 @@
"class_finalize fields in <link
linkend=\"GTypeInfo\"><type>GTypeInfo</type></"
"link>."
msgstr ""
+"类的销毁函数(C++析构函数):<link
linkend=\"GTypeInfo\"><type>GTypeInfo</"
+"type></link>的 base_finalize 和 class_finalize。"

#: tut_gtype.xml:886(title)
msgid "Interface Destruction"
@@ -3545,6 +3759,8 @@
"instance size (C++ parameter to new): the instance_size field in <link "
"linkend=\"GTypeInfo\"><type>GTypeInfo</type></link>."
msgstr ""
+"实例的大小(C++参数new):<link linkend=\"GTypeInfo\"><type>GTypeInfo</"
+"type></link>中 的 instance_size。"

#: tut_gtype.xml:901(para)
msgid ""
@@ -3583,12 +3799,16 @@
"instantiation policy (C++ type of new operator): the n_preallocs field
in "
"<link linkend=\"GTypeInfo\"><type>GTypeInfo</type></link>."
msgstr ""
+"实例化策略(C++ 类的new operator):<link linkend=\"GTypeInfo"
+"\"><type>GTypeInfo</type></link>的n_preallocs。"

#: tut_gtype.xml:98(para)
msgid ""
"copy functions (C++ copy operators): the value_table field in <link
linkend="
"\"GTypeInfo\"><type>GTypeInfo</type></link>."
msgstr ""
+"复制函数(C++的复制操作):<link linkend=\"GTypeInfo\"><type>GTypeInfo</"
+"type></link>的 value_table。"

#: tut_howto.xml:1001(title)
msgid "Interface definition prerequisites"
Reply all
Reply to author
Forward
0 new messages