gimp r27774 - in trunk: . app/core



Author: martinn
Date: Thu Dec 11 20:15:08 2008
New Revision: 27774
URL: http://svn.gnome.org/viewvc/gimp?rev=27774&view=rev

Log:
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().


Modified:
   trunk/ChangeLog
   trunk/app/core/gimptagged.c
   trunk/app/core/gimptagged.h

Modified: trunk/app/core/gimptagged.c
==============================================================================
--- trunk/app/core/gimptagged.c	(original)
+++ trunk/app/core/gimptagged.c	Thu Dec 11 20:15:08 2008
@@ -152,3 +152,45 @@
 
   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);
+}

Modified: trunk/app/core/gimptagged.h
==============================================================================
--- trunk/app/core/gimptagged.h	(original)
+++ trunk/app/core/gimptagged.h	Thu Dec 11 20:15:08 2008
@@ -36,17 +36,19 @@
   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_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__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]