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)
31
#ifndef __NA_OBJECT_H__
32
#define __NA_OBJECT_H__
36
* @short_description: #NAObject class definition.
37
* @include: common/na-object.h
39
* This is the base class for NAAction and NActionProfile.
41
* It implements the NAIDuplicable interface in order to have easily
42
* duplicable derived objects.
44
* A #NAObject object is characterized by :
45
* - an internal identifiant (ASCII, case insensitive)
46
* - a libelle (UTF8, localizable).
48
* The #NAObject class is a pure virtual class.
51
#include <glib-object.h>
55
#define NA_OBJECT_TYPE ( na_object_get_type())
56
#define NA_OBJECT( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NA_OBJECT_TYPE, NAObject ))
57
#define NA_OBJECT_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, NA_OBJECT_TYPE, NAObjectClass ))
58
#define NA_IS_OBJECT( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NA_OBJECT_TYPE ))
59
#define NA_IS_OBJECT_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NA_OBJECT_TYPE ))
60
#define NA_OBJECT_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NA_OBJECT_TYPE, NAObjectClass ))
62
typedef struct NAObjectPrivate NAObjectPrivate;
66
NAObjectPrivate *private;
70
typedef struct NAObjectClassPrivate NAObjectClassPrivate;
74
NAObjectClassPrivate *private;
78
* @object: the #NAObject-derived object to be dumped.
80
* Dumps via g_debug the content of the object.
82
* In order to get a down-to-top display, the derived class
83
* implementation should call its parent class before actually
84
* dumping its own data and properties.
86
void ( *dump ) ( const NAObject *object );
89
* check_edited_status:
90
* @object: the #NAObject-derived object to be checked.
92
* Checks a #NAObject-derived object for modification and validity
95
void ( *check_edited_status )( const NAObject *object );
99
* @object: the #NAObject-derived object to be dumped.
101
* Duplicates a #NAObject-derived object.
103
* As the most-derived class will actually allocate the new object
104
* with the right class, it shouldn't call its parent class.
106
* Copying data and properties should then be done via the
107
* na_object_copy() function.
109
* Returns: a newly allocated object, which is an exact copy of
112
NAObject * ( *duplicate ) ( const NAObject *object );
116
* @target: the #NAObject-derived object which will receive data.
117
* @source: the #NAObject-derived object which will provide data.
119
* Copies data and properties from @source to @target.
121
* Each derived class should take care of calling its parent class
122
* to complete the copy.
124
void ( *copy ) ( NAObject *target, const NAObject *source );
128
* @a: a first #NAObject object.
129
* @b: a second #NAObject object to be compared to the first one.
131
* Compares the two objects.
133
* At least when it finds that @a and @b are equal, each derived
134
* class should call its parent class to give it an opportunity to
135
* detect a difference.
137
* Returns: %TRUE if @a and @b are identical, %FALSE else.
139
gboolean ( *are_equal ) ( const NAObject *a, const NAObject *b );
143
* @object: the #NAObject object to be checked.
145
* Checks @object for validity.
147
* At least when it finds that @object is valid, each derived class
148
* should call its parent class to give it an opportunity to detect
151
* A #NAObject is valid if its internal identifiant is set.
153
* Returns: %TRUE if @object is valid, %FALSE else.
155
gboolean ( *is_valid ) ( const NAObject *object );
160
* used in derived classes to access to the properties
163
PROP_NAOBJECT_ID = 1,
167
GType na_object_get_type( void );
169
void na_object_dump( const NAObject *object );
170
NAObject *na_object_duplicate( const NAObject *object );
171
void na_object_copy( NAObject *target, const NAObject *source );
173
void na_object_check_edited_status( const NAObject *object );
174
gboolean na_object_are_equal( const NAObject *a, const NAObject *b );
175
gboolean na_object_is_valid( const NAObject *object );
177
NAObject *na_object_get_origin( const NAObject *object );
178
gboolean na_object_get_modified_status( const NAObject *object );
179
gboolean na_object_get_valid_status( const NAObject *object );
181
void na_object_set_origin( NAObject *object, const NAObject *origin );
183
gchar *na_object_get_id( const NAObject *object );
184
gchar *na_object_get_label( const NAObject *object );
186
void na_object_set_id( NAObject *object, const gchar *id );
187
void na_object_set_label( NAObject *object, const gchar *label );
191
#endif /* __NA_OBJECT_H__ */