Browser/main.js
[gitlive] / Browser / main.js
1 #!/usr/bin/env seed
2
3 Gtk = imports.gi.Gtk;
4 WebKit = imports.gi.WebKit;
5 Hotkey = imports.gi.GtkHotkey;
6
7 Gtk.init(Seed.argv);
8
9
10 Browser = {
11     Settings : imports.Settings,
12     View : imports.View.Browser.View,
13     Tab : imports.Tab.Browser.Tab
14 };
15
16  
17  
18
19 window = new Gtk.Window({title: "Browser"});
20 window.resize(800, 600);
21 window.signal.destroy.connect(Gtk.main_quit);
22
23  var new_tab = new Browser.Tab();
24 new_tab.get_web_view().browse(Browser.Settings.home_page);
25 window.add(new_tab);
26
27 var state = false;
28 //window.show_all();
29 //window.hide();
30 //window.fullscreen();
31   
32     var hot = new Hotkey.Info.c_new("gtkhotkey-test", "gtkhotkey-test-key","<Control>Escape" );  
33         
34         //g_signal_connect (hot, "notify::bound", G_CALLBACK(hotkey_bound_cb), NULL);
35         //hot.bind();
36         //error = NULL;
37     var x = hot.bind();
38     print("BIND RETURNED" + x);
39         //gtk_hotkey_info_bind (hot, &error);
40         hot.signal.activated.connect(function ( ) {
41          
42         if (!state) {
43             window.show_all();
44             //GLib.timeout_add(GLib.PRIORITY_LOW, 500, function() {
45                  window.fullscreen();
46                 window.grab_focus();
47                 window.set_keep_above(true);
48             //});    
49             
50         } else {
51 //            window.unfullscreen();
52             window.hide();
53         }
54         state= !state;
55         print ("GOT hotkey test")
56         
57     }); 
58  
59
60 Gtk.main();