3
* A Nautilus extension which offers configurable context menu actions.
5
* Copyright (C) 2005 The GNOME Foundation
6
* Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
7
* Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
9
* This Program is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU General Public License as
11
* published by the Free Software Foundation; either version 2 of
12
* the License, or (at your option) any later version.
14
* This Program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public
20
* License along with this Library; see the file COPYING. If not,
21
* write to the Free Software Foundation, Inc., 59 Temple Place,
22
* Suite 330, Boston, MA 02111-1307, USA.
25
* Frederic Ruaudel <grumz@grumz.net>
26
* Rodrigo Moya <rodrigo@gnome-db.org>
27
* Pierre Wieser <pwieser@trychlos.org>
28
* ... and many others (see AUTHORS)
35
#include "test-iface-base.h"
36
#include "test-iface-iface.h"
40
struct TestBaseClassPrivate {
41
void *empty; /* so that gcc -pedantic is happy */
44
/* private instance data
46
struct TestBasePrivate {
47
gboolean dispose_has_run;
50
static GObjectClass *st_parent_class = NULL;
52
static GType register_type( void );
53
static void class_init( TestBaseClass *klass );
54
static void iface_iface_init( TestIFaceInterface *iface );
55
static void instance_init( GTypeInstance *instance, gpointer klass );
56
static void instance_dispose( GObject *object );
57
static void instance_finalize( GObject *object );
59
static void iface_fna( TestIFace *object );
60
static void iface_fnb( TestIFace *object );
63
test_base_get_type( void )
65
static GType object_type = 0;
68
object_type = register_type();
71
return( object_type );
77
static const gchar *thisfn = "test_iface_base_register_type";
80
static GTypeInfo info = {
81
sizeof( TestBaseClass ),
82
( GBaseInitFunc ) NULL,
83
( GBaseFinalizeFunc ) NULL,
84
( GClassInitFunc ) class_init,
89
( GInstanceInitFunc ) instance_init
92
static const GInterfaceInfo iface_iface_info = {
93
( GInterfaceInitFunc ) iface_iface_init,
98
g_debug( "%s", thisfn );
100
type = g_type_register_static( G_TYPE_OBJECT, "TestBase", &info, 0 );
102
g_type_add_interface_static( type, TEST_IFACE_TYPE, &iface_iface_info );
108
class_init( TestBaseClass *klass )
110
static const gchar *thisfn = "test_iface_base_class_init";
111
GObjectClass *object_class;
113
g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
115
st_parent_class = g_type_class_peek_parent( klass );
117
object_class = G_OBJECT_CLASS( klass );
118
object_class->dispose = instance_dispose;
119
object_class->finalize = instance_finalize;
121
klass->private = g_new0( TestBaseClassPrivate, 1 );
125
iface_iface_init( TestIFaceInterface *iface )
127
static const gchar *thisfn = "test_iface_base_iface_iface_init";
129
g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
131
iface->fna = iface_fna;
132
iface->fnb = iface_fnb;
136
instance_init( GTypeInstance *instance, gpointer klass )
138
static const gchar *thisfn = "test_iface_base_instance_init";
141
g_debug( "%s: instance=%p, klass=%p", thisfn, ( void * ) instance, ( void * ) klass );
142
g_assert( TEST_IS_BASE( instance ));
143
self = TEST_BASE( instance );
145
self->private = g_new0( TestBasePrivate, 1 );
147
self->private->dispose_has_run = FALSE;
151
instance_dispose( GObject *object )
153
static const gchar *thisfn = "test_iface_base_instance_dispose";
156
g_debug( "%s: object=%p", thisfn, ( void * ) object );
157
g_assert( TEST_IS_BASE( object ));
158
self = TEST_BASE( object );
160
if( !self->private->dispose_has_run ){
162
self->private->dispose_has_run = TRUE;
164
/* chain up to the parent class */
165
if( G_OBJECT_CLASS( st_parent_class )->dispose ){
166
G_OBJECT_CLASS( st_parent_class )->dispose( object );
172
instance_finalize( GObject *object )
176
g_assert( TEST_IS_BASE( object ));
177
self = ( TestBase * ) object;
179
g_free( self->private );
181
/* chain call to parent class */
182
if( G_OBJECT_CLASS( st_parent_class )->finalize ){
183
G_OBJECT_CLASS( st_parent_class )->finalize( object );
188
test_base_new( void )
190
TestBase *object = g_object_new( TEST_BASE_TYPE, NULL );
196
iface_fna( TestIFace *object )
198
static const gchar *thisfn = "test_iface_base_iface_fna";
199
g_debug( "%s: %s at %p", thisfn, G_OBJECT_TYPE_NAME( object ), ( void * ) object );
203
iface_fnb( TestIFace *object )
205
static const gchar *thisfn = "test_iface_base_iface_fnb";
206
g_debug( "%s: %s at %p", thisfn, G_OBJECT_TYPE_NAME( object ), ( void * ) object );