~nhoad/roland

d7fbf88565552f72677caa836d76ffa427288c76 — Nathan Hoad 2 years ago d369793
In practice, related webviews are basically always available, so this creates a single enormous webview.
2 files changed, 6 insertions(+), 15 deletions(-)

M roland/core.py
M roland/extensions.py
M roland/core.py => roland/core.py +3 -5
@@ 1431,7 1431,7 @@ class BrowserView(BrowserCommands):

    def on_create_web_view(self, webview, navigation_request):
        if self.roland.hooks('should_open_popup', navigation_request.get_request().get_uri(), default=True):
            v = self.roland.new_webview(related=webview)
            v = self.roland.new_webview()
            self.roland.add_window(self.roland.browser_view.from_webview(v, self.roland))
            return v



@@ 1759,12 1759,10 @@ class Roland(RolandConfigBase, Gtk.Application):
        elif position == 'visible':
            notebook.set_show_tabs(True)

    def new_webview(self, related=None):
    def new_webview(self):
        user_content_manager = self.get_extension('UserContentManager')

        if related is not None:
            webview = WebKit2.WebView.new_with_related_view(related)
        elif user_content_manager is not None:
        if user_content_manager is not None:
            webview = WebKit2.WebView.new_with_user_content_manager(user_content_manager.manager)
        else:
            webview = WebKit2.WebView()

M roland/extensions.py => roland/extensions.py +3 -10
@@ 464,16 464,9 @@ class DBusManager(Extension):
                if isinstance(url, bytes):
                    url = url.decode('utf8')

                if related_id:
                    related = roland.find_browser(page_id=related_id)
                    webview = roland.new_webview(related=related.webview)
                    webview.load_uri(url)
                    roland.add_window(roland.browser_view.from_webview(webview, roland))
                    webview.emit('ready-to-show')
                else:
                    # FIXME: this background should be configurable
                    # This also forces new window follows to background
                    roland.new_window(uri, background=True)
                # FIXME: this background should be configurable
                # This also forces new window follows to background
                roland.new_window(url, background=True)
                return 1

            @dbus.service.method(name)