[maemo-commits] [maemo-commits] r16237 - in projects/haf/branches/hildon-thumbnail/daemonize: . daemon

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Sep 26 12:33:04 EEST 2008
Author: pvanhoof
Date: 2008-09-26 12:33:02 +0300 (Fri, 26 Sep 2008)
New Revision: 16237

Modified:
   projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog
   projects/haf/branches/hildon-thumbnail/daemonize/daemon/albumart.c
   projects/haf/branches/hildon-thumbnail/daemonize/daemon/albumart.h
   projects/haf/branches/hildon-thumbnail/daemonize/daemon/albumart.xml
   projects/haf/branches/hildon-thumbnail/daemonize/daemon/utils.c
   projects/haf/branches/hildon-thumbnail/daemonize/daemon/utils.h
Log:
2008-09-26  Philip Van Hoof  <pvanhoof at gnome.org>

	* daemon/utils.c
	* daemon/utils.h
	* daemon/albumart.c
	* daemon/albumart.h
	* daemon/albumart.xml: Fallback to uri in case albumart is null



Modified: projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog	2008-09-26 09:24:50 UTC (rev 16236)
+++ projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog	2008-09-26 09:33:02 UTC (rev 16237)
@@ -1,5 +1,13 @@
 2008-09-26  Philip Van Hoof  <pvanhoof at gnome.org>
 
+	* daemon/utils.c
+	* daemon/utils.h
+	* daemon/albumart.c
+	* daemon/albumart.h
+	* daemon/albumart.xml: Fallback to uri in case albumart is null
+
+2008-09-26  Philip Van Hoof  <pvanhoof at gnome.org>
+
 	* thumbs/hildon-thumbnail-factory.c
 	* daemon/utils.c
 	* daemon/plugins/gdkpixbuf-plugin.c

Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/albumart.c
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/daemon/albumart.c	2008-09-26 09:24:50 UTC (rev 16236)
+++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/albumart.c	2008-09-26 09:33:02 UTC (rev 16237)
@@ -76,6 +76,7 @@
 typedef struct {
 	Albumart *object;
 	gchar *albumartist;
+	gchar *uri;
 	guint num;
 	gboolean unqueued;
 } WorkTask;
@@ -112,21 +113,24 @@
 }
 
 void
