-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtesteWebkit.js
More file actions
executable file
·65 lines (49 loc) · 1.84 KB
/
testeWebkit.js
File metadata and controls
executable file
·65 lines (49 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/gjs
const Glib = imports.gi.GLib
const Gtk = imports.gi.Gtk
const Lang = imports.lang
const Webkit = imports.gi.WebKit2
const App = new Lang.Class({
Name: 'New App',
//Cria a aplicação
_init: function() {
this.application = new Gtk.Application ();
//Conecta 'activate' e 'startup' sinais para as funções callback
this.application.connect('activate', Lang.bind(this, this._onActivate));
this.application.connect('startup', Lang.bind(this, this._onStartup));
},
//Função callback para o sinal 'activate' presente na janela quando ativa
_onActivate: function() {
this._window.present()
},
//Função callback para o sinal 'startup' construir a interface do usuario
_onStartup: function() {
this._buildUi()
},
//Função para construir a interface do usuario
_buildUi: function() {
//Cria a janela da aplicação
this._window = new Gtk.ApplicationWindow({
application: this.application,
title: 'App for Linux',
default_height: 600,
default_width: 800,
window_position: Gtk.WindowPosition.CENTER
})
//Cria um web view para exibir um web app
this._webView = new Webkit.WebView()
//Envia o web app para o webview
this._webView.load_uri('http://google.com', null)
this._headerBar = new Gtk.HeaderBar()
this._headerBar.set_title('App for Linux')
this._headerBar.set_subtitle('WebKit Teste')
this._headerBar.show_close_button = true
this._window.set_titlebar(this._headerBar)
//Insere o webview na janela do applicativo
this._window.add(this._webView)
//Exibe a janela e todos seus widgets filhos
this._window.show_all()
}
})
let app = new App()
app.application.run(ARGV)