|
1 | 1 | /*-
|
2 | 2 | * Copyright (c) 2015 Erasmo Marín <[email protected]>
|
3 |
| - * Copyright (c) 2017-2017 Artem Anufrij <[email protected]> |
| 3 | + * Copyright (c) 2017-2018 Artem Anufrij <[email protected]> |
4 | 4 | *
|
5 | 5 | * This program is free software: you can redistribute it and/or modify
|
6 | 6 | * it under the terms of the GNU Lesser General Public License as published by
|
@@ -108,65 +108,59 @@ namespace Webpin.Widgets {
|
108 | 108 | }
|
109 | 109 | container.pack_start (icon, true, true, 0);
|
110 | 110 |
|
111 |
| - web_view.create.connect ( |
112 |
| - (action) => { |
113 |
| - app_notification.title = _ ("Open request in an external application…"); |
114 |
| - app_notification.send_notification (); |
115 |
| - |
116 |
| - external_request (action); |
117 |
| - return new WebKit.WebView (); |
118 |
| - }); |
119 |
| - |
120 |
| - web_view.load_changed.connect ( |
121 |
| - (load_event) => { |
122 |
| - request_begin (); |
123 |
| - if (load_event == WebKit.LoadEvent.FINISHED) { |
124 |
| - visible_child_name = "app"; |
125 |
| - if (app_notification.reveal_child) { |
126 |
| - app_notification.reveal_child = false; |
127 |
| - } |
128 |
| - request_finished (); |
| 111 | + web_view.create.connect ((action) => { |
| 112 | + app_notification.title = _ ("Open request in an external application…"); |
| 113 | + app_notification.send_notification (); |
| 114 | + |
| 115 | + external_request (action); |
| 116 | + return new WebKit.WebView (); |
| 117 | + }); |
| 118 | + |
| 119 | + web_view.load_changed.connect ((load_event) => { |
| 120 | + request_begin (); |
| 121 | + if (load_event == WebKit.LoadEvent.FINISHED) { |
| 122 | + visible_child_name = "app"; |
| 123 | + if (app_notification.reveal_child) { |
| 124 | + app_notification.reveal_child = false; |
129 | 125 | }
|
130 |
| - }); |
| 126 | + request_finished (); |
| 127 | + } |
| 128 | + }); |
| 129 | + |
| 130 | + web_view.show_notification.connect ((notification) => { |
| 131 | + desktop_notification (notification.title, notification.body, icon_for_notification); |
| 132 | + return true; |
| 133 | + }); |
131 | 134 |
|
132 |
| - web_view.show_notification.connect ( |
133 |
| - (notification) => { |
134 |
| - desktop_notification (notification.title, notification.body, icon_for_notification); |
| 135 | + web_view.permission_request.connect ((permission) => { |
| 136 | + var permission_type = permission as WebKit.NotificationPermissionRequest; |
| 137 | + if (permission_type != null) { |
| 138 | + permission_type.allow (); |
| 139 | + } |
| 140 | + return false; |
| 141 | + }); |
| 142 | + |
| 143 | + web_view.button_press_event.connect ((event) => { |
| 144 | + if (event.button == 8) { |
| 145 | + web_view.go_back (); |
| 146 | + return true; |
| 147 | + } else if (event.button == 9) { |
| 148 | + web_view.go_forward (); |
135 | 149 | return true;
|
136 |
| - }); |
| 150 | + } |
| 151 | + return base.button_press_event (event); |
| 152 | + }); |
137 | 153 |
|
138 |
| - web_view.permission_request.connect ( |
139 |
| - (permission) => { |
140 |
| - var permission_type = permission as WebKit.NotificationPermissionRequest; |
141 |
| - if (permission_type != null) { |
142 |
| - permission_type.allow (); |
143 |
| - } |
144 |
| - return false; |
145 |
| - }); |
146 |
| - |
147 |
| - web_view.button_press_event.connect ( |
148 |
| - (event) => { |
149 |
| - if (event.button == 8) { |
150 |
| - web_view.go_back (); |
151 |
| - return true; |
152 |
| - } else if (event.button == 9) { |
153 |
| - web_view.go_forward (); |
154 |
| - return true; |
155 |
| - } |
156 |
| - return base.button_press_event (event); |
157 |
| - }); |
158 |
| - |
159 |
| - web_view.key_press_event.connect ( |
160 |
| - (event) => { |
161 |
| - if (event.keyval == Gdk.Key.Back) { |
162 |
| - web_view.go_back (); |
163 |
| - return true; |
164 |
| - } else if (event.keyval == Gdk.Key.Forward) { |
165 |
| - web_view.go_forward (); |
166 |
| - return true; |
167 |
| - } |
168 |
| - return base.key_press_event (event); |
169 |
| - }); |
| 154 | + web_view.key_press_event.connect ((event) => { |
| 155 | + if (event.keyval == Gdk.Key.Back) { |
| 156 | + web_view.go_back (); |
| 157 | + return true; |
| 158 | + } else if (event.keyval == Gdk.Key.Forward) { |
| 159 | + web_view.go_forward (); |
| 160 | + return true; |
| 161 | + } |
| 162 | + return base.key_press_event (event); |
| 163 | + }); |
170 | 164 | }
|
171 | 165 |
|
172 | 166 | public void go_home () {
|
|
0 commit comments