From 25668c1535cf631accefc15c16817cafc81ecf49 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Thu, 11 Dec 2008 20:15:08 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20555954=20=E2=80=93=20Merge=20Tagging=20of?= =?UTF-8?q?=20Gimp=20Resources=20GSoC=20Project?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- ChangeLog | 9 +++++++++ app/core/gimptagged.c | 42 ++++++++++++++++++++++++++++++++++++++++++ app/core/gimptagged.h | 22 +++++++++++++--------- 3 files changed, 64 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0a7e83d509..e00b9c0a9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-12-11 Martin Nordholts + + 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 s/gimp_tagged_get_get_tags/gimp_tagged_get_tags/ diff --git a/app/core/gimptagged.c b/app/core/gimptagged.c index 912bdcdb16..cfd81bf8d9 100644 --- a/app/core/gimptagged.c +++ b/app/core/gimptagged.c @@ -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); +} diff --git a/app/core/gimptagged.h b/app/core/gimptagged.h index 94c3c46919..864434ca47 100644 --- a/app/core/gimptagged.h +++ b/app/core/gimptagged.h @@ -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__ */