tags 549037 + patch thanks Hi,
I've just looked into this and have ported foomatic-gui to webkit. The widget seems to load fine et al, but I can't test it properly since foomatic doesn't display any printer info (not even with an unpatched version). If you test the patch and find any problems let me know. Cheers, Emilio
diff -ruNp foomatic-gui-0.7.9.2+nmu2/foomatic-gui foomatic-gui-0.7.9.2+nmu2.new/foomatic-gui --- foomatic-gui-0.7.9.2+nmu2/foomatic-gui 2008-10-03 13:18:22.000000000 +0200 +++ foomatic-gui-0.7.9.2+nmu2.new/foomatic-gui 2010-05-21 20:25:03.000000000 +0200 @@ -64,7 +64,7 @@ except: gnomevfs = gnome.vfs import tempfile -import gtkhtml2 +import webkit import new import types @@ -188,17 +188,13 @@ class GUI(gtk.glade.XML): selection = view.get_selection() selection.connect('changed', self.fix_driverpage_buttons) - htmlview = gtkhtml2.View() - self.printinfo = gtkhtml2.Document() - self.printinfo.connect('link-clicked', self.link_clicked) - htmlview.connect("on_url", self.on_url) - self.printinfo.connect("request-url", self.request_url) - htmlview.get_vadjustment().set_value(0) - self.printinfowin.set_hadjustment(htmlview.get_hadjustment()) - self.printinfowin.set_vadjustment(htmlview.get_vadjustment()) - self.printinfo.clear() - htmlview.set_document(self.printinfo) - self.printinfowin.add(htmlview) + self.printinfo = webkit.WebView() + self.printinfo.connect('navigation-policy-decision-requested', + self.navigation_policy_decision_requested) + #self.printinfo.get_focus_vadjustment().set_value(0) # FIXME + self.printinfowin.set_hadjustment(self.printinfo.get_focus_hadjustment()) + self.printinfowin.set_vadjustment(self.printinfo.get_focus_vadjustment()) + self.printinfowin.add(self.printinfo) self.printinfowin.show_all() self.printinfowin.set_sensitive(False) @@ -634,15 +630,13 @@ class GUI(gtk.glade.XML): self.druid1.set_buttons_sensitive(True, enabled, True, True) if changed: - self.printinfo.clear() + self.printinfo.load_string("", "", "", "") if printinfo: - self.printinfo.open_stream('text/html') html = '''<html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head><body>%s</body></html>''' % printinfo html = html.encode('utf-8') - self.printinfo.write_stream(html) - self.printinfo.close_stream() + self.printinfo.load_string(html, "text/html", "utf-8", "") va = self.printinfowin.get_vadjustment() va.set_value(va.lower) self.printinfowin.set_sensitive(True) @@ -671,7 +665,7 @@ class GUI(gtk.glade.XML): self.oldmake = make # Clear the printinfo when we change rows - self.printinfo.clear() + self.printinfo.load_string("", "", "", "") self.printinfowin.set_sensitive(False) view = self.model_treeview @@ -1003,17 +997,12 @@ class GUI(gtk.glade.XML): on_quit1_activate = on_mainWindow_delete_event on_set_options1_activate = on_options_button_clicked - # HTML Stuff - currently not much here - def on_url(self, view, url): - return - - def link_clicked(self, document, link): - link = link.strip() + def navigation_policy_decision_requested(self, view, frame, request, navigation_action, policy_decision): + link = request.get_uri().strip() + print "link: " + link gnome.url_show(link) - return - - def request_url(self, document, url, stream): - return + policy_decision.ignore() # Don't follow the link + return True # We've handled the request def main(): app = GUI()