Top | ![]() |
![]() |
![]() |
![]() |
#define | FMA_IDUPLICABLE() |
#define | FMA_IS_IDUPLICABLE() |
#define | FMA_IDUPLICABLE_GET_INTERFACE() |
void | fma_iduplicable_dispose () |
void | fma_iduplicable_dump () |
FMAIDuplicable * | fma_iduplicable_duplicate () |
void | fma_iduplicable_check_status () |
FMAIDuplicable * | fma_iduplicable_get_origin () |
gboolean | fma_iduplicable_is_valid () |
gboolean | fma_iduplicable_is_modified () |
void | fma_iduplicable_set_origin () |
void | fma_iduplicable_set_modified () |
void | fma_iduplicable_register_consumer () |
This interface is implemented by FMAObject in order to let FMAObject -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.
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 children of object..
Table 9. Historic of the versions of the FMAIDuplicable interface
FileManager-Actions™ version | FMAIDuplicable interface version | |
---|---|---|
since 2.30 | 1 | current version |
#define FMA_IDUPLICABLE( instance ) ( G_TYPE_CHECK_INSTANCE_CAST( instance, FMA_TYPE_IDUPLICABLE, FMAIDuplicable ))
#define FMA_IS_IDUPLICABLE( instance ) ( G_TYPE_CHECK_INSTANCE_TYPE( instance, FMA_TYPE_IDUPLICABLE ))
#define FMA_IDUPLICABLE_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), FMA_TYPE_IDUPLICABLE, FMAIDuplicableInterface ))
void
fma_iduplicable_dispose (const FMAIDuplicable *object
);
Releases resources.
Since: 2.30
void
fma_iduplicable_dump (const FMAIDuplicable *object
);
Dumps via g_debug the properties of the object.
We ouput here only the data we set ourselves againt the FMAIDuplicable -implemented object.
This function should be called by the implementation when it dumps itself its own content.
Since: 2.30
FMAIDuplicable * fma_iduplicable_duplicate (const FMAIDuplicable *object
,guint mode
);
Exactly duplicates a FMAIDuplicable -implemented object, including
modification and validity status which are copied from object
to
the duplicated one.
object |
the FMAIDuplicable object to be duplicated. |
|
mode |
the |
Since: 2.30
void
fma_iduplicable_check_status (const FMAIDuplicable *object
);
Checks the edition status of the FMAIDuplicable object, and set up the corresponding properties.
This function is supposed to be called each time the object may have
been modified in order to set the corresponding properties. Helper
functions fma_iduplicable_is_modified()
and fma_iduplicable_is_valid()
will then only return the current value of the properties.
fma_iduplicable_check_status() is not, as itself, recursive.
That is, the modification and validity status are only set on the
specified object.
FMAObject implementation has chosen to handle itself the recursivity:
fma_object_check_status()
so first check status for children, before
calling this function.
Since: 2.30
FMAIDuplicable *
fma_iduplicable_get_origin (const FMAIDuplicable *object
);
Returns the origin of a duplicated FMAIDuplicable.
Since: 2.30
gboolean
fma_iduplicable_is_valid (const FMAIDuplicable *object
);
Returns the current value of the relevant property without rechecking the edition status itself.
Since: 2.30
gboolean
fma_iduplicable_is_modified (const FMAIDuplicable *object
);
Returns the current value of the 'is_modified' property without rechecking the edition status itself.
Since: 2.30
void fma_iduplicable_set_origin (FMAIDuplicable *object
,const FMAIDuplicable *origin
);
Sets the new origin of a duplicated FMAIDuplicable.
object |
the FMAIDuplicable object whose origin is to be set. |
|
origin |
the new original FMAIDuplicable. |
Since: 2.30
void fma_iduplicable_set_modified (FMAIDuplicable *object
,gboolean modified
);
fma_iduplicable_set_modified
has been deprecated since version 3.1 and should not be used in newly-written code.
Sets the new modification status of a duplicated FMAIDuplicable.
object |
the FMAIDuplicable object whose modification status is to be set. |
|
modified |
the new modification status FMAIDuplicable. |
Since: 2.30
void
fma_iduplicable_register_consumer (GObject *consumer
);
This function registers a consumer, i.e. an instance to which edition status signals will be propagated.
Since: 2.30
typedef struct { /** * copy: * @target: the #FMAIDuplicable target of the copy. * @source: the #FMAIDuplicable source of the copy. * @mode: the duplication mode. * * 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 ) ( FMAIDuplicable *target, const FMAIDuplicable *source, guint mode ); /** * are_equal: * @a: a first #FMAIDuplicable object. * @b: a second #FMAIDuplicable 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. * * When testing for the modification status of an object, @a stands for * the original object, while @b stands for the duplicated one. * * Returns: TRUE if @a and @b are identical, FALSE else. * * Since: 2.30 */ gboolean ( *are_equal ) ( const FMAIDuplicable *a, const FMAIDuplicable *b ); /** * is_valid: * @object: the FMAIDuplicable 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 FMAIDuplicable *object ); } FMAIDuplicableInterface;
This interface is implemented by FMAObject objects, in order to be able to keep the trace of all duplicated objects.
#define IDUPLICABLE_SIGNAL_MODIFIED_CHANGED "iduplicable-modified-changed"
#define IDUPLICABLE_SIGNAL_VALID_CHANGED "iduplicable-valid-changed"