os/ossrv/glib/tsrc/BC/tests/gobject/mambaz.c
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
sl@0
     3
*
sl@0
     4
* This library is free software; you can redistribute it and/or
sl@0
     5
* modify it under the terms of the GNU Lesser General Public
sl@0
     6
* License as published by the Free Software Foundation; either
sl@0
     7
* version 2 of the License, or (at your option) any later version.
sl@0
     8
*
sl@0
     9
* This library is distributed in the hope that it will be useful,
sl@0
    10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
sl@0
    11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
sl@0
    12
* Lesser General Public License for more details.
sl@0
    13
*
sl@0
    14
* You should have received a copy of the GNU Lesser General Public
sl@0
    15
* License along with this library; if not, write to the
sl@0
    16
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
sl@0
    17
* Boston, MA 02111-1307, USA.
sl@0
    18
*
sl@0
    19
* Description:
sl@0
    20
*
sl@0
    21
*/
sl@0
    22
sl@0
    23
#include "mambaz.h"
sl@0
    24
sl@0
    25
extern GType baz_type;
sl@0
    26
sl@0
    27
static void
sl@0
    28
maman_ibaz_base_init (gpointer g_class)
sl@0
    29
{
sl@0
    30
  
sl@0
    31
}
sl@0
    32
sl@0
    33
GType
sl@0
    34
maman_ibaz_get_type (void)
sl@0
    35
{
sl@0
    36
  static GType type = 0;
sl@0
    37
  if (type == 0) {
sl@0
    38
    static const GTypeInfo info = {
sl@0
    39
      sizeof (MamanIbazInterface),
sl@0
    40
      maman_ibaz_base_init,   /* base_init */
sl@0
    41
      NULL,   /* base_finalize */
sl@0
    42
      NULL,   /* class_init */
sl@0
    43
      NULL,   /* class_finalize */
sl@0
    44
      NULL,   /* class_data */
sl@0
    45
      0,
sl@0
    46
      0,      /* n_preallocs */
sl@0
    47
      NULL    /* instance_init */
sl@0
    48
    };
sl@0
    49
    type = g_type_register_static (G_TYPE_INTERFACE, "MamanIbaz", &info, 0);
sl@0
    50
  }
sl@0
    51
  return type;
sl@0
    52
}
sl@0
    53
sl@0
    54
void maman_ibaz_do_action (MamanIbaz *self)
sl@0
    55
{
sl@0
    56
 
sl@0
    57
  MAMAN_IBAZ_GET_INTERFACE (self)->do_action (self);
sl@0
    58
}
sl@0
    59
sl@0
    60
//that was the interface class
sl@0
    61
sl@0
    62
static void baz_do_action (MamanBaz *self)
sl@0
    63
{
sl@0
    64
  self->instance_member = 10;
sl@0
    65
}
sl@0
    66
sl@0
    67
void
sl@0
    68
baz_interface_init (gpointer   g_iface,
sl@0
    69
                    gpointer   iface_data)
sl@0
    70
{
sl@0
    71
  MamanIbazInterface *iface = (MamanIbazInterface *)g_iface;
sl@0
    72
  iface->do_action = (void (*) (MamanIbaz *self))baz_do_action;
sl@0
    73
}
sl@0
    74
sl@0
    75
void
sl@0
    76
baz_instance_init (GTypeInstance   *instance,
sl@0
    77
                   gpointer         g_class)
sl@0
    78
{
sl@0
    79
  MamanBaz *self = MAMAN_BAZ(instance);
sl@0
    80
  self->instance_member = 0xdeadbeaf;
sl@0
    81
}
sl@0
    82
sl@0
    83
sl@0
    84