~ubuntu-branches/ubuntu/lucid/gnome-shell/lucid-updates

« back to all changes in this revision

Viewing changes to js/misc/docInfo.js

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2009-08-11 19:36:26 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090811193626-05vzd2jssuwow57x
Tags: 2.27.0-0ubuntu1
New upstream version

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
DocInfo.prototype = {
19
19
    _init : function(recentInfo) {
20
20
        this._recentInfo = recentInfo;
 
21
        // We actually used get_modified() instead of get_visited()
 
22
        // here, as GtkRecentInfo doesn't updated get_visited()
 
23
        // correctly. See http://bugzilla.gnome.org/show_bug.cgi?id=567094
 
24
        this.timestamp = recentInfo.get_modified().getTime() / 1000;
21
25
        this.name = recentInfo.get_display_name();
22
26
        this.uri = recentInfo.get_uri();
23
27
        this.mimeType = recentInfo.get_mime_type();
24
28
    },
25
29
 
26
30
    createIcon : function(size) {
27
 
        let icon = null;
28
 
        let defaultPixbuf = this._recentInfo.get_icon(size);
29
 
 
30
 
        if (this.uri.match("^file://")) {
31
 
            icon = Shell.TextureCache.get_default().load_thumbnail(size, this.uri, this.mimeType,
32
 
                                                                   defaultPixbuf);
33
 
        }
34
 
 
35
 
        if (!icon) {
36
 
            icon = new Clutter.Texture({});
37
 
            Shell.clutter_texture_set_from_pixbuf(icon, defaultPixbuf);
38
 
        }
39
 
        return icon;
 
31
        return Shell.TextureCache.get_default().load_recent_thumbnail(size, this._recentInfo);
40
32
    },
41
33
 
42
34
    launch : function() {
50
42
        if (appInfo != null) {
51
43
            appInfo.launch_uris([this.uri], Main.createAppLaunchContext());
52
44
        } else {
53
 
            log("Failed to get default application info for mime type " + mimeType +
 
45
            log("Failed to get default application info for mime type " + this.mimeType +
54
46
                ". Will try to use the last application that registered the document.");
55
47
            let appName = this._recentInfo.last_application();
56
48
            let [success, appExec, count, time] = this._recentInfo.get_application_info(appName);
88
80
 
89
81
    exists : function() {
90
82
        return this._recentInfo.exists();
91
 
    },
92
 
 
93
 
    lastVisited : function() {
94
 
        // We actually used get_modified() instead of get_visited()
95
 
        // here, as GtkRecentInfo doesn't updated get_visited()
96
 
        // correctly. See
97
 
        // http://bugzilla.gnome.org/show_bug.cgi?id=567094
98
 
 
99
 
        return this._recentInfo.get_modified();
100
83
    }
101
84
};
102
85
 
137
120
        let deleted = {};
138
121
        for (var uri in this._items) {
139
122
            if (!(uri in newItems))
140
 
                deleted[uri] = 1;
 
123
                deleted[uri] = this._items[uri];
141
124
        }
142
125
        /* If we'd cached any thumbnail references that no longer exist,
143
126
           dump them here */
144
127
        let texCache = Shell.TextureCache.get_default();
145
128
        for (var uri in deleted) {
146
 
            texCache.unref_thumbnail(this._iconSize, uri);
 
129
            texCache.evict_recent_thumbnail(this._iconSize, this._items[uri]);
147
130
        }
148
131
        this._items = newItems;
149
132
    },