added refresh button
This commit is contained in:
		
							parent
							
								
									c78302acb5
								
							
						
					
					
						commit
						f49db24518
					
				
					 2 changed files with 76 additions and 69 deletions
				
			
		| 
						 | 
					@ -191,5 +191,13 @@ namespace Webpin.Widgets {
 | 
				
			||||||
        public bool can_go_forward () {
 | 
					        public bool can_go_forward () {
 | 
				
			||||||
            return web_view.can_go_forward ();
 | 
					            return web_view.can_go_forward ();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public void reload () {
 | 
				
			||||||
 | 
					            web_view.reload ();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public void reload_bypass_cache () {
 | 
				
			||||||
 | 
					            web_view.reload_bypass_cache ();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,8 +54,7 @@ namespace Webpin.Windows {
 | 
				
			||||||
            var copy_url = new Gtk.Button.from_icon_name ("insert-link-symbolic", Gtk.IconSize.MENU);
 | 
					            var copy_url = new Gtk.Button.from_icon_name ("insert-link-symbolic", Gtk.IconSize.MENU);
 | 
				
			||||||
            copy_url.valign = Gtk.Align.CENTER;
 | 
					            copy_url.valign = Gtk.Align.CENTER;
 | 
				
			||||||
            copy_url.tooltip_text = _ ("Copy URL into clipboard");
 | 
					            copy_url.tooltip_text = _ ("Copy URL into clipboard");
 | 
				
			||||||
            copy_url.clicked.connect (
 | 
					            copy_url.clicked.connect (() => {
 | 
				
			||||||
                () => {
 | 
					 | 
				
			||||||
                Gtk.Clipboard.get_default (Gdk.Display.get_default ()).set_text (browser.web_view.uri, -1);
 | 
					                Gtk.Clipboard.get_default (Gdk.Display.get_default ()).set_text (browser.web_view.uri, -1);
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            headerbar.pack_end (copy_url);
 | 
					            headerbar.pack_end (copy_url);
 | 
				
			||||||
| 
						 | 
					@ -65,18 +64,26 @@ namespace Webpin.Windows {
 | 
				
			||||||
            stay_open.active = desktop_file.hide_on_close;
 | 
					            stay_open.active = desktop_file.hide_on_close;
 | 
				
			||||||
            stay_open.tooltip_text = _ ("Run in background if closed");
 | 
					            stay_open.tooltip_text = _ ("Run in background if closed");
 | 
				
			||||||
            stay_open.image = new Gtk.Image.from_icon_name ("view-pin-symbolic", Gtk.IconSize.MENU);
 | 
					            stay_open.image = new Gtk.Image.from_icon_name ("view-pin-symbolic", Gtk.IconSize.MENU);
 | 
				
			||||||
            stay_open.toggled.connect (
 | 
					            stay_open.toggled.connect (() => {
 | 
				
			||||||
                () => {
 | 
					 | 
				
			||||||
                desktop_file.edit_property ("X-Webpin-StayOpen", stay_open.active.to_string ());
 | 
					                desktop_file.edit_property ("X-Webpin-StayOpen", stay_open.active.to_string ());
 | 
				
			||||||
                desktop_file.save_to_file ();
 | 
					                desktop_file.save_to_file ();
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            headerbar.pack_end (stay_open);
 | 
					            headerbar.pack_end (stay_open);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var button_refresh = new Gtk.Button.from_icon_name ("view-refresh-symbolic", Gtk.IconSize.MENU);
 | 
				
			||||||
 | 
					            button_refresh.tooltip_text = _("Reload");
 | 
				
			||||||
 | 
					            button_refresh.valign = Gtk.Align.CENTER;
 | 
				
			||||||
 | 
					            button_refresh.clicked.connect (() => {
 | 
				
			||||||
 | 
					                browser.reload ();
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            headerbar.pack_end (button_refresh);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            spinner = new Gtk.Spinner ();
 | 
					            spinner = new Gtk.Spinner ();
 | 
				
			||||||
            spinner.set_size_request (16, 16);
 | 
					            spinner.set_size_request (16, 16);
 | 
				
			||||||
            headerbar.pack_end (spinner);
 | 
					            headerbar.pack_end (spinner);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var button_back = new Gtk.Button.from_icon_name ("go-previous-symbolic", Gtk.IconSize.MENU);
 | 
					            var button_back = new Gtk.Button.from_icon_name ("go-previous-symbolic", Gtk.IconSize.MENU);
 | 
				
			||||||
 | 
					            button_back.tooltip_text = _("Back");
 | 
				
			||||||
            button_back.sensitive = false;
 | 
					            button_back.sensitive = false;
 | 
				
			||||||
            button_back.valign = Gtk.Align.CENTER;
 | 
					            button_back.valign = Gtk.Align.CENTER;
 | 
				
			||||||
            button_back.clicked.connect (() => {
 | 
					            button_back.clicked.connect (() => {
 | 
				
			||||||
| 
						 | 
					@ -85,6 +92,7 @@ namespace Webpin.Windows {
 | 
				
			||||||
            headerbar.pack_start (button_back);
 | 
					            headerbar.pack_start (button_back);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var button_home = new Gtk.Button.from_icon_name ("go-home-symbolic", Gtk.IconSize.MENU);
 | 
					            var button_home = new Gtk.Button.from_icon_name ("go-home-symbolic", Gtk.IconSize.MENU);
 | 
				
			||||||
 | 
					            button_home.tooltip_text = _("Home");
 | 
				
			||||||
            button_home.valign = Gtk.Align.CENTER;
 | 
					            button_home.valign = Gtk.Align.CENTER;
 | 
				
			||||||
            button_home.clicked.connect (() => {
 | 
					            button_home.clicked.connect (() => {
 | 
				
			||||||
                browser.go_home ();
 | 
					                browser.go_home ();
 | 
				
			||||||
| 
						 | 
					@ -92,17 +100,16 @@ namespace Webpin.Windows {
 | 
				
			||||||
            headerbar.pack_start (button_home);
 | 
					            headerbar.pack_start (button_home);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var button_forward = new Gtk.Button.from_icon_name ("go-next-symbolic", Gtk.IconSize.MENU);
 | 
					            var button_forward = new Gtk.Button.from_icon_name ("go-next-symbolic", Gtk.IconSize.MENU);
 | 
				
			||||||
 | 
					            button_forward.tooltip_text = _("Forward");
 | 
				
			||||||
            button_forward.sensitive = false;
 | 
					            button_forward.sensitive = false;
 | 
				
			||||||
            button_forward.valign = Gtk.Align.CENTER;
 | 
					            button_forward.valign = Gtk.Align.CENTER;
 | 
				
			||||||
            button_forward.clicked.connect (() => {
 | 
					            button_forward.clicked.connect (() => {
 | 
				
			||||||
                browser.go_forward ();
 | 
					                browser.go_forward ();
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            headerbar.pack_start (button_forward);
 | 
					            headerbar.pack_start (button_forward);
 | 
				
			||||||
 | 
					 | 
				
			||||||
            this.set_titlebar (headerbar);
 | 
					            this.set_titlebar (headerbar);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            this.delete_event.connect (
 | 
					            this.delete_event.connect (() => {
 | 
				
			||||||
                () => {
 | 
					 | 
				
			||||||
                save_settings ();
 | 
					                save_settings ();
 | 
				
			||||||
                if (desktop_file.hide_on_close) {
 | 
					                if (desktop_file.hide_on_close) {
 | 
				
			||||||
                    this.hide_on_delete ();
 | 
					                    this.hide_on_delete ();
 | 
				
			||||||
| 
						 | 
					@ -110,15 +117,12 @@ namespace Webpin.Windows {
 | 
				
			||||||
                return desktop_file.hide_on_close;
 | 
					                return desktop_file.hide_on_close;
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            this.window_state_event.connect (
 | 
					            this.window_state_event.connect ((event) => {
 | 
				
			||||||
                (event) => {
 | 
					 | 
				
			||||||
                current_state = event.new_window_state;
 | 
					                current_state = event.new_window_state;
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            browser.external_request.connect (
 | 
					            browser.external_request.connect ((action) => {
 | 
				
			||||||
                (action) => {
 | 
					 | 
				
			||||||
                    debug ("Web app external request: %s", action.get_request ().uri);
 | 
					 | 
				
			||||||
                try {
 | 
					                try {
 | 
				
			||||||
                    Process.spawn_command_line_async ("xdg-open " + action.get_request ().uri);
 | 
					                    Process.spawn_command_line_async ("xdg-open " + action.get_request ().uri);
 | 
				
			||||||
                } catch (Error e) {
 | 
					                } catch (Error e) {
 | 
				
			||||||
| 
						 | 
					@ -126,8 +130,7 @@ namespace Webpin.Windows {
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            browser.desktop_notification.connect (
 | 
					            browser.desktop_notification.connect ((title, body, icon) => {
 | 
				
			||||||
                (title, body, icon) => {
 | 
					 | 
				
			||||||
                var desktop_notification = new Notification (title);
 | 
					                var desktop_notification = new Notification (title);
 | 
				
			||||||
                desktop_notification.set_body (body);
 | 
					                desktop_notification.set_body (body);
 | 
				
			||||||
                desktop_notification.set_icon (icon);
 | 
					                desktop_notification.set_icon (icon);
 | 
				
			||||||
| 
						 | 
					@ -135,20 +138,17 @@ namespace Webpin.Windows {
 | 
				
			||||||
                WebpinApp.instance.send_notification (null, desktop_notification);
 | 
					                WebpinApp.instance.send_notification (null, desktop_notification);
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            browser.request_begin.connect (
 | 
					            browser.request_begin.connect (() => {
 | 
				
			||||||
                () => {
 | 
					 | 
				
			||||||
                spinner.active = true;
 | 
					                spinner.active = true;
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            browser.request_finished.connect (
 | 
					            browser.request_finished.connect (() => {
 | 
				
			||||||
                () => {
 | 
					 | 
				
			||||||
                spinner.active = false;
 | 
					                spinner.active = false;
 | 
				
			||||||
                button_back.sensitive = browser.can_go_back ();
 | 
					                button_back.sensitive = browser.can_go_back ();
 | 
				
			||||||
                button_forward.sensitive = browser.can_go_forward ();
 | 
					                button_forward.sensitive = browser.can_go_forward ();
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            browser.found_website_color.connect (
 | 
					            browser.found_website_color.connect ((color) => {
 | 
				
			||||||
                (color) => {
 | 
					 | 
				
			||||||
                stdout.printf ("%s\n", color.to_string ());
 | 
					                stdout.printf ("%s\n", color.to_string ());
 | 
				
			||||||
                int gray_val = (int)(desktop_file.color.red * 255);
 | 
					                int gray_val = (int)(desktop_file.color.red * 255);
 | 
				
			||||||
                if (desktop_file.color == null || ((gray_val == 222 || gray_val == 255) && desktop_file.color.red == desktop_file.color.green && desktop_file.color.red == desktop_file.color.blue)) {
 | 
					                if (desktop_file.color == null || ((gray_val == 222 || gray_val == 255) && desktop_file.color.red == desktop_file.color.green && desktop_file.color.red == desktop_file.color.blue)) {
 | 
				
			||||||
| 
						 | 
					@ -163,8 +163,7 @@ namespace Webpin.Windows {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            this.show_all ();
 | 
					            this.show_all ();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            this.show.connect (
 | 
					            this.show.connect (() => {
 | 
				
			||||||
                () => {
 | 
					 | 
				
			||||||
                var x = desktop_file.get_property ("X-Webpin-WindowX");
 | 
					                var x = desktop_file.get_property ("X-Webpin-WindowX");
 | 
				
			||||||
                var y = desktop_file.get_property ("X-Webpin-WindowY");
 | 
					                var y = desktop_file.get_property ("X-Webpin-WindowY");
 | 
				
			||||||
                if (x != null && y != null) {
 | 
					                if (x != null && y != null) {
 | 
				
			||||||
| 
						 | 
					@ -271,9 +270,9 @@ namespace Webpin.Windows {
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case Gdk.Key.F5 :
 | 
					            case Gdk.Key.F5 :
 | 
				
			||||||
                if (Gdk.ModifierType.CONTROL_MASK in event.state) {
 | 
					                if (Gdk.ModifierType.CONTROL_MASK in event.state) {
 | 
				
			||||||
                    browser.web_view.reload ();
 | 
					                    browser.reload ();
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    browser.web_view.reload_bypass_cache ();
 | 
					                    browser.reload_bypass_cache ();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            case Gdk.Key.Left :
 | 
					            case Gdk.Key.Left :
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue