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 () {
|
||||
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);
|
||||
copy_url.valign = Gtk.Align.CENTER;
|
||||
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);
|
||||
});
|
||||
headerbar.pack_end (copy_url);
|
||||
|
@ -65,18 +64,26 @@ namespace Webpin.Windows {
|
|||
stay_open.active = desktop_file.hide_on_close;
|
||||
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.toggled.connect (
|
||||
() => {
|
||||
stay_open.toggled.connect (() => {
|
||||
desktop_file.edit_property ("X-Webpin-StayOpen", stay_open.active.to_string ());
|
||||
desktop_file.save_to_file ();
|
||||
});
|
||||
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.set_size_request (16, 16);
|
||||
headerbar.pack_end (spinner);
|
||||
|
||||
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.valign = Gtk.Align.CENTER;
|
||||
button_back.clicked.connect (() => {
|
||||
|
@ -85,6 +92,7 @@ namespace Webpin.Windows {
|
|||
headerbar.pack_start (button_back);
|
||||
|
||||
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.clicked.connect (() => {
|
||||
browser.go_home ();
|
||||
|
@ -92,17 +100,16 @@ namespace Webpin.Windows {
|
|||
headerbar.pack_start (button_home);
|
||||
|
||||
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.valign = Gtk.Align.CENTER;
|
||||
button_forward.clicked.connect (() => {
|
||||
browser.go_forward ();
|
||||
});
|
||||
headerbar.pack_start (button_forward);
|
||||
|
||||
this.set_titlebar (headerbar);
|
||||
|
||||
this.delete_event.connect (
|
||||
() => {
|
||||
this.delete_event.connect (() => {
|
||||
save_settings ();
|
||||
if (desktop_file.hide_on_close) {
|
||||
this.hide_on_delete ();
|
||||
|
@ -110,15 +117,12 @@ namespace Webpin.Windows {
|
|||
return desktop_file.hide_on_close;
|
||||
});
|
||||
|
||||
this.window_state_event.connect (
|
||||
(event) => {
|
||||
this.window_state_event.connect ((event) => {
|
||||
current_state = event.new_window_state;
|
||||
return false;
|
||||
});
|
||||
|
||||
browser.external_request.connect (
|
||||
(action) => {
|
||||
debug ("Web app external request: %s", action.get_request ().uri);
|
||||
browser.external_request.connect ((action) => {
|
||||
try {
|
||||
Process.spawn_command_line_async ("xdg-open " + action.get_request ().uri);
|
||||
} catch (Error e) {
|
||||
|
@ -126,8 +130,7 @@ namespace Webpin.Windows {
|
|||
}
|
||||
});
|
||||
|
||||
browser.desktop_notification.connect (
|
||||
(title, body, icon) => {
|
||||
browser.desktop_notification.connect ((title, body, icon) => {
|
||||
var desktop_notification = new Notification (title);
|
||||
desktop_notification.set_body (body);
|
||||
desktop_notification.set_icon (icon);
|
||||
|
@ -135,20 +138,17 @@ namespace Webpin.Windows {
|
|||
WebpinApp.instance.send_notification (null, desktop_notification);
|
||||
});
|
||||
|
||||
browser.request_begin.connect (
|
||||
() => {
|
||||
browser.request_begin.connect (() => {
|
||||
spinner.active = true;
|
||||
});
|
||||
|
||||
browser.request_finished.connect (
|
||||
() => {
|
||||
browser.request_finished.connect (() => {
|
||||
spinner.active = false;
|
||||
button_back.sensitive = browser.can_go_back ();
|
||||
button_forward.sensitive = browser.can_go_forward ();
|
||||
});
|
||||
|
||||
browser.found_website_color.connect (
|
||||
(color) => {
|
||||
browser.found_website_color.connect ((color) => {
|
||||
stdout.printf ("%s\n", color.to_string ());
|
||||
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)) {
|
||||
|
@ -163,8 +163,7 @@ namespace Webpin.Windows {
|
|||
|
||||
this.show_all ();
|
||||
|
||||
this.show.connect (
|
||||
() => {
|
||||
this.show.connect (() => {
|
||||
var x = desktop_file.get_property ("X-Webpin-WindowX");
|
||||
var y = desktop_file.get_property ("X-Webpin-WindowY");
|
||||
if (x != null && y != null) {
|
||||
|
@ -271,9 +270,9 @@ namespace Webpin.Windows {
|
|||
break;
|
||||
case Gdk.Key.F5 :
|
||||
if (Gdk.ModifierType.CONTROL_MASK in event.state) {
|
||||
browser.web_view.reload ();
|
||||
browser.reload ();
|
||||
} else {
|
||||
browser.web_view.reload_bypass_cache ();
|
||||
browser.reload_bypass_cache ();
|
||||
}
|
||||
return true;
|
||||
case Gdk.Key.Left :
|
||||
|
|
Loading…
Reference in a new issue