Re: [PATCH] Move custom icons when copying metadata



On Wed, 2005-09-21 at 23:34 +0200, Christian Neumair wrote:
> The attached patch ensures that custom icons that have URIs inside a
> folder they're used for (consider album covers) are changed upon copying
> the folder that has the custom URI set. It heavily interferes with [1],
> so we should probably decide what route to take. I'd propose to not
> commit the huge metadata changes from [1] to the (to be created) stable
> branch, but just to HEAD, and to commit the attached patch to the stable
> branch and afterwards adapt it to the changes in HEAD introduced by [1].

You're mixing g_free/xmlFree in:
+               property = xmlGetProp (destination_file_node, NAUTILUS_METADATA_KEY_CUSTOM_ICON);
+               if (property != NULL && g_str_has_prefix (property, source_file_uri)) {
+                       p = property;
+
+                       property = g_strconcat (destination_file_uri,
+                                               property + strlen (source_file_uri),
+                                               NULL);
+                       xmlSetProp (destination_file_node, NAUTILUS_METADATA_KEY_CUSTOM_ICON, property);
+
+                       xmlFree (p);
+               }
+
+               xmlFree (property);

I recommend using p for the g_strconcat result instead and then
g_free(p).

Its sort of strange that the metafile system special-cases a specific
key entry like this. It would make more sense to e.g. store the custom
icon with a relative filename. That would work for more cases than the
prefix of the uri being identical too. For instance when there are
symlinks etc involved.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's an impetuous moralistic dog-catcher looking for a cure to the poison 
coursing through his veins. She's a vivacious junkie schoolgirl with an evil 
twin sister. They fight crime! 




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