domains/remove_print_css.js
[app.webkitpdf] / BrowserToolbar.js
1 Gtk = imports.gi.Gtk;
2
3 BrowserSettings = imports.BrowserSettings;
4 TabbedBrowser = imports.TabbedBrowser;
5 File = imports.File.File;
6
7
8
9 BrowserToolbar = new GType({
10     parent: Gtk.HBox.type,
11     name: "BrowserToolbar",
12     init: function ()
13     {
14         // Private
15         var url_bar = new Gtk.Entry();
16
17         var back_button = new Gtk.ToolButton({stock_id:"gtk-go-back"});
18         var forward_button = new Gtk.ToolButton({stock_id:"gtk-go-forward"});
19         var refresh_button = new Gtk.ToolButton({stock_id:"gtk-refresh"});
20         var grab_button = new Gtk.ToolButton({label:"mirror"});
21         var nsgrab_button = new Gtk.ToolButton({label:"netsuite grab"});
22         
23         
24         var back = function ()
25         {
26             TabbedBrowser.browser.current_tab().get_web_view().go_back();
27         };
28
29         var forward = function ()
30         {
31             TabbedBrowser.browser.current_tab().get_web_view().go_forward();
32         };
33
34         var refresh = function ()
35         {
36             
37             
38             TabbedBrowser.browser.current_tab().get_web_view().reload();
39             
40             /*TabbedBrowser.browser.current_tab().get_web_view().signals.onload_event(function() {
41            
42                 print("Sending gather links");
43                 TabbedBrowser.browser.current_tab().get_web_view().execute_script(
44                     "gatherlinks();"
45                     
46                 );
47              });
48             */
49
50         };
51
52         var browse = function (url)
53         {
54             TabbedBrowser.browser.current_tab().get_web_view().browse(url.text);
55         };
56
57         var grab = function(){
58 //            print("sedning gather links (Start)");
59             TabbedBrowser.browser.current_tab().get_web_view().add_inject();
60             TabbedBrowser.browser.current_tab().get_web_view().execute_script(
61                 "BrowserMirror.gatherlinks();"
62             );
63     
64            // print('test');
65         };
66          
67         
68         
69          
70         // Public
71         this.set_url = function (url)
72         {
73             url_bar.text = url;
74         };
75
76         this.set_can_go_back = function (can_go_back)
77         {
78             back_button.sensitive = can_go_back;
79         };
80
81         this.set_can_go_forward = function (can_go_forward)
82         {
83             forward_button.sensitive = can_go_forward;
84         };
85
86         this.set_progress = function (progress)
87         {
88             if(BrowserSettings.have_progress_bar)
89                 url_bar.set_progress_fraction(progress);
90         };
91
92         // Implementation
93         back_button.signal.clicked.connect(back);
94         forward_button.signal.clicked.connect(forward);
95         refresh_button.signal.clicked.connect(refresh);
96         url_bar.signal.activate.connect(browse);
97         grab_button.signal.clicked.connect(grab);
98        
99
100         this.pack_start(back_button);
101         this.pack_start(forward_button);
102         
103         
104         this.pack_start(refresh_button);
105         this.pack_start(grab_button);
106         this.pack_start(nsgrab_button);
107         this.pack_start(url_bar, true, true);
108
109
110     }
111 });