Example #1
0
  def __init__(self):
    Gtk.Window.__init__(self)
    self.set_type_hint(Gdk.WindowTypeHint.DOCK)
    #self.fullscreen()
    self.set_size_request(480, 320)

    WebKit.set_cache_model(WebKit.CacheModel.DOCUMENT_VIEWER)
    self.view = WebKit.WebView()
    self.view.connect("close-web-view", self.closehandler)

    box = Gtk.Box()
    self.add(box)
    box.pack_start(self.view, True, True, 0)
    self.connect("destroy", lambda q: Gtk.main_quit())

    self.show_all()
    self.move(0, 0)
Example #2
0
    def __init__(self, *args, **kwargs):
        # TODO: Change to DOCUMENT_VIEWER after we start caching remote
        # resources at item processing stage
        WebKit.set_cache_model(WebKit.CacheModel.DOCUMENT_BROWSER)
        WebKit.get_default_session().set_property('max-conns-per-host', 8)

        settings = WebKit.WebSettings()
        settings.set_properties(
            **{
                # These three saves us ~25MiB of residental memory
                'enable_scripts': False,
                'enable_plugins': False,
                'enable_java_applet': False,
                # We already have most files cached and load locally
                'enable_page_cache': False,
                'enable_dns_prefetching': False,
                'enable_private_browsing': True,
                # We don't use any of these features
                'enable_html5_database': False,
                'enable_html5_local_storage': False,
                'enable_offline_web_application_cache': False,
                'enable_xss_auditor': False,
                'resizable_text_areas': False,
                # Need this one of usability reasons.
                'enable_default_context_menu': False,
                # Enable in case developer tools are needed
                'enable_developer_extras': arguments.devtools
            })
        super(ItemView, self).__init__(*args, settings=settings, **kwargs)

        self.connect('show', self.on_show)
        self.connect('style-updated', self.on_style)
        self.connect('notify::item-id', self.on_item_change)
        self.connect('console-message', self.on_console_message)
        self.connect('context-menu', self.on_ctx_menu)

        # Load base template
        template_path = get_data_path('ui', 'feedview', 'template.html')
        self.load_uri('file://' + template_path)
Example #3
0
 def _start_cache(self):
     webkit.set_cache_model(webkit.CacheModel.WEB_BROWSER)
     log ("Cache model changed")