-albumart_queue (Albumart *object, gchar *albumartist, guint handle_to_unqueue, DBusGMethodInvocation *context)
+albumart_queue (Albumart *object, gchar *albumartist, gchar *uri, guint handle_to_unqueue, DBusGMethodInvocation *context)
 {
 	AlbumartPrivate *priv = ALBUMART_GET_PRIVATE (object);
-	WorkTask *task = g_slice_new (WorkTask);
+	WorkTask *task = g_slice_new0 (WorkTask);
 	static guint num = 0;
 
-	dbus_async_return_if_fail (albumartist != NULL, context);
 
 	keep_alive ();
 
 	task->unqueued = FALSE;
 	task->num = ++num;
 	task->object = g_object_ref (object);
-	task->albumartist = g_strdup (albumartist);
 
+	if (albumartist)
+		task->albumartist = g_strdup (albumartist);
+	if (uri)
+		task->uri = g_strdup (uri);
+
 	g_mutex_lock (priv->mutex);
 	g_list_foreach (priv->tasks, (GFunc) mark_unqueued, (gpointer) handle_to_unqueue);
 	priv->tasks = g_list_prepend (priv->tasks, task);
@@ -150,11 +154,12 @@
 {
 	AlbumartPrivate *priv = ALBUMART_GET_PRIVATE (task->object);
 	gchar *albumartist = task->albumartist;
+	gchar *uri = task->uri;
 	gchar *path;
 
 	g_mutex_lock (priv->mutex);
 	priv->tasks = g_list_remove (priv->tasks, task);
-	if (task->unqueued) {
+	if (task->unqueued || (!uri && !albumartist)) {
 		g_mutex_unlock (priv->mutex);
 		goto unqueued;
 	}
@@ -163,7 +168,7 @@
 	g_signal_emit (task->object, signals[STARTED_SIGNAL], 0,
 			task->num);
 
-	hildon_thumbnail_util_get_albumart_paths (albumartist, &path);
+	hildon_thumbnail_util_get_albumart_path (albumartist, uri, &path);
 
 	if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
 
@@ -210,6 +215,7 @@
 
 	g_object_unref (task->object);
 	g_free (task->albumartist);
+	g_free (task->uri);
 	g_slice_free (WorkTask, task);
 
 	return;
@@ -217,15 +223,13 @@
 
 
 void
-albumart_delete (Albumart *object, gchar *albumartist, DBusGMethodInvocation *context)
+albumart_delete (Albumart *object, gchar *albumartist, gchar *uri, DBusGMethodInvocation *context)
 {
 	gchar *path;
 
-	dbus_async_return_if_fail (albumartist != NULL, context);
-
 	keep_alive ();
 
-	hildon_thumbnail_util_get_albumart_paths (albumartist, &path);
+	hildon_thumbnail_util_get_albumart_path (albumartist, uri, &path);
 
 	g_unlink (path);
 

Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/albumart.h
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/daemon/albumart.h	2008-09-26 09:24:50 UTC (rev 16236)
+++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/albumart.h	2008-09-26 09:33:02 UTC (rev 16237)
@@ -57,9 +57,9 @@
 
 GType albumart_get_type (void);
 
-void albumart_queue (Albumart *object, gchar *albumartist, guint handle_to_unqueue, DBusGMethodInvocation *context);
+void albumart_queue (Albumart *object, gchar *albumartist, gchar *uri, guint handle_to_unqueue, DBusGMethodInvocation *context);
 void albumart_unqueue (Albumart *object, guint handle, DBusGMethodInvocation *context);
-void albumart_delete (Albumart *object, gchar *albumartist, DBusGMethodInvocation *context);
+void albumart_delete (Albumart *object, gchar *albumartist, gchar *uri, DBusGMethodInvocation *context);
 
 void albumart_do_stop (void);
 void albumart_do_init (DBusGConnection *connection, Albumart **albumart, GError **error);

Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/albumart.xml
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/daemon/albumart.xml	2008-09-26 09:24:50 UTC (rev 16236)
+++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/albumart.xml	2008-09-26 09:33:02 UTC (rev 16237)
@@ -5,6 +5,7 @@
     <method name="Queue">
       <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
       <arg type="s" name="albumartist" direction="in" />
+      <arg type="s" name="uri" direction="in" />
       <arg type="u" name="handle_to_unqueue" direction="in" />
       <arg type="u" name="handle" direction="out" />
     </method>
@@ -36,6 +37,7 @@
     <method name="Delete">
       <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
       <arg type="s" name="albumartist" direction="in" />
+      <arg type="s" name="uri" direction="in" />
     </method>
 
   </interface>

Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/utils.c
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/daemon/utils.c	2008-09-26 09:24:50 UTC (rev 16236)
+++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/utils.c	2008-09-26 09:33:02 UTC (rev 16237)
@@ -96,12 +96,17 @@
 
 
 void
-hildon_thumbnail_util_get_albumart_paths (const gchar *albumartist, gchar **path)
+hildon_thumbnail_util_get_albumart_path (const gchar *albumartist, const gchar *uri, gchar **path)
 {
 	gchar ascii_digest[33];
 	gchar art_filename[128];
 	static gchar *dir = NULL;
-	gchar *down = g_utf8_strdown (albumartist, -1);
+	gchar *down;
+	
+	if (albumartist)
+		down = g_utf8_strdown (albumartist, -1);
+	else 
+		down = g_strdup (uri);
 
 	/* I know we leak, but it's better than doing memory fragementation on 
 	 * these strings ... */

Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/utils.h
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/daemon/utils.h	2008-09-26 09:24:50 UTC (rev 16236)
+++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/utils.h	2008-09-26 09:33:02 UTC (rev 16237)
@@ -29,7 +29,7 @@
 #include <gio/gio.h>
 
 void hildon_thumbnail_util_get_thumb_paths (const gchar *uri, gchar **large, gchar **normal, gchar **cropped);
-void hildon_thumbnail_util_get_albumart_paths (const gchar *albumartist, gchar **path);
+void hildon_thumbnail_util_get_albumart_path (const gchar *albumartist, const gchar *uri, gchar **path);
 
 #ifndef g_sprintf
 gint g_sprintf (gchar *string, gchar const *format, ...);


More information about the maemo-commits mailing list