| Nautilus-Actions™ Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Implemented Interfaces | ||||
#include <nautilus-actions/na-object.h> #define NA_OBJECT_TYPE #define NA_OBJECT (object) #define NA_IS_OBJECT (object) NAObject; NAObjectClass; void na_object_object_check_status (const NAObject *object); gboolean na_object_object_check_status_up (const NAObject *object); void na_object_object_reset_origin (NAObject *object,const NAObject *origin); NAObject * na_object_object_ref (NAObject *object); void na_object_object_unref (NAObject *object); void na_object_object_copy (NAObject *target,const NAObject *source,gboolean recursive); void na_object_object_dump (const NAObject *object); void na_object_object_dump_norec (const NAObject *object); void na_object_object_dump_tree (GList *tree); GList * na_object_object_get_hierarchy (const NAObject *object); void na_object_free_hierarchy (GList *hierarchy); void na_object_object_debug_invalid (const NAObject *object,const gchar *reason);
This is the base class of all our data object hierarchy. NAObject is supposed to be used as a pure virtual base class, i.e. should only be derived.
#define NA_OBJECT( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NA_OBJECT_TYPE, NAObject ))
#define NA_IS_OBJECT( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NA_OBJECT_TYPE ))
typedef struct {
/**
* dump:
* @object: the NAObject-derived object to be dumped.
*
* Dumps via g_debug the content of the object.
*
* NAObject class takes care of calling this function for each
* derived class, starting from topmost base class up to most-
* derived one. Each derived class has so only to take care of
* dumping its own data.
*
* Since: 2.30
*/
void ( *dump ) ( const NAObject *object );
/**
* copy:
* @target: the NAObject-derived object which will receive data.
* @source: the NAObject-derived object which will provide data.
* @recursive: whether children should be recursively copied.
*
* Copies data and properties from @source to @target.
*
* Each derived class should take care of implementing this function
* when relevant. NAObject class will take care of calling this
* function for each class of the hierarchy, starting from topmost
* base class up to the most-derived one. Each class has so only to
* take care of dumping its own data.
*
* Since: 2.30
*/
void ( *copy ) ( NAObject *target, const NAObject *source, gboolean recursive );
/**
* are_equal:
* @a: a first NAObject object.
* @b: a second NAObject object to be compared to the first one.
*
* Compares the two objects.
*
* Each derived class should take care of implementing this function
* when relevant. NAObject class will take care of calling this
* function for each class of the hierarchy, starting from topmost
* base class up to the most-derived one, at least while result
* stays at TRUE.
* As soon as a difference is detected, the calling sequence will
* be stopped, and the result returned.
*
* Returns: TRUE if @a and @b are identical, FALSE else.
*
* Since: 2.30
*/
gboolean ( *are_equal )( const NAObject *a, const NAObject *b );
/**
* is_valid:
* @object: the NAObject object to be checked.
*
* Checks @object for validity.
*
* A NAObject is valid if its internal identifiant is set.
*
* Each derived class should take care of implementing this function
* when relevant. NAObject class will take care of calling this
* function for each class of the hierarchy, starting from topmost
* base class up to the most-derived one, at least while result
* stays at TRUE.
* As soon as a difference is detected, the calling sequence will
* be stopped, and the result returned.
*
* Returns: TRUE if @object is valid, FALSE else.
*
* Since: 2.30
*/
gboolean ( *is_valid ) ( const NAObject *object );
} NAObjectClass;
The NAObjectClass defines some methods available to derived classes.
gboolean na_object_object_check_status_up (const NAObject *object);
void na_object_object_reset_origin (NAObject *object,const NAObject *origin);
void na_object_object_copy (NAObject *target,const NAObject *source,gboolean recursive);