Bug 555954 – Merge Tagging of Gimp Resources GSoC Project

Partial merge of code from Aurimas Juška.

* app/core/gimptagged.[ch]: Added GimpTagged::get_identifier() and
GimpTagged::get_checksum().

svn path=/trunk/; revision=27774
This commit is contained in:
Martin Nordholts
2008-12-11 20:15:08 +00:00
parent 7a3646c6f0
commit 25668c1535
3 changed files with 64 additions and 9 deletions

View File

@ -1,3 +1,12 @@
2008-12-11 Martin Nordholts <martinn@svn.gnome.org>
Bug 555954 Merge Tagging of Gimp Resources GSoC Project
Partial merge of code from Aurimas Juška.
* app/core/gimptagged.[ch]: Added GimpTagged::get_identifier() and
GimpTagged::get_checksum().
2008-12-11 Martin Nordholts <martinn@svn.gnome.org>
s/gimp_tagged_get_get_tags/gimp_tagged_get_tags/

View File

@ -152,3 +152,45 @@ gimp_tagged_get_tags (GimpTagged *tagged)
return GIMP_TAGGED_GET_INTERFACE (tagged)->get_tags (tagged);
}
/**
* gimp_tagged_get_identifier:
* @tagged: an object that implements the %GimpTagged interface
*
* Returns an identifier string which uniquely identifies the tagged
* object. Two different objects must have unique identifiers but may
* have the same checksum (which will be the case if one object is a
* copy of the other).
*
* Return value: a newly allocated string containing unique identifier
* of the object. It must be freed using #g_free.
**/
gchar *
gimp_tagged_get_identifier (GimpTagged *tagged)
{
g_return_val_if_fail (GIMP_IS_TAGGED (tagged), NULL);
return GIMP_TAGGED_GET_INTERFACE (tagged)->get_identifier (tagged);
}
/**
* gimp_tagged_get_checksum:
* @tagged: an object that implements the %GimpTagged interface
*
* Returns the checksum of the @tagged object. It is used to remap the
* tags for an object for which the identifier has changed, for
* example if the user has renamed a data file since the last session.
*
* If the object does not want to support such remapping (objects not
* stored in file for example) it can return #NULL.
*
* Return value: checksum string if object needs identifier remapping,
* #NULL otherwise. Returned string must be freed with #g_free().
**/
gchar *
gimp_tagged_get_checksum (GimpTagged *tagged)
{
g_return_val_if_fail (GIMP_IS_TAGGED (tagged), FALSE);
return GIMP_TAGGED_GET_INTERFACE (tagged)->get_checksum (tagged);
}

View File

@ -36,17 +36,19 @@ struct _GimpTaggedInterface
GTypeInterface base_iface;
/* signals */
void (* tag_added) (GimpTagged *tagged,
GimpTag tag);
void (* tag_removed) (GimpTagged *tagged,
GimpTag tag);
void (* tag_added) (GimpTagged *tagged,
GimpTag tag);
void (* tag_removed) (GimpTagged *tagged,
GimpTag tag);
/* virtual functions */
gboolean (* add_tag) (GimpTagged *tagged,
GimpTag tag);
gboolean (* remove_tag) (GimpTagged *tagged,
GimpTag tag);
GList * (* get_tags) (GimpTagged *tagged);
gboolean (* add_tag) (GimpTagged *tagged,
GimpTag tag);
gboolean (* remove_tag) (GimpTagged *tagged,
GimpTag tag);
GList * (* get_tags) (GimpTagged *tagged);
gchar * (* get_identifier) (GimpTagged *tagged);
gchar * (* get_checksum) (GimpTagged *tagged);
};
@ -57,6 +59,8 @@ void gimp_tagged_add_tag (GimpTagged *tagged,
void gimp_tagged_remove_tag (GimpTagged *tagged,
GimpTag tag);
GList * gimp_tagged_get_tags (GimpTagged *tagged);
gchar * gimp_tagged_get_identifier (GimpTagged *tagged);
gchar * gimp_tagged_get_checksum (GimpTagged *tagged);
#endif /* __GIMP_TAGGED_H__ */