Merge branch 'master' into my-overlay-design

This commit is contained in:
Marina Zhurakhinskaya 2009-06-16 13:04:56 -04:00
commit 614e83476e
4 changed files with 24 additions and 11 deletions

View File

@ -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,

View File

@ -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)

View File

@ -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);

View File

@ -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);