16 Updated patches.
[webos-internals:modifications.git] / top-bar / top-bar-ringer-switch-icon.patch
1 diff --git a/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js b/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
2 index a4a150e..582514b 100644
3 --- a/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
4 +++ b/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
5 @@ -65,6 +65,9 @@ var BarAssistant = Class.create({
6                 //Initialize and Subscribe for Storage / Media Mode Notification.                       
7                 this.storageInit();
8                 
9 +               //Subscribe for Ringer Switch Status
10 +               this.ringerStatus();
11 +
12                 //Initialize and Subscribe for Power Off Notification.
13                 this.powerOffInit();
14                 
15 @@ -3099,6 +3102,30 @@ showAudioAlert: function(volume,showringer,audioTarget) {
16                 }       
17  },
18  
19 +ringerStatus: function() {
20 +       this.controller.serviceRequest('palm://com.palm.keys/switches', {
21 +               method:'status',
22 +               parameters: {"subscribe":true},
23 +               onSuccess: function(payload) {
24 +                       this.controller.serviceRequest('palm://com.palm.audio/media', {
25 +                               method:'status',
26 +                               onSuccess: function(response) {
27 +                                       this.displayMutedIcon(!response['ringer switch']);
28 +                               }.bind(this)
29 +                       });
30 +               }.bind(this)
31 +       });
32 +},
33 +
34 +displayMutedIcon: function(mute) {
35 +       if(mute) {
36 +               $('ringer').className = 'off';
37 +       }
38 +       else {
39 +               $('ringer').className = 'on';   
40 +       }
41 +},
42 +
43  dataImportInit: function() {
44         //Subscribe to Data Srevice status Notifications.
45         this.dataImportNotificationSession = new Mojo.Service.Request('palm://com.palm.dataimport/', {
46 diff --git a/usr/lib/luna/system/luna-systemui/app/views/bar/bar-scene.html b/usr/lib/luna/system/luna-systemui/app/views/bar/bar-scene.html
47 index c1daf79..4b574ae 100644
48 --- a/usr/lib/luna/system/luna-systemui/app/views/bar/bar-scene.html
49 +++ b/usr/lib/luna/system/luna-systemui/app/views/bar/bar-scene.html
50 @@ -19,6 +19,8 @@
51         <div id="devicemenu">
52                 <div id="power">
53                 </div>
54 +               <div id="ringer">
55 +               </div>
56                 <div id="rssi">
57                 </div>
58                 <div id="roaming">
59 diff --git a/usr/lib/luna/system/luna-systemui/stylesheets/systemui.css b/usr/lib/luna/system/luna-systemui/stylesheets/systemui.css
60 index a0dee3c..8f9e33c 100644
61 --- a/usr/lib/luna/system/luna-systemui/stylesheets/systemui.css
62 +++ b/usr/lib/luna/system/luna-systemui/stylesheets/systemui.css
63 @@ -122,6 +122,7 @@ body.palm-default {
64  #tty,
65  #hac,
66  #callforward,
67 +#ringer,
68  #gps {
69                 float: right;
70                 height: 20px;
71 @@ -217,6 +218,16 @@ body.palm-default {
72         background: url(../images/battery-charged.png) center center no-repeat;
73  }
74  
75 +#ringer {
76 +       width: 20px;
77 +       margin-left: 2px;
78 +}
79 +#ringer.off {
80 +       background: url(../../../../../palm/applications/com.palm.app.soundsandalerts/images/prefs-mute.png) center left no-repeat;
81 +}
82 +#ringer.on {
83 +       display: none;
84 +}
85  
86  #rssi {
87         width: 19px;