NAIDuplicable

NAIDuplicable — The Duplication Interface

Synopsis

#include <nautilus-actions/private/na-iduplicable.h>

#define             NA_IDUPLICABLE_TYPE
#define             NA_IDUPLICABLE                      (instance)
#define             NA_IS_IDUPLICABLE                   (instance)
#define             NA_IDUPLICABLE_GET_INTERFACE        (instance)
                    NAIDuplicable;
                    NAIDuplicableInterface;
#define             NA_IDUPLICABLE_SIGNAL_STATUS_CHANGED
void                na_iduplicable_dispose              (const NAIDuplicable *object);
void                na_iduplicable_dump                 (const NAIDuplicable *object);
NAIDuplicable *     na_iduplicable_duplicate            (const NAIDuplicable *object);
void                na_iduplicable_check_status         (const NAIDuplicable *object);
NAIDuplicable *     na_iduplicable_get_origin           (const NAIDuplicable *object);
gboolean            na_iduplicable_is_valid             (const NAIDuplicable *object);
gboolean            na_iduplicable_is_modified          (const NAIDuplicable *object);
void                na_iduplicable_set_origin           (NAIDuplicable *object,
                                                         const NAIDuplicable *origin);
void                na_iduplicable_set_modified         (NAIDuplicable *object,
                                                         gboolean modified);
void                na_iduplicable_register_consumer    (GObject *consumer);

Object Hierarchy

  GInterface
   +----NAIDuplicable

Prerequisites

NAIDuplicable requires GObject.

Known Implementations

NAIDuplicable is implemented by NAObject, NAObjectAction, NAObjectId, NAObjectItem, NAObjectMenu and NAObjectProfile.

Description

This interface is implemented by NAObject in order to let NAObject -derived instance duplication be easily tracked. This works by keeping a pointer on the original object at duplication time, and then only checking edition status when explicitely required.

As the reference count of the original object is not incremented here, the caller has to garantee itself that the original object will stay in life at least as long as the duplicated one.

Modification status in Nautilus-Actions configuration tool

  • Objects whose origin is NULL are considered as modified ; this is in particular the case of new, pasted, imported and dropped objects.

  • when a new object, whether is is really new or it has been pasted, imported or dropped, is inserted somewhere in the tree, its immediate parent is also marked as modified.

  • Check for edition status, which positions modification and validity status, is not recursive ; it is the responsability of the implementation to check for edition status of childs of object..

Versions historic

Table 8. Historic of the versions of the NAIDuplicable interface

Nautilus-Actions™ version NAIDuplicable interface version  
since 2.30 1 current version

Details

NA_IDUPLICABLE_TYPE

#define NA_IDUPLICABLE_TYPE                        ( na_iduplicable_get_type())

NA_IDUPLICABLE()

#define NA_IDUPLICABLE( instance )                 ( G_TYPE_CHECK_INSTANCE_CAST( instance, NA_IDUPLICABLE_TYPE, NAIDuplicable ))

NA_IS_IDUPLICABLE()

#define NA_IS_IDUPLICABLE( instance )              ( G_TYPE_CHECK_INSTANCE_TYPE( instance, NA_IDUPLICABLE_TYPE ))

NA_IDUPLICABLE_GET_INTERFACE()

#define NA_IDUPLICABLE_GET_INTERFACE( instance )   ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NA_IDUPLICABLE_TYPE, NAIDuplicableInterface ))

NAIDuplicable

typedef struct _NAIDuplicable NAIDuplicable;

NAIDuplicableInterface

typedef struct {
	/**
	 * copy:
	 * @target: the #NAIDuplicable target of the copy.
	 * @source: the #NAIDuplicable source of the copy
	 *
	 * Copies data from @source to @ŧarget, so that @target becomes an
	 * exact copy of @source.
	 *
	 * Each derived class of the implementation should define this
	 * function to copy its own data. The implementation should take
	 * care itself of calling each function in the class hierarchy,
	 * from topmost base class to most-derived one.
	 *
	 * Since: 2.30
	 */
	void     ( *copy )     ( NAIDuplicable *target, const NAIDuplicable *source );

	/**
	 * are_equal:
	 * @a: a first #NAIDuplicable object.
	 * @b: a second #NAIDuplicable object to be compared to the first
	 * one.
	 *
	 * Compares the two objects.
	 *
	 * Each derived class of the implementation should define this
	 * function to compare its own data. The implementation should take
	 * care itself of calling each function in the class hierarchy,
	 * from topmost base class to most-derived one.
	 *
	 * Returns: TRUE if @a and @b are identical, FALSE else.
	 *
	 * Since: 2.30
	 */
	gboolean ( *are_equal )( const NAIDuplicable *a, const NAIDuplicable *b );

	/**
	 * is_valid:
	 * @object: the NAIDuplicable object to be checked.
	 *
	 * Checks @object for validity.
	 *
	 * Each derived class of the implementation should define this
	 * function to compare its own data. The implementation should take
	 * care itself of calling each function in the class hierarchy,
	 * from topmost base class to most-derived one.
	 *
	 * Returns: TRUE if @object is valid, FALSE else.
	 *
	 * Since: 2.30
	 */
	gboolean ( *is_valid )   ( const NAIDuplicable *object );
} NAIDuplicableInterface;

This interface is implemented by NAObject objects, in order to be able to keep the trace of all duplicated objects.

copy ()

copies one object to another.

are_equal ()

tests if two objects are equals.

is_valid ()

tests if one object is valid.

NA_IDUPLICABLE_SIGNAL_STATUS_CHANGED

#define NA_IDUPLICABLE_SIGNAL_STATUS_CHANGED "status-changed"

na_iduplicable_dispose ()

void                na_iduplicable_dispose              (const NAIDuplicable *object);

na_iduplicable_dump ()

void                na_iduplicable_dump                 (const NAIDuplicable *object);

na_iduplicable_duplicate ()

NAIDuplicable *     na_iduplicable_duplicate            (const NAIDuplicable *object);

na_iduplicable_check_status ()

void                na_iduplicable_check_status         (const NAIDuplicable *object);

na_iduplicable_get_origin ()

NAIDuplicable *     na_iduplicable_get_origin           (const NAIDuplicable *object);

na_iduplicable_is_valid ()

gboolean            na_iduplicable_is_valid             (const NAIDuplicable *object);

na_iduplicable_is_modified ()

gboolean            na_iduplicable_is_modified          (const NAIDuplicable *object);

na_iduplicable_set_origin ()

void                na_iduplicable_set_origin           (NAIDuplicable *object,
                                                         const NAIDuplicable *origin);

na_iduplicable_set_modified ()

void                na_iduplicable_set_modified         (NAIDuplicable *object,
                                                         gboolean modified);

na_iduplicable_register_consumer ()

void                na_iduplicable_register_consumer    (GObject *consumer);