Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/ui.js

Issue 10989110: Worked around Fennec bug: selecting a subscription in the list is ignored (Closed)
Patch Set: Created July 9, 2013, 5:27 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 if (currentSubscription && url == currentSubscription.url) 184 if (currentSubscription && url == currentSubscription.url)
185 list.selectedIndex = list.itemCount - 1; 185 list.selectedIndex = list.itemCount - 1;
186 186
187 if (currentSubscription && list.selectedIndex < 0) 187 if (currentSubscription && list.selectedIndex < 0)
188 { 188 {
189 list.appendItem(currentSubscription.title, currentSubscription.url , null); 189 list.appendItem(currentSubscription.title, currentSubscription.url , null);
190 list.selectedIndex = list.itemCount - 1; 190 list.selectedIndex = list.itemCount - 1;
191 } 191 }
192 } 192 }
193 193
194 list.addEventListener("command", function(event) 194 var listener = function()
195 { 195 {
196 if (list.value) 196 if (list.value)
197 UI.setSubscription(list.value, list.label); 197 UI.setSubscription(list.value, list.label);
198 }, false); 198 }
199 list.addEventListener("command", listener, false);
200
201 // xul:menulist in Fennec is broken and doesn't trigger any events
202 // on selection. Have to detect selectIndex changes instead.
203 // See http://hg.mozilla.org/mozilla-central/file/04d8c309fe72/mobile/ android/chrome/content/SelectHelper.js#l40
204 list.watch("selectedIndex", function(prop, oldval, newval)
205 {
206 Utils.runAsync(listener);
207 return newval;
208 });
199 }, false); 209 }, false);
200 request.send(); 210 request.send();
201 } 211 }
202 } 212 }
203 }, 213 },
204 214
205 observe: function(subject, topic, data) 215 observe: function(subject, topic, data)
206 { 216 {
207 let {addonID} = require("info") 217 let {addonID} = require("info")
208 if (data != addonID) 218 if (data != addonID)
(...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1933 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], 1943 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)],
1934 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] 1944 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)]
1935 ]; 1945 ];
1936 1946
1937 onShutdown.add(function() 1947 onShutdown.add(function()
1938 { 1948 {
1939 for (let window in UI.applicationWindows) 1949 for (let window in UI.applicationWindows)
1940 if (UI.isBottombarOpen(window)) 1950 if (UI.isBottombarOpen(window))
1941 UI.toggleBottombar(window); 1951 UI.toggleBottombar(window);
1942 }); 1952 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld