Skip to content

Commit

Permalink
Load default provider from prefs.
Browse files Browse the repository at this point in the history
  • Loading branch information
rnewman committed Feb 15, 2011
1 parent 077a00a commit 454a708
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Makefile
Expand Up @@ -45,7 +45,7 @@ export stage_dir=$(objdir)/stage
xpi_dir=$(objdir)/xpi

xpi_name := identity.xpi
xpi_files := chrome/identity.jar components modules \
xpi_files := chrome/identity.jar defaults components modules \
platform install.rdf chrome.manifest

SUBST = perl -pe 's/@([^@]+)@/defined $$ENV{$$1} ? $$ENV{$$1} : $$&/ge'
Expand Down Expand Up @@ -77,13 +77,15 @@ build: setup idl
$(MKDIR) $(stage_dir)/chrome/content
$(MKDIR) $(stage_dir)/chrome/skin
$(MKDIR) $(stage_dir)/components
$(MKDIR) $(stage_dir)/defaults/preferences
$(SLINK) $(TOPSRCDIR)/addon/chrome.manifest $(stage_dir)/chrome.manifest
$(SLINK) $(TOPSRCDIR)/addon/install.rdf $(stage_dir)/install.rdf
$(SLINK) $(TOPSRCDIR)/addon/bootstrap.js $(stage_dir)/bootstrap.js
$(SLINK) $(TOPSRCDIR)/addon/options.xul $(stage_dir)/chrome/content/options.xul
$(SLINK) $(TOPSRCDIR)/addon/identity-32x32.png $(stage_dir)/chrome/skin/identity-32x32.png
$(SLINK) $(TOPSRCDIR)/addon/components/identity.js $(stage_dir)/components/identity.js
$(SLINK) $(TOPSRCDIR)/addon/components/IdentityManager.xpt $(stage_dir)/components/IdentityManager.xpt
$(SLINK) $(TOPSRCDIR)/addon/defaults/preferences/identityPrefs.js $(stage_dir)/defaults/preferences/identityPrefs.js

xpi: build
cd $(stage_dir)/chrome;rm -f identity.jar;zip -0r identity.jar *
Expand Down
8 changes: 7 additions & 1 deletion addon/components/identity.js
Expand Up @@ -60,8 +60,14 @@ IdentityManager.prototype = {
_blankPath: "/login/blank.html",
*/

_prefsService: Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService),

get _defaultProvider() {
let prefs = this._prefsService.getBranch("services.identity.providers.");
return prefs.getCharPref("default");
},
_defaultProtocol: "http",
_defaultProvider: "twinql.com",
_defaultPath: "/login/wrappedLogin.html",
_blankPath: "/login/blank.html",

Expand Down
1 change: 1 addition & 0 deletions addon/defaults/preferences/identityPrefs.js
@@ -0,0 +1 @@
pref("services.identity.providers.default", "twinql.com");

0 comments on commit 454a708

Please sign in to comment.