Skip to content

Commit

Permalink
code style
Browse files Browse the repository at this point in the history
  • Loading branch information
artemanufrij committed Oct 26, 2018
1 parent f49db24 commit 5fbf355
Showing 1 changed file with 50 additions and 56 deletions.
106 changes: 50 additions & 56 deletions src/Widgets/Browser.vala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-
* Copyright (c) 2015 Erasmo Marín <[email protected]>
* Copyright (c) 2017-2017 Artem Anufrij <[email protected]>
* Copyright (c) 2017-2018 Artem Anufrij <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -108,65 +108,59 @@ namespace Webpin.Widgets {
}
container.pack_start (icon, true, true, 0);

web_view.create.connect (
(action) => {
app_notification.title = _ ("Open request in an external application…");
app_notification.send_notification ();

external_request (action);
return new WebKit.WebView ();
});

web_view.load_changed.connect (
(load_event) => {
request_begin ();
if (load_event == WebKit.LoadEvent.FINISHED) {
visible_child_name = "app";
if (app_notification.reveal_child) {
app_notification.reveal_child = false;
}
request_finished ();
web_view.create.connect ((action) => {
app_notification.title = _ ("Open request in an external application…");
app_notification.send_notification ();

external_request (action);
return new WebKit.WebView ();
});

web_view.load_changed.connect ((load_event) => {
request_begin ();
if (load_event == WebKit.LoadEvent.FINISHED) {
visible_child_name = "app";
if (app_notification.reveal_child) {
app_notification.reveal_child = false;
}
});
request_finished ();
}
});

web_view.show_notification.connect ((notification) => {
desktop_notification (notification.title, notification.body, icon_for_notification);
return true;
});

web_view.show_notification.connect (
(notification) => {
desktop_notification (notification.title, notification.body, icon_for_notification);
web_view.permission_request.connect ((permission) => {
var permission_type = permission as WebKit.NotificationPermissionRequest;
if (permission_type != null) {
permission_type.allow ();
}
return false;
});

web_view.button_press_event.connect ((event) => {
if (event.button == 8) {
web_view.go_back ();
return true;
} else if (event.button == 9) {
web_view.go_forward ();
return true;
});
}
return base.button_press_event (event);
});

web_view.permission_request.connect (
(permission) => {
var permission_type = permission as WebKit.NotificationPermissionRequest;
if (permission_type != null) {
permission_type.allow ();
}
return false;
});

web_view.button_press_event.connect (
(event) => {
if (event.button == 8) {
web_view.go_back ();
return true;
} else if (event.button == 9) {
web_view.go_forward ();
return true;
}
return base.button_press_event (event);
});

web_view.key_press_event.connect (
(event) => {
if (event.keyval == Gdk.Key.Back) {
web_view.go_back ();
return true;
} else if (event.keyval == Gdk.Key.Forward) {
web_view.go_forward ();
return true;
}
return base.key_press_event (event);
});
web_view.key_press_event.connect ((event) => {
if (event.keyval == Gdk.Key.Back) {
web_view.go_back ();
return true;
} else if (event.keyval == Gdk.Key.Forward) {
web_view.go_forward ();
return true;
}
return base.key_press_event (event);
});
}

public void go_home () {
Expand Down

0 comments on commit 5fbf355

Please sign in to comment.