Update NACT screenshots
[nautilus-actions.git] / src / api / na-object.h
blob24541067ca361316c712c3d65a614fb9c1d9455f
1 /*
2 * Nautilus-Actions
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, 2010, 2011 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.
24 * Authors:
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 __NAUTILUS_ACTIONS_API_NA_OBJECT_H__
32 #define __NAUTILUS_ACTIONS_API_NA_OBJECT_H__
34 /**
35 * SECTION: object
36 * @title: NAObject
37 * @short_description: The Deepest Base Class Definition
38 * @include: nautilus-actions/na-object.h
40 * This is the base class of all our data object hierarchy. #NAObject is
41 * supposed to be used as a pure virtual base class, i.e. should only be
42 * derived.
44 * All the API described here is rather private. External code should
45 * use the API described in <filename>nautilus-actions/na-object-api.h</filename>.
48 #include <glib-object.h>
50 G_BEGIN_DECLS
52 #define NA_OBJECT_TYPE ( na_object_object_get_type())
53 #define NA_OBJECT( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NA_OBJECT_TYPE, NAObject ))
54 #define NA_OBJECT_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, NA_OBJECT_TYPE, NAObjectClass ))
55 #define NA_IS_OBJECT( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NA_OBJECT_TYPE ))
56 #define NA_IS_OBJECT_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NA_OBJECT_TYPE ))
57 #define NA_OBJECT_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NA_OBJECT_TYPE, NAObjectClass ))
59 typedef struct _NAObjectPrivate NAObjectPrivate;
61 typedef struct {
62 /*< private >*/
63 GObject parent;
64 NAObjectPrivate *private;
66 NAObject;
68 typedef struct _NAObjectClassPrivate NAObjectClassPrivate;
70 /**
71 * NAObjectClass:
72 * @dump: Dumps the #NAObject -part of the #NAObject -derived object.
73 * @copy: Copies a #NAObject to another.
74 * @are_equal: Tests if two #NAObject are equal.
75 * @is_valid: Tests if a #NAObject is valid.
77 * The #NAObjectClass defines some methods available to derived classes.
79 typedef struct {
80 /*< private >*/
81 GObjectClass parent;
82 NAObjectClassPrivate *private;
84 /*< public >*/
85 /**
86 * dump:
87 * @object: the NAObject-derived object to be dumped.
89 * Dumps via g_debug the content of the object.
91 * The derived class should call its parent class at the end of the
92 * dump of its own datas.
94 * Since: 2.30
96 void ( *dump ) ( const NAObject *object );
98 /**
99 * copy:
100 * @target: the NAObject-derived object which will receive data.
101 * @source: the NAObject-derived object which will provide data.
102 * @recursive: whether children should be recursively copied.
104 * Copies data and properties from @source to @target.
106 * The derived class should call its parent class at the end of the
107 * copy of its own datas.
109 * Since: 2.30
111 void ( *copy ) ( NAObject *target, const NAObject *source, gboolean recursive );
114 * are_equal:
115 * @a: a first NAObject object.
116 * @b: a second NAObject object to be compared to the first one.
118 * Compares the two objects.
120 * When testing for the modification status of an object, @a stands for
121 * the original object, while @b stands for the duplicated one.
123 * As long as no difference is detected, the derived class should call
124 * its parent class at the end of its comparison.
125 * As soon as a difference is detected, the calling sequence should
126 * be stopped, and the result returned.
128 * Returns: TRUE if @a and @b are identical, FALSE else.
130 * Since: 2.30
132 gboolean ( *are_equal )( const NAObject *a, const NAObject *b );
135 * is_valid:
136 * @object: the NAObject object to be checked.
138 * Checks @object for validity.
140 * A NAObject is valid if its internal identifier is set.
142 * As long as the item is valid, the derived class should call its parent
143 * at the end of its checks.
144 * As soon as an error is detected, the calling sequence should be stopped,
145 * and the result returned.
147 * Returns: TRUE if @object is valid, FALSE else.
149 * Since: 2.30
151 gboolean ( *is_valid ) ( const NAObject *object );
153 NAObjectClass;
155 GType na_object_object_get_type( void );
157 void na_object_object_check_status_rec( const NAObject *object );
159 void na_object_object_reset_origin ( NAObject *object, const NAObject *origin );
161 NAObject *na_object_object_ref ( NAObject *object );
162 void na_object_object_unref( NAObject *object );
164 void na_object_object_dump ( const NAObject *object );
165 void na_object_object_dump_norec( const NAObject *object );
166 void na_object_object_dump_tree ( GList *tree );
168 #ifndef NA_DISABLE_DEPRECATED
169 GList *na_object_get_hierarchy( const NAObject *object );
170 void na_object_free_hierarchy( GList *hierarchy );
171 #endif
173 void na_object_object_debug_invalid( const NAObject *object, const gchar *reason );
175 G_END_DECLS
177 #endif /* __NAUTILUS_ACTIONS_API_NA_OBJECT_H__ */