Skip to content

Commit

Permalink
Add ethernet connection icon to status bar
Browse files Browse the repository at this point in the history
Conflicts:

	apps/system/index.html
  • Loading branch information
Phan Van Tuong authored and Nguyen Thanh Trung committed Mar 28, 2014
1 parent 411ca62 commit c886a45
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/system/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
data-level="100" hidden></div>
<div id="statusbar-wifi" class="sb-icon sb-icon-wifi"
data-level="4" hidden></div>
<div id="statusbar-ethernet" class="sb-icon sb-icon-ethernet" hidden></div>
<div id="statusbar-flight-mode" class="sb-icon sb-icon-flight-mode" hidden></div>
<div id="statusbar-connections"></div>
<div id="statusbar-headphones" class="sb-icon sb-icon-headphones" hidden></div>
Expand Down
13 changes: 12 additions & 1 deletion apps/system/js/statusbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function Clock() {
var StatusBar = {
/* all elements that are children nodes of the status bar */
ELEMENTS: ['notification', 'emergency-cb-notification', 'time', 'connections',
'battery', 'wifi', 'data', 'flight-mode', 'network-activity', 'tethering',
'battery', 'wifi', 'ethernet', 'data', 'flight-mode', 'network-activity', 'tethering',
'alarm', 'bluetooth', 'mute', 'headphones', 'bluetooth-headphones',
'bluetooth-transferring', 'recording', 'sms', 'geolocation', 'usb', 'label',
'system-downloads', 'call-forwarding', 'playing'],
Expand Down Expand Up @@ -118,6 +118,8 @@ var StatusBar = {
headphonesActive: false,

listeningCallschanged: false,

ethernetManager: null,

playingActive: false,

Expand Down Expand Up @@ -162,6 +164,7 @@ var StatusBar = {
this._cacheHeight = this.element.getBoundingClientRect().height;

this.listeningCallschanged = false;
this.ethernetManager = navigator.mozEthernetManager,

// Refresh the time to reflect locale changes
this.toggleTimeLabel(true);
Expand Down Expand Up @@ -209,6 +212,14 @@ var StatusBar = {

// Listen to 'screenchange' from screen_manager.js
window.addEventListener('screenchange', this);

//Observer connected event of ethernet manager to hide/show the icon on status bar
this.ethernetManager.onconnectedchanged = function ethernet_connectedChanged(event) {
self.icons.ethernet.hidden = !self.ethernetManager.connected;
}

//Update ethernet status at start-up
this.icons.ethernet.hidden = !this.ethernetManager.connected;

// mozChromeEvent fired from Gecko is earlier been loaded,
// so we use mozAudioChannelManager to
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions apps/system/style/statusbar/statusbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,12 @@ body.rb-enabled #statusbar-label {
background-position: -8.4rem -6rem;
}

.sb-icon-ethernet {
background: url('images/ethernet-connected.png') no-repeat;
background-position: 0 0;
background-size: 1.6rem;
}

.sb-icon-data-circle {
background-position: -12.6rem -8rem;
}
Expand Down

0 comments on commit c886a45

Please sign in to comment.