Cleaned up patch from Adrian:
authorKristian Kræmmer Nielsen <jkkn@jkkn.dk>
Sun, 10 Aug 2008 01:27:00 +0000 (03:27 +0200)
committerKristian Kræmmer Nielsen <jkkn@jkkn.dk>
Sun, 10 Aug 2008 01:27:00 +0000 (03:27 +0200)
 - Removed code that saved new preference - this is done automatically by firefox
 - Changed behaviour to instantly change icon location by using a preference observer instead of requiring a browser restart
 - Added default preference parameter in default preference file
 - Added credit in about box
 - Bombed to version 0.11.0

content/about.xul
content/browser_overlay.xul
content/options.js
content/options.xul
content/tv2developer.js
content/util.js
defaults/preferences/tv2developer.js
locale/da-DK/tv2developer.dtd
locale/en-US/tv2developer.dtd
version

index a1fa475e07e13c078788e2793e0a4b94be037177..f9ac958dc4f6c6d9489d5e0cc5e4af27354b5b01 100644 (file)
@@ -18,6 +18,9 @@
   <text value="&createdBy;" style="font-weight: bold;"/>
   <text value="Kristian Kræmmer Nielsen &lt;jkkn@tv2.dk&gt;" class="url"
         onclick="window.close();openUILinkIn('http://jkkn.dk/tv2developer/', 'tab');"/>
+  <separator class="thin"/>
+  <text value="&patchesBy;" style="font-weight: bold;"/>
+  <text value="Adrian Bak &lt;adba@tv2.dk&gt;"/>
   <separator class="thin"/>
     <text value="&homePage;" style="font-weight: bold;"/>
     <text value="http://jkkn.dk/tv2developer/"
index 19cc76ad3bf54cab1273978b130102f3471d768f..b85353e72fdee10eaf40523f93b37c2a09d82d25 100644 (file)
@@ -21,6 +21,7 @@
                   oncommand="window.openDialog('chrome://tv2developer/content/about.xul','tv2about','modal,centerscreen,chrome,resizable=no')" />
     </popup>
 </popupset>
+
 <toolbarpalette id="BrowserToolbarPalette">
   <toolbarbutton id="tv2-swap-button" type="menu-button"
                  context="tv2developer-contextmenu"
@@ -30,7 +31,7 @@
                  onclick="checkForMiddleClick(this, event);"
                  onmouseover="TV2Developer.handleStatusText(event);"
                  onmouseout="TV2Developer.setStatusText('');">
-  <menupopup context=""
+    <menupopup context=""
                id="tv2developer-popupmenu"
                onpopupshowing="TV2Developer.fillMenu(event)"
                oncommand="TV2Developer.handleMenu(event); event.stopPropagation();"
 </toolbarpalette>
 
 <statusbar id="status-bar">
-    <statusbarpanel class="statusbarpanel-menu-iconic" id="tv2developer_statusbutton" src="chrome://tv2developer/skin/interaktiv.png"/>
+    <statusbarpanel id="tv2developer_statusbutton"
+        class="statusbarpanel-menu-iconic"
+        context="tv2developer-contextmenu"
+        src="chrome://tv2developer/skin/interaktiv.png"/>
 </statusbar>
 
 </overlay>
index 52e1333360d60b810cbe2718651072c85c37d526..2a218e6182d5801672b570b3ccb9e275e3f0b69f 100644 (file)
@@ -6,9 +6,6 @@ var TV2Options = {
     _hackEnabled: false,
     init: function() {
         
-        // the status bar thingy.
-        document.getElementById('statusbarmode').checked = TV2Util.getPref('useStatusBarMode', false);
-
         var hacks = document.getElementById('mac-hacks');
         var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
         this._keyBranch = prefs.getBranch('ui.key.');
@@ -123,16 +120,10 @@ var TV2Options = {
             }
         }
         
-        // Save the statusbar thing
-        var statusbar = document.getElementById('statusbarmode').checked;
-        TV2Util.setPref('useStatusBarMode', statusbar);
-
     },
     
     update: function() {
-       if(this._prefBranch != null) { // sometimes it's null on my mac (adba)
-           var instantApply = this._prefBranch.getBoolPref("instantApply", false);
-       }
+       var instantApply = this._prefBranch.getBoolPref("instantApply", false);
        if (instantApply) this.save();
     }
     
