~ubuntu-branches/ubuntu/quantal/gnome-documents/quantal

« back to all changes in this revision

Viewing changes to src/mainToolbar.js

  • Committer: Package Import Robot
  • Author(s): Michael Biebl
  • Date: 2012-05-16 17:53:49 UTC
  • mfrom: (1.1.4) (4.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20120516175349-8wi69lhm4uq36qlr
Tags: 0.4.2-1
* New upstream release.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 *
20
20
 */
21
21
 
 
22
const Clutter = imports.gi.Clutter;
22
23
const Gd = imports.gi.Gd;
23
24
const Gio = imports.gi.Gio;
24
25
const GLib = imports.gi.GLib;
33
34
const Mainloop = imports.mainloop;
34
35
 
35
36
const Global = imports.global;
 
37
const Searchbar = imports.searchbar;
36
38
const Tweener = imports.util.tweener;
37
39
const WindowMode = imports.windowMode;
38
40
 
51
53
        this.widget.get_style_context().add_class(Gtk.STYLE_CLASS_MENUBAR);
52
54
        this.widget.show();
53
55
 
54
 
        this.actor = new GtkClutter.Actor({ contents: this.widget });
 
56
        this.layout = new Clutter.BoxLayout({ vertical: true });
 
57
        this.actor = new Clutter.Actor({ layout_manager: this.layout });
 
58
 
 
59
        this.toolbarActor = new GtkClutter.Actor({ contents: this.widget });
 
60
 
 
61
        this.layout.pack(this.toolbarActor,
 
62
                         false, true, false,
 
63
                         Clutter.BoxAlignment.CENTER, Clutter.BoxAlignment.START);
55
64
 
56
65
        // setup listeners to mode changes that affect the toolbar layout
57
66
        this._searchStringId =
170
179
        this.widget.set_back_visible(item != null);
171
180
 
172
181
        this._setToolbarTitle();
 
182
        this.searchbar.hide();
173
183
    },
174
184
 
175
185
    _setToolbarTitle: function() {
283
293
    }
284
294
};
285
295
 
286
 
function FullscreenToolbar() {
 
296
function PreviewToolbar() {
287
297
    this._init();
288
298
};
289
299
 
290
 
FullscreenToolbar.prototype = {
 
300
PreviewToolbar.prototype = {
291
301
    __proto__: MainToolbar.prototype,
292
302
 
293
303
    _init: function() {
310
320
                           transition: 'easeOutQuad' });
311
321
    }
312
322
};
 
323
 
 
324
function OverviewToolbar() {
 
325
    this._init();
 
326
};
 
327
 
 
328
OverviewToolbar.prototype = {
 
329
    __proto__: MainToolbar.prototype,
 
330
 
 
331
    _init: function() {
 
332
        MainToolbar.prototype._init.call(this);
 
333
 
 
334
        this.searchbar = new Searchbar.Searchbar();
 
335
        this.layout.pack_start = true;
 
336
        this.layout.pack(this.searchbar.actor, false, true, false,
 
337
                         Clutter.BoxAlignment.CENTER, Clutter.BoxAlignment.START);
 
338
    },
 
339
 
 
340
    _onWindowModeChanged: function() {
 
341
        MainToolbar.prototype._onWindowModeChanged.call(this);
 
342
 
 
343
        let mode = Global.modeController.getWindowMode();
 
344
 
 
345
        if (mode == WindowMode.WindowMode.PREVIEW)
 
346
            this.searchbar.hide();
 
347
        else if (mode == WindowMode.WindowMode.OVERVIEW &&
 
348
                   Global.searchController.getString() != '')
 
349
            this.searchbar.show();
 
350
    }
 
351
};