mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-06-13 16:13:47 +02:00
fix lots of typos, some of which were reported by Leonardo Boshell.
2005-05-25 Mathieu Lacage <mathieu@gnome.org> * gobject/tut_*.xml: fix lots of typos, some of which were reported by Leonardo Boshell.
This commit is contained in:
parent
1397c53eb7
commit
8db223409d
@ -1,3 +1,8 @@
|
|||||||
|
2005-05-25 Mathieu Lacage <mathieu@gnome.org>
|
||||||
|
|
||||||
|
* gobject/tut_*.xml: fix lots of typos,
|
||||||
|
some of which were reported by Leonardo Boshell.
|
||||||
|
|
||||||
2005-05-23 Matthias Clasen <mclasen@redhat.com>
|
2005-05-23 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/tmpl/threads.sgml: Point out exceptions to the
|
* glib/tmpl/threads.sgml: Point out exceptions to the
|
||||||
|
@ -498,7 +498,7 @@ void g_object_run_dispose (GObject *object);
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
The above example, which might seem a bit contrived can really happen if your
|
The above example, which might seem a bit contrived can really happen if your
|
||||||
GObject's are being by language bindings. I would thus suggest the rules stated above
|
GObject's are being handled by language bindings. I would thus suggest the rules stated above
|
||||||
for object destruction are closely followed. Otherwise, <emphasis>Bad Bad Things</emphasis>
|
for object destruction are closely followed. Otherwise, <emphasis>Bad Bad Things</emphasis>
|
||||||
will happen.
|
will happen.
|
||||||
</para>
|
</para>
|
||||||
|
@ -29,7 +29,7 @@ return_type function_callback (... , gpointer user_data);
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
The <type><link linkend="GClosure">GClosure</link></type> structure represents the common functionality of all
|
The <type><link linkend="GClosure">GClosure</link></type> structure represents the common functionality of all
|
||||||
closure implementations: there exist a different Closure implementation for
|
closure implementations: there exists a different Closure implementation for
|
||||||
each separate runtime which wants to use the GObject type system.
|
each separate runtime which wants to use the GObject type system.
|
||||||
<footnote><para>
|
<footnote><para>
|
||||||
In Practice, Closures sit at the boundary of language runtimes: if you are
|
In Practice, Closures sit at the boundary of language runtimes: if you are
|
||||||
|
@ -286,7 +286,7 @@ struct _GTypeValueTable
|
|||||||
#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_BAR_TYPE))
|
#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_BAR_TYPE))
|
||||||
#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_BAR_TYPE, MamanBarClass))
|
#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_BAR_TYPE, MamanBarClass))
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<note>Stick to the naming <code>klass</code> as <code>class</code> is a registered c++ keyword.</note>
|
<note><simpara>Stick to the naming <varname>klass</varname> as <varname>class</varname> is a registered c++ keyword.</simpara></note>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@ -387,13 +387,13 @@ typedef struct {
|
|||||||
int field_a;
|
int field_a;
|
||||||
} MamanBar;
|
} MamanBar;
|
||||||
|
|
||||||
struct _MamanBarClass {
|
typedef struct {
|
||||||
GObjectClass parent;
|
GObjectClass parent;
|
||||||
/* class members */
|
/* class members */
|
||||||
void (*do_action_public_virtual) (MamanBar *self, guint8 i);
|
void (*do_action_public_virtual) (MamanBar *self, guint8 i);
|
||||||
|
|
||||||
void (*do_action_public_pure_virtual) (MamanBar *self, guint8 i);
|
void (*do_action_public_pure_virtual) (MamanBar *self, guint8 i);
|
||||||
};
|
} MamanBarClass;
|
||||||
|
|
||||||
#define MAMAN_BAR_TYPE (maman_bar_get_type ())
|
#define MAMAN_BAR_TYPE (maman_bar_get_type ())
|
||||||
|
|
||||||
@ -413,7 +413,7 @@ maman_bar_get_type (void)
|
|||||||
0, /* n_preallocs */
|
0, /* n_preallocs */
|
||||||
(GInstanceInitFunc) NULL /* instance_init */
|
(GInstanceInitFunc) NULL /* instance_init */
|
||||||
};
|
};
|
||||||
type = g_type_register_fundamental (G_TYPE_OBJECT,
|
type = g_type_register_static (G_TYPE_OBJECT,
|
||||||
"BarType",
|
"BarType",
|
||||||
&info, 0);
|
&info, 0);
|
||||||
}
|
}
|
||||||
@ -609,8 +609,9 @@ The class initialization process is entirely implemented in
|
|||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>First call to <function><link linkend="g-type-create-instance">g_type_create_instance</link></function> for target type</entry>
|
<entry>First call to <function><link linkend="g-type-create-instance">g_type_create_instance</link></function> for target type</entry>
|
||||||
<entry colspan="2">interface initialization, see
|
<entry>interface initialization, see
|
||||||
<xref linkend="gtype-non-instantiable-classed-init"/></entry>
|
<xref linkend="gtype-non-instantiable-classed-init"/></entry>
|
||||||
|
<entry></entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>Each call to <function><link linkend="g-type-create-instance">g_type_create_instance</link></function> for target type</entry>
|
<entry>Each call to <function><link linkend="g-type-create-instance">g_type_create_instance</link></function> for target type</entry>
|
||||||
@ -619,7 +620,7 @@ The class initialization process is entirely implemented in
|
|||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>Last call to <function><link linkend="g-type-free-instance">g_type_free_instance</link></function> for target type</entry>
|
<entry>Last call to <function><link linkend="g-type-free-instance">g_type_free_instance</link></function> for target type</entry>
|
||||||
<entry colspan="2">interface destruction, see
|
<entry>interface destruction, see
|
||||||
<xref linkend="gtype-non-instantiable-classed-dest"/></entry>
|
<xref linkend="gtype-non-instantiable-classed-dest"/></entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
</row>
|
</row>
|
||||||
@ -675,7 +676,7 @@ void maman_ibaz_do_action (MamanIbaz *self)
|
|||||||
MAMAN_IBAZ_GET_INTERFACE (self)->do_action (self);
|
MAMAN_IBAZ_GET_INTERFACE (self)->do_action (self);
|
||||||
}
|
}
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<function>maman_ibaz_get_gtype</function> registers a type named <emphasis>MamanIBaz</emphasis>
|
<function>maman_ibaz_get_type</function> registers a type named <emphasis>MamanIBaz</emphasis>
|
||||||
which inherits from G_TYPE_INTERFACE. All interfaces must be children of G_TYPE_INTERFACE in the
|
which inherits from G_TYPE_INTERFACE. All interfaces must be children of G_TYPE_INTERFACE in the
|
||||||
inheritance tree.
|
inheritance tree.
|
||||||
</para>
|
</para>
|
||||||
|
@ -164,20 +164,20 @@ struct _MamanBar {
|
|||||||
MamanBarPrivate *priv;
|
MamanBarPrivate *priv;
|
||||||
};
|
};
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<note>Do not call this <code>private</code>, as that is a registered c++ keyword.</note>
|
<note><simpara>Do not call this <varname>private</varname>, as that is a registered c++ keyword.</simpara></note>
|
||||||
The private structure is then defined in the .c file, instantiated in the object's
|
The private structure is then defined in the .c file, instantiated in the object's
|
||||||
<function>init</function> function and destroyed in the object's <function>finalize</function> function.
|
<function>init</function> function and destroyed in the object's <function>finalize</function> function.
|
||||||
<programlisting>
|
<programlisting>
|
||||||
static void maman_bar_finalize(GObject *object) {
|
static void maman_bar_finalize(GObject *object) {
|
||||||
MamanBar *self = MAMAN_BAR (object);
|
MamanBar *self = MAMAN_BAR (object);
|
||||||
...
|
/* do stuff */
|
||||||
g_free (self->priv);
|
g_free (self->priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void maman_bar_init(GTypeInstance *instance, gpointer g_class) {
|
static void maman_bar_init(GTypeInstance *instance, gpointer g_class) {
|
||||||
MamanBar *self = MAMAN_BAR (instance);
|
MamanBar *self = MAMAN_BAR (instance);
|
||||||
self->priv = g_new0(MamanBarPrivate,1);
|
self->priv = g_new0(MamanBarPrivate,1);
|
||||||
...
|
/* do stuff */
|
||||||
}
|
}
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
@ -495,7 +495,7 @@ if (self->private->dispose_has_run) {
|
|||||||
Just as with C++, there are many different ways to define object
|
Just as with C++, there are many different ways to define object
|
||||||
methods and extend them: the following list and sections draw on C++ vocabulary.
|
methods and extend them: the following list and sections draw on C++ vocabulary.
|
||||||
(Readers are expected to know basic C++ buzzwords. Those who have not had to
|
(Readers are expected to know basic C++ buzzwords. Those who have not had to
|
||||||
write C++ code recently can refer to e.g. <ulink>http://www.cplusplus.com/doc/tutorial/</ulink> to refresh their
|
write C++ code recently can refer to e.g. <ulink url="http://www.cplusplus.com/doc/tutorial/"/> to refresh their
|
||||||
memories.)
|
memories.)
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
|
@ -148,10 +148,10 @@ boundaries is written once: the figure below states this more clearly.
|
|||||||
<figure>
|
<figure>
|
||||||
<mediaobject>
|
<mediaobject>
|
||||||
<imageobject> <!-- this is for HTML output -->
|
<imageobject> <!-- this is for HTML output -->
|
||||||
<imagedata fileref="glue.png" format="png" align="center"/>
|
<imagedata fileref="glue.png" format="PNG" align="center"/>
|
||||||
</imageobject>
|
</imageobject>
|
||||||
<imageobject> <!-- this is for PDF output -->
|
<imageobject> <!-- this is for PDF output -->
|
||||||
<imagedata fileref="glue.jpg" format="jpg" align="center"/>
|
<imagedata fileref="glue.jpg" format="JPG" align="center"/>
|
||||||
</imageobject>
|
</imageobject>
|
||||||
</mediaobject>
|
</mediaobject>
|
||||||
</figure>
|
</figure>
|
||||||
@ -165,7 +165,7 @@ is no need to generate huge amounts of glue code either automatically or by hand
|
|||||||
the whole GType/GObject library. C programmers are likely to be puzzled at the complexity
|
the whole GType/GObject library. C programmers are likely to be puzzled at the complexity
|
||||||
of the features exposed in the following chapters if they forget that the GType/GObject library
|
of the features exposed in the following chapters if they forget that the GType/GObject library
|
||||||
was not only designed to offer OO-like features to C programmers but also transparent
|
was not only designed to offer OO-like features to C programmers but also transparent
|
||||||
cross-langage interoperability.
|
cross-language interoperability.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<partintro>
|
<partintro>
|
||||||
<para>
|
<para>
|
||||||
Several useful developer tools have been build around GObject technology.
|
Several useful developer tools have been build around GObject technology.
|
||||||
Next sections briefly introduce them and link to the respective project pages.
|
The next sections briefly introduce them and link to the respective project pages.
|
||||||
</para>
|
</para>
|
||||||
</partintro>
|
</partintro>
|
||||||
|
|
||||||
@ -10,26 +10,39 @@
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
Writing gobjects can be a tedious task. It requires a lot of typing and just
|
Writing gobjects can be a tedious task. It requires a lot of typing and just
|
||||||
doing copy and paste needs care. On obvious idea is to use some sort of
|
doing a copy/paste requires a great deal of care.
|
||||||
templates for the class skelletons. Then a tool could generate the real c
|
One obvious idea is to use some sort of templates for the class skeletons.
|
||||||
files from them.
|
and then run them through a special tool to generate the real C files.
|
||||||
<ulink url="http://www.5z.com/jirka/gob.html">GOB/</ulink> (or GOB2) is suc
|
<ulink url="http://www.5z.com/jirka/gob.html">GOB/</ulink> (or GOB2) is such
|
||||||
h a tool. It is a preprocessor for making GObjects with inline C code so
|
a tool. It is a preprocessor which can be used to build GObjects
|
||||||
that generated files are not edited.
|
with inline C code so that there is no need to edit the generated C code.
|
||||||
Syntax is inspired by Java and Yacc or Lex. The implementation is
|
The syntax is inspired by Java and Yacc or Lex. The implementation is
|
||||||
intentionally kept simple, and no C actual code parsing is done.
|
intentionally kept simple: the inline C code provided by the user
|
||||||
|
is not parsed.
|
||||||
</para>
|
</para>
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
|
<chapter id="tools-ginspector">
|
||||||
|
<title>Graphical inspection of Gobjects</title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Yet another tool that you may find helpful when working with
|
||||||
|
GObjects is <ulink
|
||||||
|
url="http://sourceforge.net/projects/g-inspector">G-Inspector</ulink>. It
|
||||||
|
is able to display Glib/Gtk+ objects and their properties.
|
||||||
|
</para>
|
||||||
|
</chapter>
|
||||||
|
|
||||||
|
|
||||||
<chapter id="tools-refdb">
|
<chapter id="tools-refdb">
|
||||||
<title>Debugging reference count problems</title>
|
<title>Debugging reference count problems</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The reference counting scheme used by GObject does solve quite
|
The reference counting scheme used by GObject does solve quite
|
||||||
a few memory management problems but also introduces new sources of bugs.
|
a few memory management problems but also introduces new sources of bugs.
|
||||||
In large applications, finding the exact spot where a the reference count
|
In large applications, finding the exact spot where the reference count
|
||||||
of an Object is not properly handled can be very difficult. Hopefully,
|
of an Object is not properly handled can be very difficult. Hopefully,
|
||||||
there exist at a too named <ulink url="http://refdbg.sf.net/">refdbg/</ulink>
|
there exist a tool named <ulink url="http://refdbg.sf.net/">refdbg/</ulink>
|
||||||
which can be used to automate the task of tracking down the location
|
which can be used to automate the task of tracking down the location
|
||||||
of invalid code with regard to reference counting. This application
|
of invalid code with regard to reference counting. This application
|
||||||
intercepts the reference counting calls and tries to detect invalid behavior.
|
intercepts the reference counting calls and tries to detect invalid behavior.
|
||||||
@ -71,6 +84,5 @@ gtk_widget_freeze_child_notify (GtkWidget *widget)
|
|||||||
<ulink url="http://developer.gnome.org/arch/doc/authors.html">documentation</ulink>
|
<ulink url="http://developer.gnome.org/arch/doc/authors.html">documentation</ulink>
|
||||||
on how to setup and use gtk-doc in your
|
on how to setup and use gtk-doc in your
|
||||||
project is provided on the gnome developer website.
|
project is provided on the gnome developer website.
|
||||||
gtk-doc generates
|
|
||||||
</para>
|
</para>
|
||||||
</chapter>
|
</chapter>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user