os/ossrv/glib/tsrc/BC/tests/gobject/mambaz.c
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/glib/tsrc/BC/tests/gobject/mambaz.c	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,84 @@
     1.4 +/*
     1.5 +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
     1.6 +*
     1.7 +* This library is free software; you can redistribute it and/or
     1.8 +* modify it under the terms of the GNU Lesser General Public
     1.9 +* License as published by the Free Software Foundation; either
    1.10 +* version 2 of the License, or (at your option) any later version.
    1.11 +*
    1.12 +* This library is distributed in the hope that it will be useful,
    1.13 +* but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.14 +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.15 +* Lesser General Public License for more details.
    1.16 +*
    1.17 +* You should have received a copy of the GNU Lesser General Public
    1.18 +* License along with this library; if not, write to the
    1.19 +* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    1.20 +* Boston, MA 02111-1307, USA.
    1.21 +*
    1.22 +* Description:
    1.23 +*
    1.24 +*/
    1.25 +
    1.26 +#include "mambaz.h"
    1.27 +
    1.28 +extern GType baz_type;
    1.29 +
    1.30 +static void
    1.31 +maman_ibaz_base_init (gpointer g_class)
    1.32 +{
    1.33 +  
    1.34 +}
    1.35 +
    1.36 +GType
    1.37 +maman_ibaz_get_type (void)
    1.38 +{
    1.39 +  static GType type = 0;
    1.40 +  if (type == 0) {
    1.41 +    static const GTypeInfo info = {
    1.42 +      sizeof (MamanIbazInterface),
    1.43 +      maman_ibaz_base_init,   /* base_init */
    1.44 +      NULL,   /* base_finalize */
    1.45 +      NULL,   /* class_init */
    1.46 +      NULL,   /* class_finalize */
    1.47 +      NULL,   /* class_data */
    1.48 +      0,
    1.49 +      0,      /* n_preallocs */
    1.50 +      NULL    /* instance_init */
    1.51 +    };
    1.52 +    type = g_type_register_static (G_TYPE_INTERFACE, "MamanIbaz", &info, 0);
    1.53 +  }
    1.54 +  return type;
    1.55 +}
    1.56 +
    1.57 +void maman_ibaz_do_action (MamanIbaz *self)
    1.58 +{
    1.59 + 
    1.60 +  MAMAN_IBAZ_GET_INTERFACE (self)->do_action (self);
    1.61 +}
    1.62 +
    1.63 +//that was the interface class
    1.64 +
    1.65 +static void baz_do_action (MamanBaz *self)
    1.66 +{
    1.67 +  self->instance_member = 10;
    1.68 +}
    1.69 +
    1.70 +void
    1.71 +baz_interface_init (gpointer   g_iface,
    1.72 +                    gpointer   iface_data)
    1.73 +{
    1.74 +  MamanIbazInterface *iface = (MamanIbazInterface *)g_iface;
    1.75 +  iface->do_action = (void (*) (MamanIbaz *self))baz_do_action;
    1.76 +}
    1.77 +
    1.78 +void
    1.79 +baz_instance_init (GTypeInstance   *instance,
    1.80 +                   gpointer         g_class)
    1.81 +{
    1.82 +  MamanBaz *self = MAMAN_BAZ(instance);
    1.83 +  self->instance_member = 0xdeadbeaf;
    1.84 +}
    1.85 +
    1.86 +
    1.87 +