gimp r26355 - in branches/soc-2008-tagging: . app/core
- From: aurisj svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26355 - in branches/soc-2008-tagging: . app/core
- Date: Sun, 3 Aug 2008 15:13:11 +0000 (UTC)
Author: aurisj
Date: Sun Aug 3 15:13:11 2008
New Revision: 26355
URL: http://svn.gnome.org/viewvc/gimp?rev=26355&view=rev
Log:
2008-08-03 Aurimas JuÅka <aurisj svn gnome org>
* app/core/gimpdata.c (gimp_data_get_identifier)
* app/core/gimptagcache.c (gimp_tag_cache_object_add),
(tagged_to_cache_record_foreach)
* app/core/gimptagged.c: GimpTagged identifier is now always UTF-8
string.
Modified:
branches/soc-2008-tagging/ChangeLog
branches/soc-2008-tagging/app/core/gimpdata.c
branches/soc-2008-tagging/app/core/gimptagcache.c
branches/soc-2008-tagging/app/core/gimptagged.c
Modified: branches/soc-2008-tagging/app/core/gimpdata.c
==============================================================================
--- branches/soc-2008-tagging/app/core/gimpdata.c (original)
+++ branches/soc-2008-tagging/app/core/gimpdata.c Sun Aug 3 15:13:11 2008
@@ -415,11 +415,25 @@
if (data->internal)
{
- return data->internal_name;
+ return g_strdup (data->internal_name);
}
else
{
- return data->filename;
+ gchar *utf8_filename;
+ gsize bytes_written;
+
+ utf8_filename = g_filename_to_utf8 (data->filename, -1, NULL,
+ &bytes_written, NULL);
+ if (utf8_filename)
+ {
+ return utf8_filename;
+ }
+ else
+ {
+ g_warning ("could not convert filename to utf8: %s\n",
+ data->filename);
+ return g_strdup (data->filename);
+ }
}
}
Modified: branches/soc-2008-tagging/app/core/gimptagcache.c
==============================================================================
--- branches/soc-2008-tagging/app/core/gimptagcache.c (original)
+++ branches/soc-2008-tagging/app/core/gimptagcache.c Sun Aug 3 15:13:11 2008
@@ -188,7 +188,7 @@
GimpTagged *tagged,
GimpTagCache *cache)
{
- const char *identifier;
+ gchar *identifier;
GQuark identifier_quark = 0;
gchar *checksum_string;
GQuark checksum_quark;
@@ -196,11 +196,12 @@
gint i;
identifier = gimp_tagged_get_identifier (tagged);
+ identifier_quark = g_quark_try_string (identifier);
+ g_free (identifier);
- if (identifier
+ if (identifier_quark
&& !gimp_tagged_get_tags (tagged))
{
- identifier_quark = g_quark_try_string (identifier);
if (identifier_quark)
{
for (i = 0; i < cache->records->len; i++)
@@ -215,7 +216,7 @@
{
printf ("assigning cached tag: %s to %s\n",
gimp_tag_get_name (GIMP_TAG (tag_iterator->data)),
- identifier);
+ g_quark_to_string (identifier_quark));
gimp_tagged_add_tag (tagged, GIMP_TAG (tag_iterator->data));
tag_iterator = g_list_next (tag_iterator);
@@ -240,15 +241,16 @@
if (rec->checksum == checksum_quark)
{
printf ("remapping identifier: %s ==> %s\n",
- g_quark_to_string (rec->identifier), identifier);
- rec->identifier = g_quark_from_string (identifier);
+ g_quark_to_string (rec->identifier),
+ g_quark_to_string (identifier_quark));
+ rec->identifier = identifier_quark;
tag_iterator = rec->tags;
while (tag_iterator)
{
printf ("assigning cached tag: %s to %s\n",
gimp_tag_get_name (GIMP_TAG (tag_iterator->data)),
- identifier);
+ g_quark_to_string (identifier_quark));
gimp_tagged_add_tag (tagged, GIMP_TAG (tag_iterator->data));
tag_iterator = g_list_next (tag_iterator);
@@ -272,7 +274,7 @@
tagged_to_cache_record_foreach (GimpTagged *tagged,
GList **cache_records)
{
- const char *identifier;
+ gchar *identifier;
gchar *checksum;
GimpTagCacheRecord *cache_rec;
@@ -287,6 +289,7 @@
cache_rec->tags = g_list_copy (gimp_tagged_get_tags (tagged));
*cache_records = g_list_append (*cache_records, cache_rec);
}
+ g_free (identifier);
}
void
Modified: branches/soc-2008-tagging/app/core/gimptagged.c
==============================================================================
--- branches/soc-2008-tagging/app/core/gimptagged.c (original)
+++ branches/soc-2008-tagging/app/core/gimptagged.c Sun Aug 3 15:13:11 2008
@@ -158,10 +158,9 @@
* @tagged: an object that implements the %GimpTagged interface
*
* Returns an identifier string which uniquely identifies the object.
- * The returned string is owned by @tagged object and must not be
- * modified or destroyed.
*
- * Return value: unique identifier of the object.
+ * Return value: a newly allocated string containing unique identifier
+ * of the object. It should be freed using #g_free.
**/
gchar *
gimp_tagged_get_identifier (GimpTagged *tagged)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]