Hi all,

I think it makes sense to open web pages in the user's preferred web browser, 
so I wrote this patch.  It works against
revision 139 and uses the following as it's top level directory: 
svn://svn.0pointer.de/service-discovery-applet/trunk.
Please let me know if this is NOT how you want patches submitted; I've got a 
laundry list of them I want to add.

Thanks!

~Jason

Index: plugins/website_browser.py.in
===================================================================
--- plugins/website_browser.py.in	(revision 0)
+++ plugins/website_browser.py.in	(revision 0)
@@ -0,0 +1,41 @@
+# -*- coding: UTF-8 -*-
+# -*- python -*-
+# Copyright (C) 2007 by Jason Whitlark
+#
+# This file may be distributed and/or modified under the terms of
+# the GNU General Public License version 2 as published by
+# the Free Software Foundation.
+# This file is distributed without any warranty; without even the implied
+# warranty of merchantability or fitness for a particular purpose.
+# See "COPYING" in the source distribution for more information.
+#
+# $Id: nautilus.py.in 115 2006-08-06 23:52:31Z sebest $
+#
+
+from sdapplet.pluginutils import *
+import subprocess
+import webbrowser
+
+
+class plugin_website_browser:
+    def __init__(self):
+        self.service_type = ["_http._tcp",  "_https._tcp"]
+        self.author = "Jason Whitlark"
+        self.description = "Accessing zeroconf web sites using user's preferred browser"
+
+    def connect(self, use_host_names, name, stype, hostname, address, port, txts):
+        if use_host_names == True:
+            address = hostname
+        print "connecting using firefox"
+        path = get_txt_value(txts,"path")
+        username = get_txt_value(txts,"u")
+        password = get_txt_value(txts,"p")
+        if stype == "_http._tcp":
+            url = build_url("http",address,port, path, username,password)
+        if stype == "_https._tcp":
+            url = build_url("https",address,port, path, username,password)
+
+	webbrowser.open(url)
+
+def load():
+    return plugin_website_browser()
Index: plugins/Makefile.am
===================================================================
--- plugins/Makefile.am	(revision 139)
+++ plugins/Makefile.am	(working copy)
@@ -5,14 +5,16 @@
 	nautilus.py.in \
 	xvncviewer.py.in \
 	obby.py.in \
-	ekiga.py.in
+	ekiga.py.in \
+	website_browser.py.in
 
 plugins_DATA = \
 	gconfterminal.py \
 	nautilus.py \
 	xvncviewer.py \
 	obby.py \
-	ekiga.py
+	ekiga.py \
+	website_browser.py
 
 gconfterminal.py: gconfterminal.py.in
 	sed \
@@ -39,6 +41,11 @@
 	-e 's,@toolsdir\@,$(TOOLSDIR),g' \
 	$< > $@
 
+website_browser.py: website_browser.py.in
+	sed \
+	-e 's,@toolsdir\@,$(TOOLSDIR),g' \
+	$< > $@
+
 EXTRA_DIST = $(plugins)
 
 CLEANFILES = $(plugins_DATA)

_______________________________________________
avahi mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/avahi

Reply via email to