8 New, 4 updated patches.
[webos-internals:shivaramv-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 6fdbb39..e5f3d8b 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 @@ -60,6 +60,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 @@ -2999,6 +3002,32 @@ 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 +               $('batpercent').className = 'hide';
38 +       }
39 +       else {
40 +               $('ringer').className = 'on';   
41 +               $('batpercent').className = 'show';             
42 +       }
43 +},
44 +
45  dataImportInit: function() {
46         //Subscribe to Data Srevice status Notifications.
47         this.dataImportNotificationSession = new Mojo.Service.Request('palm://com.palm.dataimport/', {
48 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
49 index c1daf79..4b574ae 100644
50 --- a/usr/lib/luna/system/luna-systemui/app/views/bar/bar-scene.html
51 +++ b/usr/lib/luna/system/luna-systemui/app/views/bar/bar-scene.html
52 @@ -19,6 +19,8 @@
53         <div id="devicemenu">
54                 <div id="power">
55                 </div>
56 +               <div id="ringer">
57 +               </div>
58                 <div id="rssi">
59                 </div>
60                 <div id="roaming">
61 diff --git a/usr/lib/luna/system/luna-systemui/stylesheets/systemui.css b/usr/lib/luna/system/luna-systemui/stylesheets/systemui.css
62 index 0917ee7..7a0cd64 100644
63 --- a/usr/lib/luna/system/luna-systemui/stylesheets/systemui.css
64 +++ b/usr/lib/luna/system/luna-systemui/stylesheets/systemui.css
65 @@ -122,6 +122,7 @@ body.palm-default {
66  #tty,
67  #hac,
68  #callforward,
69 +#ringer,
70  #gps {
71                 float: right;
72                 height: 20px;
73 @@ -217,6 +218,21 @@ body.palm-default {
74         background: url(../images/battery-charged.png) center center no-repeat;
75  }
76  
77 +#ringer {
78 +       width: 20px;
79 +       margin-left: 2px;
80 +}
81 +#ringer.off {
82 +       background: url(../../../../../palm/applications/com.palm.app.soundsandalerts/images/prefs-mute.png) center left no-repeat;
83 +}
84 +#ringer.on {
85 +       display: none;
86 +}
87 +#batpercent.hide {
88 +       display: none;
89 +}
90 +#batpercent.show {
91 +}
92  
93  #rssi {
94         width: 19px;