index 951b1962f6157e4f55c84d05f5ca22e0f03c78d4..45a9de9caf0e4c463098adf0f12fc8ff5aa2f6ad 100644 (file)
@@ -18,6 +18,7 @@
   <prefpane id="pane1" label="&optionsDialog.options.label;">
     <preferences>
       <preference id="pref_developer-initials" name="tv2developer.developer-initials" type="string"/>
+      <preference id="pref_statusbarmode" name="tv2developer.useStatusBarMode" type="bool"/>
     </preferences>
      
     <groupbox>
           oncommand="TV2Options.update()"
           tooltiptext="&optionsDialog.mac.accesskeys.tooltiptext;"/>
     </groupbox>
+    
     <groupbox id="misc">
         <checkbox id="statusbarmode" label="&optionsDialog.misc.statusbarmode;"
-          oncommand="TV2Options.update()"
-          tooltiptext="&optionsDialog.misc.statusbarmode.tooltiptext;"/>
+            preference="pref_statusbarmode"
+            tooltiptext="&optionsDialog.misc.statusbarmode.tooltiptext;"/>
     </groupbox>
  
   </prefpane>
index 385b119769dff12fbb1bc89b48d6b7cc2f7ba0f1..91eb0df7c26f0e20c439517070ffe9b63028aad4 100644 (file)
 var TV2Developer = {
     
     _lastAction: null,
-    _statusBarIconEnabled: false,
+    _useStatusBarIconInstead: false,
    
     /* toggle between statusbar/toolbar mode */
-    enableStatusBarIcon: function( enabled ) {
-        this._statusBarIconEnabled = enabled;
+    updateStatusBarMode: function() {
+        var enabled = this._useStatusBarIconInstead = TV2Util.getPref('useStatusBarMode');
+        
         var statusbutton = document.getElementById('tv2developer_statusbutton');
         var swapbutton = document.getElementById('tv2-swap-button');
         var popupmenu = document.getElementById('tv2developer-popupmenu');
@@ -46,8 +47,7 @@ var TV2Developer = {
         statusbutton.hidden = !enabled;
         swapbutton.hidden = enabled;
 
-        statusbutton.setAttribute('context', 'tv2developer-contextmenu'); // Add the rightclick menu.
-        if(enabled) {
+        if (enabled) {
             statusbutton.appendChild(popupmenu);
         } else {
             swapbutton.appendChild(popupmenu);
@@ -56,7 +56,7 @@ var TV2Developer = {
 
     /* method for initialize, reading properties, adding icon at firstrun, added keyshortcuts */
     init: function() {
-       // init
+        // init
         this._lastAction = TV2Util.getPref('lastaction-linktype');
         // add shortcuts depending on platform
         var shortcuts = document.getElementById('mainKeyset');
@@ -107,8 +107,14 @@ var TV2Developer = {
              catch(e) { }
         }
         
-        // initializes the statusbar icon.
-        this.enableStatusBarIcon(TV2Util.getPref('useStatusBarMode', false));
+        // initializes the statusbar icon by observe optional preference changes
+        TV2Util.prefs.addObserver('useStatusBarMode', {
+            observe: function(subject, topic, data) {
+                if (topic == 'nsPref:changed') {
+                    TV2Developer.updateStatusBarMode();
+                }
+            }}, false);
+        TV2Developer.updateStatusBarMode();
     },
     
     /* utility function to create shortcut object */
@@ -573,8 +579,12 @@ var TV2Developer = {
 
     /* shortcut to open menu */
     handleKeyShortcut: function(event) {
-        var popupmenu = document.getElementById('tv2developer-popupmenu');
-        popupmenu.showPopup();
+        if (!this._useStatusBarIconInstead) { // normal icon dropdown
+            document.getElementById('tv2-swap-button').open = true;
+        } else { // status bar icon
+            var popupmenu = document.getElementById('tv2developer-popupmenu');
+            popupmenu.showPopup();
+        }
     },
     
     /* utility function to go to a link */
index 92d28e0cc21abcb2dedfc6f4aad23e5cda759141..2070f0f70f0c2f15604d4bf4242683d651f332ce 100644 (file)
@@ -25,18 +25,22 @@ var TV2Util = {
     /* preference functions */
     _prefs: null,
     get prefs() {
-        if (!this._prefs)
+        if (!this._prefs) {
             this._prefs =
                 Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch('tv2developer.');
+            this._prefs.QueryInterface(Components.interfaces.nsIPrefBranch2);
+        }
         return this._prefs;
     },
     
     /* default preference functions */
     _defPrefs: null,
     get defPrefs() {
-        if (!this._defPrefs)
+        if (!this._defPrefs) {
             this._defPrefs =
                 Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getDefaultBranch('tv2developer.');
+            this._defPrefs.QueryInterface(Components.interfaces.nsIPrefBranch2);
+        }
         return this._defPrefs;
     },
 
index d8b2d3c5a56fb7a293f6619d6b471d130ebcdc4c..72025af07534f4dbfd0cc4a393eacf65ad6009ad 100644 (file)
@@ -4,3 +4,4 @@ pref('tv2developer.firstRun', true);
 pref('tv2developer.developer-initials', 'CHANGE-THIS');
 pref('tv2developer.lastaction-linktype', 'tango/entry');
 pref('tv2developer.php4sites', '2000,ally,annonceinfo,arkivsalg,auth,betaling,betalingsputnik,bryllup,dagsdato,finans,formel1,harris,hovsa,inc,it,konsol,loginsputnik,louth,million,piszulu,playmoney,podcast-files,pokermoney,rss,sms,spil,spil-deal,spil-million,spil-solo,sputnikmobil,swim,titoonic,trafikken,tv2,tv2r,tvsputnik,wimbledon,wptmoney,zulu');
+pref('tv2developer.useStatusBarMode', false);
index 7eb570a95d18954cd5db7a0d17045207f6d11569..5cf49014e78dfed1848195cbf46c54b5dad11c5f 100644 (file)
@@ -2,6 +2,7 @@
 <!ENTITY aboutDialog.title "TV 2 Links - Om">
 <!ENTITY aboutDialog.appname "TV 2 Links Plugin">
 <!ENTITY createdBy "Udviklet af:">
+<!ENTITY patchesBy "Tilføjelser af:">
 <!ENTITY homePage "Hjemmeside:">
 
 <!ENTITY optionsDialog.title "TV 2 Links - Indstillinger">
@@ -10,8 +11,8 @@
 <!ENTITY optionsDialog.mac.accesskeys "Slå genvejstaster til i Firefox på Mac">
 <!ENTITY optionsDialog.mac.accesskeys.tooltiptext "Ændring af dette felt kræver genstart af Firefox">
 
-<!ENTITY optionsDialog.misc.statusbarmode "Slås statusbar til">
-<!ENTITY optionsDialog.misc.statusbarmode.tooltiptext "Ændring af dette felt kræver genstart af Firefox">
+<!ENTITY optionsDialog.misc.statusbarmode "Placér ikon i statusbar istedet">
+<!ENTITY optionsDialog.misc.statusbarmode.tooltiptext "Dette flytter ikonet ned i statusbaren istedet for i toolbaren">
 
 
 <!ENTITY optionsDialog.php4sites.label "Gamle PHP 4 sites">
index 4d3350ea21ed96961608e0c848b205836cd52a21..6ecb06f15ab4aa75c6516a0b23c0b6bcf2d3ccfd 100644 (file)
@@ -1,7 +1,8 @@
 <!ENTITY version "version">
 <!ENTITY aboutDialog.title "TV 2 Developer  - about">
 <!ENTITY aboutDialog.appname "TV 2 Developer Plugin">
-<!ENTITY createdBy "Created By:">
+<!ENTITY createdBy "Created by:">
+<!ENTITY patchesBy "Patches by:">
 <!ENTITY homePage "Home Page:">
 
 <!ENTITY optionsDialog.title "TV 2 Developer - Options">
@@ -10,8 +11,8 @@
 <!ENTITY optionsDialog.mac.accesskeys "Enable accesskeys in Firefox on Mac">
 <!ENTITY optionsDialog.mac.accesskeys.tooltiptext "Changing this requires restart of Firefox">
 
-<!ENTITY optionsDialog.misc.statusbarmode "Enable statusbar mode">
-<!ENTITY optionsDialog.misc.statusbarmode.tooltiptext "Changing this requires restart of Firefox">
+<!ENTITY optionsDialog.misc.statusbarmode "Place icon in statusbar instead">
+<!ENTITY optionsDialog.misc.statusbarmode.tooltiptext "This moves the icon into the statusbar instead of as a toolbar icon">
 
 <!ENTITY optionsDialog.php4sites.label "PHP 4 legacy sites">
 <!ENTITY optionsDialog.php4sites.tooltiptext "Sites listed here will be seen as PHP 4 sites.">
diff --git a/version b/version
index 9028ec636547108feb5621cdcf44bb54241f3c3c..d9df1bbc0c7befdbc28d61efc28ed3e5c08d015f 100644 (file)
--- a/version
+++ b/version
@@ -1 +1 @@
-0.10.5
+0.11.0