diff --git a/js/ui/docDisplay.js b/js/ui/docDisplay.js index df020081f..070fe62eb 100644 --- a/js/ui/docDisplay.js +++ b/js/ui/docDisplay.js @@ -34,7 +34,7 @@ DocDisplayItem.prototype = { let description = ""; let icon = new Clutter.Texture(); - this._iconPixbuf = Shell.get_thumbnail_for_recent_info(docInfo); + this._iconPixbuf = Shell.get_thumbnail(docInfo.get_uri(), docInfo.get_mime_type()); if (this._iconPixbuf) { // We calculate the width and height of the texture so as to preserve the aspect ratio of the thumbnail. // Because the images generated based on thumbnails don't have an internal padding like system icons do, diff --git a/src/shell-app-system.c b/src/shell-app-system.c index 882938922..0605b71ee 100644 --- a/src/shell-app-system.c +++ b/src/shell-app-system.c @@ -287,7 +287,7 @@ shell_app_system_get_menus (ShellAppSystem *monitor) * * Returns a list of all desktop file ids under "settings.menu". * - * Return value: (transfer full) (element-type utf8): List of desktop file ids + * Return value: (transfer none) (element-type utf8): List of desktop file ids */ GSList * shell_app_system_get_all_settings (ShellAppSystem *monitor) diff --git a/src/shell-global.c b/src/shell-global.c index 070c962ac..a88de0e65 100644 --- a/src/shell-global.c +++ b/src/shell-global.c @@ -341,23 +341,36 @@ shell_clutter_texture_set_from_pixbuf (ClutterTexture *texture, static GnomeThumbnailFactory *thumbnail_factory; /** - * shell_get_thumbnail_for_recent_info: + * shell_get_thumbnail: * - * @recent_info: #GtkRecentInfo for which to return a thumbnail + * @uri: URI of the file to thumbnail * - * Return value: #GdkPixbuf containing a thumbnail for the file described by #GtkRecentInfo + * @mime_type: Mime-Type of the file to thumbnail + * + * Return value: #GdkPixbuf containing a thumbnail for file @uri * if the thumbnail exists or can be generated, %NULL otherwise */ GdkPixbuf * -shell_get_thumbnail_for_recent_info(GtkRecentInfo *recent_info) +shell_get_thumbnail(const gchar *uri, + const gchar *mime_type) { char *existing_thumbnail; GdkPixbuf *pixbuf = NULL; - const gchar *uri = gtk_recent_info_get_uri (recent_info); - time_t mtime = gtk_recent_info_get_modified (recent_info); - const gchar *mime_type = gtk_recent_info_get_mime_type (recent_info); GError *error = NULL; - + GFile *file = NULL; + GFileInfo *file_info = NULL; + GTimeVal mtime_g; + time_t mtime = 0; + + file = g_file_new_for_uri (uri); + file_info = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED, G_FILE_QUERY_INFO_NONE, NULL, NULL); + g_object_unref (file); + if (file_info) { + g_file_info_get_modification_time (file_info, &mtime_g); + g_object_unref (file_info); + mtime = (time_t) mtime_g.tv_sec; + } + if (thumbnail_factory == NULL) thumbnail_factory = gnome_thumbnail_factory_new (GNOME_THUMBNAIL_SIZE_NORMAL); diff --git a/src/shell-global.h b/src/shell-global.h index a05a72909..2192b75c2 100644 --- a/src/shell-global.h +++ b/src/shell-global.h @@ -36,7 +36,7 @@ GType shell_global_get_type (void) G_GNUC_CONST; gboolean shell_clutter_texture_set_from_pixbuf (ClutterTexture *texture, GdkPixbuf *pixbuf); -GdkPixbuf *shell_get_thumbnail_for_recent_info(GtkRecentInfo *recent_info); +GdkPixbuf *shell_get_thumbnail(const gchar *uri, const gchar *mime_type); GSList *shell_get_categories_for_desktop_file(const char *desktop_file_name);