Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preferences wired up. Alerts on service discovery added. select poll …
…interval reduced. More...
- Loading branch information
Showing
21 changed files
with
379 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,88 @@ | ||
function contextListEventHandler(event) { | ||
var node = document.popupNode; | ||
var pNode = node.parentNode; | ||
/* | ||
dump("context\n"); | ||
dump(node.value + "\n"); | ||
dump(pNode.onclick + "\n"); | ||
dump(event.target.value + "\n"); | ||
dump(event.bubbles + "\n"); | ||
dump(event.type + "\n"); | ||
dump(event.shiftKey + "\n"); | ||
dump(event.button + "\n"); | ||
*/ | ||
pNode.onclick(event); | ||
} | ||
|
||
function listEventHandler(event,target,serviceName,regType,regDomain) { | ||
// dump("list\n"); | ||
// event.shiftKey | ||
// event.type == "click" | ||
if (event.type=="click") { | ||
if (event.button=="0") { | ||
if (event.shiftKey) { | ||
openLink("window",serviceName,regType,regDomain); | ||
} else { | ||
openLink("default",serviceName,regType,regDomain); | ||
} | ||
} else if (event.button=="1") { | ||
openLink("tab",serviceName,regType,regDomain); | ||
} | ||
} if (event.type=="command") { | ||
openLink(event.target.value,serviceName,regType,regDomain); | ||
} | ||
} | ||
|
||
function updateServiceList() { | ||
var obj=Components.classes["@andrew.tj.id.au/dsdmanager;1"].getService(Components.interfaces.IDSDMANAGER); | ||
obj.discoverServices("_http._tcp.",null); | ||
|
||
var serviceList = document.getElementById('serviceList'); | ||
if (serviceList.hasChildNodes()) { | ||
if (serviceList.hasChildNodes()) | ||
{ | ||
while (serviceList.firstChild) { | ||
serviceList.removeChild(serviceList.firstChild); | ||
} | ||
} | ||
|
||
var discoveredServices = obj.getDiscoveredServices("_http._tcp.",null); | ||
|
||
for(var i=0;i<discoveredServices.length;i++) { | ||
for(var i=0;i<discoveredServices.length;i++) | ||
{ | ||
var discoveredService = discoveredServices.queryElementAt(i,Components.interfaces.nsIArray); | ||
var serviceName = discoveredService.queryElementAt(2,Components.interfaces.nsIVariant); | ||
|
||
|
||
var richlistEl = document.createElement('richlistitem'); | ||
var descriptionEl = document.createElement('description'); | ||
descriptionEl.setAttribute('value', serviceName); | ||
descriptionEl.setAttribute('crop','center'); | ||
descriptionEl.setAttribute('flex','1'); | ||
richlistEl.appendChild(descriptionEl); | ||
richlistEl.setAttribute('onclick','openLink("content","' + escape(discoveredService.queryElementAt(2,Components.interfaces.nsIVariant)) + '","' + escape(discoveredService.queryElementAt(1,Components.interfaces.nsIVariant)) + '","' + escape(discoveredService.queryElementAt(0,Components.interfaces.nsIVariant)) + '");'); | ||
|
||
richlistEl.setAttribute('onclick','listEventHandler(event,"default","' + [ | ||
escape(discoveredService.queryElementAt(2,Components.interfaces.nsIVariant)), | ||
escape(discoveredService.queryElementAt(1,Components.interfaces.nsIVariant)), | ||
escape(discoveredService.queryElementAt(0,Components.interfaces.nsIVariant)) | ||
].join('","') + '");'); | ||
serviceList.appendChild(richlistEl); | ||
|
||
// listitem.setAttribute('label', foo); | ||
// listitem.setAttribute('onclick','openLink("content","' + escape(discoveredService.queryElementAt(2,Components.interfaces.nsIVariant)) + '","' + escape(discoveredService.queryElementAt(1,Components.interfaces.nsIVariant)) + '","' + escape(discoveredService.queryElementAt(0,Components.interfaces.nsIVariant)) + '");'); | ||
// listitem.setAttribute('label',obj[i].replyName); | ||
// listitem.setAttribute('onclick','window._content.location="' + obj[i].url + '"'); | ||
// serviceList.appendChild(listitem); | ||
} | ||
} | ||
|
||
/* | ||
function onTreeClicked(event){ | ||
var tree = document.getElementById("serviceListT"); | ||
var tbo = tree.treeBoxObject; | ||
try { | ||
// get the row, col and child element at the point | ||
var row = { }, col = { }, child = { }; | ||
tbo.getCellAt(event.clientX, event.clientY, row, col, child); | ||
var cellValue = tree.view.getCellValue(row.value, col.value); | ||
window._content.location=cellValue; | ||
} | ||
catch (e) { | ||
return; | ||
} | ||
} | ||
*/ | ||
|
||
function dsdObserver() | ||
{ | ||
this.register(); | ||
} | ||
dsdObserver.prototype = { | ||
observe: function(subject, topic, data) { | ||
var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService); | ||
aConsoleService.logStringMessage("dsdObserver: " + topic + " " + data); | ||
updateServiceList(); | ||
}, | ||
register: function() { | ||
var observerService = Components.classes["@mozilla.org/observer-service;1"] | ||
.getService(Components.interfaces.nsIObserverService); | ||
observerService.addObserver(this, "dsd_add_http._tcp.", false); | ||
observerService.addObserver(this, "dsd_rmv_http._tcp.", false); | ||
observerService.addObserver(this, "dsd_service_add__http._tcp.", false); | ||
observerService.addObserver(this, "dsd_service_rmv__http._tcp.", false); | ||
}, | ||
unregister: function() { | ||
var observerService = Components.classes["@mozilla.org/observer-service;1"] | ||
.getService(Components.interfaces.nsIObserverService); | ||
observerService.removeObserver(this, "dsd_add_http._tcp.", false); | ||
observerService.removeObserver(this, "dsd_rmv_http._tcp.", false); | ||
observerService.removeObserver(this, "dsd_service_add__http._tcp.", false); | ||
observerService.removeObserver(this, "dsd_service_rmv__http._tcp.", false); | ||
} | ||
} | ||
|
||
var dsdObserverInstance = new dsdObserver(); | ||
var dsdObserverInstance = new dsdObserver(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0"?> | ||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> | ||
|
||
<prefwindow id="BrowserPreferences" | ||
title="BonjourFoxy Options" | ||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" | ||
xmlns:html="http://www.w3.org/1999/xhtml" | ||
buttons="accept"> | ||
|
||
<prefpane id="bonjourfoxy-prefpane" label="BonjourFoxy Preferences"> | ||
<preferences> | ||
<preference id="pref_alerts" name="extensions.bonjourfoxy.alerts" instantApply="true" type="bool"/> | ||
<preference id="pref_target" name="extensions.bonjourfoxy.target" instantApply="true" type="string"/> | ||
</preferences> | ||
|
||
<html:h2 flex="1" style="text-align: center;">BonjourFoxy Preferences</html:h2> | ||
<groupbox flex="1"> | ||
<vbox flex="1"> | ||
<hbox> | ||
<label control="alerts" value="Discovery notifications:"/> | ||
<spacer flex="1"/> | ||
<checkbox preference="pref_alerts" id="alerts"/> | ||
</hbox> | ||
<hbox flex="1"> | ||
<label control="target" value="Open links in:"/> | ||
<spacer flex="1"/> | ||
<menulist preference="pref_target" id="target"> | ||
<menupopup> | ||
<menuitem label="Current Page" value="current"/> | ||
<menuitem label="New Tab" value="tab"/> | ||
<menuitem label="New Window" value="window" /> | ||
</menupopup> | ||
</menulist> | ||
</hbox> | ||
</vbox> | ||
</groupbox> | ||
<hbox style='padding-bottom: 30px;'><spacer flex="1"/><description>Settings apply instantly</description><spacer flex="1"/></hbox> | ||
</prefpane> | ||
|
||
</prefwindow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
pref("extensions.dsd.logToErrorConsole", false); | ||
pref("extensions.bonjourfoxy.alerts", true); | ||
pref("extensions.bonjourfoxy.target", "current"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<!ENTITY bonjourfoxy.title "Bonjour"> | ||
<!ENTITY bonjourfoxy.label "Bonjour"> | ||
<!ENTITY bonjourfoxy.title "BonjourFoxy"> | ||
<!ENTITY bonjourfoxy.label "BonjourFoxy"> | ||
<!ENTITY bonjourfoxyMenuSidebar.label "Display Sidebar"> | ||
<!ENTITY bonjourfoxyToolbar.label "Bonjour Button"> | ||
<!ENTITY bonjourfoxyToolbar.tooltip "Toggle Bonjour Sidebar"> | ||
<!ENTITY bonjourfoxyToolbar.label "BonjourFoxy Button"> | ||
<!ENTITY bonjourfoxyToolbar.tooltip "Toggle BonjourFoxy Sidebar"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
title="Bonjour Foxy" | ||
title="BonjourFoxy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.