[glib] docs: Update instance private data in GObject how-to examples
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] docs: Update instance private data in GObject how-to examples
- Date: Fri, 21 Aug 2015 14:16:36 +0000 (UTC)
commit ffc248919bc6456a90792a1ea0ecb689b8078791
Author: Philip Withnall <philip withnall collabora co uk>
Date: Fri Feb 20 13:10:04 2015 +0000
docs: Update instance private data in GObject how-to examples
Use get_instance_private().
https://bugzilla.gnome.org/show_bug.cgi?id=744060
docs/reference/gobject/tut_howto.xml | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/docs/reference/gobject/tut_howto.xml b/docs/reference/gobject/tut_howto.xml
index da15dce..4cd8a09 100644
--- a/docs/reference/gobject/tut_howto.xml
+++ b/docs/reference/gobject/tut_howto.xml
@@ -305,7 +305,7 @@ maman_bar_class_init (MamanBarClass *klass)
static void
maman_bar_init (MamanBar *self)
{
- self->priv = maman_bar_get_instance_private (self);
+ MamanBarPrivate *priv = maman_bar_get_instance_private (self);
/* initialize all public and private members to reasonable default values.
* They are all automatically initialized to 0 to begin with. */
@@ -407,7 +407,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (MamanBar, maman_bar, G_TYPE_OBJECT)
static void
maman_bar_dispose (GObject *gobject)
{
- MamanBar *self = MAMAN_BAR (gobject);
+ MamanBarPrivate *priv = maman_bar_get_instance_private (MAMAN_BAR (gobject));
/* In dispose(), you are supposed to free all types referenced from this
* object which might themselves hold a reference to self. Generally,
@@ -419,7 +419,7 @@ maman_bar_dispose (GObject *gobject)
* calling g_object_unref() on an invalid GObject by setting the member
* NULL; g_clear_object() does this for us.
*/
- g_clear_object (&self->priv->an_object);
+ g_clear_object (&priv->an_object);
/* Always chain up to the parent class; there is no need to check if
* the parent class implements the dispose() virtual function: it is
@@ -431,9 +431,9 @@ maman_bar_dispose (GObject *gobject)
static void
maman_bar_finalize (GObject *gobject)
{
- MamanBar *self = MAMAN_BAR (gobject);
+ MamanBarPrivate *priv = maman_bar_get_instance_private (MAMAN_BAR (gobject));
- g_free (self->priv->a_string);
+ g_free (priv->a_string);
/* Always chain up to the parent class; as with dispose(), finalize()
* is guaranteed to exist on the parent's class virtual function table
@@ -444,19 +444,19 @@ maman_bar_finalize (GObject *gobject)
static void
maman_bar_class_init (MamanBarClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
- gobject_class->dispose = maman_bar_dispose;
- gobject_class->finalize = maman_bar_finalize;
+ object_class->dispose = maman_bar_dispose;
+ object_class->finalize = maman_bar_finalize;
}
static void
maman_bar_init (MamanBar *self);
{
- self->priv = maman_bar_get_instance_private (self);
+ MamanBarPrivate *priv = maman_bar_get_instance_private (self);
- self->priv->an_object = g_object_new (MAMAN_TYPE_BAZ, NULL);
- self->priv->a_string = g_strdup ("Maman");
+ priv->an_object = g_object_new (MAMAN_TYPE_BAZ, NULL);
+ priv->a_string = g_strdup ("Maman");
}
</programlisting></informalexample>
</para>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]