[maemo-commits] [maemo-commits] r18243 - in projects/haf/trunk/hildon-thumbnail: . daemon daemon/plugins
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Tue May 5 17:05:30 EEST 2009
- Previous message: [maemo-commits] r18242 - projects/haf/trunk/dbus/debian
- Next message: [maemo-commits] r18244 - in projects/haf/trunk/hildon-thumbnail: . daemon
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: pvanhoof Date: 2009-05-05 17:05:19 +0300 (Tue, 05 May 2009) New Revision: 18243 Modified: projects/haf/trunk/hildon-thumbnail/ChangeLog projects/haf/trunk/hildon-thumbnail/daemon/hildon-thumbnail-plugin.c projects/haf/trunk/hildon-thumbnail/daemon/hildon-thumbnail-plugin.h projects/haf/trunk/hildon-thumbnail/daemon/plugins/epeg-plugin.c projects/haf/trunk/hildon-thumbnail/daemon/plugins/exec-plugin.c projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-jpeg-out-plugin.c projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-plugin.c projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-png-out-plugin.c projects/haf/trunk/hildon-thumbnail/daemon/plugins/gstreamer-video-plugin.c projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.c Log: 2009-05-05 Philip Van Hoof <pvanhoof at codeminded.be> * daemon/hildon-thumbnail-plugin.h * daemon/plugins/gdkpixbuf-plugin.c * daemon/plugins/exec-plugin.c * daemon/plugins/gdkpixbuf-png-out-plugin.c * daemon/plugins/gdkpixbuf-jpeg-out-plugin.c * daemon/plugins/gstreamer-video-plugin.c * daemon/plugins/epeg-plugin.c * daemon/thumbnailer.c * daemon/hildon-thumbnail-plugin.c: Spec changes and writing files in fail directory Modified: projects/haf/trunk/hildon-thumbnail/ChangeLog =================================================================== --- projects/haf/trunk/hildon-thumbnail/ChangeLog 2009-05-05 13:30:00 UTC (rev 18242) +++ projects/haf/trunk/hildon-thumbnail/ChangeLog 2009-05-05 14:05:19 UTC (rev 18243) @@ -1,3 +1,16 @@ +2009-05-05 Philip Van Hoof <pvanhoof at codeminded.be> + + * daemon/hildon-thumbnail-plugin.h + * daemon/plugins/gdkpixbuf-plugin.c + * daemon/plugins/exec-plugin.c + * daemon/plugins/gdkpixbuf-png-out-plugin.c + * daemon/plugins/gdkpixbuf-jpeg-out-plugin.c + * daemon/plugins/gstreamer-video-plugin.c + * daemon/plugins/epeg-plugin.c + * daemon/thumbnailer.c + * daemon/hildon-thumbnail-plugin.c: Spec changes and writing files in fail + directory + 2009-04-28 Philip Van Hoof <pvanhoof at codeminded.be> * daemon/thumb-hal.c: Bug# 99641: Putting a message for the Modified: projects/haf/trunk/hildon-thumbnail/daemon/hildon-thumbnail-plugin.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/hildon-thumbnail-plugin.c 2009-05-05 13:30:00 UTC (rev 18242) +++ projects/haf/trunk/hildon-thumbnail/daemon/hildon-thumbnail-plugin.c 2009-05-05 14:05:19 UTC (rev 18243) @@ -33,8 +33,38 @@ typedef gboolean (*StopFunc) (void); typedef gchar * (*GetOrigFunc) (const gchar *path); typedef void (*CleanupFunc) (const gchar *uri_match, guint64 max_mtime); +typedef void (*PutFunc) (guint64 mtime, const gchar *uri); void +hildon_thumbnail_outplugins_put_error (guint64 mtime, const gchar *uri) +{ + GList *copy; + + g_static_rec_mutex_lock (&mutex); + copy = g_list_copy (outplugs); + + while (copy) { + GModule *module = copy->data; + PutFunc put_func; + + if (g_module_symbol (module, "hildon_thumbnail_outplugin_put_error", (gpointer *) &put_func)) { + IsActiveFunc isac_func; + if (g_module_symbol (module, "hildon_thumbnail_outplugin_is_active", (gpointer *) &isac_func)) { + if (isac_func ()) { + put_func (mtime, uri); + } + } + } + + copy = g_list_next (copy); + } + + g_static_rec_mutex_unlock (&mutex); + + g_list_free (copy); +} + +void hildon_thumbnail_outplugins_cleanup (const gchar *uri_match, guint since) { Modified: projects/haf/trunk/hildon-thumbnail/daemon/hildon-thumbnail-plugin.h =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/hildon-thumbnail-plugin.h 2009-05-05 13:30:00 UTC (rev 18242) +++ projects/haf/trunk/hildon-thumbnail/daemon/hildon-thumbnail-plugin.h 2009-05-05 14:05:19 UTC (rev 18243) @@ -77,6 +77,7 @@ void hildon_thumbnail_outplugins_cleanup (const gchar *uri_match, guint since); +void hildon_thumbnail_outplugins_put_error (guint64 mtime, const gchar *uri); G_END_DECLS Modified: projects/haf/trunk/hildon-thumbnail/daemon/plugins/epeg-plugin.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/plugins/epeg-plugin.c 2009-05-05 13:30:00 UTC (rev 18242) +++ projects/haf/trunk/hildon-thumbnail/daemon/plugins/epeg-plugin.c 2009-05-05 14:05:19 UTC (rev 18243) @@ -337,7 +337,22 @@ t = 0; while (copy) { + GFile *file; + GFileInfo *info; + furis[t] = copy->data; + + file = g_file_new_for_uri (furis[t]); + info = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED, + G_FILE_QUERY_INFO_NONE, + NULL, NULL); + if (info) { + guint64 mtime = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED); + hildon_thumbnail_outplugins_put_error (mtime, furis[t]); + g_object_unref (info); + } + + g_object_unref (file); copy = g_list_next (copy); t++; } Modified: projects/haf/trunk/hildon-thumbnail/daemon/plugins/exec-plugin.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/plugins/exec-plugin.c 2009-05-05 13:30:00 UTC (rev 18242) +++ projects/haf/trunk/hildon-thumbnail/daemon/plugins/exec-plugin.c 2009-05-05 14:05:19 UTC (rev 18243) @@ -327,7 +327,22 @@ t = 0; while (copy) { + GFile *file; + GFileInfo *info; + furis[t] = copy->data; + + file = g_file_new_for_uri (furis[t]); + info = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED, + G_FILE_QUERY_INFO_NONE, + NULL, NULL); + if (info) { + guint64 mtime = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED); + hildon_thumbnail_outplugins_put_error (mtime, furis[t]); + g_object_unref (info); + } + + g_object_unref (file); copy = g_list_next (copy); t++; } Modified: projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-jpeg-out-plugin.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-jpeg-out-plugin.c 2009-05-05 13:30:00 UTC (rev 18242) +++ projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-jpeg-out-plugin.c 2009-05-05 14:05:19 UTC (rev 18243) @@ -167,8 +167,9 @@ gboolean hildon_thumbnail_outplugin_needs_out (HildonThumbnailPluginOutType type, guint64 mtime, const gchar *uri) { - gboolean retval; - gchar *large, *normal, *cropped, *filen; + gboolean retval, check = FALSE; + gchar *large, *normal, *cropped, *filen, *filenp; + GFile *parent, *file, *fail_file, *fail_dir; hildon_thumbnail_util_get_thumb_paths (uri, &large, &normal, &cropped, NULL, NULL, NULL, FALSE); @@ -185,16 +186,52 @@ break; } - retval = FALSE; + retval = TRUE; - if (g_file_test (filen, G_FILE_TEST_EXISTS)) { - struct stat st; - g_stat (filen, &st); - if (st.st_mtime != (gint64) mtime) - retval = TRUE; - } else - retval = TRUE; + file = g_file_new_for_path (filen); + filenp = g_file_get_basename (file); + parent = g_file_get_parent (file); /* ~/.thumbnails/large */ + fail_dir = g_file_get_parent (parent); /* ~/.thumbnails/ */ + g_object_unref (parent); + + parent = g_file_get_child (fail_dir, "fail"); /* ~/.thumbnails/fail */ + g_object_unref (fail_dir); + + fail_dir = g_file_get_child (parent, PACKAGE_NAME "-" PACKAGE_VERSION); /* ~/.thumbnails/large/hild-thum-version/ */ + g_object_unref (parent); + + fail_file = g_file_get_child (fail_dir, filenp); + g_object_unref (fail_dir); + g_free (filenp); + + if (g_file_query_exists (fail_file, NULL)) { + g_object_unref (file); + file = g_object_ref (fail_file); + check = TRUE; + } else if (g_file_query_exists (file, NULL)) { + check = TRUE; + } + + if (check) { + GFileInfo *info; + info = g_file_query_info (file, + G_FILE_ATTRIBUTE_TIME_MODIFIED, + G_FILE_QUERY_INFO_NONE, NULL, NULL); + if (info) { + guint64 fmtime; + fmtime = g_file_info_get_attribute_uint64 (info, + G_FILE_ATTRIBUTE_TIME_MODIFIED); + if (fmtime == (gint64) mtime) { + retval = FALSE; + } + g_object_unref (info); + } + } + + g_object_unref (fail_file); + g_object_unref (file); + g_free (normal); g_free (large); g_free (cropped); @@ -202,7 +239,67 @@ return retval; } + void +hildon_thumbnail_outplugin_put_error (guint64 mtime, const gchar *uri) +{ + gchar *large, *normal, *cropped, *filenp, *dirn; + GFile *parent, *file, *fail_file, *fail_dir; + GFileOutputStream *out; + struct utimbuf buf; + GError *error = NULL; + + hildon_thumbnail_util_get_thumb_paths (uri, &large, &normal, &cropped, + NULL, NULL, NULL, FALSE); + + file = g_file_new_for_path (large); + filenp = g_file_get_basename (file); + + parent = g_file_get_parent (file); /* ~/.thumbnails/large */ + fail_dir = g_file_get_parent (parent); /* ~/.thumbnails/ */ + g_object_unref (parent); + + parent = g_file_get_child (fail_dir, "fail"); /* ~/.thumbnails/fail */ + g_object_unref (fail_dir); + + fail_dir = g_file_get_child (parent, PACKAGE_NAME "-" PACKAGE_VERSION); /* ~/.thumbnails/large/hild-thum-version/ */ + dirn = g_file_get_path (fail_dir); + g_mkdir_with_parents (dirn, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + g_free (dirn); + g_object_unref (parent); + + fail_file = g_file_get_child (fail_dir, filenp); + g_object_unref (fail_dir); + g_free (filenp); + + out = g_file_create (fail_file, 0, NULL, &error); + + if (out) { + g_object_unref (out); + } + + if (error) { + g_debug ("%s\n", error->message); + g_error_free (error); + } + + filenp = g_file_get_path (fail_file); + buf.actime = buf.modtime = mtime; + utime (filenp, &buf); + g_free (filenp); + + g_object_unref (fail_file); + g_object_unref (file); + + g_free (normal); + g_free (large); + g_free (cropped); + + return; +} + + +void hildon_thumbnail_outplugin_out (const guchar *rgb8_pixmap, guint width, guint height, guint rowstride, guint bits_per_sample, @@ -246,6 +343,8 @@ if (!nerror) g_rename (temp, filen); + else + hildon_thumbnail_outplugin_put_error (mtime, uri); g_free (temp); Modified: projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-plugin.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-plugin.c 2009-05-05 13:30:00 UTC (rev 18242) +++ projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-plugin.c 2009-05-05 14:05:19 UTC (rev 18243) @@ -360,7 +360,23 @@ t = 0; while (copy) { + GFile *file; + GFileInfo *info; + furis[t] = copy->data; + + file = g_file_new_for_uri (furis[t]); + info = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED, + G_FILE_QUERY_INFO_NONE, + NULL, NULL); + if (info) { + guint64 mtime = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED); + hildon_thumbnail_outplugins_put_error (mtime, furis[t]); + g_object_unref (info); + } + + g_object_unref (file); + copy = g_list_next (copy); t++; } Modified: projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-png-out-plugin.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-png-out-plugin.c 2009-05-05 13:30:00 UTC (rev 18242) +++ projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-png-out-plugin.c 2009-05-05 14:05:19 UTC (rev 18243) @@ -189,8 +189,9 @@ gboolean hildon_thumbnail_outplugin_needs_out (HildonThumbnailPluginOutType type, guint64 mtime, const gchar *uri) { - gboolean retval; - gchar *large, *normal, *cropped, *filen; + gboolean retval, check = FALSE; + gchar *large, *normal, *cropped, *filen, *filenp; + GFile *parent, *file, *fail_file, *fail_dir; hildon_thumbnail_util_get_thumb_paths (uri, &large, &normal, &cropped, NULL, NULL, NULL, TRUE); @@ -207,16 +208,52 @@ break; } - retval = FALSE; + retval = TRUE; - if (g_file_test (filen, G_FILE_TEST_EXISTS)) { - struct stat st; - g_stat (filen, &st); - if (st.st_mtime != (gint64) mtime) - retval = TRUE; - } else - retval = TRUE; + file = g_file_new_for_path (filen); + filenp = g_file_get_basename (file); + parent = g_file_get_parent (file); /* ~/.thumbnails/large */ + fail_dir = g_file_get_parent (parent); /* ~/.thumbnails/ */ + g_object_unref (parent); + + parent = g_file_get_child (fail_dir, "fail"); /* ~/.thumbnails/fail */ + g_object_unref (fail_dir); + + fail_dir = g_file_get_child (parent, PACKAGE_NAME "-" PACKAGE_VERSION); /* ~/.thumbnails/large/hild-thum-version/ */ + g_object_unref (parent); + + fail_file = g_file_get_child (fail_dir, filenp); + g_object_unref (fail_dir); + g_free (filenp); + + if (g_file_query_exists (fail_file, NULL)) { + g_object_unref (file); + file = g_object_ref (fail_file); + check = TRUE; + } else if (g_file_query_exists (file, NULL)) { + check = TRUE; + } + + if (check) { + GFileInfo *info; + info = g_file_query_info (file, + G_FILE_ATTRIBUTE_TIME_MODIFIED, + G_FILE_QUERY_INFO_NONE, NULL, NULL); + if (info) { + guint64 fmtime; + fmtime = g_file_info_get_attribute_uint64 (info, + G_FILE_ATTRIBUTE_TIME_MODIFIED); + if (fmtime == (gint64) mtime) { + retval = FALSE; + } + g_object_unref (info); + } + } + + g_object_unref (fail_file); + g_object_unref (file); + g_free (normal); g_free (large); g_free (cropped); @@ -224,7 +261,66 @@ return retval; } + void +hildon_thumbnail_outplugin_put_error (guint64 mtime, const gchar *uri) +{ + gchar *large, *normal, *cropped, *filenp, *dirn; + GFile *parent, *file, *fail_file, *fail_dir; + GFileOutputStream *out; + struct utimbuf buf; + GError *error = NULL; + + hildon_thumbnail_util_get_thumb_paths (uri, &large, &normal, &cropped, + NULL, NULL, NULL, TRUE); + + file = g_file_new_for_path (large); + filenp = g_file_get_basename (file); + + parent = g_file_get_parent (file); /* ~/.thumbnails/large */ + fail_dir = g_file_get_parent (parent); /* ~/.thumbnails/ */ + g_object_unref (parent); + + parent = g_file_get_child (fail_dir, "fail"); /* ~/.thumbnails/fail */ + g_object_unref (fail_dir); + + fail_dir = g_file_get_child (parent, PACKAGE_NAME "-" PACKAGE_VERSION); /* ~/.thumbnails/large/hild-thum-version/ */ + g_object_unref (parent); + + fail_file = g_file_get_child (fail_dir, filenp); + dirn = g_file_get_path (fail_dir); + g_mkdir_with_parents (dirn, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + g_free (dirn); + + g_object_unref (fail_dir); + g_free (filenp); + + out = g_file_create (fail_file, 0, NULL, &error); + + if (out) { + g_object_unref (out); + } + + if (error) { + g_debug ("%s\n", error->message); + g_error_free (error); + } + + filenp = g_file_get_path (fail_file); + buf.actime = buf.modtime = mtime; + utime (filenp, &buf); + g_free (filenp); + + g_object_unref (fail_file); + g_object_unref (file); + + g_free (normal); + g_free (large); + g_free (cropped); + +} + +void hildon_thumbnail_outplugin_out (const guchar *rgb8_pixmap, guint width, guint height, guint rowstride, guint bits_per_sample, @@ -290,8 +386,10 @@ g_rename (temp, filen); buf.actime = buf.modtime = mtime; utime (filen, &buf); - } else + } else { + hildon_thumbnail_outplugin_put_error (mtime, uri); g_propagate_error (error, nerror); + } g_free (temp); Modified: projects/haf/trunk/hildon-thumbnail/daemon/plugins/gstreamer-video-plugin.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/plugins/gstreamer-video-plugin.c 2009-05-05 13:30:00 UTC (rev 18242) +++ projects/haf/trunk/hildon-thumbnail/daemon/plugins/gstreamer-video-plugin.c 2009-05-05 14:05:19 UTC (rev 18243) @@ -623,7 +623,22 @@ t = 0; while (copy) { + GFile *file; + GFileInfo *info; + furis[t] = copy->data; + + file = g_file_new_for_uri (furis[t]); + info = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED, + G_FILE_QUERY_INFO_NONE, + NULL, NULL); + if (info) { + guint64 mtime = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED); + hildon_thumbnail_outplugins_put_error (mtime, furis[t]); + g_object_unref (info); + } + + g_object_unref (file); copy = g_list_next (copy); t++; } Modified: projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.c =================================================================== --- projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.c 2009-05-05 13:30:00 UTC (rev 18242) +++ projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.c 2009-05-05 14:05:19 UTC (rev 18243) @@ -301,7 +301,7 @@ } static gboolean -strv_contains (const GStrv list, gchar *uri) +strv_contains (const gchar **list, gchar *uri) { guint i = 0; gboolean found = FALSE; @@ -353,6 +353,56 @@ return retval; } + +typedef struct { + GCond *condition; + GMutex *mutex; + gchar *error_msg; + gint error_code; + const gchar *uri, *mime_type; + gboolean had_callback, had_event; +} SpecializedInfo; + +static void +specialized_error (DBusGProxy *proxy, + gchar *uri, + gint error_code, + gchar *error_msg, + gpointer user_data) +{ + SpecializedInfo *info = user_data; + + if (g_strcmp0 (info->uri, uri) == 0) { + info->error_msg = g_strdup (error_msg); + info->error_code = error_code; + + g_mutex_lock (info->mutex); + g_cond_broadcast (info->condition); + info->had_callback = TRUE; + g_mutex_unlock (info->mutex); + } +} + +static void +specialized_ready (DBusGProxy *proxy, + gchar *uri, + gpointer user_data) +{ + SpecializedInfo *info = user_data; + + if (g_strcmp0 (info->uri, uri) == 0) { + info->error_msg = NULL; + + g_mutex_lock (info->mutex); + g_cond_broadcast (info->condition); + info->had_callback = TRUE; + g_mutex_unlock (info->mutex); + } +} + +#define DAEMON_ERROR_DOMAIN "HildonThumbnailerSpecialized" +#define DAEMON_ERROR g_quark_from_static_string (DAEMON_ERROR_DOMAIN) + /* This is the threadpool's function. This means that everything we do is * asynchronous wrt to the mainloop (we aren't blocking it). Because it all * happens in a thread, we must care about proper locking, too. @@ -362,7 +412,6 @@ * canceling currently running requests. Also note that the thread count of the * pool is set to one. We could increase this number to add some parallelism */ - static void do_the_work (WorkTask *task, gpointer user_data) { @@ -566,44 +615,113 @@ proxy = thumbnail_manager_get_handler (priv->manager, uri_scheme, mime_type); if (proxy) { - GError *error = NULL; - GStrv failed_urls = NULL; + guint o; - keep_alive (); + for (o = 0; urlss[o]; o++) { + GError *error = NULL; + GStrv failed_urls = NULL; + SpecializedInfo info; + GTimeVal timev; - dbus_g_proxy_call (proxy, "Create", &error, - G_TYPE_STRV, urlss, - G_TYPE_STRING, mime_type, - G_TYPE_INVALID, - G_TYPE_STRV, &failed_urls, - G_TYPE_INVALID); + keep_alive (); - keep_alive (); + info.condition = g_cond_new (); + info.had_callback = FALSE; + info.mutex = g_mutex_new (); + info.uri = urlss[o]; + info.mime_type = mime_type; - g_object_unref (proxy); + /* Register signals to know about tracker-indexer presence */ + dbus_g_proxy_add_signal (proxy, "Ready", + G_TYPE_STRING, + G_TYPE_INVALID); - if (error) { - GStrv newlist = subtract_strv (urlss, failed_urls); + dbus_g_proxy_add_signal (proxy, "Error", + G_TYPE_STRING, + G_TYPE_INT, + G_TYPE_STRING, + G_TYPE_INVALID); - if (newlist) { - g_signal_emit (task->object, signals[READY_SIGNAL], - 0, newlist); - g_strfreev (newlist); + dbus_g_proxy_connect_signal (proxy, "Ready", + G_CALLBACK (specialized_ready), + &info, + NULL); + + dbus_g_proxy_connect_signal (proxy, "Error", + G_CALLBACK (specialized_error), + &info, + NULL); + + dbus_g_proxy_call (proxy, "Create", &error, + G_TYPE_STRING, info.uri, + G_TYPE_STRING, info.mime_type, + G_TYPE_INVALID, + G_TYPE_INVALID); + + + g_get_current_time (&timev); + g_time_val_add (&timev, 100000000); /* 100 seconds worth of timeout */ + + g_mutex_lock (info.mutex); + if (!info.had_callback) + g_cond_timed_wait (info.condition, info.mutex, &timev); + g_mutex_unlock (info.mutex); + + if (!info.had_callback) { + g_set_error (&error, DAEMON_ERROR, 0, + "Timeout"); } - g_signal_emit (task->object, signals[ERROR_SIGNAL], - 0, task->num, failed_urls, 1, - error->message); - g_clear_error (&error); + if (info.error_msg) { + g_set_error (&error, DAEMON_ERROR, + info.error_code, + "%s", info.error_msg); + g_free (info.error_msg); + } - had_err = TRUE; - } else - g_signal_emit (task->object, signals[READY_SIGNAL], - 0, urlss); + dbus_g_proxy_disconnect_signal (proxy, "Error", + G_CALLBACK (specialized_error), + &info); - if (failed_urls) - g_strfreev (failed_urls); + dbus_g_proxy_disconnect_signal (proxy, "Ready", + G_CALLBACK (specialized_ready), + &info); + g_cond_free (info.condition); + g_mutex_free (info.mutex); + + keep_alive (); + + g_object_unref (proxy); + + if (error) { + GStrv failed_urls = (GStrv) g_malloc0 (sizeof (gchar *) * 2); + + failed_urls[0] = g_strdup (info.uri); + failed_urls[1] = NULL; + + g_signal_emit (task->object, signals[ERROR_SIGNAL], + 0, task->num, failed_urls, 1, + error->message); + + g_error_free (error); + + g_strfreev (failed_urls); + + had_err = TRUE; + } else { + GStrv succeeded_urls = (GStrv) g_malloc0 (sizeof (gchar *) * 2); + + succeeded_urls[0] = g_strdup (info.uri); + succeeded_urls[1] = NULL; + + g_signal_emit (task->object, signals[READY_SIGNAL], + 0, succeeded_urls); + + g_strfreev (succeeded_urls); + } + } + /* If not if we have a plugin that can handle it, we let the * plugin have a go at it */
- Previous message: [maemo-commits] r18242 - projects/haf/trunk/dbus/debian
- Next message: [maemo-commits] r18244 - in projects/haf/trunk/hildon-thumbnail: . daemon
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]