[maemo-commits] [maemo-commits] r18248 - in projects/haf/trunk/hildon-thumbnail/daemon: . plugins
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Tue May 5 20:17:52 EEST 2009
- Previous message: [maemo-commits] r18247 - projects/haf/trunk/libmatchbox2/debian
- Next message: [maemo-commits] r18250 - in projects/haf/trunk/matchbox-window-manager/matchbox-window-manager: . src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: pvanhoof
Date: 2009-05-05 20:17:36 +0300 (Tue, 05 May 2009)
New Revision: 18248
Modified:
projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-jpeg-out-plugin.c
projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-png-out-plugin.c
projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.c
Log:
Thumbnail check
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 15:01:53 UTC (rev 18247)
+++ projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-jpeg-out-plugin.c 2009-05-05 17:17:36 UTC (rev 18248)
@@ -222,7 +222,7 @@
guint64 fmtime;
fmtime = g_file_info_get_attribute_uint64 (info,
G_FILE_ATTRIBUTE_TIME_MODIFIED);
- if (fmtime == (gint64) mtime) {
+ if (fmtime == (guint64) mtime) {
retval = FALSE;
}
g_object_unref (info);
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 15:01:53 UTC (rev 18247)
+++ projects/haf/trunk/hildon-thumbnail/daemon/plugins/gdkpixbuf-png-out-plugin.c 2009-05-05 17:17:36 UTC (rev 18248)
@@ -244,7 +244,7 @@
guint64 fmtime;
fmtime = g_file_info_get_attribute_uint64 (info,
G_FILE_ATTRIBUTE_TIME_MODIFIED);
- if (fmtime == (gint64) mtime) {
+ if (fmtime == (guint64) mtime) {
retval = FALSE;
}
g_object_unref (info);
Modified: projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.c
===================================================================
--- projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.c 2009-05-05 15:01:53 UTC (rev 18247)
+++ projects/haf/trunk/hildon-thumbnail/daemon/thumbnailer.c 2009-05-05 17:17:36 UTC (rev 18248)
@@ -194,9 +194,8 @@
g_mutex_unlock (priv->mutex);
}
-
static void
-get_some_file_infos (const gchar *uri, gchar **mime_type, gchar *mime_hint, GError **error)
+get_some_file_infos (const gchar *uri, gchar **mime_type, guint64 *mtime, gchar *mime_hint, GError **error)
{
const gchar *content_type;
GFileInfo *info;
@@ -206,11 +205,14 @@
file = g_file_new_for_uri (uri);
info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
+ G_FILE_ATTRIBUTE_TIME_MODIFIED,
G_FILE_QUERY_INFO_NONE,
NULL, error);
if (info) {
+ if (mtime)
+ *mtime = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
content_type = g_file_info_get_content_type (info);
if (content_type)
*mime_type = g_strdup (content_type);
@@ -403,6 +405,32 @@
#define DAEMON_ERROR_DOMAIN "HildonThumbnailerSpecialized"
#define DAEMON_ERROR g_quark_from_static_string (DAEMON_ERROR_DOMAIN)
+static gboolean
+thumb_check (const gchar *filename, guint64 mtime)
+{
+ gboolean retval = FALSE;
+
+ if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
+ GFileInfo *info;
+ GFile *file = g_file_new_for_path (filename);
+ 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 == (guint64) mtime) {
+ retval = TRUE;
+ }
+ g_object_unref (info);
+ }
+ g_object_unref (file);
+ }
+
+ return retval;
+}
+
/* 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.
@@ -457,25 +485,26 @@
gboolean has_thumb = FALSE;
GError *error = NULL;
gchar *normal = NULL, *large = NULL, *cropped = NULL;
+ guint64 mtime_x = 0;
hildon_thumbnail_util_get_thumb_paths (urls[i], &large, &normal, &cropped,
NULL, NULL, NULL, FALSE);
- get_some_file_infos (urls[i], &mime_type,
+ get_some_file_infos (urls[i], &mime_type, &mtime_x,
mime_types?mime_types[i]:NULL,
&error);
- has_thumb = (g_file_test (large, G_FILE_TEST_EXISTS) &&
- g_file_test (normal, G_FILE_TEST_EXISTS) &&
- g_file_test (cropped, G_FILE_TEST_EXISTS));
+ has_thumb = (thumb_check (large, mtime_x) &&
+ thumb_check (normal, mtime_x) &&
+ thumb_check (cropped, mtime_x));
if (!has_thumb) {
gchar *pnormal = NULL, *plarge = NULL, *pcropped = NULL;
hildon_thumbnail_util_get_thumb_paths (urls[i], &plarge, &pnormal, &pcropped,
NULL, NULL, NULL, FALSE);
- has_thumb = (g_file_test (plarge, G_FILE_TEST_EXISTS) &&
- g_file_test (pnormal, G_FILE_TEST_EXISTS) &&
- g_file_test (pcropped, G_FILE_TEST_EXISTS));
+ has_thumb = (thumb_check (plarge, mtime_x) &&
+ thumb_check (pnormal, mtime_x) &&
+ thumb_check (pcropped, mtime_x));
if (has_thumb) {
g_free (normal);
- Previous message: [maemo-commits] r18247 - projects/haf/trunk/libmatchbox2/debian
- Next message: [maemo-commits] r18250 - in projects/haf/trunk/matchbox-window-manager/matchbox-window-manager: . src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
