[maemo-commits] [maemo-commits] r16532 - in projects/haf/trunk/hildon-thumbnail: . daemon
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Thu Oct 30 12:41:09 EET 2008
- Previous message: [maemo-commits] r16531 - projects/haf/tags/gconf2
- Next message: [maemo-commits] r16533 - projects/haf/trunk/hildon-thumbnail/daemon
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: pvanhoof Date: 2008-10-30 12:41:07 +0200 (Thu, 30 Oct 2008) New Revision: 16532 Modified: projects/haf/trunk/hildon-thumbnail/ChangeLog projects/haf/trunk/hildon-thumbnail/daemon/utils.c Log: 2008-10-30 Philip Van Hoof <philip at codeminded.be> * daemon/utils.c: Local thumbnail art, and code cleaning up Modified: projects/haf/trunk/hildon-thumbnail/ChangeLog =================================================================== --- projects/haf/trunk/hildon-thumbnail/ChangeLog 2008-10-30 08:27:56 UTC (rev 16531) +++ projects/haf/trunk/hildon-thumbnail/ChangeLog 2008-10-30 10:41:07 UTC (rev 16532) @@ -1,3 +1,7 @@ +2008-10-30 Philip Van Hoof <philip at codeminded.be> + + * daemon/utils.c: Local thumbnail art, and code cleaning up + 2008-10-29 Philip Van Hoof <philip at codeminded.be> * daemon/thumbnail-manager.h Modified: projects/haf/trunk/hildon-thumbnail/daemon/utils.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/utils.c 2008-10-30 08:27:56 UTC (rev 16531) +++ projects/haf/trunk/hildon-thumbnail/daemon/utils.c 2008-10-30 10:41:07 UTC (rev 16532) @@ -139,47 +139,37 @@ void hildon_thumbnail_util_get_albumart_path (const gchar *a, const gchar *b, const gchar *prefix, gchar **path) { - gchar *art_filename, *str; - static gchar *dir = NULL; - gchar *_tmp14, *_tmp13, *down; + gchar *art_filename; + gchar *dir; + gchar *str; + gchar *down; - if (!prefix) - prefix = "album"; + *path = NULL; if (!a && !b) { - *path = NULL; return; } - if (!a) - a = ""; + str = g_strconcat (a ? a : "", + " ", + b ? b : "", + NULL); + down = g_utf8_strdown (str, -1); + g_free (str); - if (!b) - b = ""; + dir = g_build_filename (g_get_user_cache_dir (), "media-art", NULL); - down = g_utf8_strdown (_tmp14 = (g_strconcat ((_tmp13 = g_strconcat (a, " ", NULL)), b, NULL)),-1); - - g_free (_tmp14); - g_free (_tmp13); - - /* I know we leak, but it's better than doing memory fragementation on - * these strings ... */ - - if (!dir) - dir = g_build_filename (g_get_user_cache_dir (), "media-art", NULL); - - *path = NULL; - - if(!g_file_test (dir, G_FILE_TEST_EXISTS)) + if (!g_file_test (dir, G_FILE_TEST_EXISTS)) { g_mkdir_with_parents (dir, 0770); + } str = g_compute_checksum_for_string (G_CHECKSUM_MD5, down, -1); + g_free (down); - art_filename = g_strdup_printf ("%s-%s.jpeg", prefix, str); + art_filename = g_strdup_printf ("%s-%s.jpeg", prefix?prefix:"album", str); + g_free (str); *path = g_build_filename (dir, art_filename, NULL); - - g_free (str); + g_free (dir); g_free (art_filename); - g_free (down); }
- Previous message: [maemo-commits] r16531 - projects/haf/tags/gconf2
- Next message: [maemo-commits] r16533 - projects/haf/trunk/hildon-thumbnail/daemon
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]