/gpump/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/gpump/trunk

« back to all changes in this revision

Viewing changes to src/app.js

  • Committer: Gustav Hartvigsson
  • Date: 2014-06-08 17:44:33 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20140608174433-0fstlfochr1l7d68
* Changed to extending Gtk.Application instead....

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
const Application = new Lang.Class ({
18
18
  Name: "Application",
 
19
  Extends: Gtk.Application,
19
20
  
20
21
  _init: function () {
21
 
    this.application = new Gtk.Application ({
 
22
    this.parent ({
22
23
      application_id: "org.gego.gpump",
23
24
      flags: Gio.ApplicationFlags.FLAGS_NONE,
24
25
      register_session: true
25
26
    });
26
 
    this.application.connect('activate', Lang.bind(this, this._on_activate));
 
27
    this.connect('activate', Lang.bind(this, this._on_activate));
27
28
  },
28
29
  
29
30
  _on_activate: function () {
30
31
    /* Guarantee that only one window is present at any time. */
31
 
    let w_list = this.application.get_windows ();
 
32
    let w_list = this.get_windows ();
32
33
    if (w_list.length) {
33
34
      w_list[0].present ();
34
35
      return;
68
69
                         Lang.bind (this.window,
69
70
                                    this.window.hide_on_delete));
70
71
    
71
 
    this.application.add_window (this.window);
 
72
    this.add_window (this.window);
72
73
  },
73
74
  
74
75
  /**
86
87
    section.append (_("Quit"), "app.quit");
87
88
    menu.append_section (null, section);
88
89
    
89
 
    this.application.set_app_menu (menu);
 
90
    this.set_app_menu (menu);
90
91
    
91
92
    let quit_action = new Gio.SimpleAction ({name: "quit"});
92
93
    quit_action.connect ('activate', Lang.bind (this, function () {
93
 
      this.application.quit ();
 
94
      this.quit ();
94
95
    }));
95
 
    this.application.add_action (quit_action);
 
96
    this.add_action (quit_action);
96
97
    
97
98
  },
98
99